neatkit 0.16.4 → 0.16.6

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 (43) hide show
  1. package/dist/{Button-ZzJbnjNg.js → Button-Dsr1zrKT.js} +1 -1
  2. package/dist/{Button-CYFy6sTv.cjs → Button-DyO8fkk1.cjs} +1 -1
  3. package/dist/Button.cjs +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/Checkbox.cjs +1 -1
  6. package/dist/Checkbox.js +1 -1
  7. package/dist/{Icon-BHNINDhB.js → Icon-B9-_-fzr.js} +25 -16
  8. package/dist/{Icon-De6sqmQ9.cjs → Icon-Yl22zVSN.cjs} +1 -1
  9. package/dist/Icon.cjs +1 -1
  10. package/dist/Icon.js +1 -1
  11. package/dist/Input.cjs +1 -1
  12. package/dist/Input.js +1 -1
  13. package/dist/Markdown.cjs +1 -1
  14. package/dist/Markdown.js +1 -1
  15. package/dist/Modal.cjs +1 -1
  16. package/dist/Modal.js +26 -26
  17. package/dist/Popover.cjs +1 -1
  18. package/dist/Popover.js +81 -82
  19. package/dist/Select.cjs +1 -1
  20. package/dist/Select.js +280 -283
  21. package/dist/Sidebar.cjs +1 -1
  22. package/dist/Sidebar.js +21 -21
  23. package/dist/{Table-WlCsBVHC.js → Table-CURYs469.js} +2 -2
  24. package/dist/{Table-DEjAMnG3.cjs → Table-DTxKbMgJ.cjs} +1 -1
  25. package/dist/Table.cjs +1 -1
  26. package/dist/Table.js +1 -1
  27. package/dist/{Tooltip-4RWCnb2Q.js → Tooltip-BuRMZ4p_.js} +35 -35
  28. package/dist/{Tooltip-B2rZmRCs.cjs → Tooltip-tzVg8Bky.cjs} +1 -1
  29. package/dist/Tooltip.cjs +1 -1
  30. package/dist/Tooltip.js +1 -1
  31. package/dist/components/Popover/Popover.d.ts +10 -8
  32. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +7 -4
  33. package/dist/components/Select/components/CustomSelect.d.ts +5 -4
  34. package/dist/components/Select/components/SelectListbox.d.ts +2 -4
  35. package/dist/components/Sidebar/Sidebar.d.ts +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/{useFocusTrap-BxPazAL6.js → useFocusTrap-BL3fDmTs.js} +1 -1
  38. package/dist/{useFocusTrap-CrMcAu8s.cjs → useFocusTrap-C--8mnsI.cjs} +1 -1
  39. package/dist/usePresence-BYnWctTh.js +232 -0
  40. package/dist/usePresence-HVr855AK.cjs +1 -0
  41. package/package.json +1 -1
  42. package/dist/usePresence-BTRY1_l-.js +0 -212
  43. package/dist/usePresence-Dm0mls5p.cjs +0 -1
@@ -1,212 +0,0 @@
1
- "use client";
2
- import { jsx as P } from "react/jsx-runtime";
3
- import { createContext as R, useState as E, useEffect as d, useRef as O, useContext as S, useReducer as T } from "react";
4
- import { createPortal as k } from "react-dom";
5
- import { u as B, a as _ } from "./effects-DGbA6Q2O.js";
6
- const A = R(void 0);
7
- function N(r) {
8
- const { children: e } = r, n = O(null), t = S(A);
9
- return _(() => {
10
- const s = n.current;
11
- if (!(!s || !t))
12
- return t.registerBranch(s);
13
- }, [t]), /* @__PURE__ */ P(
14
- "div",
15
- {
16
- className: "nk-portal",
17
- ref: n,
18
- style: { display: "contents" },
19
- children: e
20
- }
21
- );
22
- }
23
- function H(r) {
24
- const { children: e } = r, n = B("Portal"), [t, s] = E(!1);
25
- d(() => {
26
- s(!0);
27
- }, []);
28
- const u = n.portalElement;
29
- return t && u ? k(/* @__PURE__ */ P(N, { children: e }), u) : null;
30
- }
31
- const b = 1e3, C = 10, m = /* @__PURE__ */ new WeakMap();
32
- function y(r) {
33
- const e = m.get(r);
34
- if (e) return e;
35
- const n = {
36
- focusLayers: /* @__PURE__ */ new Set(),
37
- layers: [],
38
- listeners: /* @__PURE__ */ new Set()
39
- };
40
- return m.set(r, n), n;
41
- }
42
- function g(r) {
43
- r.listeners.forEach((e) => e());
44
- }
45
- function J(r, e) {
46
- const n = O(Symbol("nk-overlay-layer")), [, t] = T((o) => o + 1, 0);
47
- d(() => {
48
- if (!r || !e) return;
49
- const o = y(e), i = () => t();
50
- return o.listeners.add(i), o.layers.push(n.current), g(o), () => {
51
- o.listeners.delete(i);
52
- const l = o.layers.indexOf(n.current);
53
- l >= 0 && o.layers.splice(l, 1), g(o);
54
- };
55
- }, [r, e]);
56
- const s = e ? y(e) : null, u = (s == null ? void 0 : s.layers.indexOf(
57
- n.current
58
- )) ?? -1, a = u >= 0 ? u : (s == null ? void 0 : s.layers.length) ?? 0;
59
- return {
60
- id: n.current,
61
- zIndex: b + a * C
62
- };
63
- }
64
- function w(r, e) {
65
- const n = y(r).layers;
66
- return n.length > 0 && n[n.length - 1] === e;
67
- }
68
- function F(r) {
69
- var e;
70
- return (((e = m.get(r)) == null ? void 0 : e.layers.length) ?? 0) > 0;
71
- }
72
- function K(r, e, n) {
73
- d(() => {
74
- if (!r || !e) return;
75
- const t = y(e);
76
- return t.focusLayers.add(n), () => {
77
- t.focusLayers.delete(n);
78
- };
79
- }, [r, n, e]);
80
- }
81
- function U(r, e) {
82
- const n = y(r);
83
- for (let t = n.layers.length - 1; t >= 0; t -= 1) {
84
- const s = n.layers[t];
85
- if (n.focusLayers.has(s))
86
- return s === e;
87
- }
88
- return !1;
89
- }
90
- const D = 1;
91
- function V(r) {
92
- if (!r) return null;
93
- const e = r.nodeType === D ? r : r.parentElement;
94
- return (e == null ? void 0 : e.closest(".nk-boundary")) ?? null;
95
- }
96
- function I(r, e) {
97
- var t;
98
- let n = V(r);
99
- for (; n !== null; ) {
100
- if (n === e) return !1;
101
- if (F(n)) return !0;
102
- n = ((t = n.parentElement) == null ? void 0 : t.closest(".nk-boundary")) ?? null;
103
- }
104
- return !1;
105
- }
106
- function Y(r, e) {
107
- return I(
108
- r.activeElement,
109
- e
110
- );
111
- }
112
- function X(r, e) {
113
- return I(r, e);
114
- }
115
- function Z(r, e) {
116
- const n = r.composedPath();
117
- return e.some((t) => {
118
- var a;
119
- const s = t.current;
120
- if (!s) return !1;
121
- if (n.includes(s)) return !0;
122
- const u = (a = s.ownerDocument.defaultView) == null ? void 0 : a.Node;
123
- return u && r.target instanceof u ? s.contains(r.target) : !1;
124
- });
125
- }
126
- function W(r) {
127
- const {
128
- active: e,
129
- boundaries: n,
130
- boundary: t,
131
- dismissOnEscape: s = !0,
132
- dismissOnPointerDownOutside: u = !0,
133
- layerId: a,
134
- onEscapeDismiss: o,
135
- onEscapeKeyDown: i,
136
- onPointerDownOutside: l,
137
- onPointerDownOutsideDismiss: h,
138
- ownerDocument: f
139
- } = r;
140
- d(() => {
141
- if (!e || !f || !t) return;
142
- const p = t, x = f;
143
- function v(c) {
144
- c.key !== "Escape" || !s || !w(p, a) || Y(x, p) || (i == null || i(c), !c.defaultPrevented && (c.preventDefault(), o == null || o()));
145
- }
146
- function L(c) {
147
- if (!u || !w(p, a) || Z(c, n))
148
- return;
149
- const M = c.target;
150
- X(M, p) || (l == null || l(c), !c.defaultPrevented && (h == null || h()));
151
- }
152
- return f.addEventListener("keydown", v, !0), f.addEventListener("pointerdown", L, !0), () => {
153
- f.removeEventListener("keydown", v, !0), f.removeEventListener("pointerdown", L, !0);
154
- };
155
- }, [
156
- e,
157
- n,
158
- t,
159
- s,
160
- u,
161
- a,
162
- o,
163
- i,
164
- l,
165
- h,
166
- f
167
- ]);
168
- }
169
- function j() {
170
- const [r, e] = E(!1);
171
- return d(() => {
172
- const n = typeof window > "u" ? null : window;
173
- if (!(n != null && n.matchMedia)) return;
174
- const t = n.matchMedia(
175
- "(prefers-reduced-motion: reduce)"
176
- ), s = () => {
177
- e(t.matches);
178
- };
179
- return s(), t.addEventListener("change", s), () => t.removeEventListener("change", s);
180
- }, []), r;
181
- }
182
- function $(r, e = 200) {
183
- const n = j(), [t, s] = E(r);
184
- return d(() => {
185
- if (r) {
186
- s(!0);
187
- return;
188
- }
189
- if (!t) return;
190
- if (n || e <= 0) {
191
- s(!1);
192
- return;
193
- }
194
- const u = window.setTimeout(() => {
195
- s(!1);
196
- }, e);
197
- return () => window.clearTimeout(u);
198
- }, [e, r, n, t]), {
199
- present: t,
200
- state: r ? "open" : t ? "closing" : "closed"
201
- };
202
- }
203
- export {
204
- A as F,
205
- H as P,
206
- Y as a,
207
- $ as b,
208
- J as c,
209
- W as d,
210
- U as i,
211
- K as u
212
- };
@@ -1 +0,0 @@
1
- "use client";"use strict";const O=require("react/jsx-runtime"),u=require("react"),M=require("react-dom"),P=require("./effects-D98vUn6N.cjs"),w=u.createContext(void 0);function T(r){const{children:e}=r,t=u.useRef(null),n=u.useContext(w);return P.useIsomorphicLayoutEffect(()=>{const s=t.current;if(!(!s||!n))return n.registerBranch(s)},[n]),O.jsx("div",{className:"nk-portal",ref:t,style:{display:"contents"},children:e})}function k(r){const{children:e}=r,t=P.useBoundary("Portal"),[n,s]=u.useState(!1);u.useEffect(()=>{s(!0)},[]);const c=t.portalElement;return n&&c?M.createPortal(O.jsx(T,{children:e}),c):null}const A=1e3,B=10,E=new WeakMap;function y(r){const e=E.get(r);if(e)return e;const t={focusLayers:new Set,layers:[],listeners:new Set};return E.set(r,t),t}function m(r){r.listeners.forEach(e=>e())}function F(r,e){const t=u.useRef(Symbol("nk-overlay-layer")),[,n]=u.useReducer(o=>o+1,0);u.useEffect(()=>{if(!r||!e)return;const o=y(e),l=()=>n();return o.listeners.add(l),o.layers.push(t.current),m(o),()=>{o.listeners.delete(l);const f=o.layers.indexOf(t.current);f>=0&&o.layers.splice(f,1),m(o)}},[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:A+i*B}}function g(r,e){const t=y(r).layers;return t.length>0&&t[t.length-1]===e}function _(r){var e;return(((e=E.get(r))==null?void 0:e.layers.length)??0)>0}function N(r,e,t){u.useEffect(()=>{if(!r||!e)return;const n=y(e);return n.focusLayers.add(t),()=>{n.focusLayers.delete(t)}},[r,t,e])}function b(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 C=1;function D(r){if(!r)return null;const e=r.nodeType===C?r:r.parentElement;return(e==null?void 0:e.closest(".nk-boundary"))??null}function I(r,e){var n;let t=D(r);for(;t!==null;){if(t===e)return!1;if(_(t))return!0;t=((n=t.parentElement)==null?void 0:n.closest(".nk-boundary"))??null}return!1}function x(r,e){return I(r.activeElement,e)}function q(r,e){return I(r,e)}function j(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 V(r){const{active:e,boundaries:t,boundary:n,dismissOnEscape:s=!0,dismissOnPointerDownOutside:c=!0,layerId:i,onEscapeDismiss:o,onEscapeKeyDown:l,onPointerDownOutside:f,onPointerDownOutsideDismiss:h,ownerDocument:d}=r;u.useEffect(()=>{if(!e||!d||!n)return;const p=n,R=d;function L(a){a.key!=="Escape"||!s||!g(p,i)||x(R,p)||(l==null||l(a),!a.defaultPrevented&&(a.preventDefault(),o==null||o()))}function v(a){if(!c||!g(p,i)||j(a,t))return;const S=a.target;q(S,p)||(f==null||f(a),!a.defaultPrevented&&(h==null||h()))}return d.addEventListener("keydown",L,!0),d.addEventListener("pointerdown",v,!0),()=>{d.removeEventListener("keydown",L,!0),d.removeEventListener("pointerdown",v,!0)}},[e,t,n,s,c,i,o,l,f,h,d])}function Y(){const[r,e]=u.useState(!1);return u.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 X(r,e=200){const t=Y(),[n,s]=u.useState(r);return u.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=w;exports.Portal=k;exports.isFocusInsideAnotherOverlay=x;exports.isTopmostFocusLayer=b;exports.useDismissableLayer=V;exports.useOverlayFocusLayer=N;exports.useOverlayLayer=F;exports.usePresence=X;