neatkit 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +1 -1
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +1 -1
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +123 -123
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +2 -2
- package/dist/{Table-GlG5aITK.cjs → Table-DBkiHOd0.cjs} +1 -1
- package/dist/{Table-Dvi-4XA7.js → Table-DdTjtnRE.js} +1 -1
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Tooltip-CDOwCTig.js → Tooltip-4RWCnb2Q.js} +1 -1
- package/dist/{Tooltip-DrAZSmEv.cjs → Tooltip-B2rZmRCs.cjs} +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +12 -10
- package/dist/components/Portal/utils/floating-position.d.ts +5 -36
- package/dist/components/Portal/utils/geometry.d.ts +45 -0
- package/dist/components/Select/utils/listbox-position.d.ts +6 -5
- package/dist/style.css +1 -1
- package/dist/useAnchoredPosition-CrdY2Eat.cjs +1 -0
- package/dist/useAnchoredPosition-xI79veB2.js +79 -0
- package/dist/useFloatingPosition-DPVO2E8O.cjs +1 -0
- package/dist/useFloatingPosition-DktY7k-t.js +110 -0
- package/package.json +1 -1
- package/dist/useAnchoredPosition-BEzN03Oi.cjs +0 -1
- package/dist/useAnchoredPosition-BIXEDNSo.js +0 -119
- package/dist/useFloatingPosition-8_GSpDjw.cjs +0 -1
- package/dist/useFloatingPosition-Cizey9UN.js +0 -58
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useState as T } from "react";
|
|
2
|
+
import { a as V } from "./effects-DGbA6Q2O.js";
|
|
3
|
+
function K(o, n, t, e) {
|
|
4
|
+
return o === "start" ? n : o === "end" ? n + t - e : n + (t - e) / 2;
|
|
5
|
+
}
|
|
6
|
+
function W(o, n) {
|
|
7
|
+
const t = n.getComputedStyle(o);
|
|
8
|
+
let e = Number.parseFloat(t.width), i = Number.parseFloat(t.height);
|
|
9
|
+
t.boxSizing !== "border-box" && (e += (Number.parseFloat(t.paddingLeft) || 0) + (Number.parseFloat(t.paddingRight) || 0) + (Number.parseFloat(t.borderLeftWidth) || 0) + (Number.parseFloat(t.borderRightWidth) || 0), i += (Number.parseFloat(t.paddingTop) || 0) + (Number.parseFloat(t.paddingBottom) || 0) + (Number.parseFloat(t.borderTopWidth) || 0) + (Number.parseFloat(t.borderBottomWidth) || 0));
|
|
10
|
+
const s = o.offsetWidth, a = o.offsetHeight;
|
|
11
|
+
return {
|
|
12
|
+
width: Math.round(e) === s ? e : s,
|
|
13
|
+
height: Math.round(i) === a ? i : a
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function H(o, n, t) {
|
|
17
|
+
const e = Math.max(o.left, 0), i = Math.max(o.top, 0), s = Math.min(o.right, n), a = Math.min(o.bottom, t);
|
|
18
|
+
return s <= e || a <= i ? o : { bottom: a, left: e, right: s, top: i };
|
|
19
|
+
}
|
|
20
|
+
const I = 8;
|
|
21
|
+
function _(o, n) {
|
|
22
|
+
const t = n.getComputedStyle(o), e = Number.parseFloat(
|
|
23
|
+
t.getPropertyValue("--nk-space-8")
|
|
24
|
+
);
|
|
25
|
+
return Number.isFinite(e) ? e : I;
|
|
26
|
+
}
|
|
27
|
+
function X(o) {
|
|
28
|
+
const { active: n, boundary: t, fit: e, panel: i, trigger: s } = o, [a, m] = T(null);
|
|
29
|
+
return V(() => {
|
|
30
|
+
if (!n || !s || !t) {
|
|
31
|
+
m(null);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const f = s, u = t, b = s.ownerDocument.defaultView;
|
|
35
|
+
if (!b) return;
|
|
36
|
+
const c = b;
|
|
37
|
+
let g;
|
|
38
|
+
function C() {
|
|
39
|
+
return g === void 0 && (g = _(
|
|
40
|
+
f,
|
|
41
|
+
c
|
|
42
|
+
)), g;
|
|
43
|
+
}
|
|
44
|
+
function d() {
|
|
45
|
+
const l = u.getBoundingClientRect(), p = W(u, c), A = i ? W(i, c) : void 0, P = f.getBoundingClientRect(), v = p.width > 0 && l.width > 0 ? l.width / p.width : 1, L = p.height > 0 && l.height > 0 ? l.height / p.height : 1;
|
|
46
|
+
function N(h) {
|
|
47
|
+
const F = (h.left - l.left) / v - u.clientLeft + u.scrollLeft, x = (h.top - l.top) / L - u.clientTop + u.scrollTop, B = (h.right - h.left) / v, S = (h.bottom - h.top) / L;
|
|
48
|
+
return {
|
|
49
|
+
bottom: x + S,
|
|
50
|
+
height: S,
|
|
51
|
+
left: F,
|
|
52
|
+
right: F + B,
|
|
53
|
+
top: x,
|
|
54
|
+
width: B
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const y = H(
|
|
58
|
+
l,
|
|
59
|
+
c.innerWidth,
|
|
60
|
+
c.innerHeight
|
|
61
|
+
), E = N(P), M = N(y), R = e({
|
|
62
|
+
panelSize: A,
|
|
63
|
+
readSpacing: C,
|
|
64
|
+
triggerBounds: E,
|
|
65
|
+
visibleBounds: M
|
|
66
|
+
});
|
|
67
|
+
m(R);
|
|
68
|
+
}
|
|
69
|
+
d(), c.addEventListener("scroll", d, !0), c.addEventListener("resize", d);
|
|
70
|
+
const w = c.ResizeObserver, r = w ? new w(d) : null;
|
|
71
|
+
return r == null || r.observe(f, { box: "border-box" }), r == null || r.observe(u, { box: "border-box" }), i && (r == null || r.observe(i, { box: "border-box" })), () => {
|
|
72
|
+
c.removeEventListener("scroll", d, !0), c.removeEventListener("resize", d), r == null || r.disconnect();
|
|
73
|
+
};
|
|
74
|
+
}, [n, t, e, i, s]), a;
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
K as c,
|
|
78
|
+
X as u
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const b=require("react"),u=require("./useAnchoredPosition-CrdY2Eat.cjs");function P(o){return/^on[A-Z]/.test(o)}function A(o){return typeof o=="function"||o===void 0}function T(o,t){return o?t?function(i){o(i),t(i)}:o:t}function E(o,t){const e={...t};for(const[i,l]of Object.entries(t)){if(!P(i))continue;const f=o[i];!A(l)||!A(f)||(e[i]=T(f,l))}return t.className!==void 0?e.className=[o.className,t.className].filter(Boolean).join(" "):delete e.className,t.style!==void 0?e.style={...o.style,...t.style}:delete e.style,e}const F=12,x={bottom:"top",left:"right",right:"left",top:"bottom"};function N(o,t){const e=Math.min(F,t/2);return Math.min(Math.max(e,o),t-e)}function q(o){return x[o]}function w(o,t){return t==="left"||t==="right"?o.width:o.height}function I(o,t,e,i,l,f="center"){const h={bottom:l.bottom-e.bottom-t*2,left:e.left-l.left-t*2,right:l.right-e.right-t*2,top:e.top-l.top-t*2},m=q(o),a=w(i,o),c=h[o]<a&&h[m]>h[o]?m:o;let n=u.calculateAlignedPosition(f,e.left,e.width,i.width),s=u.calculateAlignedPosition(f,e.top,e.height,i.height);c==="top"?s=e.top-i.height-t:c==="bottom"?s=e.bottom+t:c==="left"?n=e.left-i.width-t:n=e.right+t;const M=l.left+t,O=l.top+t;n=Math.min(Math.max(M,n),Math.max(M,l.right-t-i.width)),s=Math.min(Math.max(O,s),Math.max(O,l.bottom-t-i.height));let r;return c==="top"||c==="bottom"?r=N(e.left+e.width/2-n,i.width):r=N(e.top+e.height/2-s,i.height),{arrowOffset:r,left:n,placement:c,top:s}}function _(o,t,e,i,l,f="center"){const h=b.useCallback(m=>{const{panelSize:a,readSpacing:v,triggerBounds:c,visibleBounds:n}=m;return a?I(t,v(),c,a,n,f):null},[f,t]);return u.useAnchoredPosition({active:o,boundary:l,fit:h,panel:i,trigger:e})}exports.resolveTriggerOverrides=E;exports.useFloatingPosition=_;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useCallback as x } from "react";
|
|
2
|
+
import { c as O, u as A } from "./useAnchoredPosition-xI79veB2.js";
|
|
3
|
+
function E(o) {
|
|
4
|
+
return /^on[A-Z]/.test(o);
|
|
5
|
+
}
|
|
6
|
+
function N(o) {
|
|
7
|
+
return typeof o == "function" || o === void 0;
|
|
8
|
+
}
|
|
9
|
+
function T(o, t) {
|
|
10
|
+
return o ? t ? function(i) {
|
|
11
|
+
o(i), t(i);
|
|
12
|
+
} : o : t;
|
|
13
|
+
}
|
|
14
|
+
function G(o, t) {
|
|
15
|
+
const e = { ...t };
|
|
16
|
+
for (const [i, l] of Object.entries(t)) {
|
|
17
|
+
if (!E(i)) continue;
|
|
18
|
+
const f = o[i];
|
|
19
|
+
!N(l) || !N(f) || (e[i] = T(
|
|
20
|
+
f,
|
|
21
|
+
l
|
|
22
|
+
));
|
|
23
|
+
}
|
|
24
|
+
return t.className !== void 0 ? e.className = [
|
|
25
|
+
o.className,
|
|
26
|
+
t.className
|
|
27
|
+
].filter(Boolean).join(" ") : delete e.className, t.style !== void 0 ? e.style = {
|
|
28
|
+
...o.style,
|
|
29
|
+
...t.style
|
|
30
|
+
} : delete e.style, e;
|
|
31
|
+
}
|
|
32
|
+
const F = 12, P = {
|
|
33
|
+
bottom: "top",
|
|
34
|
+
left: "right",
|
|
35
|
+
right: "left",
|
|
36
|
+
top: "bottom"
|
|
37
|
+
};
|
|
38
|
+
function b(o, t) {
|
|
39
|
+
const e = Math.min(F, t / 2);
|
|
40
|
+
return Math.min(Math.max(e, o), t - e);
|
|
41
|
+
}
|
|
42
|
+
function p(o) {
|
|
43
|
+
return P[o];
|
|
44
|
+
}
|
|
45
|
+
function w(o, t) {
|
|
46
|
+
return t === "left" || t === "right" ? o.width : o.height;
|
|
47
|
+
}
|
|
48
|
+
function I(o, t, e, i, l, f = "center") {
|
|
49
|
+
const s = {
|
|
50
|
+
bottom: l.bottom - e.bottom - t * 2,
|
|
51
|
+
left: e.left - l.left - t * 2,
|
|
52
|
+
right: l.right - e.right - t * 2,
|
|
53
|
+
top: e.top - l.top - t * 2
|
|
54
|
+
}, n = p(o), a = w(i, o), h = s[o] < a && s[n] > s[o] ? n : o;
|
|
55
|
+
let m = O(
|
|
56
|
+
f,
|
|
57
|
+
e.left,
|
|
58
|
+
e.width,
|
|
59
|
+
i.width
|
|
60
|
+
), c = O(
|
|
61
|
+
f,
|
|
62
|
+
e.top,
|
|
63
|
+
e.height,
|
|
64
|
+
i.height
|
|
65
|
+
);
|
|
66
|
+
h === "top" ? c = e.top - i.height - t : h === "bottom" ? c = e.bottom + t : h === "left" ? m = e.left - i.width - t : m = e.right + t;
|
|
67
|
+
const M = l.left + t, v = l.top + t;
|
|
68
|
+
m = Math.min(
|
|
69
|
+
Math.max(M, m),
|
|
70
|
+
Math.max(M, l.right - t - i.width)
|
|
71
|
+
), c = Math.min(
|
|
72
|
+
Math.max(v, c),
|
|
73
|
+
Math.max(v, l.bottom - t - i.height)
|
|
74
|
+
);
|
|
75
|
+
let u;
|
|
76
|
+
return h === "top" || h === "bottom" ? u = b(
|
|
77
|
+
e.left + e.width / 2 - m,
|
|
78
|
+
i.width
|
|
79
|
+
) : u = b(
|
|
80
|
+
e.top + e.height / 2 - c,
|
|
81
|
+
i.height
|
|
82
|
+
), { arrowOffset: u, left: m, placement: h, top: c };
|
|
83
|
+
}
|
|
84
|
+
function H(o, t, e, i, l, f = "center") {
|
|
85
|
+
const s = x(
|
|
86
|
+
(n) => {
|
|
87
|
+
const { panelSize: a, readSpacing: r, triggerBounds: h, visibleBounds: m } = n;
|
|
88
|
+
return a ? I(
|
|
89
|
+
t,
|
|
90
|
+
r(),
|
|
91
|
+
h,
|
|
92
|
+
a,
|
|
93
|
+
m,
|
|
94
|
+
f
|
|
95
|
+
) : null;
|
|
96
|
+
},
|
|
97
|
+
[f, t]
|
|
98
|
+
);
|
|
99
|
+
return A({
|
|
100
|
+
active: o,
|
|
101
|
+
boundary: l,
|
|
102
|
+
fit: s,
|
|
103
|
+
panel: i,
|
|
104
|
+
trigger: e
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
G as r,
|
|
109
|
+
H as u
|
|
110
|
+
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const L=require("react");function A(o,e,t,i){return o==="start"?e:o==="end"?e+t-i:e+(t-i)/2}const E=12,T={bottom:"top",left:"right",right:"left",top:"bottom"};function C(o,e){const t=Math.min(E,e/2);return Math.min(Math.max(t,o),e-t)}function x(o){return T[o]}function F(o,e){return e==="left"||e==="right"?o.width:o.height}function R(o,e,t){const i=Math.max(o.left,0),n=Math.max(o.top,0),f=Math.min(o.right,e),r=Math.min(o.bottom,t);return f<=i||r<=n?o:{bottom:r,left:i,right:f,top:n}}function S(o,e,t,i,n,f="center"){const r={bottom:n.bottom-t.bottom-e*2,left:t.left-n.left-e*2,right:n.right-t.right-e*2,top:t.top-n.top-e*2},p=x(o),w=F(i,o),s=r[o]<w&&r[p]>r[o]?p:o;let l=A(f,t.left,t.width,i.width),h=A(f,t.top,t.height,i.height);s==="top"?h=t.top-i.height-e:s==="bottom"?h=t.bottom+e:s==="left"?l=t.left-i.width-e:l=t.right+e;const P=n.left+e,m=n.top+e;l=Math.min(Math.max(P,l),Math.max(P,n.right-e-i.width)),h=Math.min(Math.max(m,h),Math.max(m,n.bottom-e-i.height));let u;return s==="top"||s==="bottom"?u=C(t.left+t.width/2-l,i.width):u=C(t.top+t.height/2-h,i.height),{arrowOffset:u,left:l,placement:s,top:h}}const N=8;function b(o,e){const t=e.getComputedStyle(o),i=Number.parseFloat(t.getPropertyValue("--nk-space-8"));return Number.isFinite(i)?i:N}function _(o){const{active:e,boundary:t,fit:i,panel:n,trigger:f}=o,[r,p]=L.useState(null);return L.useEffect(()=>{if(!e||!f||!t){p(null);return}const w=f,a=t,s=f.ownerDocument.defaultView;if(!s)return;const l=s;let h;function P(){return h===void 0&&(h=b(w,l)),h}function m(){const v=a.getBoundingClientRect(),M=i({panelBounds:n==null?void 0:n.getBoundingClientRect(),readSpacing:P,triggerBounds:w.getBoundingClientRect(),visibleBounds:R(v,l.innerWidth,l.innerHeight)});if(!M){p(null);return}p({...M,left:M.left-v.left-a.clientLeft+a.scrollLeft,top:M.top-v.top-a.clientTop+a.scrollTop})}m(),l.addEventListener("scroll",m,!0),l.addEventListener("resize",m);const u=l.ResizeObserver,c=u?new u(m):null;return c==null||c.observe(w),c==null||c.observe(a),n&&(c==null||c.observe(n)),()=>{l.removeEventListener("scroll",m,!0),l.removeEventListener("resize",m),c==null||c.disconnect()}},[e,t,i,n,f]),r}exports.calculateAlignedPosition=A;exports.calculateFloatingPosition=S;exports.useAnchoredPosition=_;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { useState as x, useEffect as C } from "react";
|
|
2
|
-
function A(o, e, t, i) {
|
|
3
|
-
return o === "start" ? e : o === "end" ? e + t - i : e + (t - i) / 2;
|
|
4
|
-
}
|
|
5
|
-
const E = 12, T = {
|
|
6
|
-
bottom: "top",
|
|
7
|
-
left: "right",
|
|
8
|
-
right: "left",
|
|
9
|
-
top: "bottom"
|
|
10
|
-
};
|
|
11
|
-
function L(o, e) {
|
|
12
|
-
const t = Math.min(E, e / 2);
|
|
13
|
-
return Math.min(Math.max(t, o), e - t);
|
|
14
|
-
}
|
|
15
|
-
function R(o) {
|
|
16
|
-
return T[o];
|
|
17
|
-
}
|
|
18
|
-
function S(o, e) {
|
|
19
|
-
return e === "left" || e === "right" ? o.width : o.height;
|
|
20
|
-
}
|
|
21
|
-
function F(o, e, t) {
|
|
22
|
-
const i = Math.max(o.left, 0), n = Math.max(o.top, 0), f = Math.min(o.right, e), s = Math.min(o.bottom, t);
|
|
23
|
-
return f <= i || s <= n ? o : { bottom: s, left: i, right: f, top: n };
|
|
24
|
-
}
|
|
25
|
-
function H(o, e, t, i, n, f = "center") {
|
|
26
|
-
const s = {
|
|
27
|
-
bottom: n.bottom - t.bottom - e * 2,
|
|
28
|
-
left: t.left - n.left - e * 2,
|
|
29
|
-
right: n.right - t.right - e * 2,
|
|
30
|
-
top: t.top - n.top - e * 2
|
|
31
|
-
}, p = R(o), w = S(i, o), m = s[o] < w && s[p] > s[o] ? p : o;
|
|
32
|
-
let l = A(
|
|
33
|
-
f,
|
|
34
|
-
t.left,
|
|
35
|
-
t.width,
|
|
36
|
-
i.width
|
|
37
|
-
), h = A(
|
|
38
|
-
f,
|
|
39
|
-
t.top,
|
|
40
|
-
t.height,
|
|
41
|
-
i.height
|
|
42
|
-
);
|
|
43
|
-
m === "top" ? h = t.top - i.height - e : m === "bottom" ? h = t.bottom + e : m === "left" ? l = t.left - i.width - e : l = t.right + e;
|
|
44
|
-
const M = n.left + e, r = n.top + e;
|
|
45
|
-
l = Math.min(
|
|
46
|
-
Math.max(M, l),
|
|
47
|
-
Math.max(M, n.right - e - i.width)
|
|
48
|
-
), h = Math.min(
|
|
49
|
-
Math.max(r, h),
|
|
50
|
-
Math.max(r, n.bottom - e - i.height)
|
|
51
|
-
);
|
|
52
|
-
let u;
|
|
53
|
-
return m === "top" || m === "bottom" ? u = L(
|
|
54
|
-
t.left + t.width / 2 - l,
|
|
55
|
-
i.width
|
|
56
|
-
) : u = L(
|
|
57
|
-
t.top + t.height / 2 - h,
|
|
58
|
-
i.height
|
|
59
|
-
), { arrowOffset: u, left: l, placement: m, top: h };
|
|
60
|
-
}
|
|
61
|
-
const N = 8;
|
|
62
|
-
function b(o, e) {
|
|
63
|
-
const t = e.getComputedStyle(o), i = Number.parseFloat(
|
|
64
|
-
t.getPropertyValue("--nk-space-8")
|
|
65
|
-
);
|
|
66
|
-
return Number.isFinite(i) ? i : N;
|
|
67
|
-
}
|
|
68
|
-
function I(o) {
|
|
69
|
-
const { active: e, boundary: t, fit: i, panel: n, trigger: f } = o, [s, p] = x(null);
|
|
70
|
-
return C(() => {
|
|
71
|
-
if (!e || !f || !t) {
|
|
72
|
-
p(null);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const w = f, a = t, m = f.ownerDocument.defaultView;
|
|
76
|
-
if (!m) return;
|
|
77
|
-
const l = m;
|
|
78
|
-
let h;
|
|
79
|
-
function M() {
|
|
80
|
-
return h === void 0 && (h = b(
|
|
81
|
-
w,
|
|
82
|
-
l
|
|
83
|
-
)), h;
|
|
84
|
-
}
|
|
85
|
-
function r() {
|
|
86
|
-
const P = a.getBoundingClientRect(), v = i({
|
|
87
|
-
panelBounds: n == null ? void 0 : n.getBoundingClientRect(),
|
|
88
|
-
readSpacing: M,
|
|
89
|
-
triggerBounds: w.getBoundingClientRect(),
|
|
90
|
-
// Fit against the visible part of the boundary so a boundary taller
|
|
91
|
-
// than the viewport cannot place the content below the fold.
|
|
92
|
-
visibleBounds: F(
|
|
93
|
-
P,
|
|
94
|
-
l.innerWidth,
|
|
95
|
-
l.innerHeight
|
|
96
|
-
)
|
|
97
|
-
});
|
|
98
|
-
if (!v) {
|
|
99
|
-
p(null);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
p({
|
|
103
|
-
...v,
|
|
104
|
-
left: v.left - P.left - a.clientLeft + a.scrollLeft,
|
|
105
|
-
top: v.top - P.top - a.clientTop + a.scrollTop
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
r(), l.addEventListener("scroll", r, !0), l.addEventListener("resize", r);
|
|
109
|
-
const u = l.ResizeObserver, c = u ? new u(r) : null;
|
|
110
|
-
return c == null || c.observe(w), c == null || c.observe(a), n && (c == null || c.observe(n)), () => {
|
|
111
|
-
l.removeEventListener("scroll", r, !0), l.removeEventListener("resize", r), c == null || c.disconnect();
|
|
112
|
-
};
|
|
113
|
-
}, [e, t, i, n, f]), s;
|
|
114
|
-
}
|
|
115
|
-
export {
|
|
116
|
-
A as a,
|
|
117
|
-
H as c,
|
|
118
|
-
I as u
|
|
119
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const v=require("react"),u=require("./useAnchoredPosition-BEzN03Oi.cjs");function y(e){return/^on[A-Z]/.test(e)}function l(e){return typeof e=="function"||e===void 0}function N(e,n){return e?n?function(s){e(s),n(s)}:e:n}function g(e,n){const t={...n};for(const[s,o]of Object.entries(n)){if(!y(s))continue;const i=e[s];!l(o)||!l(i)||(t[s]=N(i,o))}return n.className!==void 0?t.className=[e.className,n.className].filter(Boolean).join(" "):delete t.className,n.style!==void 0?t.style={...e.style,...n.style}:delete t.style,t}function b(e,n,t,s,o,i="center"){const a=v.useCallback(r=>{const{panelBounds:c,readSpacing:f,triggerBounds:d,visibleBounds:m}=r;return c?u.calculateFloatingPosition(n,f(),d,c,m,i):null},[i,n]);return u.useAnchoredPosition({active:e,boundary:o,fit:a,panel:s,trigger:t})}exports.resolveTriggerOverrides=g;exports.useFloatingPosition=b;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useCallback as d } from "react";
|
|
2
|
-
import { c as v, u as y } from "./useAnchoredPosition-BIXEDNSo.js";
|
|
3
|
-
function N(e) {
|
|
4
|
-
return /^on[A-Z]/.test(e);
|
|
5
|
-
}
|
|
6
|
-
function u(e) {
|
|
7
|
-
return typeof e == "function" || e === void 0;
|
|
8
|
-
}
|
|
9
|
-
function b(e, n) {
|
|
10
|
-
return e ? n ? function(s) {
|
|
11
|
-
e(s), n(s);
|
|
12
|
-
} : e : n;
|
|
13
|
-
}
|
|
14
|
-
function F(e, n) {
|
|
15
|
-
const t = { ...n };
|
|
16
|
-
for (const [s, i] of Object.entries(n)) {
|
|
17
|
-
if (!N(s)) continue;
|
|
18
|
-
const o = e[s];
|
|
19
|
-
!u(i) || !u(o) || (t[s] = b(
|
|
20
|
-
o,
|
|
21
|
-
i
|
|
22
|
-
));
|
|
23
|
-
}
|
|
24
|
-
return n.className !== void 0 ? t.className = [
|
|
25
|
-
e.className,
|
|
26
|
-
n.className
|
|
27
|
-
].filter(Boolean).join(" ") : delete t.className, n.style !== void 0 ? t.style = {
|
|
28
|
-
...e.style,
|
|
29
|
-
...n.style
|
|
30
|
-
} : delete t.style, t;
|
|
31
|
-
}
|
|
32
|
-
function g(e, n, t, s, i, o = "center") {
|
|
33
|
-
const a = d(
|
|
34
|
-
(c) => {
|
|
35
|
-
const { panelBounds: l, readSpacing: f, triggerBounds: r, visibleBounds: m } = c;
|
|
36
|
-
return l ? v(
|
|
37
|
-
n,
|
|
38
|
-
f(),
|
|
39
|
-
r,
|
|
40
|
-
l,
|
|
41
|
-
m,
|
|
42
|
-
o
|
|
43
|
-
) : null;
|
|
44
|
-
},
|
|
45
|
-
[o, n]
|
|
46
|
-
);
|
|
47
|
-
return y({
|
|
48
|
-
active: e,
|
|
49
|
-
boundary: i,
|
|
50
|
-
fit: a,
|
|
51
|
-
panel: s,
|
|
52
|
-
trigger: t
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
F as r,
|
|
57
|
-
g as u
|
|
58
|
-
};
|