neatkit 0.18.1 → 0.18.3
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/Modal.cjs +1 -1
- package/dist/Modal.js +2 -2
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +2 -2
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +1 -1
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +3 -3
- package/dist/{Table-DTxKbMgJ.cjs → Table-CJmczuqs.cjs} +1 -1
- package/dist/{Table-CURYs469.js → Table-DL02k8n8.js} +1 -1
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Tooltip-tzVg8Bky.cjs → Tooltip-DhSawjGg.cjs} +1 -1
- package/dist/{Tooltip-BuRMZ4p_.js → Tooltip-DiGwnVOH.js} +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{useFocusTrap-BL3fDmTs.js → useFocusTrap-BnreoiCP.js} +1 -1
- package/dist/{useFocusTrap-C--8mnsI.cjs → useFocusTrap-C2Iw9BGP.cjs} +1 -1
- package/dist/usePresence-DrCnSPkG.js +235 -0
- package/dist/usePresence-WXhrarsC.cjs +1 -0
- package/package.json +4 -4
- package/dist/usePresence-BYnWctTh.js +0 -232
- package/dist/usePresence-HVr855AK.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neatkit",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "A modern, composable UI library for the web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"library",
|
|
@@ -188,15 +188,15 @@
|
|
|
188
188
|
"@types/react": "^18.3.3",
|
|
189
189
|
"@types/react-dom": "^18.3.0",
|
|
190
190
|
"@vitejs/plugin-react": "^4.7.0",
|
|
191
|
-
"@vitest/coverage-v8": "^4.1.
|
|
191
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
192
192
|
"axe-core": "^4.13.0",
|
|
193
193
|
"jsdom": "^30.0.1",
|
|
194
194
|
"react": "^18.3.1",
|
|
195
195
|
"react-dom": "^18.3.1",
|
|
196
196
|
"tsx": "^4.23.12",
|
|
197
197
|
"typescript": "^5.5.4",
|
|
198
|
-
"vite": "^6.4.
|
|
199
|
-
"vitest": "^4.1.
|
|
198
|
+
"vite": "^6.4.5",
|
|
199
|
+
"vitest": "^4.1.12"
|
|
200
200
|
},
|
|
201
201
|
"dependencies": {
|
|
202
202
|
"highlight.js": "~11.11.0",
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as T } from "react/jsx-runtime";
|
|
3
|
-
import { createContext as b, useState as P, useEffect as y, useRef as C, useContext as F, useReducer as V } from "react";
|
|
4
|
-
import { createPortal as Y } from "react-dom";
|
|
5
|
-
import { u as W, a as X } from "./effects-DGbA6Q2O.js";
|
|
6
|
-
const Z = b(void 0);
|
|
7
|
-
function j(t) {
|
|
8
|
-
const { children: e } = t, n = C(null), r = F(Z);
|
|
9
|
-
return X(() => {
|
|
10
|
-
const s = n.current;
|
|
11
|
-
if (!(!s || !r))
|
|
12
|
-
return r.registerBranch(s);
|
|
13
|
-
}, [r]), /* @__PURE__ */ T(
|
|
14
|
-
"div",
|
|
15
|
-
{
|
|
16
|
-
className: "nk-portal",
|
|
17
|
-
ref: n,
|
|
18
|
-
style: { display: "contents" },
|
|
19
|
-
children: e
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
function te(t) {
|
|
24
|
-
const { children: e } = t, n = W("Portal"), [r, s] = P(!1);
|
|
25
|
-
y(() => {
|
|
26
|
-
s(!0);
|
|
27
|
-
}, []);
|
|
28
|
-
const c = n.portalElement;
|
|
29
|
-
return r && c ? Y(/* @__PURE__ */ T(j, { children: e }), c) : null;
|
|
30
|
-
}
|
|
31
|
-
const z = 1e3, Q = 10, L = /* @__PURE__ */ new WeakMap();
|
|
32
|
-
function p(t) {
|
|
33
|
-
const e = L.get(t);
|
|
34
|
-
if (e) return e;
|
|
35
|
-
const n = {
|
|
36
|
-
focusLayers: /* @__PURE__ */ new Set(),
|
|
37
|
-
layers: [],
|
|
38
|
-
listeners: /* @__PURE__ */ new Set()
|
|
39
|
-
};
|
|
40
|
-
return L.set(t, n), n;
|
|
41
|
-
}
|
|
42
|
-
function B(t) {
|
|
43
|
-
t.listeners.forEach((e) => e());
|
|
44
|
-
}
|
|
45
|
-
function re(t, e) {
|
|
46
|
-
const n = C(Symbol("nk-overlay-layer")), [, r] = V((i) => i + 1, 0);
|
|
47
|
-
y(() => {
|
|
48
|
-
if (!t || !e) return;
|
|
49
|
-
const i = p(e), d = () => r();
|
|
50
|
-
return i.listeners.add(d), i.layers.push(n.current), B(i), () => {
|
|
51
|
-
i.listeners.delete(d);
|
|
52
|
-
const l = i.layers.indexOf(n.current);
|
|
53
|
-
l >= 0 && i.layers.splice(l, 1), B(i);
|
|
54
|
-
};
|
|
55
|
-
}, [t, e]);
|
|
56
|
-
const s = e ? p(e) : null, c = (s == null ? void 0 : s.layers.indexOf(
|
|
57
|
-
n.current
|
|
58
|
-
)) ?? -1, f = c >= 0 ? c : (s == null ? void 0 : s.layers.length) ?? 0;
|
|
59
|
-
return {
|
|
60
|
-
id: n.current,
|
|
61
|
-
zIndex: z + f * Q
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function g(t, e) {
|
|
65
|
-
const n = p(t).layers;
|
|
66
|
-
return n.length > 0 && n[n.length - 1] === e;
|
|
67
|
-
}
|
|
68
|
-
function q(t) {
|
|
69
|
-
var e;
|
|
70
|
-
return (((e = L.get(t)) == null ? void 0 : e.layers.length) ?? 0) > 0;
|
|
71
|
-
}
|
|
72
|
-
function se(t, e, n) {
|
|
73
|
-
y(() => {
|
|
74
|
-
if (!t || !e) return;
|
|
75
|
-
const r = p(e);
|
|
76
|
-
return r.focusLayers.add(n), () => {
|
|
77
|
-
r.focusLayers.delete(n);
|
|
78
|
-
};
|
|
79
|
-
}, [t, n, e]);
|
|
80
|
-
}
|
|
81
|
-
function oe(t, e) {
|
|
82
|
-
const n = p(t);
|
|
83
|
-
for (let r = n.layers.length - 1; r >= 0; r -= 1) {
|
|
84
|
-
const s = n.layers[r];
|
|
85
|
-
if (n.focusLayers.has(s))
|
|
86
|
-
return s === e;
|
|
87
|
-
}
|
|
88
|
-
return !1;
|
|
89
|
-
}
|
|
90
|
-
const G = 1;
|
|
91
|
-
function H(t) {
|
|
92
|
-
if (!t) return null;
|
|
93
|
-
const e = t.nodeType === G ? t : t.parentElement;
|
|
94
|
-
return (e == null ? void 0 : e.closest(".nk-boundary")) ?? null;
|
|
95
|
-
}
|
|
96
|
-
function N(t, e) {
|
|
97
|
-
var r;
|
|
98
|
-
let n = H(t);
|
|
99
|
-
for (; n !== null; ) {
|
|
100
|
-
if (n === e) return !1;
|
|
101
|
-
if (q(n)) return !0;
|
|
102
|
-
n = ((r = n.parentElement) == null ? void 0 : r.closest(".nk-boundary")) ?? null;
|
|
103
|
-
}
|
|
104
|
-
return !1;
|
|
105
|
-
}
|
|
106
|
-
function J(t, e) {
|
|
107
|
-
return N(
|
|
108
|
-
t.activeElement,
|
|
109
|
-
e
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
function D(t, e) {
|
|
113
|
-
return N(t, e);
|
|
114
|
-
}
|
|
115
|
-
const v = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
|
|
116
|
-
function m(t, e) {
|
|
117
|
-
var n;
|
|
118
|
-
return ((n = v.get(t)) == null ? void 0 : n.has(e)) ?? !1;
|
|
119
|
-
}
|
|
120
|
-
function w(t, e) {
|
|
121
|
-
const n = v.get(t) ?? /* @__PURE__ */ new Set();
|
|
122
|
-
n.add(e), v.set(t, n);
|
|
123
|
-
}
|
|
124
|
-
function S(t, e) {
|
|
125
|
-
const n = t.composedPath();
|
|
126
|
-
return e.some((r) => {
|
|
127
|
-
var f;
|
|
128
|
-
const s = r.current;
|
|
129
|
-
if (!s) return !1;
|
|
130
|
-
if (n.includes(s)) return !0;
|
|
131
|
-
const c = (f = s.ownerDocument.defaultView) == null ? void 0 : f.Node;
|
|
132
|
-
return c && t.target instanceof c ? s.contains(t.target) : !1;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function ce(t) {
|
|
136
|
-
const {
|
|
137
|
-
active: e,
|
|
138
|
-
boundaries: n,
|
|
139
|
-
boundary: r,
|
|
140
|
-
dismissOnEscape: s = !0,
|
|
141
|
-
dismissOnOutsideInteraction: c,
|
|
142
|
-
layerId: f,
|
|
143
|
-
onEscapeDismiss: i,
|
|
144
|
-
onEscapeKeyDown: d,
|
|
145
|
-
onOutsideDismiss: l,
|
|
146
|
-
onPointerDownOutside: h,
|
|
147
|
-
ownerDocument: a
|
|
148
|
-
} = t;
|
|
149
|
-
y(() => {
|
|
150
|
-
if (!e || !a || !r) return;
|
|
151
|
-
const u = r, _ = a;
|
|
152
|
-
function k(o) {
|
|
153
|
-
o.key !== "Escape" || !s || m(o, u) || !g(u, f) || J(_, u) || (d == null || d(o), !o.defaultPrevented && (o.preventDefault(), w(o, u), i == null || i()));
|
|
154
|
-
}
|
|
155
|
-
function I(o) {
|
|
156
|
-
if (m(o, u) || !g(u, f) || S(o, n))
|
|
157
|
-
return;
|
|
158
|
-
const E = o.target;
|
|
159
|
-
D(E, u) || (h == null || h(o), !o.defaultPrevented && (w(o, u), l == null || l()));
|
|
160
|
-
}
|
|
161
|
-
function O(o) {
|
|
162
|
-
R.set(u, o);
|
|
163
|
-
}
|
|
164
|
-
function M(o) {
|
|
165
|
-
if (m(o, u) || !g(u, f) || S(o, n))
|
|
166
|
-
return;
|
|
167
|
-
const E = o.target;
|
|
168
|
-
if (D(E, u)) return;
|
|
169
|
-
const x = R.get(u), A = o.detail > 0 && x !== void 0 && m(x, u);
|
|
170
|
-
o.preventDefault(), o.stopPropagation(), w(o, u), A || l == null || l();
|
|
171
|
-
}
|
|
172
|
-
return a.addEventListener("keydown", k, !0), c === "pass-through" ? a.addEventListener("pointerdown", I, !0) : c === "consume" && (a.addEventListener("pointerdown", O, !0), a.addEventListener("click", M, !0)), () => {
|
|
173
|
-
a.removeEventListener("keydown", k, !0), c === "pass-through" ? a.removeEventListener("pointerdown", I, !0) : c === "consume" && (a.removeEventListener("pointerdown", O, !0), a.removeEventListener("click", M, !0));
|
|
174
|
-
};
|
|
175
|
-
}, [
|
|
176
|
-
e,
|
|
177
|
-
n,
|
|
178
|
-
r,
|
|
179
|
-
s,
|
|
180
|
-
c,
|
|
181
|
-
f,
|
|
182
|
-
i,
|
|
183
|
-
d,
|
|
184
|
-
l,
|
|
185
|
-
h,
|
|
186
|
-
a
|
|
187
|
-
]);
|
|
188
|
-
}
|
|
189
|
-
function K() {
|
|
190
|
-
const [t, e] = P(!1);
|
|
191
|
-
return y(() => {
|
|
192
|
-
const n = typeof window > "u" ? null : window;
|
|
193
|
-
if (!(n != null && n.matchMedia)) return;
|
|
194
|
-
const r = n.matchMedia(
|
|
195
|
-
"(prefers-reduced-motion: reduce)"
|
|
196
|
-
), s = () => {
|
|
197
|
-
e(r.matches);
|
|
198
|
-
};
|
|
199
|
-
return s(), r.addEventListener("change", s), () => r.removeEventListener("change", s);
|
|
200
|
-
}, []), t;
|
|
201
|
-
}
|
|
202
|
-
function ue(t, e = 200) {
|
|
203
|
-
const n = K(), [r, s] = P(t);
|
|
204
|
-
return y(() => {
|
|
205
|
-
if (t) {
|
|
206
|
-
s(!0);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (!r) return;
|
|
210
|
-
if (n || e <= 0) {
|
|
211
|
-
s(!1);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const c = window.setTimeout(() => {
|
|
215
|
-
s(!1);
|
|
216
|
-
}, e);
|
|
217
|
-
return () => window.clearTimeout(c);
|
|
218
|
-
}, [e, t, n, r]), {
|
|
219
|
-
present: r,
|
|
220
|
-
state: t ? "open" : r ? "closing" : "closed"
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export {
|
|
224
|
-
Z as F,
|
|
225
|
-
te as P,
|
|
226
|
-
J as a,
|
|
227
|
-
ue as b,
|
|
228
|
-
re as c,
|
|
229
|
-
ce as d,
|
|
230
|
-
oe as i,
|
|
231
|
-
se as u
|
|
232
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const B=require("react/jsx-runtime"),a=require("react"),b=require("react-dom"),T=require("./effects-D98vUn6N.cjs"),C=a.createContext(void 0);function q(n){const{children:e}=n,t=a.useRef(null),r=a.useContext(C);return T.useIsomorphicLayoutEffect(()=>{const s=t.current;if(!(!s||!r))return r.registerBranch(s)},[r]),B.jsx("div",{className:"nk-portal",ref:t,style:{display:"contents"},children:e})}function j(n){const{children:e}=n,t=T.useBoundary("Portal"),[r,s]=a.useState(!1);a.useEffect(()=>{s(!0)},[]);const c=t.portalElement;return r&&c?b.createPortal(B.jsx(q,{children:e}),c):null}const V=1e3,Y=10,w=new WeakMap;function h(n){const e=w.get(n);if(e)return e;const t={focusLayers:new Set,layers:[],listeners:new Set};return w.set(n,t),t}function D(n){n.listeners.forEach(e=>e())}function W(n,e){const t=a.useRef(Symbol("nk-overlay-layer")),[,r]=a.useReducer(i=>i+1,0);a.useEffect(()=>{if(!n||!e)return;const i=h(e),y=()=>r();return i.listeners.add(y),i.layers.push(t.current),D(i),()=>{i.listeners.delete(y);const f=i.layers.indexOf(t.current);f>=0&&i.layers.splice(f,1),D(i)}},[n,e]);const s=e?h(e):null,c=(s==null?void 0:s.layers.indexOf(t.current))??-1,d=c>=0?c:(s==null?void 0:s.layers.length)??0;return{id:t.current,zIndex:V+d*Y}}function L(n,e){const t=h(n).layers;return t.length>0&&t[t.length-1]===e}function X(n){var e;return(((e=w.get(n))==null?void 0:e.layers.length)??0)>0}function Z(n,e,t){a.useEffect(()=>{if(!n||!e)return;const r=h(e);return r.focusLayers.add(t),()=>{r.focusLayers.delete(t)}},[n,t,e])}function z(n,e){const t=h(n);for(let r=t.layers.length-1;r>=0;r-=1){const s=t.layers[r];if(t.focusLayers.has(s))return s===e}return!1}const Q=1;function G(n){if(!n)return null;const e=n.nodeType===Q?n:n.parentElement;return(e==null?void 0:e.closest(".nk-boundary"))??null}function A(n,e){var r;let t=G(n);for(;t!==null;){if(t===e)return!1;if(X(t))return!0;t=((r=t.parentElement)==null?void 0:r.closest(".nk-boundary"))??null}return!1}function F(n,e){return A(n.activeElement,e)}function S(n,e){return A(n,e)}const v=new WeakMap,M=new WeakMap;function E(n,e){var t;return((t=v.get(n))==null?void 0:t.has(e))??!1}function g(n,e){const t=v.get(n)??new Set;t.add(e),v.set(n,t)}function R(n,e){const t=n.composedPath();return e.some(r=>{var d;const s=r.current;if(!s)return!1;if(t.includes(s))return!0;const c=(d=s.ownerDocument.defaultView)==null?void 0:d.Node;return c&&n.target instanceof c?s.contains(n.target):!1})}function H(n){const{active:e,boundaries:t,boundary:r,dismissOnEscape:s=!0,dismissOnOutsideInteraction:c,layerId:d,onEscapeDismiss:i,onEscapeKeyDown:y,onOutsideDismiss:f,onPointerDownOutside:p,ownerDocument:l}=n;a.useEffect(()=>{if(!e||!l||!r)return;const u=r,N=l;function P(o){o.key!=="Escape"||!s||E(o,u)||!L(u,d)||F(N,u)||(y==null||y(o),!o.defaultPrevented&&(o.preventDefault(),g(o,u),i==null||i()))}function O(o){if(E(o,u)||!L(u,d)||R(o,t))return;const m=o.target;S(m,u)||(p==null||p(o),!o.defaultPrevented&&(g(o,u),f==null||f()))}function I(o){M.set(u,o)}function k(o){if(E(o,u)||!L(u,d)||R(o,t))return;const m=o.target;if(S(m,u))return;const x=M.get(u),_=o.detail>0&&x!==void 0&&E(x,u);o.preventDefault(),o.stopPropagation(),g(o,u),_||f==null||f()}return l.addEventListener("keydown",P,!0),c==="pass-through"?l.addEventListener("pointerdown",O,!0):c==="consume"&&(l.addEventListener("pointerdown",I,!0),l.addEventListener("click",k,!0)),()=>{l.removeEventListener("keydown",P,!0),c==="pass-through"?l.removeEventListener("pointerdown",O,!0):c==="consume"&&(l.removeEventListener("pointerdown",I,!0),l.removeEventListener("click",k,!0))}},[e,t,r,s,c,d,i,y,f,p,l])}function J(){const[n,e]=a.useState(!1);return a.useEffect(()=>{const t=typeof window>"u"?null:window;if(!(t!=null&&t.matchMedia))return;const r=t.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{e(r.matches)};return s(),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),n}function K(n,e=200){const t=J(),[r,s]=a.useState(n);return a.useEffect(()=>{if(n){s(!0);return}if(!r)return;if(t||e<=0){s(!1);return}const c=window.setTimeout(()=>{s(!1)},e);return()=>window.clearTimeout(c)},[e,n,t,r]),{present:r,state:n?"open":r?"closing":"closed"}}exports.FocusScopeContext=C;exports.Portal=j;exports.isFocusInsideAnotherOverlay=F;exports.isTopmostFocusLayer=z;exports.useDismissableLayer=H;exports.useOverlayFocusLayer=Z;exports.useOverlayLayer=W;exports.usePresence=K;
|