@okam/stack-ui 1.41.1 → 1.41.2
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 +10 -0
- package/README.md +1 -0
- package/index108.js +1 -1
- package/index108.mjs +19 -13
- package/index109.js +1 -1
- package/index109.mjs +18 -12
- package/index149.js +1 -1
- package/index149.mjs +3 -3
- package/index150.js +1 -1
- package/index150.mjs +2 -2
- package/index151.js +1 -1
- package/index151.mjs +1 -1
- package/index152.js +1 -1
- package/index152.mjs +1 -1
- package/index157.js +1 -1
- package/index157.mjs +1 -1
- package/index159.js +1 -1
- package/index159.mjs +2 -2
- package/index160.js +1 -1
- package/index160.mjs +5 -5
- package/index161.js +1 -1
- package/index161.mjs +3 -3
- package/index168.js +1 -1
- package/index168.mjs +1 -1
- package/index172.js +1 -1
- package/index172.mjs +1 -1
- package/index174.js +1 -1
- package/index174.mjs +1 -1
- package/index175.js +1 -1
- package/index175.mjs +1 -1
- package/index177.js +1 -1
- package/index177.mjs +3 -3
- package/index229.js +1 -1
- package/index229.mjs +22 -68
- package/index230.js +1 -1
- package/index230.mjs +129 -370
- package/index231.js +1 -1
- package/index231.mjs +196 -45
- package/index232.js +1 -1
- package/index232.mjs +23 -4
- package/index233.js +1 -1
- package/index233.mjs +4 -25
- package/index234.js +1 -1
- package/index234.mjs +27 -46
- package/index235.js +1 -1
- package/index235.mjs +48 -4
- package/index236.js +1 -1
- package/index236.mjs +54 -24
- package/index237.js +1 -1
- package/index237.mjs +47 -11
- package/index238.js +1 -1
- package/index238.mjs +97 -4
- package/index239.js +1 -1
- package/index239.mjs +5 -14
- package/index240.js +1 -1
- package/index240.mjs +6 -42
- package/index241.js +1 -1
- package/index241.mjs +39 -55
- package/index242.js +1 -1
- package/index242.mjs +72 -42
- package/index243.js +1 -1
- package/index243.mjs +13 -27
- package/index244.js +1 -1
- package/index244.mjs +67 -30
- package/index245.js +1 -1
- package/index245.mjs +7 -14
- package/index246.js +1 -1
- package/index246.mjs +11 -10
- package/index247.js +1 -1
- package/index247.mjs +46 -27
- package/index248.js +1 -1
- package/index248.mjs +72 -8
- package/index249.js +1 -1
- package/index249.mjs +381 -6
- package/index250.js +1 -1
- package/index250.mjs +46 -5
- package/index251.js +1 -1
- package/index251.mjs +24 -7
- package/index252.js +1 -1
- package/index252.mjs +24 -29
- package/index253.js +1 -1
- package/index253.mjs +12 -18
- package/index254.js +1 -1
- package/index254.mjs +4 -13
- package/index255.js +1 -1
- package/index255.mjs +13 -42
- package/index256.js +1 -1
- package/index256.mjs +41 -7
- package/index257.js +1 -1
- package/index257.mjs +56 -16
- package/index258.js +1 -1
- package/index258.mjs +29 -3
- package/index259.js +1 -1
- package/index259.mjs +31 -4
- package/index260.js +1 -1
- package/index260.mjs +10 -19
- package/index261.js +1 -1
- package/index261.mjs +9 -54
- package/index262.js +1 -1
- package/index262.mjs +5 -27
- package/index263.js +1 -1
- package/index263.mjs +7 -140
- package/index264.js +1 -1
- package/index264.mjs +28 -196
- package/index265.js +1 -1
- package/index265.mjs +14 -18
- package/index266.js +1 -1
- package/index266.mjs +12 -48
- package/index267.js +1 -1
- package/index267.mjs +40 -45
- package/index268.js +1 -1
- package/index268.mjs +7 -96
- package/index269.js +1 -1
- package/index269.mjs +18 -72
- package/index270.js +1 -1
- package/index270.mjs +3 -69
- package/index271.js +1 -1
- package/index271.mjs +4 -7
- package/index272.js +1 -1
- package/index272.mjs +19 -11
- package/index274.js +1 -1
- package/index274.mjs +3 -3
- package/index276.js +1 -1
- package/index276.mjs +9 -9
- package/index277.js +1 -1
- package/index277.mjs +1 -1
- package/index320.js +1 -1
- package/index320.mjs +7 -63
- package/index321.js +1 -1
- package/index321.mjs +28 -7
- package/index322.js +1 -1
- package/index322.mjs +89 -24
- package/index323.js +1 -1
- package/index323.mjs +58 -88
- package/index326.js +1 -1
- package/index326.mjs +3 -3
- package/index329.js +1 -1
- package/index329.mjs +5 -5
- package/index330.js +1 -1
- package/index330.mjs +2 -2
- package/index331.js +1 -1
- package/index331.mjs +5 -5
- package/index332.js +1 -1
- package/index332.mjs +1 -1
- package/index336.js +1 -1
- package/index336.mjs +1 -1
- package/package.json +1 -1
package/index230.mjs
CHANGED
|
@@ -1,384 +1,143 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const J = Symbol("linkClicked");
|
|
49
|
-
function We(n) {
|
|
50
|
-
let { onPress: i, onPressChange: o, onPressStart: l, onPressEnd: d, onPressUp: $, onClick: h, isDisabled: v, isPressed: C, preventFocusOnPress: S, shouldCancelOnPointerExit: w, allowTextSelectionOnPress: T, ref: L, ...ne } = Ee(n), [ie, V] = ye(!1), k = $e({
|
|
51
|
-
isPressed: !1,
|
|
52
|
-
ignoreEmulatedMouseEvents: !1,
|
|
53
|
-
didFirePressStart: !1,
|
|
54
|
-
isTriggeringEvent: !1,
|
|
55
|
-
activePointerId: null,
|
|
56
|
-
target: null,
|
|
57
|
-
isOverTarget: !1,
|
|
58
|
-
pointerType: null,
|
|
59
|
-
disposables: []
|
|
60
|
-
}), { addGlobalListener: x, removeAllGlobalListeners: D } = de(), m = K((e, a) => {
|
|
61
|
-
let g = k.current;
|
|
62
|
-
if (v || g.didFirePressStart) return !1;
|
|
63
|
-
let r = !0;
|
|
64
|
-
if (g.isTriggeringEvent = !0, l) {
|
|
65
|
-
let u = new U("pressstart", a, e);
|
|
66
|
-
l(u), r = u.shouldStopPropagation;
|
|
67
|
-
}
|
|
68
|
-
return o && o(!0), g.isTriggeringEvent = !1, g.didFirePressStart = !0, V(!0), r;
|
|
69
|
-
}), y = K((e, a, g = !0) => {
|
|
70
|
-
let r = k.current;
|
|
71
|
-
if (!r.didFirePressStart) return !1;
|
|
72
|
-
r.didFirePressStart = !1, r.isTriggeringEvent = !0;
|
|
73
|
-
let u = !0;
|
|
74
|
-
if (d) {
|
|
75
|
-
let t = new U("pressend", a, e);
|
|
76
|
-
d(t), u = t.shouldStopPropagation;
|
|
77
|
-
}
|
|
78
|
-
if (o && o(!1), V(!1), i && g && !v) {
|
|
79
|
-
let t = new U("press", a, e);
|
|
80
|
-
i(t), u && (u = t.shouldStopPropagation);
|
|
81
|
-
}
|
|
82
|
-
return r.isTriggeringEvent = !1, u;
|
|
83
|
-
}), O = K((e, a) => {
|
|
84
|
-
let g = k.current;
|
|
85
|
-
if (v) return !1;
|
|
86
|
-
if ($) {
|
|
87
|
-
g.isTriggeringEvent = !0;
|
|
88
|
-
let r = new U("pressup", a, e);
|
|
89
|
-
return $(r), g.isTriggeringEvent = !1, r.shouldStopPropagation;
|
|
90
|
-
}
|
|
91
|
-
return !0;
|
|
92
|
-
}), P = K((e) => {
|
|
93
|
-
let a = k.current;
|
|
94
|
-
if (a.isPressed && a.target) {
|
|
95
|
-
a.didFirePressStart && a.pointerType != null && y(M(a.target, e), a.pointerType, !1), a.isPressed = !1, a.isOverTarget = !1, a.activePointerId = null, a.pointerType = null, D(), T || A(a.target);
|
|
96
|
-
for (let g of a.disposables) g();
|
|
97
|
-
a.disposables = [];
|
|
1
|
+
import { calculatePosition as D } from "./index231.mjs";
|
|
2
|
+
import { useCloseOnScroll as G } from "./index232.mjs";
|
|
3
|
+
import { useState as J, useRef as U, useEffect as K, useCallback as j } from "react";
|
|
4
|
+
import { useLayoutEffect as z } from "./index233.mjs";
|
|
5
|
+
import { useResizeObserver as k } from "./index234.mjs";
|
|
6
|
+
import { useLocale as M } from "@react-aria/i18n";
|
|
7
|
+
let e = typeof document < "u" ? window.visualViewport : null;
|
|
8
|
+
function te(n) {
|
|
9
|
+
let { direction: y } = M(), { arrowSize: w = 0, targetRef: c, overlayRef: i, scrollRef: s = i, placement: H = "bottom", containerPadding: P = 12, shouldFlip: L = !0, boundaryElement: $ = typeof document < "u" ? document.body : null, offset: C = 0, crossOffset: B = 0, shouldUpdatePosition: S = !0, isOpen: v = !0, onClose: p, maxHeight: b, arrowBoundaryOffset: T = 0 } = n, [t, I] = J(null), F = [
|
|
10
|
+
S,
|
|
11
|
+
H,
|
|
12
|
+
i.current,
|
|
13
|
+
c.current,
|
|
14
|
+
s.current,
|
|
15
|
+
P,
|
|
16
|
+
L,
|
|
17
|
+
$,
|
|
18
|
+
C,
|
|
19
|
+
B,
|
|
20
|
+
v,
|
|
21
|
+
y,
|
|
22
|
+
b,
|
|
23
|
+
T,
|
|
24
|
+
w
|
|
25
|
+
], N = U(e == null ? void 0 : e.scale);
|
|
26
|
+
K(() => {
|
|
27
|
+
v && (N.current = e == null ? void 0 : e.scale);
|
|
28
|
+
}, [
|
|
29
|
+
v
|
|
30
|
+
]);
|
|
31
|
+
let a = j(() => {
|
|
32
|
+
if (S === !1 || !v || !i.current || !c.current || !$ || (e == null ? void 0 : e.scale) !== N.current) return;
|
|
33
|
+
let o = null;
|
|
34
|
+
if (s.current && s.current.contains(document.activeElement)) {
|
|
35
|
+
var d;
|
|
36
|
+
let r = (d = document.activeElement) === null || d === void 0 ? void 0 : d.getBoundingClientRect(), g = s.current.getBoundingClientRect();
|
|
37
|
+
var u;
|
|
38
|
+
if (o = {
|
|
39
|
+
type: "top",
|
|
40
|
+
offset: ((u = r == null ? void 0 : r.top) !== null && u !== void 0 ? u : 0) - g.top
|
|
41
|
+
}, o.offset > g.height / 2) {
|
|
42
|
+
o.type = "bottom";
|
|
43
|
+
var R;
|
|
44
|
+
o.offset = ((R = r == null ? void 0 : r.bottom) !== null && R !== void 0 ? R : 0) - g.bottom;
|
|
45
|
+
}
|
|
98
46
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
let g = new MouseEvent("click", e);
|
|
106
|
-
se(g, a), h(oe(g));
|
|
47
|
+
let l = i.current;
|
|
48
|
+
if (!b && i.current) {
|
|
49
|
+
var O;
|
|
50
|
+
l.style.top = "0px", l.style.bottom = "";
|
|
51
|
+
var E;
|
|
52
|
+
l.style.maxHeight = ((E = (O = window.visualViewport) === null || O === void 0 ? void 0 : O.height) !== null && E !== void 0 ? E : window.innerHeight) + "px";
|
|
107
53
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!(r && !p(r.currentTarget, c(r.nativeEvent))) && r && r.button === 0 && !e.isTriggeringEvent && !z.isOpening) {
|
|
127
|
-
let u = !0;
|
|
128
|
-
if (v && r.preventDefault(), !e.ignoreEmulatedMouseEvents && !e.isPressed && (e.pointerType === "virtual" || j(r.nativeEvent))) {
|
|
129
|
-
let t = m(r, "virtual"), s = O(r, "virtual"), f = y(r, "virtual");
|
|
130
|
-
F(r), u = t && s && f;
|
|
131
|
-
} else if (e.isPressed && e.pointerType !== "keyboard") {
|
|
132
|
-
let t = e.pointerType || r.nativeEvent.pointerType || "virtual";
|
|
133
|
-
u = y(M(r.currentTarget, r), t, !0), e.isOverTarget = !1, F(r), P(r);
|
|
134
|
-
}
|
|
135
|
-
e.ignoreEmulatedMouseEvents = !1, u && r.stopPropagation();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}, g = (r) => {
|
|
139
|
-
var u;
|
|
140
|
-
if (e.isPressed && e.target && H(r, e.target)) {
|
|
141
|
-
var t;
|
|
142
|
-
ee(c(r), r.key) && r.preventDefault();
|
|
143
|
-
let f = c(r), E = p(e.target, c(r));
|
|
144
|
-
y(M(e.target, r), "keyboard", E), E && R(r, e.target), D(), r.key !== "Enter" && G(e.target) && p(e.target, f) && !r[J] && (r[J] = !0, z(e.target, r, !1)), e.isPressed = !1, (t = e.metaKeyEvents) === null || t === void 0 || t.delete(r.key);
|
|
145
|
-
} else if (r.key === "Meta" && (!((u = e.metaKeyEvents) === null || u === void 0) && u.size)) {
|
|
146
|
-
var s;
|
|
147
|
-
let f = e.metaKeyEvents;
|
|
148
|
-
e.metaKeyEvents = void 0;
|
|
149
|
-
for (let E of f.values()) (s = e.target) === null || s === void 0 || s.dispatchEvent(new KeyboardEvent("keyup", E));
|
|
54
|
+
let f = D({
|
|
55
|
+
placement: W(H, y),
|
|
56
|
+
overlayNode: i.current,
|
|
57
|
+
targetNode: c.current,
|
|
58
|
+
scrollNode: s.current || i.current,
|
|
59
|
+
padding: P,
|
|
60
|
+
shouldFlip: L,
|
|
61
|
+
boundaryElement: $,
|
|
62
|
+
offset: C,
|
|
63
|
+
crossOffset: B,
|
|
64
|
+
maxHeight: b,
|
|
65
|
+
arrowSize: w,
|
|
66
|
+
arrowBoundaryOffset: T
|
|
67
|
+
});
|
|
68
|
+
if (f.position) {
|
|
69
|
+
if (l.style.top = "", l.style.bottom = "", l.style.left = "", l.style.right = "", Object.keys(f.position).forEach((r) => l.style[r] = f.position[r] + "px"), l.style.maxHeight = f.maxHeight != null ? f.maxHeight + "px" : "", o && document.activeElement && s.current) {
|
|
70
|
+
let r = document.activeElement.getBoundingClientRect(), g = s.current.getBoundingClientRect(), A = r[o.type] - g[o.type];
|
|
71
|
+
s.current.scrollTop += A - o.offset;
|
|
150
72
|
}
|
|
151
|
-
|
|
152
|
-
if (typeof PointerEvent < "u") {
|
|
153
|
-
a.onPointerDown = (t) => {
|
|
154
|
-
if (t.button !== 0 || !p(t.currentTarget, c(t.nativeEvent))) return;
|
|
155
|
-
if (Te(t.nativeEvent)) {
|
|
156
|
-
e.pointerType = "virtual";
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
e.pointerType = t.pointerType;
|
|
160
|
-
let s = !0;
|
|
161
|
-
if (!e.isPressed) {
|
|
162
|
-
e.isPressed = !0, e.isOverTarget = !0, e.activePointerId = t.pointerId, e.target = t.currentTarget, T || N(e.target), s = m(t, e.pointerType);
|
|
163
|
-
let f = c(t.nativeEvent);
|
|
164
|
-
"releasePointerCapture" in f && f.releasePointerCapture(t.pointerId), x(Y(t.currentTarget), "pointerup", r, !1), x(Y(t.currentTarget), "pointercancel", u, !1);
|
|
165
|
-
}
|
|
166
|
-
s && t.stopPropagation();
|
|
167
|
-
}, a.onMouseDown = (t) => {
|
|
168
|
-
if (p(t.currentTarget, c(t.nativeEvent)) && t.button === 0) {
|
|
169
|
-
if (S) {
|
|
170
|
-
let s = B(t.target);
|
|
171
|
-
s && e.disposables.push(s);
|
|
172
|
-
}
|
|
173
|
-
t.stopPropagation();
|
|
174
|
-
}
|
|
175
|
-
}, a.onPointerUp = (t) => {
|
|
176
|
-
!p(t.currentTarget, c(t.nativeEvent)) || e.pointerType === "virtual" || t.button === 0 && O(t, e.pointerType || t.pointerType);
|
|
177
|
-
}, a.onPointerEnter = (t) => {
|
|
178
|
-
t.pointerId === e.activePointerId && e.target && !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, m(M(e.target, t), e.pointerType));
|
|
179
|
-
}, a.onPointerLeave = (t) => {
|
|
180
|
-
t.pointerId === e.activePointerId && e.target && e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, y(M(e.target, t), e.pointerType, !1), X(t));
|
|
181
|
-
};
|
|
182
|
-
let r = (t) => {
|
|
183
|
-
if (t.pointerId === e.activePointerId && e.isPressed && t.button === 0 && e.target) {
|
|
184
|
-
if (p(e.target, c(t)) && e.pointerType != null) {
|
|
185
|
-
let s = !1, f = setTimeout(() => {
|
|
186
|
-
e.isPressed && e.target instanceof HTMLElement && (s ? P(t) : (pe(e.target), e.target.click()));
|
|
187
|
-
}, 80);
|
|
188
|
-
x(t.currentTarget, "click", () => s = !0, !0), e.disposables.push(() => clearTimeout(f));
|
|
189
|
-
} else P(t);
|
|
190
|
-
e.isOverTarget = !1;
|
|
191
|
-
}
|
|
192
|
-
}, u = (t) => {
|
|
193
|
-
P(t);
|
|
194
|
-
};
|
|
195
|
-
a.onDragStart = (t) => {
|
|
196
|
-
p(t.currentTarget, c(t.nativeEvent)) && P(t);
|
|
197
|
-
};
|
|
198
|
-
} else if (process.env.NODE_ENV === "test") {
|
|
199
|
-
a.onMouseDown = (t) => {
|
|
200
|
-
if (t.button !== 0 || !p(t.currentTarget, c(t.nativeEvent))) return;
|
|
201
|
-
if (e.ignoreEmulatedMouseEvents) {
|
|
202
|
-
t.stopPropagation();
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
if (e.isPressed = !0, e.isOverTarget = !0, e.target = t.currentTarget, e.pointerType = j(t.nativeEvent) ? "virtual" : "mouse", Pe(() => m(t, e.pointerType)) && t.stopPropagation(), S) {
|
|
206
|
-
let f = B(t.target);
|
|
207
|
-
f && e.disposables.push(f);
|
|
208
|
-
}
|
|
209
|
-
x(Y(t.currentTarget), "mouseup", r, !1);
|
|
210
|
-
}, a.onMouseEnter = (t) => {
|
|
211
|
-
if (!p(t.currentTarget, c(t.nativeEvent))) return;
|
|
212
|
-
let s = !0;
|
|
213
|
-
e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !0, s = m(t, e.pointerType)), s && t.stopPropagation();
|
|
214
|
-
}, a.onMouseLeave = (t) => {
|
|
215
|
-
if (!p(t.currentTarget, c(t.nativeEvent))) return;
|
|
216
|
-
let s = !0;
|
|
217
|
-
e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !1, s = y(t, e.pointerType, !1), X(t)), s && t.stopPropagation();
|
|
218
|
-
}, a.onMouseUp = (t) => {
|
|
219
|
-
p(t.currentTarget, c(t.nativeEvent)) && !e.ignoreEmulatedMouseEvents && t.button === 0 && O(t, e.pointerType || "mouse");
|
|
220
|
-
};
|
|
221
|
-
let r = (t) => {
|
|
222
|
-
if (t.button === 0) {
|
|
223
|
-
if (e.ignoreEmulatedMouseEvents) {
|
|
224
|
-
e.ignoreEmulatedMouseEvents = !1;
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
e.target && e.target.contains(t.target) && e.pointerType != null || P(t), e.isOverTarget = !1;
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
a.onTouchStart = (t) => {
|
|
231
|
-
if (!p(t.currentTarget, c(t.nativeEvent))) return;
|
|
232
|
-
let s = be(t.nativeEvent);
|
|
233
|
-
if (!s) return;
|
|
234
|
-
e.activePointerId = s.identifier, e.ignoreEmulatedMouseEvents = !0, e.isOverTarget = !0, e.isPressed = !0, e.target = t.currentTarget, e.pointerType = "touch", T || N(e.target), m(b(e.target, t), e.pointerType) && t.stopPropagation(), x(I(t.currentTarget), "scroll", u, !0);
|
|
235
|
-
}, a.onTouchMove = (t) => {
|
|
236
|
-
if (!p(t.currentTarget, c(t.nativeEvent))) return;
|
|
237
|
-
if (!e.isPressed) {
|
|
238
|
-
t.stopPropagation();
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
let s = Q(t.nativeEvent, e.activePointerId), f = !0;
|
|
242
|
-
s && Z(s, t.currentTarget) ? !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, f = m(b(e.target, t), e.pointerType)) : e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, f = y(b(e.target, t), e.pointerType, !1), X(b(e.target, t))), f && t.stopPropagation();
|
|
243
|
-
}, a.onTouchEnd = (t) => {
|
|
244
|
-
if (!p(t.currentTarget, c(t.nativeEvent))) return;
|
|
245
|
-
if (!e.isPressed) {
|
|
246
|
-
t.stopPropagation();
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
let s = Q(t.nativeEvent, e.activePointerId), f = !0;
|
|
250
|
-
s && Z(s, t.currentTarget) && e.pointerType != null ? (O(b(e.target, t), e.pointerType), f = y(b(e.target, t), e.pointerType), R(t.nativeEvent, e.target)) : e.isOverTarget && e.pointerType != null && (f = y(b(e.target, t), e.pointerType, !1)), f && t.stopPropagation(), e.isPressed = !1, e.activePointerId = null, e.isOverTarget = !1, e.ignoreEmulatedMouseEvents = !0, e.target && !T && A(e.target), D();
|
|
251
|
-
}, a.onTouchCancel = (t) => {
|
|
252
|
-
p(t.currentTarget, c(t.nativeEvent)) && (t.stopPropagation(), e.isPressed && P(b(e.target, t)));
|
|
253
|
-
};
|
|
254
|
-
let u = (t) => {
|
|
255
|
-
e.isPressed && p(c(t), e.target) && P({
|
|
256
|
-
currentTarget: e.target,
|
|
257
|
-
shiftKey: !1,
|
|
258
|
-
ctrlKey: !1,
|
|
259
|
-
metaKey: !1,
|
|
260
|
-
altKey: !1
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
a.onDragStart = (t) => {
|
|
264
|
-
p(t.currentTarget, c(t.nativeEvent)) && P(t);
|
|
265
|
-
};
|
|
73
|
+
I(f);
|
|
266
74
|
}
|
|
267
|
-
|
|
75
|
+
}, F);
|
|
76
|
+
z(a, F), Q(a), k({
|
|
77
|
+
ref: i,
|
|
78
|
+
onResize: a
|
|
79
|
+
}), k({
|
|
80
|
+
ref: c,
|
|
81
|
+
onResize: a
|
|
82
|
+
});
|
|
83
|
+
let m = U(!1);
|
|
84
|
+
z(() => {
|
|
85
|
+
let o, d = () => {
|
|
86
|
+
m.current = !0, clearTimeout(o), o = setTimeout(() => {
|
|
87
|
+
m.current = !1;
|
|
88
|
+
}, 500), a();
|
|
89
|
+
}, u = () => {
|
|
90
|
+
m.current && d();
|
|
91
|
+
};
|
|
92
|
+
return e == null || e.addEventListener("resize", d), e == null || e.addEventListener("scroll", u), () => {
|
|
93
|
+
e == null || e.removeEventListener("resize", d), e == null || e.removeEventListener("scroll", u);
|
|
94
|
+
};
|
|
268
95
|
}, [
|
|
269
|
-
|
|
270
|
-
v,
|
|
271
|
-
S,
|
|
272
|
-
D,
|
|
273
|
-
T,
|
|
274
|
-
P,
|
|
275
|
-
X,
|
|
276
|
-
y,
|
|
277
|
-
m,
|
|
278
|
-
O,
|
|
279
|
-
F,
|
|
280
|
-
R
|
|
96
|
+
a
|
|
281
97
|
]);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
e && e instanceof I(e).Element && I(e).getComputedStyle(e).touchAction === "auto" && (e.style.touchAction = "pan-x pan-y pinch-zoom");
|
|
98
|
+
let q = j(() => {
|
|
99
|
+
m.current || p == null || p();
|
|
285
100
|
}, [
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}, [
|
|
296
|
-
T
|
|
297
|
-
]), {
|
|
298
|
-
isPressed: C || ie,
|
|
299
|
-
pressProps: te(ne, ae)
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
function G(n) {
|
|
303
|
-
return n.tagName === "A" && n.hasAttribute("href");
|
|
304
|
-
}
|
|
305
|
-
function H(n, i) {
|
|
306
|
-
const { key: o, code: l } = n, d = i, $ = d.getAttribute("role");
|
|
307
|
-
return (o === "Enter" || o === " " || o === "Spacebar" || l === "Space") && !(d instanceof I(d).HTMLInputElement && !re(d, o) || d instanceof I(d).HTMLTextAreaElement || d.isContentEditable) && // Links should only trigger with Enter key
|
|
308
|
-
!(($ === "link" || !$ && G(d)) && o !== "Enter");
|
|
309
|
-
}
|
|
310
|
-
function be(n) {
|
|
311
|
-
const { targetTouches: i } = n;
|
|
312
|
-
return i.length > 0 ? i[0] : null;
|
|
313
|
-
}
|
|
314
|
-
function Q(n, i) {
|
|
315
|
-
const o = n.changedTouches;
|
|
316
|
-
for (let l = 0; l < o.length; l++) {
|
|
317
|
-
const d = o[l];
|
|
318
|
-
if (d.identifier === i) return d;
|
|
319
|
-
}
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
function b(n, i) {
|
|
323
|
-
let o = 0, l = 0;
|
|
324
|
-
return i.targetTouches && i.targetTouches.length === 1 && (o = i.targetTouches[0].clientX, l = i.targetTouches[0].clientY), {
|
|
325
|
-
currentTarget: n,
|
|
326
|
-
shiftKey: i.shiftKey,
|
|
327
|
-
ctrlKey: i.ctrlKey,
|
|
328
|
-
metaKey: i.metaKey,
|
|
329
|
-
altKey: i.altKey,
|
|
330
|
-
clientX: o,
|
|
331
|
-
clientY: l
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
function M(n, i) {
|
|
335
|
-
let o = i.clientX, l = i.clientY;
|
|
101
|
+
p,
|
|
102
|
+
m
|
|
103
|
+
]);
|
|
104
|
+
G({
|
|
105
|
+
triggerRef: c,
|
|
106
|
+
isOpen: v,
|
|
107
|
+
onClose: p && q
|
|
108
|
+
});
|
|
109
|
+
var h, x;
|
|
336
110
|
return {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
111
|
+
overlayProps: {
|
|
112
|
+
style: {
|
|
113
|
+
position: "absolute",
|
|
114
|
+
zIndex: 1e5,
|
|
115
|
+
...t == null ? void 0 : t.position,
|
|
116
|
+
maxHeight: (h = t == null ? void 0 : t.maxHeight) !== null && h !== void 0 ? h : "100vh"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
placement: (x = t == null ? void 0 : t.placement) !== null && x !== void 0 ? x : null,
|
|
120
|
+
arrowProps: {
|
|
121
|
+
"aria-hidden": "true",
|
|
122
|
+
role: "presentation",
|
|
123
|
+
style: {
|
|
124
|
+
left: t == null ? void 0 : t.arrowOffsetLeft,
|
|
125
|
+
top: t == null ? void 0 : t.arrowOffsetTop
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
updatePosition: a
|
|
353
129
|
};
|
|
354
130
|
}
|
|
355
|
-
function
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
function Ke(n) {
|
|
363
|
-
return n instanceof HTMLInputElement ? !1 : n instanceof HTMLButtonElement ? n.type !== "submit" && n.type !== "reset" : !G(n);
|
|
364
|
-
}
|
|
365
|
-
function ee(n, i) {
|
|
366
|
-
return n instanceof HTMLInputElement ? !re(n, i) : Ke(n);
|
|
131
|
+
function Q(n) {
|
|
132
|
+
z(() => (window.addEventListener("resize", n, !1), () => {
|
|
133
|
+
window.removeEventListener("resize", n, !1);
|
|
134
|
+
}), [
|
|
135
|
+
n
|
|
136
|
+
]);
|
|
367
137
|
}
|
|
368
|
-
|
|
369
|
-
"
|
|
370
|
-
"radio",
|
|
371
|
-
"range",
|
|
372
|
-
"color",
|
|
373
|
-
"file",
|
|
374
|
-
"image",
|
|
375
|
-
"button",
|
|
376
|
-
"submit",
|
|
377
|
-
"reset"
|
|
378
|
-
]);
|
|
379
|
-
function re(n, i) {
|
|
380
|
-
return n.type === "checkbox" || n.type === "radio" ? i === " " : ke.has(n.type);
|
|
138
|
+
function W(n, y) {
|
|
139
|
+
return y === "rtl" ? n.replace("start", "right").replace("end", "left") : n.replace("start", "left").replace("end", "right");
|
|
381
140
|
}
|
|
382
141
|
export {
|
|
383
|
-
|
|
142
|
+
te as useOverlayPosition
|
|
384
143
|
};
|
package/index231.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("./index241.js"),q=require("./index285.js"),x={top:"top",bottom:"top",left:"left",right:"left"},z={top:"bottom",bottom:"top",left:"right",right:"left"},ct={top:"left",left:"top"},j={top:"height",left:"width"},B={width:"totalWidth",height:"totalHeight"},H={};let $=typeof document<"u"?window.visualViewport:null;function G(e){let t=0,o=0,c=0,i=0,r=0,f=0,l={};var v;let p=((v=$==null?void 0:$.scale)!==null&&v!==void 0?v:1)>1;if(e.tagName==="BODY"){let h=document.documentElement;c=h.clientWidth,i=h.clientHeight;var s;t=(s=$==null?void 0:$.width)!==null&&s!==void 0?s:c;var d;o=(d=$==null?void 0:$.height)!==null&&d!==void 0?d:i,l.top=h.scrollTop||e.scrollTop,l.left=h.scrollLeft||e.scrollLeft,$&&(r=$.offsetTop,f=$.offsetLeft)}else({width:t,height:o,top:r,left:f}=M(e)),l.top=e.scrollTop,l.left=e.scrollLeft,c=t,i=o;if(it.isWebKit()&&(e.tagName==="BODY"||e.tagName==="HTML")&&p){l.top=0,l.left=0;var g;r=(g=$==null?void 0:$.pageTop)!==null&&g!==void 0?g:0;var n;f=(n=$==null?void 0:$.pageLeft)!==null&&n!==void 0?n:0}return{width:t,height:o,totalWidth:c,totalHeight:i,scroll:l,top:r,left:f}}function nt(e){return{top:e.scrollTop,left:e.scrollLeft,width:e.scrollWidth,height:e.scrollHeight}}function K(e,t,o,c,i,r,f){var l;let v=(l=i.scroll[e])!==null&&l!==void 0?l:0,p=c[j[e]],s=c.scroll[x[e]]+r,d=p+c.scroll[x[e]]-r,g=t-v+f[e]-c[x[e]],n=t-v+o+f[e]-c[x[e]];return g<s?s-g:n>d?Math.max(d-n,s-g):0}function rt(e){let t=window.getComputedStyle(e);return{top:parseInt(t.marginTop,10)||0,bottom:parseInt(t.marginBottom,10)||0,left:parseInt(t.marginLeft,10)||0,right:parseInt(t.marginRight,10)||0}}function J(e){if(H[e])return H[e];let[t,o]=e.split(" "),c=x[t]||"right",i=ct[c];x[o]||(o="center");let r=j[c],f=j[i];return H[e]={placement:t,crossPlacement:o,axis:c,crossAxis:i,size:r,crossSize:f},H[e]}function Z(e,t,o,c,i,r,f,l,v,p){let{placement:s,crossPlacement:d,axis:g,crossAxis:n,size:h,crossSize:u}=c,a={};var w;a[n]=(w=e[n])!==null&&w!==void 0?w:0;var m,P,E,T;d==="center"?a[n]+=(((m=e[u])!==null&&m!==void 0?m:0)-((P=o[u])!==null&&P!==void 0?P:0))/2:d!==n&&(a[n]+=((E=e[u])!==null&&E!==void 0?E:0)-((T=o[u])!==null&&T!==void 0?T:0)),a[n]+=r;const _=e[n]-o[u]+v+p,S=e[n]+e[u]-v-p;if(a[n]=q.clamp(a[n],_,S),s===g){const L=l?f[h]:t[B[h]];a[z[g]]=Math.floor(L-e[g]+i)}else a[g]=Math.floor(e[g]+e[h]+i);return a}function at(e,t,o,c,i,r,f,l){const v=c?o.height:t[B.height];var p;let s=e.top!=null?o.top+e.top:o.top+(v-((p=e.bottom)!==null&&p!==void 0?p:0)-f);var d,g,n,h,u,a;let w=l!=="top"?Math.max(0,t.height+t.top+((d=t.scroll.top)!==null&&d!==void 0?d:0)-s-(((g=i.top)!==null&&g!==void 0?g:0)+((n=i.bottom)!==null&&n!==void 0?n:0)+r)):Math.max(0,s+f-(t.top+((h=t.scroll.top)!==null&&h!==void 0?h:0))-(((u=i.top)!==null&&u!==void 0?u:0)+((a=i.bottom)!==null&&a!==void 0?a:0)+r));return Math.min(t.height-r*2,w)}function Q(e,t,o,c,i,r){let{placement:f,axis:l,size:v}=r;var p,s;if(f===l)return Math.max(0,o[l]-e[l]-((p=e.scroll[l])!==null&&p!==void 0?p:0)+t[l]-((s=c[l])!==null&&s!==void 0?s:0)-c[z[l]]-i);var d;return Math.max(0,e[v]+e[l]+e.scroll[l]-t[l]-o[l]-o[v]-((d=c[l])!==null&&d!==void 0?d:0)-c[z[l]]-i)}function V(e,t,o,c,i,r,f,l,v,p,s,d,g,n,h,u){let a=J(e),{size:w,crossAxis:m,crossSize:P,placement:E,crossPlacement:T}=a,_=Z(t,l,o,a,s,d,p,g,h,u),S=s,L=Q(l,p,t,i,r+s,a);if(f&&c[w]>L){let X=J(`${z[E]} ${T}`),ot=Z(t,l,o,X,s,d,p,g,h,u);Q(l,p,t,i,r+s,X)>L&&(a=X,_=ot,S=s)}let b="bottom";a.axis==="top"?a.placement==="top"?b="top":a.placement==="bottom"&&(b="bottom"):a.crossAxis==="top"&&(a.crossPlacement==="top"?b="bottom":a.crossPlacement==="bottom"&&(b="top"));let I=K(m,_[m],o[P],l,v,r,p);_[m]+=I;let C=at(_,l,p,g,i,r,o.height,b);n&&n<C&&(C=n),o.height=Math.min(o.height,C),_=Z(t,l,o,a,S,d,p,g,h,u),I=K(m,_[m],o[P],l,v,r,p),_[m]+=I;let A={},k=t[m]+.5*t[P]-_[m]-i[x[m]];const D=h/2+u;var F,N,R,Y;const O=x[m]==="left"?((F=i.left)!==null&&F!==void 0?F:0)+((N=i.right)!==null&&N!==void 0?N:0):((R=i.top)!==null&&R!==void 0?R:0)+((Y=i.bottom)!==null&&Y!==void 0?Y:0),y=o[P]-O-h/2-u,tt=t[m]+h/2-(_[m]+i[x[m]]),et=t[m]+t[P]-h/2-(_[m]+i[x[m]]),lt=q.clamp(k,tt,et);return A[m]=q.clamp(lt,D,y),{position:_,maxHeight:C,arrowOffsetLeft:A.left,arrowOffsetTop:A.top,placement:a.placement}}function pt(e){let{placement:t,targetNode:o,overlayNode:c,scrollNode:i,padding:r,shouldFlip:f,boundaryElement:l,offset:v,crossOffset:p,maxHeight:s,arrowSize:d=0,arrowBoundaryOffset:g=0}=e,n=c instanceof HTMLElement?st(c):document.documentElement,h=n===document.documentElement;const u=window.getComputedStyle(n).position;let a=!!u&&u!=="static",w=h?M(o):U(o,n);if(!h){let{marginTop:A,marginLeft:k}=window.getComputedStyle(o);w.top+=parseInt(A,10)||0,w.left+=parseInt(k,10)||0}let m=M(c),P=rt(c);var E,T;m.width+=((E=P.left)!==null&&E!==void 0?E:0)+((T=P.right)!==null&&T!==void 0?T:0);var _,S;m.height+=((_=P.top)!==null&&_!==void 0?_:0)+((S=P.bottom)!==null&&S!==void 0?S:0);let L=nt(i),b=G(l),I=G(n),C=l.tagName==="BODY"?M(n):U(n,l);return n.tagName==="HTML"&&l.tagName==="BODY"&&(I.scroll.top=0,I.scroll.left=0),V(t,w,m,L,P,r,f,b,I,C,v,p,a,s,d,g)}function M(e){let{top:t,left:o,width:c,height:i}=e.getBoundingClientRect(),{scrollTop:r,scrollLeft:f,clientTop:l,clientLeft:v}=document.documentElement;return{top:t+r-l,left:o+f-v,width:c,height:i}}function U(e,t){let o=window.getComputedStyle(e),c;if(o.position==="fixed"){let{top:i,left:r,width:f,height:l}=e.getBoundingClientRect();c={top:i,left:r,width:f,height:l}}else{c=M(e);let i=M(t),r=window.getComputedStyle(t);i.top+=(parseInt(r.borderTopWidth,10)||0)-t.scrollTop,i.left+=(parseInt(r.borderLeftWidth,10)||0)-t.scrollLeft,c.top-=i.top,c.left-=i.left}return c.top-=parseInt(o.marginTop,10)||0,c.left-=parseInt(o.marginLeft,10)||0,c}function st(e){let t=e.offsetParent;if(t&&t===document.body&&window.getComputedStyle(t).position==="static"&&!W(t)&&(t=document.documentElement),t==null)for(t=e.parentElement;t&&!W(t);)t=t.parentElement;return t||document.documentElement}function W(e){let t=window.getComputedStyle(e);return t.transform!=="none"||/transform|perspective/.test(t.willChange)||t.filter!=="none"||t.contain==="paint"||"backdropFilter"in t&&t.backdropFilter!=="none"||"WebkitBackdropFilter"in t&&t.WebkitBackdropFilter!=="none"}exports.calculatePosition=pt;exports.calculatePositionInternal=V;
|