neatkit 0.9.0 → 0.11.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.
Files changed (108) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +191 -120
  3. package/dist/{Button-DU4j_IED.cjs → Button-DtrX4X-s.cjs} +1 -1
  4. package/dist/{Button-BV5OUXpc.js → Button-LmEHdRkW.js} +2 -2
  5. package/dist/Button.cjs +1 -1
  6. package/dist/Button.js +1 -1
  7. package/dist/Checkbox.cjs +1 -1
  8. package/dist/Checkbox.js +112 -111
  9. package/dist/Field.cjs +1 -1
  10. package/dist/Field.js +57 -62
  11. package/dist/Icon-CMSHMSDJ.cjs +1 -0
  12. package/dist/{Icon-CxK1wlGk.js → Icon-NT3kRJYz.js} +275 -94
  13. package/dist/Icon.cjs +1 -1
  14. package/dist/Icon.js +1 -1
  15. package/dist/Input.cjs +1 -1
  16. package/dist/Input.js +53 -52
  17. package/dist/Markdown.cjs +1 -1
  18. package/dist/Markdown.js +1 -1
  19. package/dist/Modal.cjs +1 -1
  20. package/dist/Modal.js +58 -57
  21. package/dist/PinInput.cjs +1 -1
  22. package/dist/PinInput.js +89 -88
  23. package/dist/Popover.cjs +1 -1
  24. package/dist/Popover.js +117 -119
  25. package/dist/Progress.cjs +1 -0
  26. package/dist/Progress.js +40 -0
  27. package/dist/Radio.cjs +1 -1
  28. package/dist/Radio.js +48 -47
  29. package/dist/Select.cjs +1 -1
  30. package/dist/Select.js +364 -359
  31. package/dist/Sidebar.cjs +1 -1
  32. package/dist/Sidebar.js +381 -332
  33. package/dist/Spinner-BE0F4y2S.cjs +1 -0
  34. package/dist/Spinner-CmxlDlOk.js +23 -0
  35. package/dist/Spinner.cjs +1 -1
  36. package/dist/Spinner.js +1 -1
  37. package/dist/Switch.cjs +1 -1
  38. package/dist/Switch.js +1 -1
  39. package/dist/{Table-qetwZpTC.cjs → Table-Bjw9lUKS.cjs} +1 -1
  40. package/dist/{Table-CADupJEU.js → Table-GeoE4h-u.js} +2 -2
  41. package/dist/Table.cjs +1 -1
  42. package/dist/Table.js +1 -1
  43. package/dist/TextArea.cjs +1 -1
  44. package/dist/TextArea.js +1 -1
  45. package/dist/Tooltip-CpyROf6x.js +225 -0
  46. package/dist/Tooltip-DDPh_YFO.cjs +1 -0
  47. package/dist/Tooltip.cjs +1 -1
  48. package/dist/Tooltip.js +1 -1
  49. package/dist/aria-Bv-xVREf.js +17 -0
  50. package/dist/aria-DM-xYEHQ.cjs +1 -0
  51. package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
  52. package/dist/components/Icon/icons/AppleIcon.d.ts +11 -0
  53. package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
  54. package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
  55. package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
  56. package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
  57. package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
  58. package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
  59. package/dist/components/Icon/utils/registry.d.ts +7 -0
  60. package/dist/components/PinInput/PinInput.d.ts +1 -1
  61. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
  62. package/dist/components/Progress/Progress.d.ts +38 -0
  63. package/dist/components/Progress/index.d.ts +2 -0
  64. package/dist/components/Progress/utils/value.d.ts +25 -0
  65. package/dist/components/Radio/Radio.d.ts +1 -1
  66. package/dist/components/Select/Select.d.ts +6 -74
  67. package/dist/components/Select/components/CustomSelect.d.ts +59 -0
  68. package/dist/components/Select/components/NativeSelect.d.ts +26 -0
  69. package/dist/components/Select/components/SelectListbox.d.ts +50 -0
  70. package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
  71. package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
  72. package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
  73. package/dist/components/Select/utils/options.d.ts +38 -0
  74. package/dist/components/Sidebar/Sidebar.d.ts +30 -24
  75. package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
  76. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
  77. package/dist/components/Sidebar/components/SidebarPanel.d.ts +3 -3
  78. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -0
  79. package/dist/effects-D98vUn6N.cjs +1 -0
  80. package/dist/effects-DGbA6Q2O.js +18 -0
  81. package/dist/style.css +1 -1
  82. package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
  83. package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
  84. package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
  85. package/dist/useFloatingPosition-MGoyautY.js +57 -0
  86. package/dist/useFocusTrap-BxPazAL6.js +136 -0
  87. package/dist/useFocusTrap-CrMcAu8s.cjs +1 -0
  88. package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
  89. package/dist/usePresence-Dm0mls5p.cjs +1 -0
  90. package/dist/utils/aria.d.ts +4 -5
  91. package/dist/utils/trigger.d.ts +46 -0
  92. package/package.json +6 -1
  93. package/dist/Icon-BIBzgznI.cjs +0 -1
  94. package/dist/Spinner-BXgw60UC.cjs +0 -1
  95. package/dist/Spinner-CVYvk6YK.js +0 -25
  96. package/dist/Tooltip-B2d5ss7S.cjs +0 -1
  97. package/dist/Tooltip-BK64rkxV.js +0 -231
  98. package/dist/aria-Bntn6ad_.cjs +0 -1
  99. package/dist/aria-CeA9QfD1.js +0 -15
  100. package/dist/effects-D5CWf-Pl.js +0 -8
  101. package/dist/effects-D85L_7zM.cjs +0 -1
  102. package/dist/floating-position-DIjh2wnP.cjs +0 -1
  103. package/dist/floating-position-DvR6e334.js +0 -50
  104. package/dist/useFloatingPosition-B3ZC-v3v.js +0 -43
  105. package/dist/useFloatingPosition-GzkP9dCc.cjs +0 -1
  106. package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
  107. package/dist/useFocusTrap-DhVnlboe.js +0 -136
  108. package/dist/usePresence-B5RYv4e1.cjs +0 -1
@@ -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-B3ZC-v3v.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
- };
@@ -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;
@@ -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
- };
@@ -1,8 +0,0 @@
1
- import { createContext as o, useEffect as t, useLayoutEffect as e } from "react";
2
- const n = o(
3
- void 0
4
- ), s = typeof window > "u" ? t : e;
5
- export {
6
- n as B,
7
- s as u
8
- };
@@ -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 +0,0 @@
1
- "use strict";const T={bottom:"top",left:"right",right:"left",top:"bottom"};function x(h,i){const t=Math.min(12,i/2);return Math.min(Math.max(t,h),i-t)}function E(h){return T[h]}function _(h,i){return i==="left"||i==="right"?h.width:h.height}function A(h,i,t){const e=Math.max(h.left,0),o=Math.max(h.top,0),l=Math.min(h.right,i),M=Math.min(h.bottom,t);return l<=e||M<=o?h:{bottom:M,left:e,right:l,top:o}}function F(h,i,t,e,o){const l={bottom:o.bottom-t.bottom-i*2,left:t.left-o.left-i*2,right:o.right-t.right-i*2,top:t.top-o.top-i*2},M=E(h),P=_(e,h),f=l[h]<P&&l[M]>l[h]?M:h;let m=t.left+(t.width-e.width)/2,c=t.top+(t.height-e.height)/2;f==="top"?c=t.top-e.height-i:f==="bottom"?c=t.bottom+i:f==="left"?m=t.left-e.width-i:m=t.right+i;const w=o.left+i,O=o.top+i;m=Math.min(Math.max(w,m),Math.max(w,o.right-i-e.width)),c=Math.min(Math.max(O,c),Math.max(O,o.bottom-i-e.height));let a;return f==="top"||f==="bottom"?a=x(t.left+t.width/2-m,e.width):a=x(t.top+t.height/2-c,e.height),{arrowOffset:a,left:m,placement:f,top:c}}exports.calculateFloatingPosition=F;exports.getVisibleBounds=A;
@@ -1,50 +0,0 @@
1
- const E = {
2
- bottom: "top",
3
- left: "right",
4
- right: "left",
5
- top: "bottom"
6
- };
7
- function x(i, h) {
8
- const t = Math.min(12, h / 2);
9
- return Math.min(Math.max(t, i), h - t);
10
- }
11
- function P(i) {
12
- return E[i];
13
- }
14
- function _(i, h) {
15
- return h === "left" || h === "right" ? i.width : i.height;
16
- }
17
- function p(i, h, t) {
18
- const e = Math.max(i.left, 0), f = Math.max(i.top, 0), o = Math.min(i.right, h), M = Math.min(i.bottom, t);
19
- return o <= e || M <= f ? i : { bottom: M, left: e, right: o, top: f };
20
- }
21
- function F(i, h, t, e, f) {
22
- const o = {
23
- bottom: f.bottom - t.bottom - h * 2,
24
- left: t.left - f.left - h * 2,
25
- right: f.right - t.right - h * 2,
26
- top: t.top - f.top - h * 2
27
- }, M = P(i), T = _(e, i), m = o[i] < T && o[M] > o[i] ? M : i;
28
- let l = t.left + (t.width - e.width) / 2, c = t.top + (t.height - e.height) / 2;
29
- m === "top" ? c = t.top - e.height - h : m === "bottom" ? c = t.bottom + h : m === "left" ? l = t.left - e.width - h : l = t.right + h;
30
- const O = f.left + h, a = f.top + h;
31
- l = Math.min(
32
- Math.max(O, l),
33
- Math.max(O, f.right - h - e.width)
34
- ), c = Math.min(
35
- Math.max(a, c),
36
- Math.max(a, f.bottom - h - e.height)
37
- );
38
- let w;
39
- return m === "top" || m === "bottom" ? w = x(
40
- t.left + t.width / 2 - l,
41
- e.width
42
- ) : w = x(
43
- t.top + t.height / 2 - c,
44
- e.height
45
- ), { arrowOffset: w, left: l, placement: m, top: c };
46
- }
47
- export {
48
- F as c,
49
- p as g
50
- };
@@ -1,43 +0,0 @@
1
- import { useState as v, useEffect as E } from "react";
2
- import { c as S, g as A } from "./floating-position-DvR6e334.js";
3
- const N = 8;
4
- function V(d, r, n, s, c) {
5
- const [m, p] = v(null);
6
- return E(() => {
7
- if (!d || !n || !s || !c) {
8
- p(null);
9
- return;
10
- }
11
- const B = n, L = s, i = c, f = n.ownerDocument.defaultView;
12
- if (!f) return;
13
- const o = f, C = o.getComputedStyle(n), a = Number.parseFloat(
14
- C.getPropertyValue("--nk-space-8")
15
- ), P = Number.isFinite(a) ? a : N;
16
- function e() {
17
- const w = B.getBoundingClientRect(), F = L.getBoundingClientRect(), l = i.getBoundingClientRect(), u = S(
18
- r,
19
- P,
20
- w,
21
- F,
22
- A(
23
- l,
24
- o.innerWidth,
25
- o.innerHeight
26
- )
27
- );
28
- p({
29
- ...u,
30
- left: u.left - l.left - i.clientLeft + i.scrollLeft,
31
- top: u.top - l.top - i.clientTop + i.scrollTop
32
- });
33
- }
34
- e(), o.addEventListener("scroll", e, !0), o.addEventListener("resize", e);
35
- const g = o.ResizeObserver, t = g ? new g(e) : null;
36
- return t == null || t.observe(n), t == null || t.observe(s), t == null || t.observe(c), () => {
37
- o.removeEventListener("scroll", e, !0), o.removeEventListener("resize", e), t == null || t.disconnect();
38
- };
39
- }, [d, c, s, r, n]), m;
40
- }
41
- export {
42
- V as u
43
- };
@@ -1 +0,0 @@
1
- "use strict";const B=require("react"),L=require("./floating-position-DIjh2wnP.cjs"),S=8;function A(d,r,o,s,c){const[P,p]=B.useState(null);return B.useEffect(()=>{if(!d||!o||!s||!c){p(null);return}const C=o,F=s,i=c,a=o.ownerDocument.defaultView;if(!a)return;const n=a,m=n.getComputedStyle(o),f=Number.parseFloat(m.getPropertyValue("--nk-space-8")),w=Number.isFinite(f)?f:S;function e(){const v=C.getBoundingClientRect(),E=F.getBoundingClientRect(),u=i.getBoundingClientRect(),l=L.calculateFloatingPosition(r,w,v,E,L.getVisibleBounds(u,n.innerWidth,n.innerHeight));p({...l,left:l.left-u.left-i.clientLeft+i.scrollLeft,top:l.top-u.top-i.clientTop+i.scrollTop})}e(),n.addEventListener("scroll",e,!0),n.addEventListener("resize",e);const g=n.ResizeObserver,t=g?new g(e):null;return t==null||t.observe(o),t==null||t.observe(s),t==null||t.observe(c),()=>{n.removeEventListener("scroll",e,!0),n.removeEventListener("resize",e),t==null||t.disconnect()}},[d,c,s,r,o]),P}exports.useFloatingPosition=A;
@@ -1 +0,0 @@
1
- "use strict";const h=require("react"),E=require("./usePresence-B5RYv4e1.cjs"),N=require("./focus-restoration-70WcQRr5.cjs"),V=["a[href]","area[href]","button","input:not([type=hidden])","select","textarea","iframe","[contenteditable]:not([contenteditable='false'])","[tabindex]"].join(",");function B(n,o){let t=n;for(;t;){if(t.hidden||t.inert||t.getAttribute("aria-hidden")==="true")return!0;const s=t.ownerDocument.defaultView,e=s==null?void 0:s.getComputedStyle(t);if((e==null?void 0:e.display)==="none"||(e==null?void 0:e.visibility)==="hidden")return!0;if(t===o)break;t=t.parentElement}return!1}function K(n,o){var u;const t=(u=n.ownerDocument.defaultView)==null?void 0:u.HTMLInputElement;if(!t||!(n instanceof t)||n.type!=="radio"||!n.name)return!0;const s=o.filter(c=>c instanceof t&&c.type==="radio"&&c.name===n.name&&c.form===n.form),e=s.find(c=>c.checked);return e?e===n:s[0]===n}function P(n){const o=Array.from(n.querySelectorAll(V)).filter(t=>!t.matches(":disabled")&&t.tabIndex>=0&&!B(t,n));return o.filter(t=>K(t,o))}function C(n,o){const t=[n,...o];return[...new Set(t.flatMap(e=>P(e)))].sort((e,u)=>{var a;if(e===u)return 0;const c=e.compareDocumentPosition(u),m=((a=e.ownerDocument.defaultView)==null?void 0:a.Node.DOCUMENT_POSITION_FOLLOWING)??4;return c&m?-1:1})}function w(n,o,t){return t?n.contains(t)||[...o].some(s=>s.contains(t)):!1}function _(n){const{active:o,autoFocus:t=!0,boundary:s,container:e,initialFocusReference:u,layerId:c,restoreFocus:m=!0}=n,a=h.useRef(new Set),S=h.useCallback(f=>(a.current.add(f),()=>a.current.delete(f)),[]),k=h.useMemo(()=>({registerBranch:S}),[S]);return E.useOverlayFocusLayer(o&&!!e,s,c),h.useEffect(()=>{var g,I;if(!o||!e||!s)return;const f=s,i=e.ownerDocument,L=(g=i.defaultView)==null?void 0:g.HTMLElement,T=(I=i.defaultView)==null?void 0:I.Node,p=L&&i.activeElement instanceof L?i.activeElement:null;let v=!0;function O(){const r=u==null?void 0:u.current;(r&&w(e,a.current,r)?r:C(e,a.current)[0]??e).focus({preventScroll:!0})}function D(r){if(r.key!=="Tab"||!E.isTopmostFocusLayer(f,c)||E.isFocusInsideAnotherOverlay(i,f))return;const l=C(e,a.current);if(l.length===0){r.preventDefault(),e==null||e.focus({preventScroll:!0});return}const y=l[0],b=l[l.length-1],d=i.activeElement,q=w(e,a.current,d),A=!l.some(M=>M===d)&&(d===e||d===(u==null?void 0:u.current));if(!q||A){r.preventDefault(),(r.shiftKey?b:y).focus();return}r.shiftKey&&d===y?(r.preventDefault(),b.focus()):!r.shiftKey&&d===b&&(r.preventDefault(),y.focus())}function F(r){E.isTopmostFocusLayer(f,c)&&!E.isFocusInsideAnotherOverlay(i,f)&&T&&r.target instanceof T&&!w(e,a.current,r.target)&&O()}return i.addEventListener("keydown",D,!0),i.addEventListener("focusin",F,!0),t&&Promise.resolve().then(()=>{v&&O()}),()=>{v=!1,i.removeEventListener("keydown",D,!0),i.removeEventListener("focusin",F,!0),m&&(p!=null&&p.isConnected)&&N.restoreElementFocus(p)}},[o,t,s,e,u,c,m]),k}exports.useFocusTrap=_;
@@ -1,136 +0,0 @@
1
- import { useRef as V, useCallback as q, useMemo as x, useEffect as B } from "react";
2
- import { u as K, i as C, a as I } from "./usePresence-CqegYqy4.js";
3
- import { r as _ } from "./focus-restoration-BvNZzrQA.js";
4
- const H = [
5
- "a[href]",
6
- "area[href]",
7
- "button",
8
- "input:not([type=hidden])",
9
- "select",
10
- "textarea",
11
- "iframe",
12
- "[contenteditable]:not([contenteditable='false'])",
13
- "[tabindex]"
14
- ].join(",");
15
- function P(n, o) {
16
- let t = n;
17
- for (; t; ) {
18
- if (t.hidden || t.inert || t.getAttribute("aria-hidden") === "true")
19
- return !0;
20
- const s = t.ownerDocument.defaultView, e = s == null ? void 0 : s.getComputedStyle(t);
21
- if ((e == null ? void 0 : e.display) === "none" || (e == null ? void 0 : e.visibility) === "hidden")
22
- return !0;
23
- if (t === o) break;
24
- t = t.parentElement;
25
- }
26
- return !1;
27
- }
28
- function G(n, o) {
29
- var u;
30
- const t = (u = n.ownerDocument.defaultView) == null ? void 0 : u.HTMLInputElement;
31
- if (!t || !(n instanceof t) || n.type !== "radio" || !n.name)
32
- return !0;
33
- const s = o.filter(
34
- (c) => c instanceof t && c.type === "radio" && c.name === n.name && c.form === n.form
35
- ), e = s.find((c) => c.checked);
36
- return e ? e === n : s[0] === n;
37
- }
38
- function R(n) {
39
- const o = Array.from(
40
- n.querySelectorAll(H)
41
- ).filter((t) => !t.matches(":disabled") && t.tabIndex >= 0 && !P(t, n));
42
- return o.filter(
43
- (t) => G(t, o)
44
- );
45
- }
46
- function F(n, o) {
47
- const t = [n, ...o];
48
- return [...new Set(
49
- t.flatMap(
50
- (e) => R(e)
51
- )
52
- )].sort((e, u) => {
53
- var a;
54
- if (e === u) return 0;
55
- const c = e.compareDocumentPosition(u), m = ((a = e.ownerDocument.defaultView) == null ? void 0 : a.Node.DOCUMENT_POSITION_FOLLOWING) ?? 4;
56
- return c & m ? -1 : 1;
57
- });
58
- }
59
- function y(n, o, t) {
60
- return t ? n.contains(t) || [...o].some((s) => s.contains(t)) : !1;
61
- }
62
- function Q(n) {
63
- const {
64
- active: o,
65
- autoFocus: t = !0,
66
- boundary: s,
67
- container: e,
68
- initialFocusReference: u,
69
- layerId: c,
70
- restoreFocus: m = !0
71
- } = n, a = V(/* @__PURE__ */ new Set()), b = q((f) => (a.current.add(f), () => a.current.delete(f)), []), k = x(() => ({ registerBranch: b }), [b]);
72
- return K(o && !!e, s, c), B(() => {
73
- var T, g;
74
- if (!o || !e || !s) return;
75
- const f = s, i = e.ownerDocument, w = (T = i.defaultView) == null ? void 0 : T.HTMLElement, S = (g = i.defaultView) == null ? void 0 : g.Node, E = w && i.activeElement instanceof w ? i.activeElement : null;
76
- let L = !0;
77
- function v() {
78
- const r = u == null ? void 0 : u.current;
79
- (r && y(
80
- e,
81
- a.current,
82
- r
83
- ) ? r : F(
84
- e,
85
- a.current
86
- )[0] ?? e).focus({ preventScroll: !0 });
87
- }
88
- function D(r) {
89
- if (r.key !== "Tab" || !C(f, c) || I(i, f))
90
- return;
91
- const l = F(
92
- e,
93
- a.current
94
- );
95
- if (l.length === 0) {
96
- r.preventDefault(), e == null || e.focus({ preventScroll: !0 });
97
- return;
98
- }
99
- const p = l[0], h = l[l.length - 1], d = i.activeElement, M = y(
100
- e,
101
- a.current,
102
- d
103
- ), N = !l.some(
104
- (A) => A === d
105
- ) && (d === e || d === (u == null ? void 0 : u.current));
106
- if (!M || N) {
107
- r.preventDefault(), (r.shiftKey ? h : p).focus();
108
- return;
109
- }
110
- r.shiftKey && d === p ? (r.preventDefault(), h.focus()) : !r.shiftKey && d === h && (r.preventDefault(), p.focus());
111
- }
112
- function O(r) {
113
- C(f, c) && !I(i, f) && S && r.target instanceof S && !y(
114
- e,
115
- a.current,
116
- r.target
117
- ) && v();
118
- }
119
- return i.addEventListener("keydown", D, !0), i.addEventListener("focusin", O, !0), t && Promise.resolve().then(() => {
120
- L && v();
121
- }), () => {
122
- L = !1, i.removeEventListener("keydown", D, !0), i.removeEventListener("focusin", O, !0), m && (E != null && E.isConnected) && _(E);
123
- };
124
- }, [
125
- o,
126
- t,
127
- s,
128
- e,
129
- u,
130
- c,
131
- m
132
- ]), k;
133
- }
134
- export {
135
- Q as u
136
- };
@@ -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;