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