neatkit 0.15.0 → 0.15.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/dist/Boundary.cjs +1 -1
- package/dist/Boundary.js +1 -1
- 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 +3 -3
- 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/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/{units-BEMW4BNr.cjs → units-BUvyiHxw.cjs} +1 -1
- package/dist/{units-D4Waz9EO.js → units-CMj64udI.js} +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
|
@@ -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
|
-
};
|