neatkit 0.10.0 → 0.12.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/dist/Boundary.cjs +1 -1
- package/dist/Boundary.js +191 -120
- package/dist/{Button-CVe9T_Zw.cjs → Button-6oWs-pyF.cjs} +1 -1
- package/dist/{Button-D6rXvcqq.js → Button-B0E-M8mp.js} +1 -1
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.js +75 -2
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +2 -2
- package/dist/Code-f0GWveGp.cjs +4 -0
- package/dist/{Code-Bp2X1k-g.js → Code-pROJjsiG.js} +57 -58
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/Field.cjs +1 -1
- package/dist/Field.js +57 -62
- package/dist/Icon-BFaHVAoQ.cjs +1 -0
- package/dist/{Icon-CxK1wlGk.js → Icon-Cj1s40xn.js} +308 -96
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +2 -2
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +76 -75
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +4 -4
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +228 -192
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +117 -119
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +1 -1
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +12 -11
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +441 -309
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.js +1 -1
- package/dist/{Table-DutHfiXR.js → Table-B2G8CHJ9.js} +111 -108
- package/dist/Table-Z8Q6XRkc.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TextArea.cjs +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/Tooltip-CpyROf6x.js +225 -0
- package/dist/Tooltip-DDPh_YFO.cjs +1 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/aria-Bv-xVREf.js +17 -0
- package/dist/aria-DM-xYEHQ.cjs +1 -0
- package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
- package/dist/components/Card/Card.d.ts +22 -23
- package/dist/components/Card/components/CardBody.d.ts +24 -0
- package/dist/components/Card/components/CardFooter.d.ts +24 -0
- package/dist/components/Card/components/CardHeader.d.ts +24 -0
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Code/Code.d.ts +9 -7
- package/dist/components/Code/index.d.ts +1 -1
- package/dist/components/Icon/icons/AppleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChainIcon.d.ts +11 -0
- package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
- package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
- package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
- package/dist/components/Icon/utils/registry.d.ts +8 -0
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/PinInput/hooks/usePinInput.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +1 -1
- package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -0
- package/dist/components/Sidebar/hooks/useContentBelow.d.ts +23 -0
- package/dist/components/Sidebar/utils/children.d.ts +16 -0
- package/dist/components/Table/Table.d.ts +8 -2
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/effects-D98vUn6N.cjs +1 -0
- package/dist/effects-DGbA6Q2O.js +18 -0
- package/dist/style.css +1 -1
- package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
- package/dist/useFloatingPosition-MGoyautY.js +57 -0
- package/dist/{useFocusTrap-C0IcCdNf.js → useFocusTrap-BxPazAL6.js} +1 -1
- package/dist/{useFocusTrap-gAK_402D.cjs → useFocusTrap-CrMcAu8s.cjs} +1 -1
- package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
- package/dist/usePresence-Dm0mls5p.cjs +1 -0
- package/dist/utils/aria.d.ts +4 -5
- package/dist/utils/trigger.d.ts +46 -0
- package/package.json +1 -1
- package/dist/Card-CPq6dsut.js +0 -34
- package/dist/Card-CQ-8_1tO.cjs +0 -1
- package/dist/Code-B7s_rN0G.cjs +0 -4
- package/dist/Icon-BIBzgznI.cjs +0 -1
- package/dist/Table-BqWBgMTU.cjs +0 -1
- package/dist/Tooltip-CCuE-hfp.cjs +0 -1
- package/dist/Tooltip-CeyRKNv4.js +0 -231
- package/dist/aria-Bntn6ad_.cjs +0 -1
- package/dist/aria-CeA9QfD1.js +0 -15
- package/dist/effects-D5CWf-Pl.js +0 -8
- package/dist/effects-D85L_7zM.cjs +0 -1
- package/dist/useFloatingPosition-Dq8xpr3E.js +0 -27
- package/dist/useFloatingPosition-g5kXywoB.cjs +0 -1
- package/dist/usePresence-B5RYv4e1.cjs +0 -1
package/dist/Tooltip-CeyRKNv4.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as C, jsxs as q, Fragment as Ie } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as X, createContext as be, forwardRef as he, Fragment as Le, useId as ve, useContext as Fe, useRef as u, useState as A, useCallback as f, useEffect as G, cloneElement as J } from "react";
|
|
4
|
-
import { g as Oe, a as K } from "./reference-CXMr27nM.js";
|
|
5
|
-
import { c as Me, b as _e, d as Pe, e as xe, P as Ne } from "./usePresence-CqegYqy4.js";
|
|
6
|
-
import { u as We } from "./useFloatingPosition-Dq8xpr3E.js";
|
|
7
|
-
import { i as ke } from "./focus-restoration-BvNZzrQA.js";
|
|
8
|
-
import { S as Ve } from "./Surface-vEFsZC12.js";
|
|
9
|
-
const je = 500, Z = be(null);
|
|
10
|
-
function Ae(r) {
|
|
11
|
-
const { children: a, delay: s = je } = r, l = X(() => ({
|
|
12
|
-
delay: s
|
|
13
|
-
}), [s]);
|
|
14
|
-
return /* @__PURE__ */ C(Z.Provider, { value: l, children: a });
|
|
15
|
-
}
|
|
16
|
-
const ee = 500, Q = 100;
|
|
17
|
-
function Ce(r, a, s, l) {
|
|
18
|
-
a.current = r, K(s, r), K(l, r);
|
|
19
|
-
}
|
|
20
|
-
function ze(r) {
|
|
21
|
-
return Number.isFinite(r) ? Math.max(0, r) : ee;
|
|
22
|
-
}
|
|
23
|
-
function Be(r, a) {
|
|
24
|
-
const s = (r == null ? void 0 : r.split(/\s+/).filter(Boolean)) ?? [];
|
|
25
|
-
return s.includes(a) || s.push(a), s.join(" ");
|
|
26
|
-
}
|
|
27
|
-
const Se = he(function(a, s) {
|
|
28
|
-
const {
|
|
29
|
-
children: l,
|
|
30
|
-
className: ne,
|
|
31
|
-
content: p,
|
|
32
|
-
contentClassName: te,
|
|
33
|
-
contentStyle: z,
|
|
34
|
-
delay: re,
|
|
35
|
-
disabled: w = !1,
|
|
36
|
-
onOpenChange: h,
|
|
37
|
-
placement: B = "top",
|
|
38
|
-
style: oe
|
|
39
|
-
} = a;
|
|
40
|
-
if (p == null || typeof p == "boolean" || typeof p == "string" && !p.trim())
|
|
41
|
-
throw new Error("Tooltip content must not be empty");
|
|
42
|
-
if (l.type === Le)
|
|
43
|
-
throw new Error("Tooltip requires a single non-Fragment trigger");
|
|
44
|
-
const S = `${ve()}-tooltip`, P = Fe(Z), t = l.props, Y = Oe(l), E = u(null), x = u(null), $ = u(w), N = u(!1), L = u(null), v = u(null), F = u(null), O = u(!1), y = u(!1), D = u(!1), d = u(!1), [M, se] = A(null), [ce, ie] = A(null), [_, ue] = A(!1);
|
|
45
|
-
$.current = w;
|
|
46
|
-
const W = ze(
|
|
47
|
-
re ?? (P == null ? void 0 : P.delay) ?? ee
|
|
48
|
-
), g = Me(_), H = (M == null ? void 0 : M.ownerDocument) ?? (typeof document > "u" ? null : document), k = _e("Tooltip").boundaryElement, V = Pe(g.present, k), m = We(
|
|
49
|
-
g.present,
|
|
50
|
-
B,
|
|
51
|
-
M,
|
|
52
|
-
ce,
|
|
53
|
-
k
|
|
54
|
-
), le = X(
|
|
55
|
-
() => [E, x],
|
|
56
|
-
[]
|
|
57
|
-
), ae = Be(
|
|
58
|
-
t["aria-describedby"],
|
|
59
|
-
S
|
|
60
|
-
), fe = _ && g.present ? ae : t["aria-describedby"], U = f(
|
|
61
|
-
(e) => {
|
|
62
|
-
Ce(
|
|
63
|
-
e,
|
|
64
|
-
E,
|
|
65
|
-
Y,
|
|
66
|
-
s
|
|
67
|
-
), se(e);
|
|
68
|
-
},
|
|
69
|
-
[s, Y]
|
|
70
|
-
), de = f(
|
|
71
|
-
(e) => {
|
|
72
|
-
x.current = e, e || (d.current = !1), ie(e);
|
|
73
|
-
},
|
|
74
|
-
[]
|
|
75
|
-
), c = f(() => {
|
|
76
|
-
const e = L.current;
|
|
77
|
-
e && e.ownerWindow.clearTimeout(e.timerId), L.current = null;
|
|
78
|
-
}, []), i = f(() => {
|
|
79
|
-
const e = v.current;
|
|
80
|
-
e && e.ownerWindow.clearTimeout(e.timerId), v.current = null;
|
|
81
|
-
}, []), R = f(() => {
|
|
82
|
-
const e = F.current;
|
|
83
|
-
e && e.ownerWindow.clearTimeout(e.timerId), F.current = null;
|
|
84
|
-
}, []), o = f((e) => {
|
|
85
|
-
N.current !== e && (e || (d.current = !1), N.current = e, ue(e), h == null || h(e));
|
|
86
|
-
}, [h]), j = f((e) => {
|
|
87
|
-
var I, b;
|
|
88
|
-
if (i(), y.current || D.current || d.current)
|
|
89
|
-
return;
|
|
90
|
-
if (e === 0) {
|
|
91
|
-
o(!1);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const n = ((I = E.current) == null ? void 0 : I.ownerDocument.defaultView) ?? ((b = x.current) == null ? void 0 : b.ownerDocument.defaultView);
|
|
95
|
-
if (!n) {
|
|
96
|
-
o(!1);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const T = n.setTimeout(() => {
|
|
100
|
-
v.current = null, !y.current && !D.current && !d.current && o(!1);
|
|
101
|
-
}, e);
|
|
102
|
-
v.current = {
|
|
103
|
-
ownerWindow: n,
|
|
104
|
-
timerId: T
|
|
105
|
-
};
|
|
106
|
-
}, [i, o]), me = f(() => {
|
|
107
|
-
var T;
|
|
108
|
-
if (c(), i(), W === 0) {
|
|
109
|
-
o(!0);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const e = (T = E.current) == null ? void 0 : T.ownerDocument.defaultView;
|
|
113
|
-
if (!e) return;
|
|
114
|
-
const n = e.setTimeout(() => {
|
|
115
|
-
L.current = null, $.current || o(!0);
|
|
116
|
-
}, W);
|
|
117
|
-
L.current = { ownerWindow: e, timerId: n };
|
|
118
|
-
}, [i, c, W, o]);
|
|
119
|
-
function pe(e) {
|
|
120
|
-
var n;
|
|
121
|
-
if ((n = t.onFocus) == null || n.call(t, e), y.current = !0, i(), O.current || ke(e.currentTarget)) {
|
|
122
|
-
c();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
c(), o(!0);
|
|
126
|
-
}
|
|
127
|
-
function Te(e) {
|
|
128
|
-
var n;
|
|
129
|
-
(n = t.onBlur) == null || n.call(t, e), !e.currentTarget.contains(e.relatedTarget) && (y.current = !1, c(), j(0));
|
|
130
|
-
}
|
|
131
|
-
function we(e) {
|
|
132
|
-
var n;
|
|
133
|
-
(n = t.onMouseEnter) == null || n.call(t, e), D.current = !0, me();
|
|
134
|
-
}
|
|
135
|
-
function Ee(e) {
|
|
136
|
-
var n;
|
|
137
|
-
(n = t.onMouseLeave) == null || n.call(t, e), D.current = !1, c(), j(Q);
|
|
138
|
-
}
|
|
139
|
-
function ye() {
|
|
140
|
-
d.current = !0, i();
|
|
141
|
-
}
|
|
142
|
-
function De() {
|
|
143
|
-
d.current = !1, j(Q);
|
|
144
|
-
}
|
|
145
|
-
function ge(e) {
|
|
146
|
-
var I, b;
|
|
147
|
-
(I = t.onPointerDown) == null || I.call(t, e), c(), i(), o(!1);
|
|
148
|
-
const n = (b = E.current) == null ? void 0 : b.ownerDocument.defaultView;
|
|
149
|
-
if (!n) return;
|
|
150
|
-
O.current = !0, R();
|
|
151
|
-
const T = n.setTimeout(() => {
|
|
152
|
-
O.current = !1, F.current = null;
|
|
153
|
-
}, 0);
|
|
154
|
-
F.current = { ownerWindow: n, timerId: T };
|
|
155
|
-
}
|
|
156
|
-
if (xe({
|
|
157
|
-
boundary: k,
|
|
158
|
-
active: _,
|
|
159
|
-
boundaries: le,
|
|
160
|
-
dismissOnPointerDownOutside: !0,
|
|
161
|
-
layerId: V.id,
|
|
162
|
-
onEscapeDismiss: () => o(!1),
|
|
163
|
-
onPointerDownOutsideDismiss: () => o(!1),
|
|
164
|
-
ownerDocument: H
|
|
165
|
-
}), G(() => {
|
|
166
|
-
w && (c(), i(), R(), O.current = !1, y.current = !1, D.current = !1, d.current = !1, N.current && o(!1));
|
|
167
|
-
}, [
|
|
168
|
-
i,
|
|
169
|
-
c,
|
|
170
|
-
R,
|
|
171
|
-
w,
|
|
172
|
-
o
|
|
173
|
-
]), G(() => () => {
|
|
174
|
-
c(), i(), R();
|
|
175
|
-
}, [i, c, R]), w)
|
|
176
|
-
return J(
|
|
177
|
-
l,
|
|
178
|
-
{ ref: U }
|
|
179
|
-
);
|
|
180
|
-
const Re = J(
|
|
181
|
-
l,
|
|
182
|
-
{
|
|
183
|
-
"aria-describedby": fe,
|
|
184
|
-
className: [t.className, "nk-tooltip__trigger", ne].filter(Boolean).join(" "),
|
|
185
|
-
onBlur: Te,
|
|
186
|
-
onFocus: pe,
|
|
187
|
-
onMouseEnter: we,
|
|
188
|
-
onMouseLeave: Ee,
|
|
189
|
-
onPointerDown: ge,
|
|
190
|
-
ref: U,
|
|
191
|
-
style: { ...t.style, ...oe }
|
|
192
|
-
}
|
|
193
|
-
);
|
|
194
|
-
return /* @__PURE__ */ q(Ie, { children: [
|
|
195
|
-
Re,
|
|
196
|
-
g.present && H ? /* @__PURE__ */ C(Ne, { children: /* @__PURE__ */ q(
|
|
197
|
-
Ve,
|
|
198
|
-
{
|
|
199
|
-
ref: de,
|
|
200
|
-
"aria-hidden": _ ? void 0 : !0,
|
|
201
|
-
className: ["nk-tooltip", te].filter(Boolean).join(" "),
|
|
202
|
-
"data-placement": (m == null ? void 0 : m.placement) ?? B,
|
|
203
|
-
"data-state": g.state === "closing" ? "closing" : "open",
|
|
204
|
-
id: S,
|
|
205
|
-
onMouseEnter: ye,
|
|
206
|
-
onMouseLeave: De,
|
|
207
|
-
role: "tooltip",
|
|
208
|
-
style: m ? {
|
|
209
|
-
...z,
|
|
210
|
-
"--nk-tooltip-arrow-offset": `${m.arrowOffset}px`,
|
|
211
|
-
left: m.left,
|
|
212
|
-
top: m.top,
|
|
213
|
-
zIndex: V.zIndex
|
|
214
|
-
} : {
|
|
215
|
-
...z,
|
|
216
|
-
visibility: "hidden",
|
|
217
|
-
zIndex: V.zIndex
|
|
218
|
-
},
|
|
219
|
-
children: [
|
|
220
|
-
/* @__PURE__ */ C("span", { "aria-hidden": "true", className: "nk-tooltip__arrow" }),
|
|
221
|
-
p
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
) }) : null
|
|
225
|
-
] });
|
|
226
|
-
}), Qe = Object.assign(Se, {
|
|
227
|
-
Provider: Ae
|
|
228
|
-
});
|
|
229
|
-
export {
|
|
230
|
-
Qe as T
|
|
231
|
-
};
|
package/dist/aria-Bntn6ad_.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function r(e){return e!==void 0&&e!==!1&&e!=="false"}function s(e,t){return e?!0:t}function l(e,t){const n=(e==null?void 0:e.split(/\s+/).filter(Boolean))??[];return n.includes(t)||n.push(t),n.join(" ")}exports.hasInvalidState=r;exports.mergeIdentifiers=l;exports.resolveAriaInvalid=s;
|
package/dist/aria-CeA9QfD1.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function s(e) {
|
|
2
|
-
return e !== void 0 && e !== !1 && e !== "false";
|
|
3
|
-
}
|
|
4
|
-
function t(e, n) {
|
|
5
|
-
return e ? !0 : n;
|
|
6
|
-
}
|
|
7
|
-
function r(e, n) {
|
|
8
|
-
const o = (e == null ? void 0 : e.split(/\s+/).filter(Boolean)) ?? [];
|
|
9
|
-
return o.includes(n) || o.push(n), o.join(" ");
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
s as h,
|
|
13
|
-
r as m,
|
|
14
|
-
t as r
|
|
15
|
-
};
|
package/dist/effects-D5CWf-Pl.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("react"),e=t.createContext(void 0),o=typeof window>"u"?t.useEffect:t.useLayoutEffect;exports.BoundaryContext=e;exports.useIsomorphicLayoutEffect=o;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useCallback as f } from "react";
|
|
2
|
-
import { c as g, u as d } from "./useAnchoredPosition-C0VS7hm6.js";
|
|
3
|
-
function m(i, o, t, r, s) {
|
|
4
|
-
const u = f(
|
|
5
|
-
(a) => {
|
|
6
|
-
const { panelBounds: n, readSpacing: e, triggerBounds: l, visibleBounds: c } = a;
|
|
7
|
-
return n ? g(
|
|
8
|
-
o,
|
|
9
|
-
e(),
|
|
10
|
-
l,
|
|
11
|
-
n,
|
|
12
|
-
c
|
|
13
|
-
) : null;
|
|
14
|
-
},
|
|
15
|
-
[o]
|
|
16
|
-
);
|
|
17
|
-
return d({
|
|
18
|
-
active: i,
|
|
19
|
-
boundary: s,
|
|
20
|
-
fit: u,
|
|
21
|
-
panel: r,
|
|
22
|
-
trigger: t
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
m as u
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("react"),o=require("./useAnchoredPosition-D7GRFzoX.cjs");function P(t,n,e,s,r){const u=d.useCallback(a=>{const{panelBounds:i,readSpacing:c,triggerBounds:l,visibleBounds:g}=a;return i?o.calculateFloatingPosition(n,c(),l,i,g):null},[n]);return o.useAnchoredPosition({active:t,boundary:r,fit:u,panel:s,trigger:e})}exports.useFloatingPosition=P;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const w=require("react/jsx-runtime"),o=require("react"),k=require("react-dom"),O=require("./effects-D85L_7zM.cjs");function P(r){const e=o.useContext(O.BoundaryContext);if(r!==void 0&&!e)throw new Error(`${r} must be rendered inside Boundary. Neatkit resolves portals, overlay stacking, and responsive behavior against the nearest Boundary, so wrap your interface in <Boundary>.`);return e}const x=o.createContext(void 0);function M(r){const{children:e}=r,t=o.useRef(null),n=o.useContext(x);return O.useIsomorphicLayoutEffect(()=>{const s=t.current;if(!(!s||!n))return n.registerBranch(s)},[n]),w.jsx("div",{className:"nk-portal",ref:t,style:{display:"contents"},children:e})}function T(r){const{children:e}=r,t=P("Portal"),[n,s]=o.useState(!1);o.useEffect(()=>{s(!0)},[]);const c=t.portalElement;return n&&c?k.createPortal(w.jsx(M,{children:e}),c):null}const b=1e3,A=10,v=new WeakMap;function y(r){const e=v.get(r);if(e)return e;const t={focusLayers:new Set,layers:[],listeners:new Set};return v.set(r,t),t}function g(r){r.listeners.forEach(e=>e())}function C(r,e){const t=o.useRef(Symbol("nk-overlay-layer")),[,n]=o.useReducer(u=>u+1,0);o.useEffect(()=>{if(!r||!e)return;const u=y(e),l=()=>n();return u.listeners.add(l),u.layers.push(t.current),g(u),()=>{u.listeners.delete(l);const f=u.layers.indexOf(t.current);f>=0&&u.layers.splice(f,1),g(u)}},[r,e]);const s=e?y(e):null,c=(s==null?void 0:s.layers.indexOf(t.current))??-1,i=c>=0?c:(s==null?void 0:s.layers.length)??0;return{id:t.current,zIndex:b+i*A}}function m(r,e){const t=y(r).layers;return t.length>0&&t[t.length-1]===e}function F(r){var e;return(((e=v.get(r))==null?void 0:e.layers.length)??0)>0}function _(r,e,t){o.useEffect(()=>{if(!r||!e)return;const n=y(e);return n.focusLayers.add(t),()=>{n.focusLayers.delete(t)}},[r,t,e])}function N(r,e){const t=y(r);for(let n=t.layers.length-1;n>=0;n-=1){const s=t.layers[n];if(t.focusLayers.has(s))return s===e}return!1}const D=1;function q(r){if(!r)return null;const e=r.nodeType===D?r:r.parentElement;return(e==null?void 0:e.closest(".nk-boundary"))??null}function I(r,e){var n;let t=q(r);for(;t!==null;){if(t===e)return!1;if(F(t))return!0;t=((n=t.parentElement)==null?void 0:n.closest(".nk-boundary"))??null}return!1}function B(r,e){return I(r.activeElement,e)}function j(r,e){return I(r,e)}function V(r,e){const t=r.composedPath();return e.some(n=>{var i;const s=n.current;if(!s)return!1;if(t.includes(s))return!0;const c=(i=s.ownerDocument.defaultView)==null?void 0:i.Node;return c&&r.target instanceof c?s.contains(r.target):!1})}function Y(r){const{active:e,boundaries:t,boundary:n,dismissOnEscape:s=!0,dismissOnPointerDownOutside:c=!0,layerId:i,onEscapeDismiss:u,onEscapeKeyDown:l,onPointerDownOutside:f,onPointerDownOutsideDismiss:h,ownerDocument:d}=r;o.useEffect(()=>{if(!e||!d||!n)return;const p=n,R=d;function E(a){a.key!=="Escape"||!s||!m(p,i)||B(R,p)||(l==null||l(a),!a.defaultPrevented&&(a.preventDefault(),u==null||u()))}function L(a){if(!c||!m(p,i)||V(a,t))return;const S=a.target;j(S,p)||(f==null||f(a),!a.defaultPrevented&&(h==null||h()))}return d.addEventListener("keydown",E,!0),d.addEventListener("pointerdown",L,!0),()=>{d.removeEventListener("keydown",E,!0),d.removeEventListener("pointerdown",L,!0)}},[e,t,n,s,c,i,u,l,f,h,d])}function X(){const[r,e]=o.useState(!1);return o.useEffect(()=>{const t=typeof window>"u"?null:window;if(!(t!=null&&t.matchMedia))return;const n=t.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{e(n.matches)};return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),r}function Z(r,e=200){const t=X(),[n,s]=o.useState(r);return o.useEffect(()=>{if(r){s(!0);return}if(!n)return;if(t||e<=0){s(!1);return}const c=window.setTimeout(()=>{s(!1)},e);return()=>window.clearTimeout(c)},[e,r,t,n]),{present:n,state:r?"open":n?"closing":"closed"}}exports.FocusScopeContext=x;exports.Portal=T;exports.isFocusInsideAnotherOverlay=B;exports.isTopmostFocusLayer=N;exports.useBoundary=P;exports.useDismissableLayer=Y;exports.useOverlayFocusLayer=_;exports.useOverlayLayer=C;exports.usePresence=Z;
|