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