neatkit 0.11.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.
Files changed (55) hide show
  1. package/dist/{Button-DtrX4X-s.cjs → Button-6oWs-pyF.cjs} +1 -1
  2. package/dist/{Button-LmEHdRkW.js → Button-B0E-M8mp.js} +1 -1
  3. package/dist/Button.cjs +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/Card.cjs +1 -1
  6. package/dist/Card.js +75 -2
  7. package/dist/Checkbox.cjs +1 -1
  8. package/dist/Checkbox.js +1 -1
  9. package/dist/Code-f0GWveGp.cjs +4 -0
  10. package/dist/{Code-Bp2X1k-g.js → Code-pROJjsiG.js} +57 -58
  11. package/dist/Code.cjs +1 -1
  12. package/dist/Code.js +1 -1
  13. package/dist/Icon-BFaHVAoQ.cjs +1 -0
  14. package/dist/{Icon-NT3kRJYz.js → Icon-Cj1s40xn.js} +122 -91
  15. package/dist/Icon.cjs +1 -1
  16. package/dist/Icon.js +1 -1
  17. package/dist/Input.cjs +1 -1
  18. package/dist/Input.js +1 -1
  19. package/dist/Markdown.cjs +1 -1
  20. package/dist/Markdown.js +76 -75
  21. package/dist/Modal.cjs +1 -1
  22. package/dist/Modal.js +1 -1
  23. package/dist/PinInput.cjs +1 -1
  24. package/dist/PinInput.js +228 -192
  25. package/dist/Select.cjs +1 -1
  26. package/dist/Select.js +1 -1
  27. package/dist/Sidebar.cjs +1 -1
  28. package/dist/Sidebar.js +427 -344
  29. package/dist/{Table-GeoE4h-u.js → Table-B2G8CHJ9.js} +111 -108
  30. package/dist/Table-Z8Q6XRkc.cjs +1 -0
  31. package/dist/Table.cjs +1 -1
  32. package/dist/Table.js +1 -1
  33. package/dist/components/Card/Card.d.ts +22 -23
  34. package/dist/components/Card/components/CardBody.d.ts +24 -0
  35. package/dist/components/Card/components/CardFooter.d.ts +24 -0
  36. package/dist/components/Card/components/CardHeader.d.ts +24 -0
  37. package/dist/components/Card/index.d.ts +1 -1
  38. package/dist/components/Code/Code.d.ts +9 -7
  39. package/dist/components/Code/index.d.ts +1 -1
  40. package/dist/components/Icon/icons/ChainIcon.d.ts +11 -0
  41. package/dist/components/Icon/utils/registry.d.ts +1 -0
  42. package/dist/components/PinInput/hooks/usePinInput.d.ts +1 -1
  43. package/dist/components/Sidebar/Sidebar.d.ts +5 -0
  44. package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
  45. package/dist/components/Sidebar/hooks/useContentBelow.d.ts +23 -0
  46. package/dist/components/Sidebar/utils/children.d.ts +16 -0
  47. package/dist/components/Table/Table.d.ts +8 -2
  48. package/dist/components/Table/index.d.ts +1 -1
  49. package/dist/style.css +1 -1
  50. package/package.json +1 -1
  51. package/dist/Card-CPq6dsut.js +0 -34
  52. package/dist/Card-CQ-8_1tO.cjs +0 -1
  53. package/dist/Code-B7s_rN0G.cjs +0 -4
  54. package/dist/Icon-CMSHMSDJ.cjs +0 -1
  55. package/dist/Table-Bjw9lUKS.cjs +0 -1
package/dist/Sidebar.js CHANGED
@@ -1,290 +1,373 @@
1
1
  "use client";
2
- import { jsx as l, jsxs as R, Fragment as H } from "react/jsx-runtime";
3
- import { useCallback as k, useSyncExternalStore as ie, forwardRef as O, useId as oe, createElement as fe, useContext as me, useRef as I, useState as C, Fragment as ge, cloneElement as ve, useMemo as re, useEffect as ne } from "react";
4
- import { u as W, a as D } from "./effects-DGbA6Q2O.js";
5
- import { g as he, a as le } from "./reference-CXMr27nM.js";
6
- import { F as ae, c as ye, d as Se, b as _e, P as te } from "./usePresence-BTRY1_l-.js";
7
- import { B as K } from "./Button-LmEHdRkW.js";
8
- import { T as $ } from "./Text-rN6iDo0V.js";
9
- import { u as ke } from "./useFocusTrap-BxPazAL6.js";
10
- import { u as Ee } from "./useScrollLock-Drd7OZRC.js";
11
- import { m as Ne } from "./aria-Bv-xVREf.js";
12
- import { r as Pe } from "./useFloatingPosition-MGoyautY.js";
13
- import { A as we } from "./Avatar-DjDCFqNG.js";
14
- import { S as Ie } from "./Spinner-CmxlDlOk.js";
2
+ import { jsx as p, jsxs as D, Fragment as $ } from "react/jsx-runtime";
3
+ import { useCallback as _, useSyncExternalStore as le, forwardRef as R, useId as ce, createElement as ye, useState as w, useRef as I, Children as Se, isValidElement as re, Fragment as de, cloneElement as z, useContext as _e, useMemo as te, useEffect as ae } from "react";
4
+ import { u as K, a as M } from "./effects-DGbA6Q2O.js";
5
+ import { g as Ee, a as ue } from "./reference-CXMr27nM.js";
6
+ import { F as se, c as ke, d as Ce, b as Ne, P as oe } from "./usePresence-BTRY1_l-.js";
7
+ import { B as Y } from "./Button-B0E-M8mp.js";
8
+ import { T as V } from "./Text-rN6iDo0V.js";
9
+ import { u as Pe } from "./useFocusTrap-BxPazAL6.js";
10
+ import { u as Te } from "./useScrollLock-Drd7OZRC.js";
11
+ import { m as Ie } from "./aria-Bv-xVREf.js";
12
+ import { r as Le } from "./useFloatingPosition-MGoyautY.js";
13
+ import { A as Re } from "./Avatar-DjDCFqNG.js";
14
+ import { S as Be } from "./Spinner-CmxlDlOk.js";
15
15
  import { T as Oe } from "./Tooltip-CpyROf6x.js";
16
- import { b as Te } from "./units-BmjPCccF.js";
17
- function Be(a) {
18
- const { label: r, onToggle: e, panelId: n, reference: u, side: i, sidebarOpen: c } = a;
19
- return /* @__PURE__ */ l(
20
- K,
16
+ import { b as Fe } from "./units-BmjPCccF.js";
17
+ function xe(t) {
18
+ const { label: n, onToggle: e, panelId: r, reference: u, side: l, sidebarOpen: o } = t;
19
+ return /* @__PURE__ */ p(
20
+ Y,
21
21
  {
22
22
  ref: u,
23
- "aria-controls": n,
24
- "aria-expanded": c,
23
+ "aria-controls": r,
24
+ "aria-expanded": o,
25
25
  "aria-haspopup": "dialog",
26
- "aria-label": r,
26
+ "aria-label": n,
27
27
  className: "nk-sidebar__fallback-trigger",
28
- "data-side": i,
28
+ "data-side": l,
29
29
  icon: "burger",
30
30
  onClick: e
31
31
  }
32
32
  );
33
33
  }
34
- const A = /* @__PURE__ */ new WeakMap();
35
- function ce(a) {
36
- const r = A.get(a);
37
- if (r) return r;
34
+ const H = /* @__PURE__ */ new WeakMap();
35
+ function fe(t) {
36
+ const n = H.get(t);
37
+ if (n) return n;
38
38
  const e = {
39
39
  listeners: /* @__PURE__ */ new Set(),
40
40
  owner: null,
41
41
  state: void 0
42
42
  };
43
- return A.set(a, e), e;
43
+ return H.set(t, e), e;
44
44
  }
45
- function Fe(a, r, e) {
46
- const n = ce(a);
47
- return n.owner !== null && n.owner !== r ? !1 : (n.owner = r, n.state = e, n.listeners.forEach((u) => u()), !0);
45
+ function De(t, n, e) {
46
+ const r = fe(t);
47
+ return r.owner !== null && r.owner !== n ? !1 : (r.owner = n, r.state = e, r.listeners.forEach((u) => u()), !0);
48
48
  }
49
- function xe(a, r) {
50
- const e = A.get(a);
51
- !e || e.owner !== r || (e.owner = null, e.state = void 0, e.listeners.forEach((n) => n()));
49
+ function we(t, n) {
50
+ const e = H.get(t);
51
+ !e || e.owner !== n || (e.owner = null, e.state = void 0, e.listeners.forEach((r) => r()));
52
52
  }
53
- function Le(a) {
54
- var r;
55
- return a ? (r = A.get(a)) == null ? void 0 : r.state : void 0;
53
+ function Ae(t) {
54
+ var n;
55
+ return t ? (n = H.get(t)) == null ? void 0 : n.state : void 0;
56
56
  }
57
- function Re(a, r) {
58
- if (!a) return () => {
57
+ function je(t, n) {
58
+ if (!t) return () => {
59
59
  };
60
- const e = ce(a);
61
- return e.listeners.add(r), () => {
62
- e.listeners.delete(r);
60
+ const e = fe(t);
61
+ return e.listeners.add(n), () => {
62
+ e.listeners.delete(n);
63
63
  };
64
64
  }
65
- const Ce = () => {
65
+ const Me = () => {
66
66
  };
67
- function F(a) {
68
- const r = W(a).boundaryElement, e = k(
69
- (u) => Re(r, u),
70
- [r]
71
- ), n = k(() => Le(r), [r]);
72
- return ie(e, n, Ce);
67
+ function A(t) {
68
+ const n = K(t).boundaryElement, e = _(
69
+ (u) => je(n, u),
70
+ [n]
71
+ ), r = _(() => Ae(n), [n]);
72
+ return le(e, r, Me);
73
73
  }
74
- function j(a, r) {
75
- return a === "both" || a === (r === "overlay" ? "overlay" : "inline");
74
+ function U(t, n) {
75
+ return t === "both" || t === (n === "overlay" ? "overlay" : "inline");
76
76
  }
77
- const De = O(
78
- function(r, e) {
79
- const { children: n, className: u, presentation: i = "both", ...c } = r, s = F("Sidebar.Footer");
80
- return j(i, s == null ? void 0 : s.presentation) ? /* @__PURE__ */ l(
77
+ const be = R(
78
+ function(n, e) {
79
+ const { children: r, className: u, presentation: l = "both", ...o } = n, a = A("Sidebar.Footer");
80
+ return U(l, a == null ? void 0 : a.presentation) ? /* @__PURE__ */ p(
81
81
  "div",
82
82
  {
83
- ...c,
83
+ ...o,
84
84
  ref: e,
85
85
  className: ["nk-sidebar__footer", u].filter(Boolean).join(" "),
86
- children: n
86
+ children: r
87
87
  }
88
88
  ) : null;
89
89
  }
90
- ), Ae = O(
91
- function(r, e) {
90
+ ), He = R(
91
+ function(n, e) {
92
92
  const {
93
- "aria-label": n,
93
+ "aria-label": r,
94
94
  "aria-labelledby": u,
95
- children: i,
96
- className: c,
97
- label: s,
98
- presentation: y = "both",
99
- ...g
100
- } = r, h = F("Sidebar.Group"), v = `${oe()}-label`, b = s != null && typeof s != "boolean" && (typeof s != "string" || s.trim() !== "");
101
- if (!j(y, h == null ? void 0 : h.presentation))
95
+ children: l,
96
+ className: o,
97
+ label: a,
98
+ presentation: v = "both",
99
+ ...f
100
+ } = n, y = A("Sidebar.Group"), i = `${ce()}-label`, b = a != null && typeof a != "boolean" && (typeof a != "string" || a.trim() !== "");
101
+ if (!U(v, y == null ? void 0 : y.presentation))
102
102
  return null;
103
- const o = u ?? (n === void 0 && b ? v : void 0);
104
- return fe(
105
- !!(n ?? o) ? "nav" : "div",
103
+ const c = u ?? (r === void 0 && b ? i : void 0);
104
+ return ye(
105
+ !!(r ?? c) ? "nav" : "div",
106
106
  {
107
- ...g,
107
+ ...f,
108
108
  ref: e,
109
- "aria-label": n,
110
- "aria-labelledby": o,
111
- className: ["nk-sidebar__group", c].filter(Boolean).join(" ")
109
+ "aria-label": r,
110
+ "aria-labelledby": c,
111
+ className: ["nk-sidebar__group", o].filter(Boolean).join(" ")
112
112
  },
113
- b ? /* @__PURE__ */ l(
114
- $,
113
+ b ? /* @__PURE__ */ p(
114
+ V,
115
115
  {
116
116
  as: "h2",
117
117
  className: "nk-sidebar__group-label",
118
- id: v,
118
+ id: i,
119
119
  size: "subtitle",
120
120
  weight: "medium",
121
- children: s
121
+ children: a
122
122
  }
123
123
  ) : null,
124
- /* @__PURE__ */ l("ul", { className: "nk-sidebar__list", children: i })
124
+ /* @__PURE__ */ p("ul", { className: "nk-sidebar__list", children: l })
125
125
  );
126
126
  }
127
- ), je = O(
128
- function(r, e) {
129
- const { children: n, className: u, presentation: i = "both", ...c } = r, s = F("Sidebar.Header");
130
- return j(i, s == null ? void 0 : s.presentation) ? /* @__PURE__ */ l(
127
+ ), Ue = R(
128
+ function(n, e) {
129
+ const { children: r, className: u, presentation: l = "both", ...o } = n, a = A("Sidebar.Header");
130
+ return U(l, a == null ? void 0 : a.presentation) ? /* @__PURE__ */ p(
131
131
  "div",
132
132
  {
133
- ...c,
133
+ ...o,
134
134
  ref: e,
135
135
  className: ["nk-sidebar__header", u].filter(Boolean).join(" "),
136
- children: n
136
+ children: r
137
137
  }
138
138
  ) : null;
139
139
  }
140
- ), Ue = O(
141
- function(r, e) {
140
+ ), Ge = R(
141
+ function(n, e) {
142
142
  const {
143
- active: n = !1,
143
+ active: r = !1,
144
144
  as: u,
145
- children: i,
146
- className: c,
147
- disabled: s = !1,
148
- icon: y,
149
- onClick: g,
150
- presentation: h = "both",
151
- type: v,
145
+ children: l,
146
+ className: o,
147
+ disabled: a = !1,
148
+ icon: v,
149
+ onClick: f,
150
+ presentation: y = "both",
151
+ type: i,
152
152
  ...b
153
- } = r, o = F("Sidebar.Item"), t = u ?? "button", d = t === "button", f = b, E = f.href !== void 0 || f.to !== void 0;
154
- function m(N) {
155
- if (s) {
156
- N.preventDefault();
153
+ } = n, c = A("Sidebar.Item"), s = u ?? "button", d = s === "button", m = b, E = m.href !== void 0 || m.to !== void 0;
154
+ function g(S) {
155
+ if (a) {
156
+ S.preventDefault();
157
157
  return;
158
158
  }
159
- g == null || g(N), o != null && o.open && o.presentation === "overlay" && !N.defaultPrevented && o.requestOpenChange(!1, "item");
159
+ f == null || f(S), c != null && c.open && c.presentation === "overlay" && !S.defaultPrevented && c.requestOpenChange(!1, "item");
160
160
  }
161
- return j(h, o == null ? void 0 : o.presentation) ? /* @__PURE__ */ l("li", { className: "nk-sidebar__item-container", children: /* @__PURE__ */ l(
162
- K,
161
+ return U(y, c == null ? void 0 : c.presentation) ? /* @__PURE__ */ p("li", { className: "nk-sidebar__item-container", children: /* @__PURE__ */ p(
162
+ Y,
163
163
  {
164
164
  ...b,
165
165
  ref: e,
166
- "aria-current": n ? E ? "page" : "true" : void 0,
167
- as: t,
168
- className: ["nk-sidebar__item", c].filter(Boolean).join(" "),
169
- "data-active": n || void 0,
170
- disabled: s,
166
+ "aria-current": r ? E ? "page" : "true" : void 0,
167
+ as: s,
168
+ className: ["nk-sidebar__item", o].filter(Boolean).join(" "),
169
+ "data-active": r || void 0,
170
+ disabled: a,
171
171
  fullWidth: !0,
172
- href: f.href,
173
- icon: y,
174
- onClick: m,
172
+ href: m.href,
173
+ icon: v,
174
+ onClick: g,
175
175
  shape: "rectangle",
176
176
  textAlignment: "left",
177
- type: d ? v ?? "button" : v,
177
+ type: d ? i ?? "button" : i,
178
178
  variant: "ghost",
179
- children: /* @__PURE__ */ l("span", { className: "nk-sidebar__item-label", children: i })
179
+ children: /* @__PURE__ */ p("span", { className: "nk-sidebar__item-label", children: l })
180
180
  }
181
181
  ) }) : null;
182
182
  }
183
- );
184
- function de(a) {
183
+ ), qe = 1;
184
+ function $e(t) {
185
+ return t == null ? void 0 : t.ResizeObserver;
186
+ }
187
+ function ze(t) {
188
+ return t == null ? void 0 : t.MutationObserver;
189
+ }
190
+ function Ve() {
191
+ const [t, n] = w(!1), e = I(null), r = _((o) => {
192
+ const a = o.scrollHeight - o.scrollTop - o.clientHeight;
193
+ n(a > qe);
194
+ }, []), u = _((o) => {
195
+ var m;
196
+ if ((m = e.current) == null || m.call(e), e.current = null, !o) return;
197
+ const a = o;
198
+ r(a);
199
+ function v() {
200
+ r(a);
201
+ }
202
+ const f = a.ownerDocument.defaultView;
203
+ f == null || f.addEventListener("resize", v);
204
+ const y = $e(f), i = y ? new y(v) : void 0;
205
+ function b() {
206
+ i == null || i.disconnect(), i == null || i.observe(a);
207
+ for (const E of a.children)
208
+ i == null || i.observe(E);
209
+ }
210
+ b();
211
+ function c(E) {
212
+ E.some(
213
+ (S) => S.type === "childList"
214
+ ) && b(), v();
215
+ }
216
+ const s = ze(f), d = s ? new s(c) : void 0;
217
+ d == null || d.observe(a, {
218
+ attributeFilter: ["class", "hidden", "style"],
219
+ characterData: !0,
220
+ childList: !0,
221
+ subtree: !0
222
+ }), e.current = () => {
223
+ f == null || f.removeEventListener("resize", v), i == null || i.disconnect(), d == null || d.disconnect();
224
+ };
225
+ }, [r]), l = _((o) => {
226
+ r(o.currentTarget);
227
+ }, [r]);
228
+ return { containerReference: u, contentBelow: t, handleScroll: l };
229
+ }
230
+ function Ke(t, n) {
231
+ for (const e of Se.toArray(t)) {
232
+ if (re(e) && e.type === de) {
233
+ const r = pe(e.props.children);
234
+ r.bodyChildren.length > 0 && n.bodyChildren.push(z(
235
+ e,
236
+ void 0,
237
+ ...r.bodyChildren
238
+ )), r.footerChildren.length > 0 && n.footerChildren.push(z(
239
+ e,
240
+ void 0,
241
+ ...r.footerChildren
242
+ ));
243
+ continue;
244
+ }
245
+ re(e) && e.type === be ? n.footerChildren.push(e) : n.bodyChildren.push(e);
246
+ }
247
+ }
248
+ function pe(t) {
249
+ const n = {
250
+ bodyChildren: [],
251
+ footerChildren: []
252
+ };
253
+ return Ke(t, n), n;
254
+ }
255
+ function me(t) {
185
256
  const {
186
- "aria-label": r,
257
+ "aria-label": n,
187
258
  "aria-labelledby": e,
188
- children: n,
259
+ children: r,
189
260
  className: u,
190
- height: i,
191
- open: c,
192
- panelId: s,
193
- panelReference: y,
194
- presentation: g,
195
- side: h,
196
- state: v,
261
+ height: l,
262
+ open: o,
263
+ panelId: a,
264
+ panelReference: v,
265
+ presentation: f,
266
+ side: y,
267
+ state: i,
197
268
  style: b,
198
- width: o,
199
- ...t
200
- } = a, d = g === "overlay", f = r ?? (e === void 0 ? "Sidebar" : void 0), E = d && c;
201
- let m = b;
202
- return (o !== void 0 || i !== void 0) && (m = { ...b }, i !== void 0 && (m["--nk-sidebar-height"] = i), o !== void 0 && (m["--nk-sidebar-width"] = o)), /* @__PURE__ */ l(
269
+ width: c,
270
+ ...s
271
+ } = t, { containerReference: d, contentBelow: m, handleScroll: E } = Ve(), g = f === "overlay", { bodyChildren: S, footerChildren: B } = pe(r), O = n ?? (e === void 0 ? "Sidebar" : void 0), L = g && o;
272
+ let P = b;
273
+ return (c !== void 0 || l !== void 0) && (P = { ...b }, l !== void 0 && (P["--nk-sidebar-height"] = l), c !== void 0 && (P["--nk-sidebar-width"] = c)), /* @__PURE__ */ D(
203
274
  "aside",
204
275
  {
205
- ...t,
206
- ref: y,
207
- "aria-hidden": d && !c ? !0 : void 0,
208
- "aria-label": d && !c ? void 0 : f,
209
- "aria-labelledby": d && !c ? void 0 : e,
210
- "aria-modal": E ? "true" : void 0,
276
+ ...s,
277
+ ref: v,
278
+ "aria-hidden": g && !o ? !0 : void 0,
279
+ "aria-label": g && !o ? void 0 : O,
280
+ "aria-labelledby": g && !o ? void 0 : e,
281
+ "aria-modal": L ? "true" : void 0,
211
282
  className: ["nk-sidebar", u].filter(Boolean).join(" "),
212
- "data-responsive": g === "pending" || void 0,
213
- "data-side": h,
214
- "data-state": v,
215
- "data-variant": d ? "overlay" : "inline",
216
- id: s,
217
- role: E ? "dialog" : void 0,
218
- style: m,
219
- tabIndex: d ? -1 : void 0,
220
- children: /* @__PURE__ */ l("div", { className: "nk-sidebar__body", children: n })
283
+ "data-responsive": f === "pending" || void 0,
284
+ "data-side": y,
285
+ "data-state": i,
286
+ "data-variant": g ? "overlay" : "inline",
287
+ id: a,
288
+ role: L ? "dialog" : void 0,
289
+ style: P,
290
+ tabIndex: g ? -1 : void 0,
291
+ children: [
292
+ /* @__PURE__ */ p(
293
+ "div",
294
+ {
295
+ ref: d,
296
+ className: "nk-sidebar__body",
297
+ "data-content-below": m || void 0,
298
+ onScroll: E,
299
+ children: S
300
+ }
301
+ ),
302
+ B
303
+ ]
221
304
  }
222
305
  );
223
306
  }
224
- function ze(a) {
307
+ function Ye(t) {
225
308
  const {
226
- boundaries: r,
309
+ boundaries: n,
227
310
  initialFocusReference: e,
228
- lockScroll: n,
311
+ lockScroll: r,
229
312
  ownerDocument: u,
230
- panelReference: i,
231
- presenceState: c,
232
- restoreFocus: s,
233
- sidebar: y,
234
- side: g,
235
- ...h
236
- } = a, { id: v, open: b, requestOpenChange: o } = y, t = me(ae), d = I(null), [f, E] = C(null), m = W("Sidebar").boundaryElement, N = ye(!0, m), U = k((T) => {
237
- d.current = T, i(T), E(T);
238
- }, [i]);
239
- D(() => {
240
- f && (f.inert = !b);
241
- }, [b, f]);
242
- const z = k(() => {
243
- o(!1, "escape");
244
- }, [o]), G = k(() => {
245
- o(!1, "outside");
246
- }, [o]);
247
- Se({
248
- boundary: m,
313
+ panelReference: l,
314
+ presenceState: o,
315
+ restoreFocus: a,
316
+ sidebar: v,
317
+ side: f,
318
+ ...y
319
+ } = t, { id: i, open: b, requestOpenChange: c } = v, s = _e(se), d = I(null), [m, E] = w(null), g = K("Sidebar").boundaryElement, S = ke(!0, g), B = _((F) => {
320
+ d.current = F, l(F), E(F);
321
+ }, [l]);
322
+ M(() => {
323
+ m && (m.inert = !b);
324
+ }, [b, m]);
325
+ const O = _(() => {
326
+ c(!1, "escape");
327
+ }, [c]), L = _(() => {
328
+ c(!1, "outside");
329
+ }, [c]);
330
+ Ce({
331
+ boundary: g,
249
332
  active: b,
250
- boundaries: r,
333
+ boundaries: n,
251
334
  dismissOnEscape: !0,
252
335
  dismissOnPointerDownOutside: !0,
253
- layerId: N.id,
254
- onEscapeDismiss: z,
255
- onPointerDownOutsideDismiss: G,
336
+ layerId: S.id,
337
+ onEscapeDismiss: O,
338
+ onPointerDownOutsideDismiss: L,
256
339
  ownerDocument: u
257
340
  });
258
- const x = ke({
259
- boundary: m,
341
+ const P = Pe({
342
+ boundary: g,
260
343
  active: b,
261
- container: f,
344
+ container: m,
262
345
  initialFocusReference: e ?? d,
263
- layerId: N.id,
264
- restoreFocus: s
346
+ layerId: S.id,
347
+ restoreFocus: a
265
348
  });
266
- return Ee(n && b, u, m), /* @__PURE__ */ l(
267
- ae.Provider,
349
+ return Te(r && b, u, g), /* @__PURE__ */ p(
350
+ se.Provider,
268
351
  {
269
- value: b ? x : t,
270
- children: /* @__PURE__ */ l(
352
+ value: b ? P : s,
353
+ children: /* @__PURE__ */ p(
271
354
  "div",
272
355
  {
273
356
  className: "nk-sidebar__overlay",
274
- "data-side": g,
275
- "data-state": c,
357
+ "data-side": f,
358
+ "data-state": o,
276
359
  role: "presentation",
277
- style: { zIndex: N.zIndex },
278
- children: /* @__PURE__ */ l(
279
- de,
360
+ style: { zIndex: S.zIndex },
361
+ children: /* @__PURE__ */ p(
362
+ me,
280
363
  {
281
- ...h,
364
+ ...y,
282
365
  open: b,
283
- panelId: v,
284
- panelReference: U,
366
+ panelId: i,
367
+ panelReference: B,
285
368
  presentation: "overlay",
286
- side: g,
287
- state: c
369
+ side: f,
370
+ state: o
288
371
  }
289
372
  )
290
373
  }
@@ -292,248 +375,248 @@ function ze(a) {
292
375
  }
293
376
  );
294
377
  }
295
- function Ge(a) {
296
- const { children: r } = a;
297
- if (r.type === ge)
378
+ function Je(t) {
379
+ const { children: n } = t;
380
+ if (n.type === de)
298
381
  throw new Error("Sidebar.Trigger requires a single non-Fragment child");
299
- const e = F("Sidebar.Trigger"), n = r.props, u = he(r), i = e == null ? void 0 : e.registerTrigger, c = e == null ? void 0 : e.unregisterTrigger, s = I(null), y = k((d) => {
300
- const f = s.current;
301
- f && f !== d && (c == null || c(f)), s.current = d, d && (i == null || i(d)), le(u, d);
302
- }, [u, i, c]), g = k((d) => {
382
+ const e = A("Sidebar.Trigger"), r = n.props, u = Ee(n), l = e == null ? void 0 : e.registerTrigger, o = e == null ? void 0 : e.unregisterTrigger, a = I(null), v = _((d) => {
383
+ const m = a.current;
384
+ m && m !== d && (o == null || o(m)), a.current = d, d && (l == null || l(d)), ue(u, d);
385
+ }, [u, l, o]), f = _((d) => {
303
386
  d.defaultPrevented || !e || e.requestOpenChange(!e.open, "trigger");
304
387
  }, [e]);
305
388
  if (!e) return null;
306
- const { id: h, open: v, presentation: b, variant: o } = e;
307
- return ve(
308
- r,
309
- Pe(n, {
310
- "aria-controls": v && b === "overlay" ? Ne(n["aria-controls"], h) : n["aria-controls"],
311
- "aria-expanded": v,
312
- "aria-haspopup": n["aria-haspopup"] ?? "dialog",
389
+ const { id: y, open: i, presentation: b, variant: c } = e;
390
+ return z(
391
+ n,
392
+ Le(r, {
393
+ "aria-controls": i && b === "overlay" ? Ie(r["aria-controls"], y) : r["aria-controls"],
394
+ "aria-expanded": i,
395
+ "aria-haspopup": r["aria-haspopup"] ?? "dialog",
313
396
  className: "nk-sidebar__trigger",
314
- "data-sidebar-variant": o,
315
- onClick: g,
316
- ref: y
397
+ "data-sidebar-variant": c,
398
+ onClick: f,
399
+ ref: v
317
400
  })
318
401
  );
319
402
  }
320
- const Me = O(
321
- function(r, e) {
403
+ const Qe = R(
404
+ function(n, e) {
322
405
  const {
323
- actions: n,
406
+ actions: r,
324
407
  className: u,
325
- description: i,
326
- image: c,
327
- loading: s = !1,
328
- name: y,
329
- onClick: g,
330
- ...h
331
- } = r, v = i != null && typeof i != "boolean", b = /* @__PURE__ */ R(H, { children: [
332
- /* @__PURE__ */ l(
333
- we,
408
+ description: l,
409
+ image: o,
410
+ loading: a = !1,
411
+ name: v,
412
+ onClick: f,
413
+ ...y
414
+ } = n, i = l != null && typeof l != "boolean", b = /* @__PURE__ */ D($, { children: [
415
+ /* @__PURE__ */ p(
416
+ Re,
334
417
  {
335
- alt: y,
418
+ alt: v,
336
419
  "aria-hidden": !0,
337
420
  className: "nk-sidebar__user-avatar",
338
- image: c
421
+ image: o
339
422
  }
340
423
  ),
341
- /* @__PURE__ */ R("span", { className: "nk-sidebar__user-text", children: [
342
- /* @__PURE__ */ l($, { as: "span", className: "nk-sidebar__user-name", children: y }),
343
- v ? /* @__PURE__ */ l(
344
- $,
424
+ /* @__PURE__ */ D("span", { className: "nk-sidebar__user-text", children: [
425
+ /* @__PURE__ */ p(V, { as: "span", className: "nk-sidebar__user-name", children: v }),
426
+ i ? /* @__PURE__ */ p(
427
+ V,
345
428
  {
346
429
  as: "span",
347
430
  className: "nk-sidebar__user-description",
348
431
  size: "caption",
349
432
  tone: "muted",
350
- children: i
433
+ children: l
351
434
  }
352
435
  ) : null
353
436
  ] })
354
437
  ] });
355
- return /* @__PURE__ */ l(
438
+ return /* @__PURE__ */ p(
356
439
  "div",
357
440
  {
358
- ...h,
441
+ ...y,
359
442
  ref: e,
360
443
  className: ["nk-sidebar__user", u].filter(Boolean).join(" "),
361
- children: s ? /* @__PURE__ */ l(Ie, { className: "nk-sidebar__user-spinner", size: 16 }) : /* @__PURE__ */ R(H, { children: [
362
- g ? /* @__PURE__ */ l(
444
+ children: a ? /* @__PURE__ */ p(Be, { className: "nk-sidebar__user-spinner", size: 16 }) : /* @__PURE__ */ D($, { children: [
445
+ f ? /* @__PURE__ */ p(
363
446
  "button",
364
447
  {
365
448
  className: "nk-sidebar__user-details",
366
- onClick: g,
449
+ onClick: f,
367
450
  type: "button",
368
451
  children: b
369
452
  }
370
- ) : /* @__PURE__ */ l("div", { className: "nk-sidebar__user-details", children: b }),
371
- n !== void 0 && n.length > 0 ? /* @__PURE__ */ l("div", { className: "nk-sidebar__user-actions", children: n.map((o) => {
453
+ ) : /* @__PURE__ */ p("div", { className: "nk-sidebar__user-details", children: b }),
454
+ r !== void 0 && r.length > 0 ? /* @__PURE__ */ p("div", { className: "nk-sidebar__user-actions", children: r.map((c) => {
372
455
  const {
373
- "aria-label": t,
456
+ "aria-label": s,
374
457
  icon: d,
375
- label: f,
458
+ label: m,
376
459
  ...E
377
- } = o;
378
- return /* @__PURE__ */ l(Oe, { content: f, children: /* @__PURE__ */ l(
379
- K,
460
+ } = c;
461
+ return /* @__PURE__ */ p(Oe, { content: m, children: /* @__PURE__ */ p(
462
+ Y,
380
463
  {
381
464
  ...E,
382
- "aria-label": t ?? f,
465
+ "aria-label": s ?? m,
383
466
  className: "nk-sidebar__user-action",
384
467
  icon: d,
385
468
  shape: "rectangle",
386
469
  type: "button",
387
470
  variant: "ghost"
388
471
  }
389
- ) }, f);
472
+ ) }, m);
390
473
  }) }) : null
391
474
  ] })
392
475
  }
393
476
  );
394
477
  }
395
- ), qe = () => () => {
396
- }, se = () => {
478
+ ), Xe = () => () => {
479
+ }, ie = () => {
397
480
  };
398
- function He(a, r) {
399
- const e = a === "responsive" ? r : void 0, n = ie(
400
- (e == null ? void 0 : e.subscribe) ?? qe,
401
- (e == null ? void 0 : e.read) ?? se,
402
- se
481
+ function Ze(t, n) {
482
+ const e = t === "responsive" ? n : void 0, r = le(
483
+ (e == null ? void 0 : e.subscribe) ?? Xe,
484
+ (e == null ? void 0 : e.read) ?? ie,
485
+ ie
403
486
  );
404
- return a !== "responsive" ? a : n === void 0 ? "pending" : n >= Te("md") ? "inline" : "overlay";
487
+ return t !== "responsive" ? t : r === void 0 ? "pending" : r >= Fe("md") ? "inline" : "overlay";
405
488
  }
406
- const $e = 32, We = O(function(r, e) {
407
- var ee;
489
+ const We = 32, en = R(function(n, e) {
490
+ var ne;
408
491
  const {
409
- defaultOpen: n = !1,
492
+ defaultOpen: r = !1,
410
493
  height: u,
411
- initialFocusReference: i,
412
- lockScroll: c = !0,
413
- onOpenChange: s,
414
- open: y,
415
- restoreFocus: g = !0,
416
- side: h = "left",
417
- variant: v = "responsive",
494
+ initialFocusReference: l,
495
+ lockScroll: o = !0,
496
+ onOpenChange: a,
497
+ open: v,
498
+ restoreFocus: f = !0,
499
+ side: y = "left",
500
+ variant: i = "responsive",
418
501
  width: b,
419
- ...o
420
- } = r, t = W("Sidebar"), d = `${oe()}-sidebar`, f = I(Symbol("nk-sidebar")).current, E = I(null), m = He(v, t == null ? void 0 : t.width), N = y !== void 0, [U, z] = C(n), [G, x] = C(0), [T, ue] = C(!1), V = I(null), w = N ? y : U, L = I(s);
421
- D(() => {
422
- L.current = s;
502
+ ...c
503
+ } = n, s = K("Sidebar"), d = `${ce()}-sidebar`, m = I(Symbol("nk-sidebar")).current, E = I(null), g = Ze(i, s == null ? void 0 : s.width), S = v !== void 0, [B, O] = w(r), [L, P] = w(0), [F, he] = w(!1), J = I(null), T = S ? v : B, j = I(a);
504
+ M(() => {
505
+ j.current = a;
423
506
  });
424
- const B = k((p, S) => {
425
- var _;
426
- w !== p && (N || z(p), (_ = L.current) == null || _.call(L, p, S));
427
- }, [N, w]), Y = k((p) => {
428
- E.current = p, le(e, p);
429
- }, [e]), P = re(
507
+ const x = _((h, k) => {
508
+ var C;
509
+ T !== h && (S || O(h), (C = j.current) == null || C.call(j, h, k));
510
+ }, [S, T]), Q = _((h) => {
511
+ E.current = h, ue(e, h);
512
+ }, [e]), N = te(
430
513
  () => [E],
431
514
  []
432
- ), J = k((p) => {
433
- P.push({ current: p }), x((S) => S + 1);
434
- }, [P]), Q = k((p) => {
435
- const S = P.findIndex((_) => _.current === p);
436
- S > 0 && P.splice(S, 1), x((_) => Math.max(_ - 1, 0));
437
- }, [P]), pe = k((p) => {
438
- const S = V.current;
439
- if (S && S !== p) {
440
- const _ = P.findIndex((be) => be.current === S);
441
- _ > 0 && P.splice(_, 1);
515
+ ), X = _((h) => {
516
+ N.push({ current: h }), P((k) => k + 1);
517
+ }, [N]), Z = _((h) => {
518
+ const k = N.findIndex((C) => C.current === h);
519
+ k > 0 && N.splice(k, 1), P((C) => Math.max(C - 1, 0));
520
+ }, [N]), ge = _((h) => {
521
+ const k = J.current;
522
+ if (k && k !== h) {
523
+ const C = N.findIndex((ve) => ve.current === k);
524
+ C > 0 && N.splice(C, 1);
442
525
  }
443
- V.current = p, p && P.push({ current: p });
444
- }, [P]), M = re(() => ({
526
+ J.current = h, h && N.push({ current: h });
527
+ }, [N]), G = te(() => ({
445
528
  id: d,
446
- open: w,
447
- presentation: m,
448
- registerTrigger: J,
449
- requestOpenChange: B,
450
- unregisterTrigger: Q,
451
- variant: v
529
+ open: T,
530
+ presentation: g,
531
+ registerTrigger: X,
532
+ requestOpenChange: x,
533
+ unregisterTrigger: Z,
534
+ variant: i
452
535
  }), [
453
- w,
536
+ T,
454
537
  d,
455
- m,
456
- J,
457
- B,
458
- Q,
459
- v
538
+ g,
539
+ X,
540
+ x,
541
+ Z,
542
+ i
460
543
  ]);
461
- D(() => {
462
- const p = t == null ? void 0 : t.boundaryElement;
463
- if (!p) return;
464
- if (Fe(p, f, M) === !1)
544
+ M(() => {
545
+ const h = s == null ? void 0 : s.boundaryElement;
546
+ if (!h) return;
547
+ if (De(h, m, G) === !1)
465
548
  throw new Error(
466
549
  "A Boundary supports one Sidebar. Neatkit resolves Trigger, Group, and Item interactions against the single Sidebar published to the nearest Boundary, so give each Sidebar a Boundary of its own."
467
550
  );
468
- }, [t == null ? void 0 : t.boundaryElement, f, M]), D(() => {
469
- const p = t == null ? void 0 : t.boundaryElement;
470
- if (p)
471
- return () => xe(p, f);
472
- }, [t == null ? void 0 : t.boundaryElement, f]), ne(() => {
473
- m === "inline" && B(!1, "variant");
474
- }, [m, B]), ne(() => {
475
- var _;
476
- const p = (_ = t == null ? void 0 : t.boundaryElement) == null ? void 0 : _.ownerDocument.defaultView;
477
- if (!p) return;
478
- const S = p.setTimeout(
479
- () => ue(!0),
480
- $e
551
+ }, [s == null ? void 0 : s.boundaryElement, m, G]), M(() => {
552
+ const h = s == null ? void 0 : s.boundaryElement;
553
+ if (h)
554
+ return () => we(h, m);
555
+ }, [s == null ? void 0 : s.boundaryElement, m]), ae(() => {
556
+ g === "inline" && x(!1, "variant");
557
+ }, [g, x]), ae(() => {
558
+ var C;
559
+ const h = (C = s == null ? void 0 : s.boundaryElement) == null ? void 0 : C.ownerDocument.defaultView;
560
+ if (!h) return;
561
+ const k = h.setTimeout(
562
+ () => he(!0),
563
+ We
481
564
  );
482
- return () => p.clearTimeout(S);
483
- }, [t == null ? void 0 : t.boundaryElement]);
484
- const q = _e(w && m === "overlay"), X = ((ee = t == null ? void 0 : t.boundaryElement) == null ? void 0 : ee.ownerDocument) ?? (typeof document > "u" ? null : document);
485
- if (m !== "overlay")
486
- return /* @__PURE__ */ l(
487
- de,
565
+ return () => h.clearTimeout(k);
566
+ }, [s == null ? void 0 : s.boundaryElement]);
567
+ const q = Ne(T && g === "overlay"), W = ((ne = s == null ? void 0 : s.boundaryElement) == null ? void 0 : ne.ownerDocument) ?? (typeof document > "u" ? null : document);
568
+ if (g !== "overlay")
569
+ return /* @__PURE__ */ p(
570
+ me,
488
571
  {
489
- ...o,
572
+ ...c,
490
573
  height: u,
491
574
  open: !1,
492
575
  panelId: d,
493
- panelReference: Y,
494
- presentation: m,
495
- side: h,
576
+ panelReference: Q,
577
+ presentation: g,
578
+ side: y,
496
579
  width: b
497
580
  }
498
581
  );
499
- const Z = T && G === 0 ? /* @__PURE__ */ l(te, { children: /* @__PURE__ */ l(
500
- Be,
582
+ const ee = F && L === 0 ? /* @__PURE__ */ p(oe, { children: /* @__PURE__ */ p(
583
+ xe,
501
584
  {
502
- label: `Open ${o["aria-label"] ?? "Sidebar"}`,
503
- onToggle: () => B(!w, "trigger"),
585
+ label: `Open ${c["aria-label"] ?? "Sidebar"}`,
586
+ onToggle: () => x(!T, "trigger"),
504
587
  panelId: q.present ? d : void 0,
505
- reference: pe,
506
- side: h,
507
- sidebarOpen: w
588
+ reference: ge,
589
+ side: y,
590
+ sidebarOpen: T
508
591
  }
509
592
  ) }) : null;
510
- return !q.present || !X ? Z : /* @__PURE__ */ R(H, { children: [
511
- Z,
512
- /* @__PURE__ */ l(te, { children: /* @__PURE__ */ l(
513
- ze,
593
+ return !q.present || !W ? ee : /* @__PURE__ */ D($, { children: [
594
+ ee,
595
+ /* @__PURE__ */ p(oe, { children: /* @__PURE__ */ p(
596
+ Ye,
514
597
  {
515
- ...o,
516
- boundaries: P,
517
- initialFocusReference: i,
518
- lockScroll: c,
519
- ownerDocument: X,
520
- panelReference: Y,
598
+ ...c,
599
+ boundaries: N,
600
+ initialFocusReference: l,
601
+ lockScroll: o,
602
+ ownerDocument: W,
603
+ panelReference: Q,
521
604
  presenceState: q.state === "closing" ? "closing" : "open",
522
- restoreFocus: g,
523
- side: h,
524
- sidebar: M,
605
+ restoreFocus: f,
606
+ side: y,
607
+ sidebar: G,
525
608
  width: b
526
609
  }
527
610
  ) })
528
611
  ] });
529
- }), lr = Object.assign(We, {
530
- Footer: De,
531
- Group: Ae,
532
- Header: je,
533
- Item: Ue,
534
- Trigger: Ge,
535
- User: Me
612
+ }), gn = Object.assign(en, {
613
+ Footer: be,
614
+ Group: He,
615
+ Header: Ue,
616
+ Item: Ge,
617
+ Trigger: Je,
618
+ User: Qe
536
619
  });
537
620
  export {
538
- lr as default
621
+ gn as default
539
622
  };