@orioncactuscorp/ui 1.6.0 → 1.7.0
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 +22 -3
- package/dist/components/Accordion/Accordion.css +1 -1
- package/dist/components/Accordion/Accordion.js +206 -214
- package/dist/components/ActionArea/ActionArea.css +1 -1
- package/dist/components/ActionArea/ActionAreaLayout.css +1 -1
- package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -1
- package/dist/components/Badge/Badge.css +1 -1
- package/dist/components/Badge/Badge.js +13 -13
- package/dist/components/Cell/Cell.css +1 -1
- package/dist/components/IconButton/IconButton.css +1 -1
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Loading/Loading.css +1 -1
- package/dist/components/Menu/Menu.css +1 -1
- package/dist/components/Menu/Menu.js +156 -140
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +571 -391
- package/dist/components/Modal/Modal.module.scss.js +58 -38
- package/dist/components/Modal/snapPoints.js +59 -35
- package/dist/components/Modal/useModalDrag.js +754 -579
- package/dist/components/Modal.js +7 -6
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton.js +55 -0
- package/dist/components/Skeleton/Skeleton.module.scss.js +16 -0
- package/dist/components/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton.js +4 -0
- package/dist/components/TextButton/TextButton.css +1 -1
- package/dist/components/TextButton/TextButton.js +45 -48
- package/dist/components/internal/DisclosureIndicator.js +39 -0
- package/dist/components/internal/Pressable.js +28 -27
- package/dist/foundations/motion.css +1 -1
- package/dist/foundations/space.css +1 -1
- package/dist/foundations.css +2 -2
- package/dist/index.js +90 -87
- package/dist/react/motion.js +79 -74
- package/dist/styles.css +14 -13
- package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/ui/src/components/Menu/Menu.d.ts +1 -1
- package/dist/ui/src/components/Menu/Menu.d.ts.map +1 -1
- package/dist/ui/src/components/Menu/index.d.ts +1 -1
- package/dist/ui/src/components/Menu/index.d.ts.map +1 -1
- package/dist/ui/src/components/Menu/types.d.ts +6 -2
- package/dist/ui/src/components/Menu/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/Modal.d.ts +3 -1
- package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/contexts.d.ts +2 -0
- package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/index.d.ts +2 -2
- package/dist/ui/src/components/Modal/index.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/snapPoints.d.ts +7 -10
- package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/types.d.ts +17 -0
- package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts +2 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
- package/dist/ui/src/components/Skeleton/Skeleton.d.ts +4 -0
- package/dist/ui/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/ui/src/components/Skeleton/index.d.ts +3 -0
- package/dist/ui/src/components/Skeleton/index.d.ts.map +1 -0
- package/dist/ui/src/components/Skeleton/types.d.ts +17 -0
- package/dist/ui/src/components/Skeleton/types.d.ts.map +1 -0
- package/dist/ui/src/components/TextButton/TextButton.d.ts.map +1 -1
- package/dist/ui/src/components/TextButton/types.d.ts +4 -2
- package/dist/ui/src/components/TextButton/types.d.ts.map +1 -1
- package/dist/ui/src/components/internal/DisclosureIndicator.d.ts +10 -0
- package/dist/ui/src/components/internal/DisclosureIndicator.d.ts.map +1 -0
- package/dist/ui/src/components/internal/Pressable.d.ts +8 -1
- package/dist/ui/src/components/internal/Pressable.d.ts.map +1 -1
- package/dist/ui/src/index.d.ts +5 -3
- package/dist/ui/src/index.d.ts.map +1 -1
- package/dist/ui/src/react/motion/index.d.ts +3 -1
- package/dist/ui/src/react/motion/index.d.ts.map +1 -1
- package/dist/ui/src/utils/motion.d.ts +2 -2
- package/dist/ui/src/utils/motion.d.ts.map +1 -1
- package/dist/utils/motion.js +24 -18
- package/dist/vscode/oc-ui-vars.css +6 -4
- package/package.json +1 -1
- package/src/scss/foundations/motion.scss +3 -1
- package/src/scss/foundations/responsive.test.ts +22 -0
- package/src/scss/foundations/space.scss +9 -4
- package/src/scss/mixins/_motion.scss +5 -8
- package/src/scss/mixins/_motion.test.ts +20 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useRef as S, useLayoutEffect as
|
|
2
|
-
import { ocSpring as
|
|
3
|
-
import { resolveOcMotion as
|
|
4
|
-
import { resolveModalPopupSnapPositions as
|
|
5
|
-
import { setModalBodyTouchScrollLock as
|
|
6
|
-
import { createSpringAnimator as
|
|
7
|
-
const
|
|
1
|
+
import { useRef as S, useLayoutEffect as Z, useCallback as d, useEffect as Mt } from "react";
|
|
2
|
+
import { ocSpring as Ce } from "../../utils/spring.js";
|
|
3
|
+
import { resolveOcMotion as Nt } from "../../utils/motion.js";
|
|
4
|
+
import { resolveModalPopupSnapPositions as Be } from "./snapPoints.js";
|
|
5
|
+
import { setModalBodyTouchScrollLock as Ot, shouldLockModalBodyTouchScroll as Ie, shouldIgnoreDragTarget as Vt, getScrollableAncestor as Ae, getBottomTouchDragDecision as Ne, getPopupTouchDragDecision as Oe } from "./modalScrollArbitration.js";
|
|
6
|
+
import { createSpringAnimator as Ht } from "../../utils/spring/animator.js";
|
|
7
|
+
const M = {
|
|
8
8
|
dragStartThresholdPx: {
|
|
9
9
|
touch: 10,
|
|
10
10
|
mouse: 2
|
|
@@ -35,31 +35,31 @@ const L = {
|
|
|
35
35
|
popupDragFollower: {
|
|
36
36
|
settleDurationFactor: 1 / 6
|
|
37
37
|
}
|
|
38
|
-
},
|
|
39
|
-
duration:
|
|
40
|
-
}),
|
|
41
|
-
function
|
|
38
|
+
}, Ve = Ce.snappy({
|
|
39
|
+
duration: M.settleSpring.durationSeconds * M.popupDragFollower.settleDurationFactor
|
|
40
|
+
}), He = [], je = [];
|
|
41
|
+
function le(r) {
|
|
42
42
|
r.cancelable !== !1 && r.preventDefault();
|
|
43
43
|
}
|
|
44
44
|
function b(r, n, i) {
|
|
45
45
|
return Math.min(Math.max(r, n), i);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ce(r) {
|
|
48
48
|
return [...new Set(r)].sort((n, i) => n - i);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ze(r, n) {
|
|
51
51
|
return r.reduce(
|
|
52
52
|
(i, a) => Math.abs(a - n) < Math.abs(i - n) ? a : i
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function ue({
|
|
56
56
|
deltaX: r,
|
|
57
57
|
deltaY: n,
|
|
58
58
|
placement: i
|
|
59
59
|
}) {
|
|
60
60
|
return i === "bottom" ? Math.abs(n) : Math.hypot(r, n);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function _e(r, n, i) {
|
|
63
63
|
if (i === "down")
|
|
64
64
|
return r.find((l) => l > n + 1) ?? r[r.length - 1] ?? 0;
|
|
65
65
|
for (let l = r.length - 1; l >= 0; l -= 1) {
|
|
@@ -69,44 +69,55 @@ function Ve(r, n, i) {
|
|
|
69
69
|
}
|
|
70
70
|
return r[0] ?? 0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const y =
|
|
72
|
+
function Re(r, n, i, a, l = i) {
|
|
73
|
+
const y = _e(r, n, a), T = a === "down" ? Math.max(i, l) : Math.min(i, l);
|
|
74
74
|
if (a === "down") {
|
|
75
75
|
if (r.filter(
|
|
76
|
-
(
|
|
76
|
+
(k) => k > n + 1 && k <= i + 1
|
|
77
77
|
).length === 0) return y;
|
|
78
|
-
const
|
|
79
|
-
(
|
|
78
|
+
const dt = r.filter(
|
|
79
|
+
(k) => k > n + 1 && k <= T + 1
|
|
80
80
|
);
|
|
81
|
-
return
|
|
81
|
+
return dt[dt.length - 1] ?? y;
|
|
82
82
|
}
|
|
83
83
|
return r.filter(
|
|
84
|
-
(
|
|
84
|
+
(L) => L < n - 1 && L >= i - 1
|
|
85
85
|
).length === 0 ? y : r.filter(
|
|
86
|
-
(
|
|
86
|
+
(L) => L < n - 1 && L >= T - 1
|
|
87
87
|
)[0] ?? y;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function pe(r, n) {
|
|
90
90
|
if (n <= 0) return 0;
|
|
91
|
-
const i = n, { resistance: a } =
|
|
91
|
+
const i = n, { resistance: a } = M.rubberBand;
|
|
92
92
|
return r * a * i / (i + a * r);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function jt({
|
|
95
95
|
targetTranslate: r,
|
|
96
96
|
minTranslate: n,
|
|
97
97
|
maxTranslate: i,
|
|
98
98
|
minBoundaryLimit: a,
|
|
99
99
|
maxBoundaryLimit: l
|
|
100
100
|
}) {
|
|
101
|
-
return r < n ? n -
|
|
101
|
+
return r < n ? n - pe(n - r, a) : r > i ? i + pe(r - i, l) : r;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function de(r) {
|
|
104
104
|
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function fe(r) {
|
|
107
|
+
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest(
|
|
108
|
+
'[data-oc-part="handle"], [data-oc-component="modal-navigation"]'
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
function Ue(r) {
|
|
112
|
+
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-component="modal-navigation"]');
|
|
113
|
+
}
|
|
114
|
+
function We(r) {
|
|
115
|
+
return typeof Element > "u" || !(r instanceof Element) ? null : r.closest('[data-oc-component="modal-navigation"]');
|
|
116
|
+
}
|
|
117
|
+
function $e(r, n) {
|
|
107
118
|
return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
108
119
|
}
|
|
109
|
-
function
|
|
120
|
+
function ge(r, n) {
|
|
110
121
|
if (!r.length)
|
|
111
122
|
return {
|
|
112
123
|
minTranslate: 0,
|
|
@@ -125,14 +136,14 @@ function ue(r, n) {
|
|
|
125
136
|
maxTranslate: l
|
|
126
137
|
};
|
|
127
138
|
}
|
|
128
|
-
function
|
|
139
|
+
function me(r, n) {
|
|
129
140
|
for (let i = 0; i < r.length; i += 1) {
|
|
130
141
|
const a = "item" in r && typeof r.item == "function" ? r.item(i) : r[i];
|
|
131
142
|
if (a?.identifier === n) return a;
|
|
132
143
|
}
|
|
133
144
|
return null;
|
|
134
145
|
}
|
|
135
|
-
function
|
|
146
|
+
function De(r) {
|
|
136
147
|
if (!r) return { x: 0, y: 0 };
|
|
137
148
|
const n = window.getComputedStyle(r).transform;
|
|
138
149
|
if (!n || n === "none") return { x: 0, y: 0 };
|
|
@@ -154,62 +165,62 @@ function xe(r) {
|
|
|
154
165
|
}
|
|
155
166
|
return { x: 0, y: 0 };
|
|
156
167
|
}
|
|
157
|
-
function
|
|
158
|
-
return
|
|
168
|
+
function zt(r) {
|
|
169
|
+
return De(r).y;
|
|
159
170
|
}
|
|
160
|
-
function
|
|
161
|
-
return
|
|
171
|
+
function he(r) {
|
|
172
|
+
return De(r);
|
|
162
173
|
}
|
|
163
|
-
function
|
|
164
|
-
if (!r) return;
|
|
174
|
+
function pt(r) {
|
|
175
|
+
if (!r || !/^-?\d*\.?\d+(?:px)?$/.test(r.trim())) return;
|
|
165
176
|
const n = Number.parseFloat(r);
|
|
166
177
|
return Number.isFinite(n) ? n : void 0;
|
|
167
178
|
}
|
|
168
|
-
function
|
|
179
|
+
function $() {
|
|
169
180
|
return Date.now();
|
|
170
181
|
}
|
|
171
|
-
function
|
|
172
|
-
const i = n -
|
|
182
|
+
function Ge(r, n) {
|
|
183
|
+
const i = n - M.releaseVelocity.sampleWindowMs;
|
|
173
184
|
for (; r.length > 2 && (r[1]?.time ?? n) < i; )
|
|
174
185
|
r.shift();
|
|
175
186
|
}
|
|
176
|
-
function
|
|
177
|
-
const i = n.time ??
|
|
187
|
+
function mt(r, n) {
|
|
188
|
+
const i = n.time ?? $();
|
|
178
189
|
r.samples.push({
|
|
179
190
|
time: i,
|
|
180
191
|
pageX: n.pageX,
|
|
181
192
|
pageY: n.pageY,
|
|
182
193
|
translateX: n.translateX,
|
|
183
194
|
translateY: n.translateY
|
|
184
|
-
}),
|
|
195
|
+
}), Ge(r.samples, i);
|
|
185
196
|
}
|
|
186
|
-
function
|
|
197
|
+
function Lt(r, n) {
|
|
187
198
|
return {
|
|
188
199
|
x: r.startTranslateX + n.pageX - r.startX,
|
|
189
200
|
y: r.startTranslate + n.pageY - r.startY
|
|
190
201
|
};
|
|
191
202
|
}
|
|
192
|
-
function
|
|
193
|
-
const i =
|
|
194
|
-
|
|
203
|
+
function ye(r, n) {
|
|
204
|
+
const i = Lt(r, n);
|
|
205
|
+
mt(r, {
|
|
195
206
|
pageX: n.pageX,
|
|
196
207
|
pageY: n.pageY,
|
|
197
208
|
translateX: i.x,
|
|
198
209
|
translateY: i.y
|
|
199
210
|
});
|
|
200
211
|
}
|
|
201
|
-
function
|
|
212
|
+
function Te({
|
|
202
213
|
session: r,
|
|
203
214
|
fallbackDeltaY: n,
|
|
204
215
|
fallbackElapsed: i
|
|
205
216
|
}) {
|
|
206
|
-
const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } =
|
|
217
|
+
const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } = M.releaseVelocity;
|
|
207
218
|
if (a) {
|
|
208
|
-
const y = a.time - f, T = r.samples.find((
|
|
219
|
+
const y = a.time - f, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
|
|
209
220
|
if (T && T !== a) {
|
|
210
|
-
const
|
|
211
|
-
if (Number.isFinite(
|
|
212
|
-
return b(
|
|
221
|
+
const D = Math.max(a.time - T.time, 1), Y = (a.translateY - T.translateY) / D * 1e3;
|
|
222
|
+
if (Number.isFinite(Y))
|
|
223
|
+
return b(Y, -l, l);
|
|
213
224
|
}
|
|
214
225
|
}
|
|
215
226
|
return b(
|
|
@@ -218,23 +229,23 @@ function ge({
|
|
|
218
229
|
l
|
|
219
230
|
);
|
|
220
231
|
}
|
|
221
|
-
function
|
|
232
|
+
function xe({
|
|
222
233
|
session: r,
|
|
223
234
|
fallbackDelta: n,
|
|
224
235
|
fallbackElapsed: i
|
|
225
236
|
}) {
|
|
226
|
-
const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } =
|
|
237
|
+
const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } = M.releaseVelocity;
|
|
227
238
|
if (a) {
|
|
228
|
-
const y = a.time - f, T = r.samples.find((
|
|
239
|
+
const y = a.time - f, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
|
|
229
240
|
if (T && T !== a) {
|
|
230
|
-
const
|
|
231
|
-
x: (a.translateX - T.translateX) /
|
|
232
|
-
y: (a.translateY - T.translateY) /
|
|
241
|
+
const D = Math.max(a.time - T.time, 1), Y = {
|
|
242
|
+
x: (a.translateX - T.translateX) / D * 1e3,
|
|
243
|
+
y: (a.translateY - T.translateY) / D * 1e3
|
|
233
244
|
};
|
|
234
|
-
if (Number.isFinite(
|
|
245
|
+
if (Number.isFinite(Y.x) && Number.isFinite(Y.y))
|
|
235
246
|
return {
|
|
236
|
-
x: b(
|
|
237
|
-
y: b(
|
|
247
|
+
x: b(Y.x, -l, l),
|
|
248
|
+
y: b(Y.y, -l, l)
|
|
238
249
|
};
|
|
239
250
|
}
|
|
240
251
|
}
|
|
@@ -251,18 +262,18 @@ function me({
|
|
|
251
262
|
)
|
|
252
263
|
};
|
|
253
264
|
}
|
|
254
|
-
function
|
|
265
|
+
function Ke({
|
|
255
266
|
currentTranslate: r,
|
|
256
267
|
releaseVelocity: n
|
|
257
268
|
}) {
|
|
258
|
-
const { lookaheadSeconds: i, maxDistancePx: a } =
|
|
269
|
+
const { lookaheadSeconds: i, maxDistancePx: a } = M.snapProjection;
|
|
259
270
|
return r + b(n * i, -a, a);
|
|
260
271
|
}
|
|
261
|
-
function
|
|
272
|
+
function Je({
|
|
262
273
|
currentTranslate: r,
|
|
263
274
|
releaseVelocity: n
|
|
264
275
|
}) {
|
|
265
|
-
const { lookaheadSeconds: i, maxDistancePx: a } =
|
|
276
|
+
const { lookaheadSeconds: i, maxDistancePx: a } = M.snapProjection;
|
|
266
277
|
return {
|
|
267
278
|
x: r.x + b(
|
|
268
279
|
n.x * i,
|
|
@@ -276,55 +287,119 @@ function Re({
|
|
|
276
287
|
)
|
|
277
288
|
};
|
|
278
289
|
}
|
|
279
|
-
function
|
|
280
|
-
return Math.abs(r) / 1e3 >
|
|
290
|
+
function Qe(r) {
|
|
291
|
+
return Math.abs(r) / 1e3 > M.releaseVelocity.flickThresholdPxPerMs;
|
|
281
292
|
}
|
|
282
|
-
function
|
|
283
|
-
return Math.hypot(r.x, r.y) / 1e3 >
|
|
293
|
+
function Ze(r) {
|
|
294
|
+
return Math.hypot(r.x, r.y) / 1e3 > M.releaseVelocity.flickThresholdPxPerMs;
|
|
284
295
|
}
|
|
285
|
-
function
|
|
296
|
+
function G(r, n) {
|
|
286
297
|
return Math.hypot(r.x - n.x, r.y - n.y);
|
|
287
298
|
}
|
|
288
|
-
function
|
|
299
|
+
function Pe(r, n) {
|
|
289
300
|
return r.reduce(
|
|
290
|
-
(i, a) =>
|
|
301
|
+
(i, a) => G(a, n) < G(i, n) ? a : i
|
|
291
302
|
);
|
|
292
303
|
}
|
|
293
|
-
function
|
|
304
|
+
function qe({
|
|
294
305
|
currentTranslate: r,
|
|
295
306
|
releaseVelocity: n,
|
|
296
307
|
targets: i
|
|
297
308
|
}) {
|
|
298
|
-
const a =
|
|
309
|
+
const a = Je({
|
|
299
310
|
currentTranslate: r,
|
|
300
311
|
releaseVelocity: n
|
|
301
312
|
});
|
|
302
|
-
if (!
|
|
303
|
-
return
|
|
313
|
+
if (!Ze(n))
|
|
314
|
+
return Pe(i, r);
|
|
304
315
|
const l = i.filter((f) => {
|
|
305
316
|
const y = f.x - r.x, T = f.y - r.y;
|
|
306
317
|
return y * n.x + T * n.y > 0;
|
|
307
318
|
});
|
|
308
|
-
return
|
|
319
|
+
return Pe(
|
|
309
320
|
l.length ? l : i,
|
|
310
321
|
a
|
|
311
322
|
);
|
|
312
323
|
}
|
|
313
|
-
function
|
|
324
|
+
function Xe(r) {
|
|
325
|
+
return r === "top" || r.startsWith("top-") ? "top" : r === "bottom" || r.startsWith("bottom-") ? "bottom" : "center";
|
|
326
|
+
}
|
|
327
|
+
function tr({
|
|
328
|
+
target: r,
|
|
329
|
+
targets: n
|
|
330
|
+
}) {
|
|
331
|
+
const i = n.filter((a) => a !== r);
|
|
332
|
+
if (i.length)
|
|
333
|
+
return i.reduce(
|
|
334
|
+
(a, l) => Math.min(a, G(r, l)),
|
|
335
|
+
Number.POSITIVE_INFINITY
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
function er({
|
|
339
|
+
closeThreshold: r,
|
|
340
|
+
currentTarget: n,
|
|
341
|
+
surfaceSize: i,
|
|
342
|
+
targets: a
|
|
343
|
+
}) {
|
|
344
|
+
const l = Xe(n.key), f = l === "center" ? Math.min(i.width, i.height) : i.height, y = Math.max(
|
|
345
|
+
M.dismissal.minDistancePx,
|
|
346
|
+
f * r
|
|
347
|
+
);
|
|
348
|
+
if (l !== "center") return y;
|
|
349
|
+
const T = tr({
|
|
350
|
+
target: n,
|
|
351
|
+
targets: a
|
|
352
|
+
});
|
|
353
|
+
return !T || !Number.isFinite(T) ? y : Math.max(y, T * 0.75);
|
|
354
|
+
}
|
|
355
|
+
function rr({
|
|
356
|
+
currentTarget: r,
|
|
357
|
+
currentTranslate: n
|
|
358
|
+
}) {
|
|
359
|
+
switch (Xe(r.key)) {
|
|
360
|
+
case "top":
|
|
361
|
+
return r.y - n.y;
|
|
362
|
+
case "bottom":
|
|
363
|
+
return n.y - r.y;
|
|
364
|
+
case "center":
|
|
365
|
+
return G(r, n);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function nr({
|
|
369
|
+
closeThreshold: r,
|
|
370
|
+
currentTarget: n,
|
|
371
|
+
currentTranslate: i,
|
|
372
|
+
releaseTarget: a,
|
|
373
|
+
surfaceSize: l,
|
|
374
|
+
targets: f
|
|
375
|
+
}) {
|
|
376
|
+
if (a.key !== n.key) return !1;
|
|
377
|
+
const y = rr({
|
|
378
|
+
currentTarget: n,
|
|
379
|
+
currentTranslate: i
|
|
380
|
+
});
|
|
381
|
+
return y <= 0 ? !1 : y >= er({
|
|
382
|
+
closeThreshold: r,
|
|
383
|
+
currentTarget: n,
|
|
384
|
+
surfaceSize: l,
|
|
385
|
+
targets: f
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function ar({
|
|
314
389
|
presentationState: r,
|
|
315
390
|
releaseTranslate: n,
|
|
316
391
|
visibleTranslate: i
|
|
317
392
|
}) {
|
|
318
393
|
return r !== "visible" || Math.abs(n - i) > 1;
|
|
319
394
|
}
|
|
320
|
-
function
|
|
395
|
+
function or({
|
|
321
396
|
drag: r,
|
|
322
397
|
placement: n,
|
|
323
398
|
snapPositionCount: i
|
|
324
399
|
}) {
|
|
325
|
-
return n === "popup" && r === "content" && i > 0;
|
|
400
|
+
return n === "popup" && (r === "content" || r === "handle") && i > 0;
|
|
326
401
|
}
|
|
327
|
-
function
|
|
402
|
+
function sr({
|
|
328
403
|
dismissible: r,
|
|
329
404
|
peekTranslate: n,
|
|
330
405
|
sheetHeight: i,
|
|
@@ -335,11 +410,11 @@ function Ke({
|
|
|
335
410
|
minTranslate: 0
|
|
336
411
|
};
|
|
337
412
|
}
|
|
338
|
-
function
|
|
413
|
+
function we(r, n = 1) {
|
|
339
414
|
const i = Math.max(n, 1);
|
|
340
415
|
return r && Math.abs(r.maxTranslate - r.minTranslate) || i;
|
|
341
416
|
}
|
|
342
|
-
function
|
|
417
|
+
function ve({
|
|
343
418
|
limit: r,
|
|
344
419
|
viewportSize: n,
|
|
345
420
|
viewportLimitRatio: i
|
|
@@ -347,26 +422,26 @@ function Te({
|
|
|
347
422
|
const a = Math.max(r, 0);
|
|
348
423
|
return n <= 0 ? a : Math.min(a, n * i);
|
|
349
424
|
}
|
|
350
|
-
function
|
|
425
|
+
function ir({
|
|
351
426
|
minTranslate: r,
|
|
352
427
|
sheetHeight: n,
|
|
353
428
|
surfaceMotion: i
|
|
354
429
|
}) {
|
|
355
|
-
const a = i.parentElement?.getBoundingClientRect(), l = a?.top ?? 0, f = a && a.height > 0 ? a.height : window.innerHeight, y = i.getBoundingClientRect(), T =
|
|
430
|
+
const a = i.parentElement?.getBoundingClientRect(), l = a?.top ?? 0, f = a && a.height > 0 ? a.height : window.innerHeight, y = i.getBoundingClientRect(), T = zt(i), D = y.top - T + r, Y = Math.max(D - l, 0), { observedViewportLimitRatio: L } = M.rubberBand;
|
|
356
431
|
return {
|
|
357
|
-
minBoundaryLimit:
|
|
358
|
-
limit:
|
|
432
|
+
minBoundaryLimit: ve({
|
|
433
|
+
limit: Y,
|
|
359
434
|
viewportSize: f,
|
|
360
|
-
viewportLimitRatio:
|
|
435
|
+
viewportLimitRatio: L.top
|
|
361
436
|
}),
|
|
362
|
-
maxBoundaryLimit:
|
|
437
|
+
maxBoundaryLimit: ve({
|
|
363
438
|
limit: n,
|
|
364
439
|
viewportSize: f,
|
|
365
|
-
viewportLimitRatio:
|
|
440
|
+
viewportLimitRatio: L.bottom
|
|
366
441
|
})
|
|
367
442
|
};
|
|
368
443
|
}
|
|
369
|
-
function
|
|
444
|
+
function lr({
|
|
370
445
|
rubberBand: r,
|
|
371
446
|
targetTranslate: n,
|
|
372
447
|
sheetHeight: i,
|
|
@@ -375,21 +450,21 @@ function Je({
|
|
|
375
450
|
rubberBandLimits: f
|
|
376
451
|
}) {
|
|
377
452
|
const y = b(
|
|
378
|
-
r ?
|
|
453
|
+
r ? jt({
|
|
379
454
|
targetTranslate: n,
|
|
380
455
|
...f,
|
|
381
456
|
...l
|
|
382
457
|
}) : n,
|
|
383
458
|
l.minTranslate - f.minBoundaryLimit,
|
|
384
459
|
l.maxTranslate + f.maxBoundaryLimit
|
|
385
|
-
), T = Math.max(-y, 0),
|
|
460
|
+
), T = Math.max(-y, 0), D = Math.max(y, 0), Y = a > 0 ? a : i, L = Y > 0 ? 1 - D / Math.max(Y, 1) : 0;
|
|
386
461
|
return {
|
|
387
462
|
translate: y,
|
|
388
463
|
overshootFillHeight: T,
|
|
389
|
-
backdropOpacity: b(
|
|
464
|
+
backdropOpacity: b(L, 0, 1)
|
|
390
465
|
};
|
|
391
466
|
}
|
|
392
|
-
function
|
|
467
|
+
function mr({
|
|
393
468
|
enabled: r,
|
|
394
469
|
drag: n,
|
|
395
470
|
open: i,
|
|
@@ -397,21 +472,22 @@ function ar({
|
|
|
397
472
|
surfaceMotionRef: l,
|
|
398
473
|
backdropRef: f,
|
|
399
474
|
bodyNode: y,
|
|
400
|
-
snapHeights: T =
|
|
401
|
-
snapPositions:
|
|
402
|
-
defaultSnapPosition:
|
|
403
|
-
peekHeight:
|
|
404
|
-
peekFallback:
|
|
405
|
-
presentationState:
|
|
406
|
-
setPresentationState:
|
|
407
|
-
requestClose:
|
|
408
|
-
canCloseAttempt:
|
|
409
|
-
dismissible:
|
|
410
|
-
visibleTranslate:
|
|
411
|
-
closeThreshold:
|
|
412
|
-
scrollLockTimeout:
|
|
475
|
+
snapHeights: T = He,
|
|
476
|
+
snapPositions: D = je,
|
|
477
|
+
defaultSnapPosition: Y,
|
|
478
|
+
peekHeight: L,
|
|
479
|
+
peekFallback: dt,
|
|
480
|
+
presentationState: k,
|
|
481
|
+
setPresentationState: bt,
|
|
482
|
+
requestClose: q,
|
|
483
|
+
canCloseAttempt: _t,
|
|
484
|
+
dismissible: N = !0,
|
|
485
|
+
visibleTranslate: H = 0,
|
|
486
|
+
closeThreshold: ft = 0.35,
|
|
487
|
+
scrollLockTimeout: Rt = 500,
|
|
488
|
+
popupSnapLayoutVersion: Ut = 0
|
|
413
489
|
}) {
|
|
414
|
-
const
|
|
490
|
+
const w = S({
|
|
415
491
|
dragging: !1,
|
|
416
492
|
allowed: !1,
|
|
417
493
|
chrome: !1,
|
|
@@ -430,71 +506,71 @@ function ar({
|
|
|
430
506
|
samples: [],
|
|
431
507
|
pointerId: null,
|
|
432
508
|
touchId: null
|
|
433
|
-
}),
|
|
509
|
+
}), K = S(y), Wt = S(!1), $t = S(!1), Se = S((t) => {
|
|
434
510
|
t.preventDefault();
|
|
435
|
-
}),
|
|
511
|
+
}), ht = S(0), kt = S(!1), j = S(null), O = S(
|
|
436
512
|
null
|
|
437
|
-
),
|
|
513
|
+
), yt = S(null), _ = S(null), gt = S(0), z = S(null), Ft = S(!1), Ct = S(!1), Bt = S(!1), tt = S(!1), v = or({
|
|
438
514
|
drag: n,
|
|
439
515
|
placement: a,
|
|
440
|
-
snapPositionCount:
|
|
441
|
-
}),
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}, [
|
|
445
|
-
const t =
|
|
446
|
-
t && t !== y &&
|
|
516
|
+
snapPositionCount: D.length
|
|
517
|
+
}), Gt = `${Y ?? ""}:${D.join("|")}`, Kt = S(D), Tt = S(Y);
|
|
518
|
+
Z(() => {
|
|
519
|
+
Kt.current = D, Tt.current = Y;
|
|
520
|
+
}, [Y, Gt, D]), Z(() => {
|
|
521
|
+
const t = K.current;
|
|
522
|
+
t && t !== y && Ot(t, !1), K.current = y, Wt.current && Ot(y, !0);
|
|
447
523
|
}, [y]);
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
}, []),
|
|
451
|
-
if (
|
|
452
|
-
|
|
453
|
-
const e =
|
|
524
|
+
const et = d((t) => {
|
|
525
|
+
Wt.current = t, Ot(K.current, t);
|
|
526
|
+
}, []), rt = d((t) => {
|
|
527
|
+
if ($t.current === t) return;
|
|
528
|
+
$t.current = t;
|
|
529
|
+
const e = Se.current;
|
|
454
530
|
if (t) {
|
|
455
531
|
document.addEventListener("selectstart", e, !0), document.addEventListener("dragstart", e, !0);
|
|
456
532
|
return;
|
|
457
533
|
}
|
|
458
534
|
document.removeEventListener("selectstart", e, !0), document.removeEventListener("dragstart", e, !0);
|
|
459
|
-
}, []),
|
|
535
|
+
}, []), xt = d(
|
|
460
536
|
({ chrome: t, target: e }) => {
|
|
461
|
-
const o =
|
|
537
|
+
const o = Ie({
|
|
462
538
|
target: e,
|
|
463
539
|
chrome: t,
|
|
464
|
-
bodyNode:
|
|
540
|
+
bodyNode: K.current
|
|
465
541
|
});
|
|
466
|
-
return
|
|
542
|
+
return et(o), o;
|
|
467
543
|
},
|
|
468
|
-
[
|
|
469
|
-
),
|
|
470
|
-
if (
|
|
471
|
-
if (
|
|
544
|
+
[et]
|
|
545
|
+
), V = d(() => l.current?.getBoundingClientRect().height ?? window.innerHeight, [l]), Jt = d(() => {
|
|
546
|
+
if (L !== void 0) return L;
|
|
547
|
+
if (dt === "header")
|
|
472
548
|
return l.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
|
|
473
|
-
}, [
|
|
474
|
-
const t =
|
|
549
|
+
}, [dt, L, l]), C = d(() => {
|
|
550
|
+
const t = Jt();
|
|
475
551
|
if (t === void 0 || t <= 0) return 0;
|
|
476
|
-
const e =
|
|
552
|
+
const e = V();
|
|
477
553
|
return b(e - t, 0, e);
|
|
478
|
-
}, [
|
|
479
|
-
() =>
|
|
480
|
-
[
|
|
481
|
-
),
|
|
554
|
+
}, [Jt, V]), It = d(
|
|
555
|
+
() => k === "peeked" ? C() : H,
|
|
556
|
+
[C, k, H]
|
|
557
|
+
), Pt = d(() => {
|
|
482
558
|
const t = l.current;
|
|
483
|
-
if (!t) return
|
|
484
|
-
const e =
|
|
559
|
+
if (!t) return It();
|
|
560
|
+
const e = pt(
|
|
485
561
|
t.style.getPropertyValue("--oc-modal-translate-y")
|
|
486
562
|
);
|
|
487
563
|
if (e !== void 0) return e;
|
|
488
|
-
const o =
|
|
564
|
+
const o = pt(
|
|
489
565
|
window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
|
|
490
566
|
);
|
|
491
|
-
return o !== void 0 ? o :
|
|
492
|
-
}, [
|
|
567
|
+
return o !== void 0 ? o : It();
|
|
568
|
+
}, [It, l]), wt = d(() => {
|
|
493
569
|
const t = l.current;
|
|
494
570
|
if (!t) return { x: 0, y: 0 };
|
|
495
|
-
const e =
|
|
571
|
+
const e = pt(
|
|
496
572
|
t.style.getPropertyValue("--oc-modal-translate-x")
|
|
497
|
-
), o =
|
|
573
|
+
), o = pt(
|
|
498
574
|
t.style.getPropertyValue("--oc-modal-translate-y")
|
|
499
575
|
);
|
|
500
576
|
if (e !== void 0 || o !== void 0)
|
|
@@ -504,33 +580,33 @@ function ar({
|
|
|
504
580
|
};
|
|
505
581
|
const c = window.getComputedStyle(t);
|
|
506
582
|
return {
|
|
507
|
-
x:
|
|
508
|
-
y:
|
|
583
|
+
x: pt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
|
|
584
|
+
y: pt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
|
|
509
585
|
};
|
|
510
|
-
}, [l]),
|
|
511
|
-
const t =
|
|
586
|
+
}, [l]), vt = d(() => {
|
|
587
|
+
const t = Pt(), e = zt(l.current);
|
|
512
588
|
return Math.abs(e - t) > 1 ? e : t;
|
|
513
|
-
}, [
|
|
514
|
-
const t =
|
|
515
|
-
return
|
|
516
|
-
}, [
|
|
589
|
+
}, [Pt, l]), nt = d(() => {
|
|
590
|
+
const t = wt(), e = he(l.current);
|
|
591
|
+
return G(e, t) > 1 ? e : t;
|
|
592
|
+
}, [wt, l]), B = d(
|
|
517
593
|
(t, {
|
|
518
594
|
active: e,
|
|
519
|
-
nextDismissible: o =
|
|
595
|
+
nextDismissible: o = N,
|
|
520
596
|
rubberBand: c = !1
|
|
521
597
|
}) => {
|
|
522
598
|
const s = l.current;
|
|
523
599
|
if (!s) return;
|
|
524
|
-
const u =
|
|
600
|
+
const u = V(), p = s.parentElement, g = C(), m = sr({
|
|
525
601
|
dismissible: o,
|
|
526
602
|
peekTranslate: g,
|
|
527
603
|
sheetHeight: u,
|
|
528
|
-
visibleTranslate:
|
|
529
|
-
}), h =
|
|
604
|
+
visibleTranslate: H
|
|
605
|
+
}), h = ir({
|
|
530
606
|
minTranslate: m.minTranslate,
|
|
531
607
|
sheetHeight: u,
|
|
532
608
|
surfaceMotion: s
|
|
533
|
-
}),
|
|
609
|
+
}), P = lr({
|
|
534
610
|
rubberBand: c,
|
|
535
611
|
targetTranslate: t,
|
|
536
612
|
sheetHeight: u,
|
|
@@ -538,107 +614,109 @@ function ar({
|
|
|
538
614
|
bounds: m,
|
|
539
615
|
rubberBandLimits: h
|
|
540
616
|
});
|
|
541
|
-
|
|
617
|
+
w.current.lastTranslate = P.translate, s.style.setProperty(
|
|
542
618
|
"--oc-modal-translate-y",
|
|
543
|
-
`${
|
|
619
|
+
`${P.translate}px`
|
|
544
620
|
), s.style.setProperty(
|
|
545
621
|
"--_-modal-elevation-shadow-opacity",
|
|
546
|
-
String(1 -
|
|
547
|
-
), s.dataset.ocModalDragging = e ? "true" : "false",
|
|
622
|
+
String(1 - P.backdropOpacity)
|
|
623
|
+
), s.dataset.ocModalDragging = e ? "true" : "false", p?.style.setProperty(
|
|
548
624
|
"--oc-modal-overshoot-fill-height",
|
|
549
|
-
`${
|
|
550
|
-
),
|
|
625
|
+
`${P.overshootFillHeight}px`
|
|
626
|
+
), p && (p.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), f.current && (f.current.style.setProperty(
|
|
551
627
|
"--oc-modal-backdrop-opacity",
|
|
552
|
-
String(
|
|
628
|
+
String(P.backdropOpacity)
|
|
553
629
|
), f.current.style.transition = e ? "none" : "");
|
|
554
630
|
},
|
|
555
631
|
[
|
|
556
632
|
f,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
633
|
+
N,
|
|
634
|
+
C,
|
|
635
|
+
V,
|
|
560
636
|
l,
|
|
561
|
-
|
|
637
|
+
H
|
|
562
638
|
]
|
|
563
|
-
),
|
|
564
|
-
const t = l.current, e =
|
|
639
|
+
), at = d(() => {
|
|
640
|
+
const t = l.current, e = Kt.current;
|
|
565
641
|
if (!(!t || !e.length))
|
|
566
|
-
return
|
|
567
|
-
defaultSnapPosition:
|
|
642
|
+
return Be({
|
|
643
|
+
defaultSnapPosition: Tt.current,
|
|
568
644
|
snapPositions: e,
|
|
569
645
|
surfaceMotion: t
|
|
570
646
|
});
|
|
571
|
-
}, [l]),
|
|
647
|
+
}, [l]), R = d(
|
|
572
648
|
({ destroy: t = !0 } = {}) => {
|
|
573
|
-
t &&
|
|
649
|
+
t && O.current?.destroy(), O.current = null, yt.current = null;
|
|
574
650
|
},
|
|
575
651
|
[]
|
|
576
|
-
),
|
|
652
|
+
), E = d(
|
|
577
653
|
(t, { active: e }) => {
|
|
578
654
|
const o = l.current;
|
|
579
655
|
if (!o) return;
|
|
580
|
-
const c =
|
|
581
|
-
x:
|
|
656
|
+
const c = at(), s = c ? o.getBoundingClientRect() : void 0, u = c ? ge(c.targets, "x") : void 0, p = c ? ge(c.targets, "y") : void 0, g = we(u, s?.width), m = we(p, s?.height), h = c ? {
|
|
657
|
+
x: jt({
|
|
582
658
|
targetTranslate: t.x,
|
|
583
659
|
minTranslate: u?.minTranslate ?? 0,
|
|
584
660
|
maxTranslate: u?.maxTranslate ?? 0,
|
|
585
661
|
minBoundaryLimit: g,
|
|
586
662
|
maxBoundaryLimit: g
|
|
587
663
|
}),
|
|
588
|
-
y:
|
|
664
|
+
y: jt({
|
|
589
665
|
targetTranslate: t.y,
|
|
590
|
-
minTranslate:
|
|
591
|
-
maxTranslate:
|
|
666
|
+
minTranslate: p?.minTranslate ?? 0,
|
|
667
|
+
maxTranslate: p?.maxTranslate ?? 0,
|
|
592
668
|
minBoundaryLimit: m,
|
|
593
669
|
maxBoundaryLimit: m
|
|
594
670
|
})
|
|
595
671
|
} : t;
|
|
596
|
-
|
|
672
|
+
w.current.lastTranslateX = h.x, w.current.lastTranslate = h.y;
|
|
673
|
+
const P = e ? void 0 : t.settledTranslate;
|
|
674
|
+
o.style.setProperty(
|
|
597
675
|
"--oc-modal-translate-x",
|
|
598
|
-
`${h.x}px`
|
|
676
|
+
P?.x ?? `${h.x}px`
|
|
599
677
|
), o.style.setProperty(
|
|
600
678
|
"--oc-modal-translate-y",
|
|
601
|
-
`${h.y}px`
|
|
679
|
+
P?.y ?? `${h.y}px`
|
|
602
680
|
), o.dataset.ocModalDragging = e ? "true" : "false", o.parentElement && (o.parentElement.dataset.ocModalDragging = e ? "true" : "false"), o.style.transition = e ? "none" : "";
|
|
603
681
|
},
|
|
604
|
-
[
|
|
605
|
-
),
|
|
606
|
-
|
|
607
|
-
}, [
|
|
608
|
-
(t, e =
|
|
609
|
-
|
|
682
|
+
[at, l]
|
|
683
|
+
), X = d(() => {
|
|
684
|
+
j.current?.destroy(), j.current = null, R();
|
|
685
|
+
}, [R]), ot = d(
|
|
686
|
+
(t, e = N) => {
|
|
687
|
+
X(), B(t, {
|
|
610
688
|
active: !0,
|
|
611
689
|
nextDismissible: e,
|
|
612
690
|
rubberBand: !0
|
|
613
691
|
});
|
|
614
692
|
},
|
|
615
|
-
[B,
|
|
616
|
-
),
|
|
617
|
-
const t =
|
|
618
|
-
return
|
|
693
|
+
[B, X, N]
|
|
694
|
+
), Qt = d(() => {
|
|
695
|
+
const t = vt(), e = nt();
|
|
696
|
+
return j.current !== null || O.current !== null ? (X(), a === "popup" && G(e, { x: 0, y: 0 }) > 0.5 ? E(e, { active: !1 }) : a === "bottom" && Math.abs(t) > 0.5 && B(t, { active: !1 }), { startTranslate: t, startTranslatePoint: e }) : { startTranslate: t, startTranslatePoint: e };
|
|
619
697
|
}, [
|
|
620
|
-
|
|
698
|
+
E,
|
|
621
699
|
B,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
700
|
+
X,
|
|
701
|
+
vt,
|
|
702
|
+
nt,
|
|
625
703
|
a
|
|
626
|
-
]),
|
|
704
|
+
]), x = d(() => {
|
|
627
705
|
const t = l.current;
|
|
628
706
|
t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), f.current?.style.removeProperty("transition"));
|
|
629
|
-
}, [f, l]),
|
|
707
|
+
}, [f, l]), Zt = d(() => {
|
|
630
708
|
const t = l.current, e = t?.parentElement;
|
|
631
|
-
|
|
632
|
-
}, [f,
|
|
709
|
+
w.current.lastTranslate = 0, t?.style.removeProperty("--oc-modal-translate-y"), t?.style.removeProperty("--_-modal-elevation-shadow-opacity"), e?.style.removeProperty("--oc-modal-overshoot-fill-height"), f.current?.style.removeProperty("--oc-modal-backdrop-opacity"), x();
|
|
710
|
+
}, [f, x, l]), qt = d(
|
|
633
711
|
({
|
|
634
712
|
preserveSnapPosition: t = !1,
|
|
635
713
|
resetY: e = !0
|
|
636
714
|
} = {}) => {
|
|
637
715
|
const o = l.current;
|
|
638
|
-
o && (t || (
|
|
716
|
+
o && (t || (_.current = null), w.current.lastTranslateX = 0, o.style.removeProperty("--oc-modal-translate-x"), e && (w.current.lastTranslate = 0, o.style.removeProperty("--oc-modal-translate-y")), x());
|
|
639
717
|
},
|
|
640
|
-
[
|
|
641
|
-
),
|
|
718
|
+
[x, l]
|
|
719
|
+
), I = d(
|
|
642
720
|
(t, {
|
|
643
721
|
initialVelocity: e = 0,
|
|
644
722
|
intent: o = "sheet",
|
|
@@ -646,23 +724,23 @@ function ar({
|
|
|
646
724
|
from: s,
|
|
647
725
|
onComplete: u
|
|
648
726
|
} = {}) => {
|
|
649
|
-
const
|
|
650
|
-
if (!
|
|
651
|
-
|
|
652
|
-
const g = s ??
|
|
727
|
+
const p = l.current;
|
|
728
|
+
if (!p) return;
|
|
729
|
+
X();
|
|
730
|
+
const g = s ?? zt(p);
|
|
653
731
|
if (Math.abs(g - t) < 0.5) {
|
|
654
|
-
B(t, { active: !1 }),
|
|
732
|
+
B(t, { active: !1 }), x(), u?.();
|
|
655
733
|
return;
|
|
656
734
|
}
|
|
657
735
|
B(g, { active: !0 });
|
|
658
|
-
const m =
|
|
659
|
-
element:
|
|
736
|
+
const m = Nt({
|
|
737
|
+
element: p,
|
|
660
738
|
intent: o,
|
|
661
739
|
phase: c,
|
|
662
740
|
reduced: "preserve",
|
|
663
741
|
reducedMotion: !1,
|
|
664
742
|
property: "transform"
|
|
665
|
-
}), h =
|
|
743
|
+
}), h = Ht({
|
|
666
744
|
value: g,
|
|
667
745
|
target: t,
|
|
668
746
|
velocity: e,
|
|
@@ -670,38 +748,38 @@ function ar({
|
|
|
670
748
|
epsilon: 0.5,
|
|
671
749
|
velocityEpsilon: 50,
|
|
672
750
|
stabilityWindow: 0.02,
|
|
673
|
-
onUpdate: (
|
|
674
|
-
B(
|
|
751
|
+
onUpdate: (P) => {
|
|
752
|
+
B(P, { active: !0 });
|
|
675
753
|
},
|
|
676
754
|
onComplete: () => {
|
|
677
|
-
|
|
755
|
+
j.current === h && (j.current = null), B(t, { active: !1 }), x(), u?.();
|
|
678
756
|
}
|
|
679
757
|
});
|
|
680
|
-
|
|
758
|
+
j.current = h;
|
|
681
759
|
},
|
|
682
|
-
[B,
|
|
683
|
-
),
|
|
760
|
+
[B, X, x, l]
|
|
761
|
+
), U = d(
|
|
684
762
|
(t, {
|
|
685
763
|
from: e,
|
|
686
764
|
initialVelocity: o = { x: 0, y: 0 }
|
|
687
765
|
} = {}) => {
|
|
688
766
|
const c = l.current;
|
|
689
767
|
if (!c) return;
|
|
690
|
-
|
|
691
|
-
const s = e ??
|
|
692
|
-
if (
|
|
693
|
-
|
|
768
|
+
X();
|
|
769
|
+
const s = e ?? he(c), u = { x: t.x, y: t.y };
|
|
770
|
+
if (G(s, u) < 0.5) {
|
|
771
|
+
E(t, { active: !1 }), x();
|
|
694
772
|
return;
|
|
695
773
|
}
|
|
696
|
-
|
|
697
|
-
const g =
|
|
774
|
+
E(s, { active: !0 });
|
|
775
|
+
const g = Nt({
|
|
698
776
|
element: c,
|
|
699
777
|
intent: "gesture",
|
|
700
778
|
phase: "release",
|
|
701
779
|
reduced: "preserve",
|
|
702
780
|
reducedMotion: !1,
|
|
703
781
|
property: "transform"
|
|
704
|
-
}), m =
|
|
782
|
+
}), m = Ht({
|
|
705
783
|
value: s,
|
|
706
784
|
target: u,
|
|
707
785
|
velocity: o,
|
|
@@ -710,79 +788,79 @@ function ar({
|
|
|
710
788
|
velocityEpsilon: 50,
|
|
711
789
|
stabilityWindow: 0.02,
|
|
712
790
|
onUpdate: (h) => {
|
|
713
|
-
|
|
791
|
+
E(h, { active: !0 });
|
|
714
792
|
},
|
|
715
793
|
onComplete: () => {
|
|
716
|
-
|
|
794
|
+
j.current === m && (j.current = null), E(t, { active: !1 }), x();
|
|
717
795
|
}
|
|
718
796
|
});
|
|
719
|
-
|
|
797
|
+
j.current = m;
|
|
720
798
|
},
|
|
721
799
|
[
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
800
|
+
E,
|
|
801
|
+
X,
|
|
802
|
+
x,
|
|
725
803
|
l
|
|
726
804
|
]
|
|
727
|
-
),
|
|
728
|
-
const t =
|
|
805
|
+
), st = d(() => {
|
|
806
|
+
const t = O.current;
|
|
729
807
|
if (!t) return null;
|
|
730
808
|
const e = t.sample();
|
|
731
|
-
return
|
|
732
|
-
}, [
|
|
809
|
+
return E(e.value, { active: !0 }), e;
|
|
810
|
+
}, [E]), te = d(
|
|
733
811
|
(t) => {
|
|
734
812
|
if (!l.current) return null;
|
|
735
|
-
|
|
736
|
-
const o =
|
|
813
|
+
X(), E(t, { active: !0 });
|
|
814
|
+
const o = Ht({
|
|
737
815
|
value: t,
|
|
738
816
|
target: t,
|
|
739
|
-
spring:
|
|
817
|
+
spring: Ve,
|
|
740
818
|
autoplay: !1,
|
|
741
819
|
epsilon: 0.5,
|
|
742
820
|
velocityEpsilon: 50,
|
|
743
821
|
stabilityWindow: 0.02,
|
|
744
822
|
onUpdate: (c) => {
|
|
745
|
-
|
|
823
|
+
E(c, { active: !0 });
|
|
746
824
|
},
|
|
747
825
|
onComplete: () => {
|
|
748
|
-
const c =
|
|
749
|
-
!c ||
|
|
826
|
+
const c = yt.current;
|
|
827
|
+
!c || O.current !== o || (R({ destroy: !1 }), E(c, { active: !1 }), x());
|
|
750
828
|
}
|
|
751
829
|
});
|
|
752
|
-
return
|
|
830
|
+
return O.current = o, o;
|
|
753
831
|
},
|
|
754
832
|
[
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
833
|
+
E,
|
|
834
|
+
X,
|
|
835
|
+
R,
|
|
836
|
+
x,
|
|
759
837
|
l
|
|
760
838
|
]
|
|
761
|
-
),
|
|
839
|
+
), ee = d(
|
|
762
840
|
(t) => {
|
|
763
|
-
const e =
|
|
764
|
-
e && (
|
|
841
|
+
const e = O.current ?? te(nt());
|
|
842
|
+
e && (yt.current = null, e.setTarget(t));
|
|
765
843
|
},
|
|
766
|
-
[
|
|
767
|
-
),
|
|
844
|
+
[nt, te]
|
|
845
|
+
), it = d(
|
|
768
846
|
(t, e) => {
|
|
769
|
-
const o =
|
|
770
|
-
return
|
|
847
|
+
const o = Lt(t, e);
|
|
848
|
+
return ee(o), st(), o;
|
|
771
849
|
},
|
|
772
|
-
[
|
|
773
|
-
),
|
|
850
|
+
[st, ee]
|
|
851
|
+
), Dt = d(
|
|
774
852
|
(t) => {
|
|
775
|
-
const e = l.current, o =
|
|
853
|
+
const e = l.current, o = O.current;
|
|
776
854
|
if (!e || !o) {
|
|
777
|
-
|
|
855
|
+
U(t);
|
|
778
856
|
return;
|
|
779
857
|
}
|
|
780
|
-
const s =
|
|
781
|
-
if (
|
|
782
|
-
|
|
858
|
+
const s = st() ? wt() : o.value, u = { x: t.x, y: t.y };
|
|
859
|
+
if (G(s, u) < 0.5) {
|
|
860
|
+
R(), E(t, { active: !1 }), x();
|
|
783
861
|
return;
|
|
784
862
|
}
|
|
785
|
-
const
|
|
863
|
+
const p = Nt({
|
|
786
864
|
element: e,
|
|
787
865
|
intent: "gesture",
|
|
788
866
|
phase: "release",
|
|
@@ -790,160 +868,196 @@ function ar({
|
|
|
790
868
|
reducedMotion: !1,
|
|
791
869
|
property: "transform"
|
|
792
870
|
});
|
|
793
|
-
|
|
871
|
+
yt.current = t, o.setTarget(u, { spring: p.spring });
|
|
794
872
|
},
|
|
795
873
|
[
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
874
|
+
E,
|
|
875
|
+
R,
|
|
876
|
+
x,
|
|
877
|
+
wt,
|
|
878
|
+
st,
|
|
879
|
+
U,
|
|
802
880
|
l
|
|
803
881
|
]
|
|
804
|
-
),
|
|
882
|
+
), lt = d(
|
|
805
883
|
({
|
|
806
884
|
key: t,
|
|
807
885
|
settle: e
|
|
808
886
|
}) => {
|
|
809
|
-
if (
|
|
810
|
-
const o =
|
|
887
|
+
if (w.current.dragging) return !1;
|
|
888
|
+
const o = at();
|
|
811
889
|
if (!o) return !1;
|
|
812
890
|
const c = (t ? o.targets.find((s) => s.key === t) : void 0) ?? o.defaultTarget;
|
|
813
|
-
return
|
|
891
|
+
return _.current = c.key, e ? U(c) : (X(), E(c, { active: !1 }), x()), !0;
|
|
814
892
|
},
|
|
815
893
|
[
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
894
|
+
E,
|
|
895
|
+
X,
|
|
896
|
+
x,
|
|
897
|
+
at,
|
|
898
|
+
U
|
|
821
899
|
]
|
|
822
|
-
),
|
|
900
|
+
), re = d(
|
|
823
901
|
(t, { from: e, initialVelocity: o = 0 }) => {
|
|
824
|
-
|
|
902
|
+
I(t, {
|
|
825
903
|
from: e,
|
|
826
904
|
initialVelocity: o,
|
|
827
905
|
onComplete: () => {
|
|
828
|
-
|
|
906
|
+
q({ reason: "drag-dismiss" }, { skipAttempt: !0 });
|
|
829
907
|
}
|
|
830
908
|
});
|
|
831
909
|
},
|
|
832
|
-
[
|
|
910
|
+
[q, I]
|
|
833
911
|
);
|
|
834
|
-
|
|
912
|
+
Mt(
|
|
835
913
|
() => () => {
|
|
836
|
-
|
|
914
|
+
X(), rt(!1), l.current && x();
|
|
837
915
|
},
|
|
838
916
|
[
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
917
|
+
X,
|
|
918
|
+
x,
|
|
919
|
+
rt,
|
|
842
920
|
l
|
|
843
921
|
]
|
|
844
|
-
),
|
|
922
|
+
), Z(() => {
|
|
845
923
|
if (!i || !r || a !== "bottom") {
|
|
846
|
-
|
|
924
|
+
Ft.current = i;
|
|
847
925
|
return;
|
|
848
926
|
}
|
|
927
|
+
Ct.current = !0;
|
|
928
|
+
const t = Ft.current;
|
|
849
929
|
Ft.current = !0;
|
|
850
|
-
const
|
|
851
|
-
bt.current = !0;
|
|
852
|
-
const e = F === "peeked" ? A() : N;
|
|
930
|
+
const e = k === "peeked" ? C() : H;
|
|
853
931
|
if (!t) {
|
|
854
|
-
const o =
|
|
855
|
-
B(o, { active: !0 }),
|
|
932
|
+
const o = V();
|
|
933
|
+
B(o, { active: !0 }), I(e, {
|
|
856
934
|
from: o,
|
|
857
935
|
intent: "sheet",
|
|
858
936
|
phase: "enter"
|
|
859
937
|
});
|
|
860
938
|
return;
|
|
861
939
|
}
|
|
862
|
-
if (
|
|
863
|
-
|
|
940
|
+
if (k === "peeked") {
|
|
941
|
+
I(C());
|
|
864
942
|
return;
|
|
865
943
|
}
|
|
866
|
-
if (
|
|
867
|
-
|
|
944
|
+
if (kt.current) {
|
|
945
|
+
kt.current = !1;
|
|
868
946
|
return;
|
|
869
947
|
}
|
|
870
|
-
|
|
948
|
+
I(H);
|
|
871
949
|
}, [
|
|
872
950
|
r,
|
|
873
|
-
|
|
874
|
-
|
|
951
|
+
C,
|
|
952
|
+
V,
|
|
875
953
|
i,
|
|
876
954
|
a,
|
|
877
|
-
F,
|
|
878
|
-
B,
|
|
879
955
|
k,
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
956
|
+
B,
|
|
957
|
+
I,
|
|
958
|
+
H
|
|
959
|
+
]), Z(() => {
|
|
960
|
+
a !== "bottom" && Ct.current && (Ct.current = !1, X(), Zt());
|
|
961
|
+
}, [X, a, Zt]), Z(() => {
|
|
962
|
+
if (!i || !r || !v) {
|
|
963
|
+
const c = !i && a === "popup" && tt.current, s = i && a !== "popup" && tt.current;
|
|
964
|
+
tt.current && !c && (z.current !== null && (window.cancelAnimationFrame(z.current), z.current = null), X(), qt({
|
|
887
965
|
preserveSnapPosition: s
|
|
888
|
-
})),
|
|
966
|
+
})), tt.current && c && (X(), x()), Bt.current = i && a === "popup", tt.current = !1;
|
|
889
967
|
return;
|
|
890
968
|
}
|
|
891
|
-
const t =
|
|
892
|
-
|
|
969
|
+
const t = Bt.current;
|
|
970
|
+
Bt.current = !0, tt.current = !0;
|
|
893
971
|
let e = null;
|
|
894
|
-
const o = (c) =>
|
|
972
|
+
const o = (c) => lt({
|
|
895
973
|
key: c,
|
|
896
974
|
settle: t
|
|
897
975
|
});
|
|
898
976
|
return o(
|
|
899
|
-
|
|
977
|
+
_.current ?? Tt.current
|
|
900
978
|
) || (e = window.requestAnimationFrame(() => {
|
|
901
979
|
e = null, o(
|
|
902
|
-
|
|
980
|
+
_.current ?? Tt.current
|
|
903
981
|
);
|
|
904
982
|
})), () => {
|
|
905
983
|
e !== null && window.cancelAnimationFrame(e);
|
|
906
984
|
};
|
|
907
985
|
}, [
|
|
908
|
-
|
|
986
|
+
X,
|
|
909
987
|
r,
|
|
910
|
-
|
|
988
|
+
x,
|
|
911
989
|
i,
|
|
912
990
|
a,
|
|
913
|
-
|
|
914
|
-
|
|
991
|
+
Gt,
|
|
992
|
+
v,
|
|
915
993
|
qt,
|
|
916
|
-
|
|
917
|
-
]),
|
|
918
|
-
if (!i || !r || !
|
|
994
|
+
lt
|
|
995
|
+
]), Z(() => {
|
|
996
|
+
if (!i || !r || !v) return;
|
|
919
997
|
const t = () => {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
key:
|
|
998
|
+
w.current.dragging || z.current === null && (z.current = window.requestAnimationFrame(() => {
|
|
999
|
+
z.current = null, !w.current.dragging && lt({
|
|
1000
|
+
key: _.current,
|
|
923
1001
|
settle: !1
|
|
924
1002
|
});
|
|
925
1003
|
}));
|
|
926
1004
|
};
|
|
927
1005
|
window.addEventListener("resize", t), window.visualViewport?.addEventListener("resize", t);
|
|
928
|
-
const e = l.current, o = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t)
|
|
929
|
-
|
|
930
|
-
|
|
1006
|
+
const e = l.current, o = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t), s = (u) => {
|
|
1007
|
+
e && u.target instanceof Element && e.contains(u.target) && t();
|
|
1008
|
+
};
|
|
1009
|
+
return c && (e && c.observe(e), o && c.observe(o)), e?.addEventListener(
|
|
1010
|
+
"transitionend",
|
|
1011
|
+
s,
|
|
1012
|
+
!0
|
|
1013
|
+
), e?.addEventListener(
|
|
1014
|
+
"transitioncancel",
|
|
1015
|
+
s,
|
|
1016
|
+
!0
|
|
1017
|
+
), () => {
|
|
1018
|
+
window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), e?.removeEventListener(
|
|
1019
|
+
"transitionend",
|
|
1020
|
+
s,
|
|
1021
|
+
!0
|
|
1022
|
+
), e?.removeEventListener(
|
|
1023
|
+
"transitioncancel",
|
|
1024
|
+
s,
|
|
1025
|
+
!0
|
|
1026
|
+
), c?.disconnect(), z.current !== null && (window.cancelAnimationFrame(z.current), z.current = null);
|
|
931
1027
|
};
|
|
932
1028
|
}, [
|
|
933
1029
|
r,
|
|
934
1030
|
i,
|
|
935
|
-
|
|
1031
|
+
v,
|
|
936
1032
|
l,
|
|
937
|
-
|
|
1033
|
+
lt
|
|
1034
|
+
]), Z(() => {
|
|
1035
|
+
if (Ut <= 0 || !i || !r || !v)
|
|
1036
|
+
return;
|
|
1037
|
+
let t = window.requestAnimationFrame(() => {
|
|
1038
|
+
t = null, lt({
|
|
1039
|
+
key: _.current,
|
|
1040
|
+
settle: !1
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
1043
|
+
return () => {
|
|
1044
|
+
t !== null && window.cancelAnimationFrame(t);
|
|
1045
|
+
};
|
|
1046
|
+
}, [
|
|
1047
|
+
r,
|
|
1048
|
+
i,
|
|
1049
|
+
v,
|
|
1050
|
+
Ut,
|
|
1051
|
+
lt
|
|
938
1052
|
]);
|
|
939
|
-
const
|
|
1053
|
+
const ne = d(
|
|
940
1054
|
(t, e, o) => {
|
|
941
|
-
if (typeof Element > "u" || !(t instanceof Element) ||
|
|
942
|
-
const c = Date.now(), s = e > 0, u =
|
|
943
|
-
return !o && u && s && u.scrollTop > 0 || !o &&
|
|
1055
|
+
if (typeof Element > "u" || !(t instanceof Element) || Vt(t)) return !1;
|
|
1056
|
+
const c = Date.now(), s = e > 0, u = Ae(t, K.current);
|
|
1057
|
+
return !o && u && s && u.scrollTop > 0 || !o && ht.current && c - ht.current < Rt && Math.abs(Pt()) <= 1 ? (ht.current = c, !1) : !0;
|
|
944
1058
|
},
|
|
945
|
-
[
|
|
946
|
-
),
|
|
1059
|
+
[Pt, Rt]
|
|
1060
|
+
), Xt = d(
|
|
947
1061
|
({
|
|
948
1062
|
chrome: t,
|
|
949
1063
|
pointerId: e = null,
|
|
@@ -952,8 +1066,8 @@ function ar({
|
|
|
952
1066
|
startY: s,
|
|
953
1067
|
touchId: u = null
|
|
954
1068
|
}) => {
|
|
955
|
-
const { startTranslate:
|
|
956
|
-
|
|
1069
|
+
const { startTranslate: p, startTranslatePoint: g } = Qt(), m = $();
|
|
1070
|
+
w.current = {
|
|
957
1071
|
dragging: !0,
|
|
958
1072
|
allowed: !1,
|
|
959
1073
|
chrome: t,
|
|
@@ -965,9 +1079,9 @@ function ar({
|
|
|
965
1079
|
lastX: c,
|
|
966
1080
|
lastY: s,
|
|
967
1081
|
startTranslateX: g.x,
|
|
968
|
-
startTranslate:
|
|
1082
|
+
startTranslate: p,
|
|
969
1083
|
lastTranslateX: g.x,
|
|
970
|
-
lastTranslate:
|
|
1084
|
+
lastTranslate: p,
|
|
971
1085
|
startTime: m,
|
|
972
1086
|
samples: [
|
|
973
1087
|
{
|
|
@@ -975,23 +1089,23 @@ function ar({
|
|
|
975
1089
|
pageX: c,
|
|
976
1090
|
pageY: s,
|
|
977
1091
|
translateX: g.x,
|
|
978
|
-
translateY:
|
|
1092
|
+
translateY: p
|
|
979
1093
|
}
|
|
980
1094
|
],
|
|
981
1095
|
pointerId: e,
|
|
982
1096
|
touchId: u
|
|
983
1097
|
};
|
|
984
1098
|
},
|
|
985
|
-
[
|
|
986
|
-
),
|
|
1099
|
+
[Qt]
|
|
1100
|
+
), ct = d(
|
|
987
1101
|
(t) => {
|
|
988
|
-
t.source === "touch" ?
|
|
1102
|
+
t.source === "touch" ? et(!1) : t.source === "pointer" && rt(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
|
|
989
1103
|
},
|
|
990
|
-
[
|
|
991
|
-
),
|
|
1104
|
+
[rt, et]
|
|
1105
|
+
), ae = d(
|
|
992
1106
|
(t, e) => {
|
|
993
|
-
const o =
|
|
994
|
-
t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = o, t.lastTranslateX = c.x, t.lastTranslate = o, t.startTime =
|
|
1107
|
+
const o = vt(), c = nt();
|
|
1108
|
+
t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = o, t.lastTranslateX = c.x, t.lastTranslate = o, t.startTime = $(), t.samples = [
|
|
995
1109
|
{
|
|
996
1110
|
time: t.startTime,
|
|
997
1111
|
pageX: e.x,
|
|
@@ -1001,8 +1115,8 @@ function ar({
|
|
|
1001
1115
|
}
|
|
1002
1116
|
];
|
|
1003
1117
|
},
|
|
1004
|
-
[
|
|
1005
|
-
),
|
|
1118
|
+
[vt, nt]
|
|
1119
|
+
), oe = d(
|
|
1006
1120
|
({
|
|
1007
1121
|
currentTranslate: t,
|
|
1008
1122
|
dismissible: e,
|
|
@@ -1010,62 +1124,65 @@ function ar({
|
|
|
1010
1124
|
deltaY: c,
|
|
1011
1125
|
startTranslate: s
|
|
1012
1126
|
}) => {
|
|
1013
|
-
const u =
|
|
1014
|
-
|
|
1015
|
-
(u -
|
|
1016
|
-
),
|
|
1017
|
-
(
|
|
1018
|
-
),
|
|
1019
|
-
|
|
1020
|
-
),
|
|
1127
|
+
const u = V(), p = C(), g = p > 0, m = u, h = Math.max(
|
|
1128
|
+
M.dismissal.minDistancePx,
|
|
1129
|
+
(u - p) * ft
|
|
1130
|
+
), P = T.map(
|
|
1131
|
+
(At) => b(u - At, 0, u)
|
|
1132
|
+
), A = ce(
|
|
1133
|
+
P.length ? P : [0]
|
|
1134
|
+
), Q = Ke({
|
|
1021
1135
|
currentTranslate: t,
|
|
1022
1136
|
releaseVelocity: o
|
|
1023
1137
|
});
|
|
1024
|
-
g &&
|
|
1025
|
-
const
|
|
1026
|
-
return e && !g && c > 0 && t >=
|
|
1027
|
-
|
|
1138
|
+
g && A.push(p);
|
|
1139
|
+
const F = ce(A);
|
|
1140
|
+
return e && !g && c > 0 && t >= p + h ? m : Qe(o) ? F.length > 1 ? Re(
|
|
1141
|
+
F,
|
|
1028
1142
|
s,
|
|
1029
1143
|
t,
|
|
1030
1144
|
c > 0 ? "down" : "up",
|
|
1031
|
-
|
|
1032
|
-
) : 0 : e && t > u *
|
|
1145
|
+
Q
|
|
1146
|
+
) : 0 : e && t > u * ft && !g ? m : ze(F, t);
|
|
1033
1147
|
},
|
|
1034
|
-
[
|
|
1035
|
-
),
|
|
1148
|
+
[ft, C, V, T]
|
|
1149
|
+
), Ye = d(
|
|
1036
1150
|
(t) => {
|
|
1037
|
-
if (!r || a !== "bottom" && !
|
|
1151
|
+
if (!r || a !== "bottom" && !v || n === !1 || t.pointerType === "touch") return;
|
|
1038
1152
|
let e = !1;
|
|
1039
|
-
if (n === "handle" && t.target
|
|
1153
|
+
if (n === "handle" && fe(t.target))
|
|
1040
1154
|
e = !0;
|
|
1041
1155
|
else if (n === "handle")
|
|
1042
1156
|
return;
|
|
1043
|
-
n === "content" && (e =
|
|
1157
|
+
if (!e && Vt(t.target) || n === "content" && (e = de(t.target), !$e(t, e)))
|
|
1158
|
+
return;
|
|
1159
|
+
const o = We(t.target);
|
|
1160
|
+
Xt({
|
|
1044
1161
|
chrome: e,
|
|
1045
1162
|
pointerId: t.pointerId,
|
|
1046
1163
|
source: "pointer",
|
|
1047
1164
|
startX: t.pageX,
|
|
1048
1165
|
startY: t.pageY
|
|
1049
|
-
}), t.preventDefault(),
|
|
1166
|
+
}), Ue(t.target) || t.preventDefault(), rt(!0), !o && typeof t.currentTarget.setPointerCapture == "function" && t.currentTarget.setPointerCapture(t.pointerId);
|
|
1050
1167
|
},
|
|
1051
1168
|
[
|
|
1052
|
-
|
|
1169
|
+
Xt,
|
|
1053
1170
|
n,
|
|
1054
1171
|
r,
|
|
1055
1172
|
a,
|
|
1056
|
-
|
|
1057
|
-
|
|
1173
|
+
v,
|
|
1174
|
+
rt
|
|
1058
1175
|
]
|
|
1059
|
-
),
|
|
1176
|
+
), ut = d(
|
|
1060
1177
|
(t, e) => {
|
|
1061
|
-
if (!
|
|
1178
|
+
if (!N) return !1;
|
|
1062
1179
|
if (e <= 0) return !0;
|
|
1063
1180
|
if (t.closeAllowed !== null) return t.closeAllowed;
|
|
1064
|
-
const o =
|
|
1181
|
+
const o = _t({ reason: "drag-dismiss" });
|
|
1065
1182
|
return t.closeAllowed = o, o;
|
|
1066
1183
|
},
|
|
1067
|
-
[
|
|
1068
|
-
),
|
|
1184
|
+
[_t, N]
|
|
1185
|
+
), St = d(
|
|
1069
1186
|
({
|
|
1070
1187
|
closeAllowed: t,
|
|
1071
1188
|
currentTranslate: e,
|
|
@@ -1073,80 +1190,116 @@ function ar({
|
|
|
1073
1190
|
releaseVelocity: c,
|
|
1074
1191
|
startTranslate: s
|
|
1075
1192
|
}) => {
|
|
1076
|
-
const
|
|
1193
|
+
const p = oe({
|
|
1077
1194
|
currentTranslate: e,
|
|
1078
|
-
dismissible:
|
|
1195
|
+
dismissible: N && t !== !1,
|
|
1079
1196
|
releaseVelocity: c,
|
|
1080
1197
|
deltaY: o,
|
|
1081
1198
|
startTranslate: s
|
|
1082
|
-
}), g =
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1199
|
+
}), g = V(), m = C();
|
|
1200
|
+
if (p >= g - 1) {
|
|
1201
|
+
q({ reason: "drag-dismiss" }, { commit: !1 }) ? re(p, {
|
|
1085
1202
|
from: e,
|
|
1086
1203
|
initialVelocity: c
|
|
1087
|
-
}) :
|
|
1204
|
+
}) : I(s, {
|
|
1088
1205
|
from: e,
|
|
1089
1206
|
initialVelocity: c
|
|
1090
1207
|
});
|
|
1091
1208
|
return;
|
|
1092
1209
|
}
|
|
1093
|
-
m > 0 &&
|
|
1094
|
-
presentationState:
|
|
1095
|
-
releaseTranslate:
|
|
1096
|
-
visibleTranslate:
|
|
1097
|
-
}) && (
|
|
1210
|
+
m > 0 && p >= m - 1 ? bt("peeked") : (ar({
|
|
1211
|
+
presentationState: k,
|
|
1212
|
+
releaseTranslate: p,
|
|
1213
|
+
visibleTranslate: H
|
|
1214
|
+
}) && (kt.current = !0), bt("visible")), I(p, {
|
|
1098
1215
|
from: e,
|
|
1099
1216
|
initialVelocity: c
|
|
1100
1217
|
});
|
|
1101
1218
|
},
|
|
1102
1219
|
[
|
|
1103
|
-
Zt,
|
|
1104
|
-
R,
|
|
1105
|
-
A,
|
|
1106
1220
|
re,
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1221
|
+
N,
|
|
1222
|
+
C,
|
|
1223
|
+
oe,
|
|
1224
|
+
V,
|
|
1111
1225
|
k,
|
|
1112
|
-
|
|
1226
|
+
q,
|
|
1227
|
+
bt,
|
|
1228
|
+
I,
|
|
1229
|
+
H
|
|
1113
1230
|
]
|
|
1114
|
-
),
|
|
1115
|
-
({
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1231
|
+
), Yt = d(
|
|
1232
|
+
({
|
|
1233
|
+
currentTranslate: t,
|
|
1234
|
+
releaseDelta: e,
|
|
1235
|
+
releaseTranslate: o,
|
|
1236
|
+
releaseVelocity: c
|
|
1237
|
+
}) => {
|
|
1238
|
+
const s = at();
|
|
1239
|
+
if (!s) return;
|
|
1240
|
+
const u = qe({
|
|
1241
|
+
currentTranslate: o,
|
|
1242
|
+
releaseVelocity: c,
|
|
1243
|
+
targets: s.targets
|
|
1244
|
+
}), p = s.targets.find(
|
|
1245
|
+
(P) => P.key === _.current
|
|
1246
|
+
) ?? s.defaultTarget, m = l.current?.getBoundingClientRect(), h = {
|
|
1247
|
+
x: p.x + e.x,
|
|
1248
|
+
y: p.y + e.y
|
|
1249
|
+
};
|
|
1250
|
+
if (N && m && nr({
|
|
1251
|
+
closeThreshold: ft,
|
|
1252
|
+
currentTarget: p,
|
|
1253
|
+
currentTranslate: h,
|
|
1254
|
+
releaseTarget: u,
|
|
1255
|
+
surfaceSize: {
|
|
1256
|
+
height: m.height,
|
|
1257
|
+
width: m.width
|
|
1258
|
+
},
|
|
1259
|
+
targets: s.targets
|
|
1260
|
+
}) && q({ reason: "drag-dismiss" })) {
|
|
1261
|
+
R(), x();
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
if (_.current = u.key, O.current) {
|
|
1265
|
+
Dt(u);
|
|
1125
1266
|
return;
|
|
1126
1267
|
}
|
|
1127
|
-
|
|
1268
|
+
U(u, {
|
|
1128
1269
|
from: t,
|
|
1129
|
-
initialVelocity:
|
|
1270
|
+
initialVelocity: c
|
|
1130
1271
|
});
|
|
1131
1272
|
},
|
|
1132
|
-
[
|
|
1133
|
-
|
|
1273
|
+
[
|
|
1274
|
+
R,
|
|
1275
|
+
ft,
|
|
1276
|
+
N,
|
|
1277
|
+
x,
|
|
1278
|
+
at,
|
|
1279
|
+
q,
|
|
1280
|
+
Dt,
|
|
1281
|
+
U,
|
|
1282
|
+
l
|
|
1283
|
+
]
|
|
1284
|
+
), Ee = d(
|
|
1134
1285
|
(t) => {
|
|
1135
|
-
const e =
|
|
1136
|
-
if (!e.dragging || e.source !== "pointer" || !r || a !== "bottom" && !
|
|
1286
|
+
const e = w.current;
|
|
1287
|
+
if (!e.dragging || e.source !== "pointer" || !r || a !== "bottom" && !v)
|
|
1137
1288
|
return;
|
|
1138
|
-
const o = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ?
|
|
1139
|
-
if (!(!e.started &&
|
|
1289
|
+
const o = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? M.dragStartThresholdPx.touch : M.dragStartThresholdPx.mouse;
|
|
1290
|
+
if (!(!e.started && ue({ deltaX: o, deltaY: c, placement: a }) < s)) {
|
|
1140
1291
|
if (!e.allowed) {
|
|
1141
|
-
if (a === "bottom" && !
|
|
1292
|
+
if (a === "bottom" && !ne(t.target, c, e.chrome))
|
|
1142
1293
|
return;
|
|
1143
1294
|
e.allowed = !0, e.started = !0;
|
|
1295
|
+
const u = t.currentTarget;
|
|
1296
|
+
e.pointerId !== null && typeof u.hasPointerCapture == "function" && typeof u.setPointerCapture == "function" && !u.hasPointerCapture(e.pointerId) && u.setPointerCapture(e.pointerId);
|
|
1144
1297
|
}
|
|
1145
1298
|
if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, a === "popup")
|
|
1146
|
-
|
|
1299
|
+
it(e, t), ye(e, t);
|
|
1147
1300
|
else {
|
|
1148
|
-
const u = e.startTranslate + c,
|
|
1149
|
-
|
|
1301
|
+
const u = e.startTranslate + c, p = ut(e, c);
|
|
1302
|
+
ot(u, p), mt(e, {
|
|
1150
1303
|
pageX: t.pageX,
|
|
1151
1304
|
pageY: t.pageY,
|
|
1152
1305
|
translateX: e.lastTranslateX,
|
|
@@ -1157,139 +1310,141 @@ function ar({
|
|
|
1157
1310
|
},
|
|
1158
1311
|
[
|
|
1159
1312
|
r,
|
|
1160
|
-
|
|
1161
|
-
|
|
1313
|
+
it,
|
|
1314
|
+
ut,
|
|
1162
1315
|
a,
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1316
|
+
v,
|
|
1317
|
+
ot,
|
|
1318
|
+
ne
|
|
1166
1319
|
]
|
|
1167
|
-
),
|
|
1320
|
+
), J = d(
|
|
1168
1321
|
({
|
|
1169
1322
|
currentTarget: t,
|
|
1170
1323
|
pageX: e,
|
|
1171
1324
|
pageY: o,
|
|
1172
1325
|
releaseCapture: c = !0
|
|
1173
1326
|
}) => {
|
|
1174
|
-
const s =
|
|
1175
|
-
if (!s.dragging || s.source !== "pointer" || !r || a !== "bottom" && !
|
|
1327
|
+
const s = w.current;
|
|
1328
|
+
if (!s.dragging || s.source !== "pointer" || !r || a !== "bottom" && !v)
|
|
1176
1329
|
return;
|
|
1177
|
-
const u = s.started,
|
|
1178
|
-
let
|
|
1330
|
+
const u = s.started, p = Number.isFinite(e) ? e : s.lastX, g = Number.isFinite(o) ? o : s.lastY, m = p - s.startX, h = g - s.startY, P = Math.max($() - s.startTime, 1);
|
|
1331
|
+
let A = {
|
|
1179
1332
|
x: s.lastTranslateX,
|
|
1180
1333
|
y: s.lastTranslate
|
|
1181
|
-
};
|
|
1182
|
-
const
|
|
1334
|
+
}, Q = A;
|
|
1335
|
+
const F = s.startTranslate;
|
|
1183
1336
|
if (u)
|
|
1184
1337
|
if (a === "popup")
|
|
1185
|
-
|
|
1186
|
-
pageX:
|
|
1338
|
+
it(s, {
|
|
1339
|
+
pageX: p,
|
|
1187
1340
|
pageY: g
|
|
1188
|
-
}),
|
|
1341
|
+
}), A = {
|
|
1189
1342
|
x: s.lastTranslateX,
|
|
1190
1343
|
y: s.lastTranslate
|
|
1191
|
-
}
|
|
1344
|
+
}, Q = Lt(s, {
|
|
1345
|
+
pageX: p,
|
|
1346
|
+
pageY: g
|
|
1347
|
+
});
|
|
1192
1348
|
else {
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1349
|
+
const W = s.startTranslate + h, Fe = ut(s, h);
|
|
1350
|
+
ot(W, Fe), A = {
|
|
1195
1351
|
x: s.lastTranslateX,
|
|
1196
1352
|
y: s.lastTranslate
|
|
1197
1353
|
};
|
|
1198
1354
|
}
|
|
1199
|
-
const
|
|
1355
|
+
const At = s.closeAllowed;
|
|
1200
1356
|
if (c && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
|
|
1201
|
-
const
|
|
1202
|
-
pageX: d,
|
|
1203
|
-
pageY: g
|
|
1204
|
-
}) : {
|
|
1357
|
+
const W = a === "popup" ? Q : {
|
|
1205
1358
|
x: s.lastTranslateX,
|
|
1206
1359
|
y: s.lastTranslate
|
|
1207
1360
|
};
|
|
1208
|
-
|
|
1209
|
-
pageX:
|
|
1361
|
+
mt(s, {
|
|
1362
|
+
pageX: p,
|
|
1210
1363
|
pageY: g,
|
|
1211
|
-
translateX:
|
|
1212
|
-
translateY:
|
|
1364
|
+
translateX: W.x,
|
|
1365
|
+
translateY: W.y
|
|
1213
1366
|
});
|
|
1214
1367
|
}
|
|
1215
|
-
if (
|
|
1216
|
-
if (a === "popup") {
|
|
1217
|
-
const
|
|
1368
|
+
if (ct(s), !!u)
|
|
1369
|
+
if (gt.current = $() + 500, a === "popup") {
|
|
1370
|
+
const W = xe({
|
|
1218
1371
|
session: s,
|
|
1219
1372
|
fallbackDelta: { x: m, y: h },
|
|
1220
|
-
fallbackElapsed:
|
|
1373
|
+
fallbackElapsed: P
|
|
1221
1374
|
});
|
|
1222
|
-
|
|
1223
|
-
currentTranslate:
|
|
1224
|
-
|
|
1375
|
+
Yt({
|
|
1376
|
+
currentTranslate: A,
|
|
1377
|
+
releaseDelta: { x: m, y: h },
|
|
1378
|
+
releaseTranslate: Q,
|
|
1379
|
+
releaseVelocity: W
|
|
1225
1380
|
});
|
|
1226
1381
|
} else {
|
|
1227
|
-
const
|
|
1382
|
+
const W = Te({
|
|
1228
1383
|
session: s,
|
|
1229
1384
|
fallbackDeltaY: h,
|
|
1230
|
-
fallbackElapsed:
|
|
1385
|
+
fallbackElapsed: P
|
|
1231
1386
|
});
|
|
1232
|
-
|
|
1233
|
-
closeAllowed:
|
|
1234
|
-
currentTranslate:
|
|
1387
|
+
St({
|
|
1388
|
+
closeAllowed: At,
|
|
1389
|
+
currentTranslate: A.y,
|
|
1235
1390
|
deltaY: h,
|
|
1236
|
-
releaseVelocity:
|
|
1237
|
-
startTranslate:
|
|
1391
|
+
releaseVelocity: W,
|
|
1392
|
+
startTranslate: F
|
|
1238
1393
|
});
|
|
1239
1394
|
}
|
|
1240
1395
|
},
|
|
1241
1396
|
[
|
|
1242
|
-
|
|
1243
|
-
|
|
1397
|
+
St,
|
|
1398
|
+
Yt,
|
|
1244
1399
|
r,
|
|
1245
|
-
|
|
1246
|
-
|
|
1400
|
+
it,
|
|
1401
|
+
ut,
|
|
1247
1402
|
a,
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1403
|
+
v,
|
|
1404
|
+
ct,
|
|
1405
|
+
ot
|
|
1251
1406
|
]
|
|
1252
|
-
),
|
|
1407
|
+
), se = d(
|
|
1253
1408
|
(t) => {
|
|
1254
|
-
|
|
1409
|
+
J({
|
|
1255
1410
|
currentTarget: t.currentTarget,
|
|
1256
1411
|
pageX: t.pageX,
|
|
1257
1412
|
pageY: t.pageY
|
|
1258
1413
|
});
|
|
1259
1414
|
},
|
|
1260
|
-
[
|
|
1261
|
-
),
|
|
1415
|
+
[J]
|
|
1416
|
+
), Me = d(
|
|
1262
1417
|
(t) => {
|
|
1263
|
-
const e =
|
|
1264
|
-
e.pointerId !== null && t.pointerId !== e.pointerId ||
|
|
1418
|
+
const e = w.current;
|
|
1419
|
+
e.pointerId !== null && t.pointerId !== e.pointerId || J({
|
|
1265
1420
|
pageX: t.pageX,
|
|
1266
1421
|
pageY: t.pageY,
|
|
1267
1422
|
releaseCapture: !1
|
|
1268
1423
|
});
|
|
1269
1424
|
},
|
|
1270
|
-
[
|
|
1425
|
+
[J]
|
|
1271
1426
|
);
|
|
1272
|
-
|
|
1427
|
+
Mt(() => {
|
|
1273
1428
|
if (!r) return;
|
|
1274
1429
|
const t = (s) => {
|
|
1275
|
-
const u =
|
|
1276
|
-
!u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId ||
|
|
1430
|
+
const u = w.current;
|
|
1431
|
+
!u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || J({
|
|
1277
1432
|
pageX: s.pageX,
|
|
1278
1433
|
pageY: s.pageY,
|
|
1279
1434
|
releaseCapture: !1
|
|
1280
1435
|
});
|
|
1281
1436
|
}, e = () => {
|
|
1282
|
-
const s =
|
|
1283
|
-
!s.dragging || s.source !== "pointer" ||
|
|
1437
|
+
const s = w.current;
|
|
1438
|
+
!s.dragging || s.source !== "pointer" || J({
|
|
1284
1439
|
pageX: s.lastX,
|
|
1285
1440
|
pageY: s.lastY,
|
|
1286
1441
|
releaseCapture: !1
|
|
1287
1442
|
});
|
|
1288
1443
|
}, o = (s) => {
|
|
1289
|
-
const u =
|
|
1444
|
+
const u = w.current;
|
|
1290
1445
|
!u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
|
|
1291
1446
|
}, c = (s) => {
|
|
1292
|
-
const u =
|
|
1447
|
+
const u = w.current;
|
|
1293
1448
|
!u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
|
|
1294
1449
|
};
|
|
1295
1450
|
return document.addEventListener("pointerout", o, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
|
|
@@ -1311,24 +1466,40 @@ function ar({
|
|
|
1311
1466
|
!0
|
|
1312
1467
|
), window.removeEventListener("blur", e);
|
|
1313
1468
|
};
|
|
1314
|
-
}, [
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1318
|
-
|
|
1469
|
+
}, [J, r]), Mt(() => {
|
|
1470
|
+
if (!r) return;
|
|
1471
|
+
const t = (e) => {
|
|
1472
|
+
const o = gt.current;
|
|
1473
|
+
if (o <= 0) return;
|
|
1474
|
+
if ($() > o) {
|
|
1475
|
+
gt.current = 0;
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
const c = l.current;
|
|
1479
|
+
c && e.target instanceof Node && c.contains(e.target) && (gt.current = 0, e.preventDefault(), e.stopPropagation());
|
|
1480
|
+
};
|
|
1481
|
+
return document.addEventListener("click", t, !0), () => {
|
|
1482
|
+
document.removeEventListener("click", t, !0);
|
|
1483
|
+
};
|
|
1484
|
+
}, [r, l]);
|
|
1485
|
+
const Et = d((t) => {
|
|
1486
|
+
const e = w.current;
|
|
1487
|
+
return e.touchId !== null ? me(t.changedTouches, e.touchId) ?? me(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
|
|
1488
|
+
}, []), Le = d(
|
|
1319
1489
|
(t) => {
|
|
1320
|
-
if (!r || a !== "bottom" && !
|
|
1490
|
+
if (!r || a !== "bottom" && !v || n === !1 || t.touches.length !== 1) return;
|
|
1321
1491
|
let e = !1;
|
|
1322
|
-
if (n === "handle" && t.target
|
|
1492
|
+
if (n === "handle" && fe(t.target))
|
|
1323
1493
|
e = !0;
|
|
1324
1494
|
else if (n === "handle")
|
|
1325
1495
|
return;
|
|
1326
|
-
|
|
1496
|
+
if (!e && Vt(t.target)) return;
|
|
1497
|
+
n === "content" && (e = de(t.target));
|
|
1327
1498
|
const o = t.touches[0];
|
|
1328
|
-
a === "bottom" &&
|
|
1499
|
+
a === "bottom" && xt({
|
|
1329
1500
|
target: t.target,
|
|
1330
1501
|
chrome: e
|
|
1331
|
-
}),
|
|
1502
|
+
}), Xt({
|
|
1332
1503
|
chrome: e,
|
|
1333
1504
|
source: "touch",
|
|
1334
1505
|
startX: o.pageX,
|
|
@@ -1337,50 +1508,50 @@ function ar({
|
|
|
1337
1508
|
});
|
|
1338
1509
|
},
|
|
1339
1510
|
[
|
|
1340
|
-
|
|
1511
|
+
Xt,
|
|
1341
1512
|
n,
|
|
1342
1513
|
r,
|
|
1343
1514
|
a,
|
|
1344
|
-
|
|
1345
|
-
|
|
1515
|
+
v,
|
|
1516
|
+
xt
|
|
1346
1517
|
]
|
|
1347
|
-
),
|
|
1518
|
+
), ie = d(
|
|
1348
1519
|
(t) => {
|
|
1349
|
-
const e =
|
|
1350
|
-
if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !
|
|
1520
|
+
const e = w.current;
|
|
1521
|
+
if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !v)
|
|
1351
1522
|
return;
|
|
1352
|
-
const o =
|
|
1523
|
+
const o = Et(t);
|
|
1353
1524
|
if (!o) return;
|
|
1354
|
-
const c = o.pageX - e.startX, s = o.pageY - e.startY, u =
|
|
1525
|
+
const c = o.pageX - e.startX, s = o.pageY - e.startY, u = ue({
|
|
1355
1526
|
deltaX: c,
|
|
1356
1527
|
deltaY: s,
|
|
1357
1528
|
placement: a
|
|
1358
|
-
}),
|
|
1529
|
+
}), p = M.dragStartThresholdPx.touch, g = a === "bottom" ? Ne({
|
|
1359
1530
|
target: t.target,
|
|
1360
1531
|
deltaY: s,
|
|
1361
1532
|
chrome: e.chrome,
|
|
1362
|
-
bodyNode:
|
|
1363
|
-
}) :
|
|
1533
|
+
bodyNode: K.current
|
|
1534
|
+
}) : Oe({
|
|
1364
1535
|
target: t.target,
|
|
1365
|
-
bodyNode:
|
|
1536
|
+
bodyNode: K.current
|
|
1366
1537
|
});
|
|
1367
1538
|
if (g.preventDefault) {
|
|
1368
|
-
const h = a === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) <
|
|
1369
|
-
!h && a === "bottom" &&
|
|
1539
|
+
const h = a === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < p && !e.started && u < p;
|
|
1540
|
+
!h && a === "bottom" && xt({
|
|
1370
1541
|
target: t.target,
|
|
1371
1542
|
chrome: e.chrome
|
|
1372
|
-
}), h ||
|
|
1543
|
+
}), h || le(t);
|
|
1373
1544
|
}
|
|
1374
1545
|
if (g.resetAnchor) {
|
|
1375
|
-
|
|
1546
|
+
et(!1), ae(e, { x: o.pageX, y: o.pageY });
|
|
1376
1547
|
return;
|
|
1377
1548
|
}
|
|
1378
|
-
if (g.allowDrag && !(!e.started && u <
|
|
1379
|
-
if (e.allowed || (e.allowed = !0, e.started = !0), g.preventDefault ||
|
|
1380
|
-
|
|
1549
|
+
if (g.allowDrag && !(!e.started && u < p))
|
|
1550
|
+
if (e.allowed || (e.allowed = !0, e.started = !0), g.preventDefault || le(t), e.lastX = o.pageX, e.lastY = o.pageY, a === "popup")
|
|
1551
|
+
it(e, o), ye(e, o);
|
|
1381
1552
|
else {
|
|
1382
|
-
const m = e.startTranslate + s, h =
|
|
1383
|
-
|
|
1553
|
+
const m = e.startTranslate + s, h = ut(e, s);
|
|
1554
|
+
ot(m, h), mt(e, {
|
|
1384
1555
|
pageX: o.pageX,
|
|
1385
1556
|
pageY: o.pageY,
|
|
1386
1557
|
translateX: e.lastTranslateX,
|
|
@@ -1390,21 +1561,21 @@ function ar({
|
|
|
1390
1561
|
},
|
|
1391
1562
|
[
|
|
1392
1563
|
r,
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1564
|
+
it,
|
|
1565
|
+
ut,
|
|
1566
|
+
Et,
|
|
1396
1567
|
a,
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1568
|
+
v,
|
|
1569
|
+
ae,
|
|
1570
|
+
et,
|
|
1571
|
+
ot,
|
|
1572
|
+
xt
|
|
1402
1573
|
]
|
|
1403
1574
|
);
|
|
1404
|
-
|
|
1405
|
-
if (!i || !r || a !== "bottom" && !
|
|
1575
|
+
Mt(() => {
|
|
1576
|
+
if (!i || !r || a !== "bottom" && !v || n === !1 || typeof window > "u") return;
|
|
1406
1577
|
const t = (e) => {
|
|
1407
|
-
|
|
1578
|
+
ie(e);
|
|
1408
1579
|
};
|
|
1409
1580
|
return window.addEventListener("touchmove", t, {
|
|
1410
1581
|
capture: !0,
|
|
@@ -1412,71 +1583,75 @@ function ar({
|
|
|
1412
1583
|
}), () => {
|
|
1413
1584
|
window.removeEventListener("touchmove", t, !0);
|
|
1414
1585
|
};
|
|
1415
|
-
}, [n, r,
|
|
1416
|
-
const
|
|
1586
|
+
}, [n, r, ie, i, a, v]);
|
|
1587
|
+
const be = d(
|
|
1417
1588
|
(t) => {
|
|
1418
|
-
const e =
|
|
1419
|
-
if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !
|
|
1589
|
+
const e = w.current;
|
|
1590
|
+
if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !v)
|
|
1420
1591
|
return;
|
|
1421
|
-
const o =
|
|
1422
|
-
a === "popup" &&
|
|
1423
|
-
const
|
|
1592
|
+
const o = Et(t), c = o?.pageX ?? e.lastX, s = o?.pageY ?? e.lastY, u = e.started, p = e.closeAllowed, g = c - e.startX, m = s - e.startY, h = Math.max($() - e.startTime, 1);
|
|
1593
|
+
a === "popup" && st();
|
|
1594
|
+
const P = {
|
|
1424
1595
|
x: e.lastTranslateX,
|
|
1425
1596
|
y: e.lastTranslate
|
|
1426
|
-
}
|
|
1597
|
+
};
|
|
1598
|
+
let A = P;
|
|
1599
|
+
const Q = e.startTranslate;
|
|
1427
1600
|
if (u) {
|
|
1428
|
-
const
|
|
1601
|
+
const F = a === "popup" ? Lt(e, {
|
|
1429
1602
|
pageX: c,
|
|
1430
1603
|
pageY: s
|
|
1431
1604
|
}) : {
|
|
1432
1605
|
x: e.lastTranslateX,
|
|
1433
1606
|
y: e.lastTranslate
|
|
1434
1607
|
};
|
|
1435
|
-
|
|
1608
|
+
A = F, mt(e, {
|
|
1436
1609
|
pageX: c,
|
|
1437
1610
|
pageY: s,
|
|
1438
|
-
translateX:
|
|
1439
|
-
translateY:
|
|
1611
|
+
translateX: F.x,
|
|
1612
|
+
translateY: F.y
|
|
1440
1613
|
});
|
|
1441
1614
|
}
|
|
1442
|
-
if (
|
|
1443
|
-
if (a === "popup") {
|
|
1444
|
-
const
|
|
1615
|
+
if (ct(e), !!u)
|
|
1616
|
+
if (gt.current = $() + 500, a === "popup") {
|
|
1617
|
+
const F = xe({
|
|
1445
1618
|
session: e,
|
|
1446
1619
|
fallbackDelta: { x: g, y: m },
|
|
1447
1620
|
fallbackElapsed: h
|
|
1448
1621
|
});
|
|
1449
|
-
|
|
1450
|
-
currentTranslate:
|
|
1451
|
-
|
|
1622
|
+
Yt({
|
|
1623
|
+
currentTranslate: P,
|
|
1624
|
+
releaseDelta: { x: g, y: m },
|
|
1625
|
+
releaseTranslate: A,
|
|
1626
|
+
releaseVelocity: F
|
|
1452
1627
|
});
|
|
1453
1628
|
} else {
|
|
1454
|
-
const
|
|
1629
|
+
const F = Te({
|
|
1455
1630
|
session: e,
|
|
1456
1631
|
fallbackDeltaY: m,
|
|
1457
1632
|
fallbackElapsed: h
|
|
1458
1633
|
});
|
|
1459
|
-
|
|
1460
|
-
closeAllowed:
|
|
1461
|
-
currentTranslate:
|
|
1634
|
+
St({
|
|
1635
|
+
closeAllowed: p,
|
|
1636
|
+
currentTranslate: P.y,
|
|
1462
1637
|
deltaY: m,
|
|
1463
|
-
releaseVelocity:
|
|
1464
|
-
startTranslate:
|
|
1638
|
+
releaseVelocity: F,
|
|
1639
|
+
startTranslate: Q
|
|
1465
1640
|
});
|
|
1466
1641
|
}
|
|
1467
1642
|
},
|
|
1468
1643
|
[
|
|
1469
|
-
Dt,
|
|
1470
|
-
Xt,
|
|
1471
|
-
r,
|
|
1472
1644
|
St,
|
|
1645
|
+
Yt,
|
|
1646
|
+
r,
|
|
1647
|
+
Et,
|
|
1473
1648
|
a,
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1649
|
+
v,
|
|
1650
|
+
ct,
|
|
1651
|
+
st
|
|
1477
1652
|
]
|
|
1478
|
-
),
|
|
1479
|
-
const t =
|
|
1653
|
+
), ke = d(() => {
|
|
1654
|
+
const t = w.current;
|
|
1480
1655
|
if (!t.dragging || t.source !== "touch") return;
|
|
1481
1656
|
const e = t.started, o = t.startTranslate, c = t.lastTranslate, s = {
|
|
1482
1657
|
x: t.startTranslateX,
|
|
@@ -1484,32 +1659,32 @@ function ar({
|
|
|
1484
1659
|
}, u = {
|
|
1485
1660
|
x: t.lastTranslateX,
|
|
1486
1661
|
y: t.lastTranslate
|
|
1487
|
-
},
|
|
1488
|
-
if (
|
|
1489
|
-
if (
|
|
1490
|
-
|
|
1662
|
+
}, p = a;
|
|
1663
|
+
if (ct(t), !!e) {
|
|
1664
|
+
if (p === "popup") {
|
|
1665
|
+
O.current ? Dt(s) : U(s, { from: u });
|
|
1491
1666
|
return;
|
|
1492
1667
|
}
|
|
1493
|
-
|
|
1668
|
+
I(o, { from: c });
|
|
1494
1669
|
}
|
|
1495
1670
|
}, [
|
|
1496
1671
|
a,
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1672
|
+
ct,
|
|
1673
|
+
Dt,
|
|
1674
|
+
U,
|
|
1675
|
+
I
|
|
1501
1676
|
]);
|
|
1502
1677
|
return {
|
|
1503
|
-
onPointerDown:
|
|
1504
|
-
onPointerMove:
|
|
1505
|
-
onPointerUp:
|
|
1506
|
-
onPointerCancel:
|
|
1507
|
-
onLostPointerCapture:
|
|
1508
|
-
onTouchStart:
|
|
1509
|
-
onTouchEnd:
|
|
1510
|
-
onTouchCancel:
|
|
1678
|
+
onPointerDown: Ye,
|
|
1679
|
+
onPointerMove: Ee,
|
|
1680
|
+
onPointerUp: se,
|
|
1681
|
+
onPointerCancel: se,
|
|
1682
|
+
onLostPointerCapture: Me,
|
|
1683
|
+
onTouchStart: Le,
|
|
1684
|
+
onTouchEnd: be,
|
|
1685
|
+
onTouchCancel: ke
|
|
1511
1686
|
};
|
|
1512
1687
|
}
|
|
1513
1688
|
export {
|
|
1514
|
-
|
|
1689
|
+
mr as useModalDrag
|
|
1515
1690
|
};
|