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