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