neatkit 0.8.0 → 0.9.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 (82) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +29 -29
  3. package/dist/Button-BV5OUXpc.js +101 -0
  4. package/dist/Button-DU4j_IED.cjs +1 -0
  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 +1 -1
  9. package/dist/{Code-JDb4VFl7.cjs → Code-B7s_rN0G.cjs} +1 -1
  10. package/dist/{Code-ClkozPlv.js → Code-Bp2X1k-g.js} +1 -4
  11. package/dist/Code.cjs +1 -1
  12. package/dist/Code.js +1 -1
  13. package/dist/Divider-C7XGlr26.cjs +1 -0
  14. package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
  15. package/dist/Divider.cjs +1 -1
  16. package/dist/Divider.js +1 -1
  17. package/dist/Icon-BIBzgznI.cjs +1 -0
  18. package/dist/{Icon-BoEUoOk7.js → Icon-CxK1wlGk.js} +98 -52
  19. package/dist/Icon.cjs +1 -1
  20. package/dist/Icon.js +1 -1
  21. package/dist/Input.cjs +1 -1
  22. package/dist/Input.js +1 -1
  23. package/dist/Markdown.cjs +1 -1
  24. package/dist/Markdown.js +108 -104
  25. package/dist/Modal.cjs +1 -1
  26. package/dist/Modal.js +1 -1
  27. package/dist/Popover.cjs +1 -1
  28. package/dist/Popover.js +147 -141
  29. package/dist/Select.cjs +1 -1
  30. package/dist/Select.js +2 -2
  31. package/dist/Sidebar.cjs +1 -1
  32. package/dist/Sidebar.js +310 -295
  33. package/dist/Table-CADupJEU.js +423 -0
  34. package/dist/Table-qetwZpTC.cjs +1 -0
  35. package/dist/Table.cjs +1 -1
  36. package/dist/Table.js +1 -1
  37. package/dist/{Tooltip-B4bajPtk.cjs → Tooltip-B2d5ss7S.cjs} +1 -1
  38. package/dist/{Tooltip-BVqdnKK_.js → Tooltip-BK64rkxV.js} +1 -1
  39. package/dist/Tooltip.cjs +1 -1
  40. package/dist/Tooltip.js +1 -1
  41. package/dist/albert-sans-cb3e34c4.woff2 +0 -0
  42. package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
  43. package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
  44. package/dist/components/Icon/utils/registry.d.ts +2 -0
  45. package/dist/components/Sidebar/Sidebar.d.ts +6 -1
  46. package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
  47. package/dist/components/Sidebar/components/SidebarGroup.d.ts +5 -16
  48. package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
  49. package/dist/components/Sidebar/components/SidebarItem.d.ts +3 -0
  50. package/dist/components/Sidebar/components/SidebarPanel.d.ts +2 -2
  51. package/dist/components/Sidebar/hooks/usePresentation.d.ts +2 -2
  52. package/dist/components/Sidebar/index.d.ts +1 -1
  53. package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
  54. package/dist/components/Sidebar/utils/state.d.ts +2 -2
  55. package/dist/components/Table/Table.d.ts +21 -209
  56. package/dist/components/Table/components/TableAction.d.ts +18 -0
  57. package/dist/components/Table/components/TableActionCell.d.ts +15 -0
  58. package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
  59. package/dist/components/Table/components/TableBody.d.ts +27 -0
  60. package/dist/components/Table/components/TableCell.d.ts +42 -0
  61. package/dist/components/Table/components/TableFoot.d.ts +19 -0
  62. package/dist/components/Table/components/TableHead.d.ts +19 -0
  63. package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
  64. package/dist/components/Table/components/TableRow.d.ts +67 -0
  65. package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
  66. package/dist/components/Table/utils/cell.d.ts +25 -0
  67. package/dist/components/Table/utils/children.d.ts +18 -0
  68. package/dist/components/Table/utils/trigger.d.ts +54 -0
  69. package/dist/floating-position-DIjh2wnP.cjs +1 -0
  70. package/dist/floating-position-DvR6e334.js +50 -0
  71. package/dist/style.css +1 -1
  72. package/dist/{useFloatingPosition-CMirP2-2.js → useFloatingPosition-B3ZC-v3v.js} +1 -1
  73. package/dist/{useFloatingPosition-BBEUHPqy.cjs → useFloatingPosition-GzkP9dCc.cjs} +1 -1
  74. package/package.json +2 -1
  75. package/dist/Button-Chv4O66e.js +0 -99
  76. package/dist/Button-DCKtFvSo.cjs +0 -1
  77. package/dist/Divider-CJYbFcSX.cjs +0 -1
  78. package/dist/Icon-DJ4BigRz.cjs +0 -1
  79. package/dist/Table-B30TBckZ.js +0 -402
  80. package/dist/Table-DceR12X9.cjs +0 -1
  81. package/dist/floating-position-5wJ5G5IT.js +0 -48
  82. package/dist/floating-position-Cy9xxdH4.cjs +0 -1
package/dist/Sidebar.js CHANGED
@@ -1,258 +1,272 @@
1
1
  "use client";
2
- import { jsx as c, jsxs as D, Fragment as J } from "react/jsx-runtime";
3
- import { forwardRef as B, useCallback as _, useSyncExternalStore as W, useId as X, createElement as ae, useContext as te, useRef as O, useState as Y, Fragment as se, cloneElement as ie, useMemo as K, useEffect as oe } from "react";
2
+ import { jsx as d, jsxs as A, Fragment as K } from "react/jsx-runtime";
3
+ import { useCallback as k, useSyncExternalStore as X, forwardRef as I, useId as Y, createElement as ae, useContext as se, useRef as B, useState as Z, Fragment as ie, cloneElement as oe, useMemo as Q, useEffect as le } from "react";
4
4
  import { u as R } from "./effects-D5CWf-Pl.js";
5
- import { g as le, a as Z } from "./reference-CXMr27nM.js";
6
- import { b as A, F as Q, d as ce, e as de, c as ue, P as pe } from "./usePresence-CqegYqy4.js";
7
- import { T as j } from "./Text-rN6iDo0V.js";
8
- import { B as ee } from "./Button-Chv4O66e.js";
9
- import { u as be } from "./useFocusTrap-DhVnlboe.js";
10
- import { u as fe } from "./useScrollLock-Drd7OZRC.js";
11
- import { m as me } from "./aria-CeA9QfD1.js";
12
- import { A as ve } from "./Avatar-DjDCFqNG.js";
13
- import { S as ge } from "./Spinner-CVYvk6YK.js";
14
- import { T as ye } from "./Tooltip-BVqdnKK_.js";
15
- import { b as he } from "./units-BmjPCccF.js";
16
- const Se = B(
17
- function(r, e) {
18
- const { children: n, className: d, ...o } = r;
19
- return /* @__PURE__ */ c(
20
- "div",
21
- {
22
- ...o,
23
- ref: e,
24
- className: ["nk-sidebar__footer", d].filter(Boolean).join(" "),
25
- children: n
26
- }
27
- );
28
- }
29
- ), F = /* @__PURE__ */ new WeakMap();
30
- function ne(t) {
31
- const r = F.get(t);
32
- if (r) return r;
5
+ import { g as ce, a as ee } from "./reference-CXMr27nM.js";
6
+ import { b as z, F as V, d as de, e as ue, c as pe, P as be } from "./usePresence-CqegYqy4.js";
7
+ import { T as U } from "./Text-rN6iDo0V.js";
8
+ import { B as ne } from "./Button-BV5OUXpc.js";
9
+ import { u as fe } from "./useFocusTrap-DhVnlboe.js";
10
+ import { u as me } from "./useScrollLock-Drd7OZRC.js";
11
+ import { m as ve } from "./aria-CeA9QfD1.js";
12
+ import { A as ge } from "./Avatar-DjDCFqNG.js";
13
+ import { S as he } from "./Spinner-CVYvk6YK.js";
14
+ import { T as ye } from "./Tooltip-BK64rkxV.js";
15
+ import { b as Se } from "./units-BmjPCccF.js";
16
+ const L = /* @__PURE__ */ new WeakMap();
17
+ function re(t) {
18
+ const n = L.get(t);
19
+ if (n) return n;
33
20
  const e = {
34
21
  listeners: /* @__PURE__ */ new Set(),
35
22
  owner: null,
36
23
  state: void 0
37
24
  };
38
- return F.set(t, e), e;
25
+ return L.set(t, e), e;
39
26
  }
40
- function _e(t, r, e) {
41
- const n = ne(t);
42
- return n.owner !== null && n.owner !== r ? !1 : (n.owner = r, n.state = e, n.listeners.forEach((d) => d()), !0);
27
+ function _e(t, n, e) {
28
+ const r = re(t);
29
+ return r.owner !== null && r.owner !== n ? !1 : (r.owner = n, r.state = e, r.listeners.forEach((b) => b()), !0);
43
30
  }
44
- function ke(t, r) {
45
- const e = F.get(t);
46
- !e || e.owner !== r || (e.owner = null, e.state = void 0, e.listeners.forEach((n) => n()));
31
+ function ke(t, n) {
32
+ const e = L.get(t);
33
+ !e || e.owner !== n || (e.owner = null, e.state = void 0, e.listeners.forEach((r) => r()));
47
34
  }
48
35
  function Ee(t) {
49
- var r;
50
- return t ? (r = F.get(t)) == null ? void 0 : r.state : void 0;
36
+ var n;
37
+ return t ? (n = L.get(t)) == null ? void 0 : n.state : void 0;
51
38
  }
52
- function Ne(t, r) {
39
+ function Ne(t, n) {
53
40
  if (!t) return () => {
54
41
  };
55
- const e = ne(t);
56
- return e.listeners.add(r), () => {
57
- e.listeners.delete(r);
42
+ const e = re(t);
43
+ return e.listeners.add(n), () => {
44
+ e.listeners.delete(n);
58
45
  };
59
46
  }
60
47
  const Pe = () => {
61
48
  };
62
- function U(t) {
63
- const r = A(t).boundaryElement, e = _(
64
- (d) => Ne(r, d),
65
- [r]
66
- ), n = _(() => Ee(r), [r]);
67
- return W(e, n, Pe);
49
+ function T(t) {
50
+ const n = z(t).boundaryElement, e = k(
51
+ (b) => Ne(n, b),
52
+ [n]
53
+ ), r = k(() => Ee(n), [n]);
54
+ return X(e, r, Pe);
68
55
  }
69
- const we = B(
70
- function(r, e) {
56
+ function x(t, n) {
57
+ return t === "both" || t === (n === "overlay" ? "overlay" : "inline");
58
+ }
59
+ const we = I(
60
+ function(n, e) {
61
+ const { children: r, className: b, presentation: o = "both", ...u } = n, a = T("Sidebar.Footer");
62
+ return x(o, a == null ? void 0 : a.presentation) ? /* @__PURE__ */ d(
63
+ "div",
64
+ {
65
+ ...u,
66
+ ref: e,
67
+ className: ["nk-sidebar__footer", b].filter(Boolean).join(" "),
68
+ children: r
69
+ }
70
+ ) : null;
71
+ }
72
+ ), Ie = I(
73
+ function(n, e) {
71
74
  const {
72
- "aria-label": n,
73
- "aria-labelledby": d,
75
+ "aria-label": r,
76
+ "aria-labelledby": b,
74
77
  children: o,
75
- className: b,
76
- label: u,
78
+ className: u,
79
+ label: a,
77
80
  presentation: y = "both",
78
- ...f
79
- } = r, g = U("Sidebar.Group"), m = `${X()}-label`, i = (g == null ? void 0 : g.presentation) === "overlay" ? "overlay" : "inline", p = u != null && typeof u != "boolean" && (typeof u != "string" || u.trim() !== "");
80
- if (y !== "both" && y !== i)
81
+ ...m
82
+ } = n, g = T("Sidebar.Group"), v = `${Y()}-label`, p = a != null && typeof a != "boolean" && (typeof a != "string" || a.trim() !== "");
83
+ if (!x(y, g == null ? void 0 : g.presentation))
81
84
  return null;
82
- const a = d ?? (n === void 0 && p ? m : void 0);
85
+ const i = b ?? (r === void 0 && p ? v : void 0);
83
86
  return ae(
84
- !!(n ?? a) ? "nav" : "div",
87
+ !!(r ?? i) ? "nav" : "div",
85
88
  {
86
- ...f,
89
+ ...m,
87
90
  ref: e,
88
- "aria-label": n,
89
- "aria-labelledby": a,
90
- className: ["nk-sidebar__group", b].filter(Boolean).join(" ")
91
+ "aria-label": r,
92
+ "aria-labelledby": i,
93
+ className: ["nk-sidebar__group", u].filter(Boolean).join(" ")
91
94
  },
92
- p ? /* @__PURE__ */ c(
93
- j,
95
+ p ? /* @__PURE__ */ d(
96
+ U,
94
97
  {
95
98
  as: "h2",
96
99
  className: "nk-sidebar__group-label",
97
- id: m,
100
+ id: v,
98
101
  size: "subtitle",
99
102
  weight: "medium",
100
- children: u
103
+ children: a
101
104
  }
102
105
  ) : null,
103
- /* @__PURE__ */ c("ul", { className: "nk-sidebar__list", children: o })
106
+ /* @__PURE__ */ d("ul", { className: "nk-sidebar__list", children: o })
104
107
  );
105
108
  }
106
- ), Ie = B(
107
- function(r, e) {
109
+ ), Oe = I(
110
+ function(n, e) {
111
+ const { children: r, className: b, presentation: o = "both", ...u } = n, a = T("Sidebar.Header");
112
+ return x(o, a == null ? void 0 : a.presentation) ? /* @__PURE__ */ d(
113
+ "div",
114
+ {
115
+ ...u,
116
+ ref: e,
117
+ className: ["nk-sidebar__header", b].filter(Boolean).join(" "),
118
+ children: r
119
+ }
120
+ ) : null;
121
+ }
122
+ ), Be = I(
123
+ function(n, e) {
108
124
  const {
109
- active: n = !1,
110
- as: d,
125
+ active: r = !1,
126
+ as: b,
111
127
  children: o,
112
- className: b,
113
- disabled: u = !1,
128
+ className: u,
129
+ disabled: a = !1,
114
130
  icon: y,
115
- onClick: f,
116
- type: g,
117
- ...m
118
- } = r, i = U("Sidebar.Item"), p = d ?? "button", a = p === "button", s = m, l = s.href !== void 0 || s.to !== void 0;
119
- function S(v) {
120
- if (u) {
121
- v.preventDefault();
131
+ onClick: m,
132
+ presentation: g = "both",
133
+ type: v,
134
+ ...p
135
+ } = n, i = T("Sidebar.Item"), s = b ?? "button", l = s === "button", c = p, S = c.href !== void 0 || c.to !== void 0;
136
+ function f(_) {
137
+ if (a) {
138
+ _.preventDefault();
122
139
  return;
123
140
  }
124
- f == null || f(v), i != null && i.open && i.presentation === "overlay" && !v.defaultPrevented && i.requestOpenChange(!1, "item");
141
+ m == null || m(_), i != null && i.open && i.presentation === "overlay" && !_.defaultPrevented && i.requestOpenChange(!1, "item");
125
142
  }
126
- return /* @__PURE__ */ c("li", { className: "nk-sidebar__item-container", children: /* @__PURE__ */ c(
127
- ee,
143
+ return x(g, i == null ? void 0 : i.presentation) ? /* @__PURE__ */ d("li", { className: "nk-sidebar__item-container", children: /* @__PURE__ */ d(
144
+ ne,
128
145
  {
129
- ...m,
146
+ ...p,
130
147
  ref: e,
131
- "aria-current": n ? l ? "page" : "true" : void 0,
132
- as: p,
133
- className: ["nk-sidebar__item", b].filter(Boolean).join(" "),
134
- "data-active": n || void 0,
135
- disabled: u,
148
+ "aria-current": r ? S ? "page" : "true" : void 0,
149
+ as: s,
150
+ className: ["nk-sidebar__item", u].filter(Boolean).join(" "),
151
+ "data-active": r || void 0,
152
+ disabled: a,
136
153
  fullWidth: !0,
137
- href: s.href,
154
+ href: c.href,
138
155
  icon: y,
139
- onClick: S,
156
+ onClick: f,
140
157
  shape: "rectangle",
141
158
  textAlignment: "left",
142
- type: a ? g ?? "button" : g,
159
+ type: l ? v ?? "button" : v,
143
160
  variant: "ghost",
144
- children: /* @__PURE__ */ c("span", { className: "nk-sidebar__item-label", children: o })
161
+ children: /* @__PURE__ */ d("span", { className: "nk-sidebar__item-label", children: o })
145
162
  }
146
- ) });
163
+ ) }) : null;
147
164
  }
148
165
  );
149
- function re(t) {
166
+ function te(t) {
150
167
  const {
151
- "aria-label": r,
168
+ "aria-label": n,
152
169
  "aria-labelledby": e,
153
- children: n,
154
- className: d,
170
+ children: r,
171
+ className: b,
155
172
  top: o,
156
- open: b,
157
- panelId: u,
173
+ open: u,
174
+ panelId: a,
158
175
  panelReference: y,
159
- presentation: f,
176
+ presentation: m,
160
177
  side: g,
161
- state: m,
162
- style: i,
163
- width: p,
164
- ...a
165
- } = t, s = f === "overlay", l = r ?? (e === void 0 ? "Sidebar" : void 0), S = s && b, v = p === void 0 && o === void 0 ? i : {
166
- ...i,
167
- ...o === void 0 ? void 0 : { "--nk-sidebar-top-offset": o },
168
- ...p === void 0 ? void 0 : { "--nk-sidebar-width": p }
169
- };
170
- return /* @__PURE__ */ c(
178
+ state: v,
179
+ style: p,
180
+ width: i,
181
+ ...s
182
+ } = t, l = m === "overlay", c = n ?? (e === void 0 ? "Sidebar" : void 0), S = l && u;
183
+ let f = p;
184
+ return (i !== void 0 || o !== void 0) && (f = { ...p }, o !== void 0 && (f["--nk-sidebar-top-offset"] = o), i !== void 0 && (f["--nk-sidebar-width"] = i)), /* @__PURE__ */ d(
171
185
  "aside",
172
186
  {
173
- ...a,
187
+ ...s,
174
188
  ref: y,
175
- "aria-hidden": s && !b ? !0 : void 0,
176
- "aria-label": s && !b ? void 0 : l,
177
- "aria-labelledby": s && !b ? void 0 : e,
189
+ "aria-hidden": l && !u ? !0 : void 0,
190
+ "aria-label": l && !u ? void 0 : c,
191
+ "aria-labelledby": l && !u ? void 0 : e,
178
192
  "aria-modal": S ? "true" : void 0,
179
- className: ["nk-sidebar", d].filter(Boolean).join(" "),
180
- "data-responsive": f === "pending" || void 0,
193
+ className: ["nk-sidebar", b].filter(Boolean).join(" "),
194
+ "data-responsive": m === "pending" || void 0,
181
195
  "data-side": g,
182
- "data-state": m,
183
- "data-variant": s ? "overlay" : "inline",
184
- id: u,
196
+ "data-state": v,
197
+ "data-variant": l ? "overlay" : "inline",
198
+ id: a,
185
199
  role: S ? "dialog" : void 0,
186
- style: v,
187
- tabIndex: s ? -1 : void 0,
188
- children: /* @__PURE__ */ c("div", { className: "nk-sidebar__body", children: n })
200
+ style: f,
201
+ tabIndex: l ? -1 : void 0,
202
+ children: /* @__PURE__ */ d("div", { className: "nk-sidebar__body", children: r })
189
203
  }
190
204
  );
191
205
  }
192
- function Oe(t) {
206
+ function Te(t) {
193
207
  const {
194
- boundaries: r,
208
+ boundaries: n,
195
209
  initialFocusReference: e,
196
- lockScroll: n,
197
- ownerDocument: d,
210
+ lockScroll: r,
211
+ ownerDocument: b,
198
212
  panelReference: o,
199
- presenceState: b,
200
- restoreFocus: u,
213
+ presenceState: u,
214
+ restoreFocus: a,
201
215
  sidebar: y,
202
- side: f,
216
+ side: m,
203
217
  ...g
204
- } = t, { id: m, open: i, requestOpenChange: p } = y, a = te(Q), s = O(null), [l, S] = Y(null), v = A("Sidebar").boundaryElement, E = ce(!0, v), L = _((k) => {
205
- s.current = k, o(k), S(k);
218
+ } = t, { id: v, open: p, requestOpenChange: i } = y, s = se(V), l = B(null), [c, S] = Z(null), f = z("Sidebar").boundaryElement, _ = de(!0, f), C = k((E) => {
219
+ l.current = E, o(E), S(E);
206
220
  }, [o]);
207
221
  R(() => {
208
- l && (l.inert = !i);
209
- }, [i, l]);
210
- const x = _(() => {
211
- p(!1, "escape");
212
- }, [p]), N = _(() => {
213
- p(!1, "outside");
214
- }, [p]);
215
- de({
216
- boundary: v,
217
- active: i,
218
- boundaries: r,
222
+ c && (c.inert = !p);
223
+ }, [p, c]);
224
+ const D = k(() => {
225
+ i(!1, "escape");
226
+ }, [i]), N = k(() => {
227
+ i(!1, "outside");
228
+ }, [i]);
229
+ ue({
230
+ boundary: f,
231
+ active: p,
232
+ boundaries: n,
219
233
  dismissOnEscape: !0,
220
234
  dismissOnPointerDownOutside: !0,
221
- layerId: E.id,
222
- onEscapeDismiss: x,
235
+ layerId: _.id,
236
+ onEscapeDismiss: D,
223
237
  onPointerDownOutsideDismiss: N,
224
- ownerDocument: d
238
+ ownerDocument: b
225
239
  });
226
- const P = be({
227
- boundary: v,
228
- active: i,
229
- container: l,
230
- initialFocusReference: e ?? s,
231
- layerId: E.id,
232
- restoreFocus: u
240
+ const P = fe({
241
+ boundary: f,
242
+ active: p,
243
+ container: c,
244
+ initialFocusReference: e ?? l,
245
+ layerId: _.id,
246
+ restoreFocus: a
233
247
  });
234
- return fe(n && i, d, v), /* @__PURE__ */ c(
235
- Q.Provider,
248
+ return me(r && p, b, f), /* @__PURE__ */ d(
249
+ V.Provider,
236
250
  {
237
- value: i ? P : a,
238
- children: /* @__PURE__ */ c(
251
+ value: p ? P : s,
252
+ children: /* @__PURE__ */ d(
239
253
  "div",
240
254
  {
241
255
  className: "nk-sidebar__overlay",
242
- "data-side": f,
243
- "data-state": b,
256
+ "data-side": m,
257
+ "data-state": u,
244
258
  role: "presentation",
245
- style: { zIndex: E.zIndex },
246
- children: /* @__PURE__ */ c(
247
- re,
259
+ style: { zIndex: _.zIndex },
260
+ children: /* @__PURE__ */ d(
261
+ te,
248
262
  {
249
263
  ...g,
250
- open: i,
251
- panelId: m,
252
- panelReference: L,
264
+ open: p,
265
+ panelId: v,
266
+ panelReference: C,
253
267
  presentation: "overlay",
254
- side: f,
255
- state: b
268
+ side: m,
269
+ state: u
256
270
  }
257
271
  )
258
272
  }
@@ -260,57 +274,57 @@ function Oe(t) {
260
274
  }
261
275
  );
262
276
  }
263
- function Be(t) {
264
- const { children: r } = t;
265
- if (r.type === se)
277
+ function Fe(t) {
278
+ const { children: n } = t;
279
+ if (n.type === ie)
266
280
  throw new Error("Sidebar.Trigger requires a single non-Fragment child");
267
- const e = U("Sidebar.Trigger"), n = r.props, d = le(r), o = e == null ? void 0 : e.registerTrigger, b = e == null ? void 0 : e.unregisterTrigger, u = O(null), y = _((s) => {
268
- const l = u.current;
269
- l && l !== s && (b == null || b(l)), u.current = s, s && (o == null || o(s)), Z(d, s);
270
- }, [d, o, b]), f = _((s) => {
271
- var l;
272
- (l = n.onClick) == null || l.call(n, s), !(s.defaultPrevented || !e) && e.requestOpenChange(!e.open, "trigger");
273
- }, [n, e]);
281
+ const e = T("Sidebar.Trigger"), r = n.props, b = ce(n), o = e == null ? void 0 : e.registerTrigger, u = e == null ? void 0 : e.unregisterTrigger, a = B(null), y = k((l) => {
282
+ const c = a.current;
283
+ c && c !== l && (u == null || u(c)), a.current = l, l && (o == null || o(l)), ee(b, l);
284
+ }, [b, o, u]), m = k((l) => {
285
+ var c;
286
+ (c = r.onClick) == null || c.call(r, l), !(l.defaultPrevented || !e) && e.requestOpenChange(!e.open, "trigger");
287
+ }, [r, e]);
274
288
  if (!e) return null;
275
- const { id: g, open: m, presentation: i, variant: p } = e;
276
- return ie(
277
- r,
289
+ const { id: g, open: v, presentation: p, variant: i } = e;
290
+ return oe(
291
+ n,
278
292
  {
279
- "aria-controls": m && i === "overlay" ? me(n["aria-controls"], g) : n["aria-controls"],
280
- "aria-expanded": m,
281
- "aria-haspopup": n["aria-haspopup"] ?? "dialog",
282
- className: [n.className, "nk-sidebar__trigger"].filter(Boolean).join(" "),
283
- "data-sidebar-variant": p,
284
- onClick: f,
293
+ "aria-controls": v && p === "overlay" ? ve(r["aria-controls"], g) : r["aria-controls"],
294
+ "aria-expanded": v,
295
+ "aria-haspopup": r["aria-haspopup"] ?? "dialog",
296
+ className: [r.className, "nk-sidebar__trigger"].filter(Boolean).join(" "),
297
+ "data-sidebar-variant": i,
298
+ onClick: m,
285
299
  ref: y
286
300
  }
287
301
  );
288
302
  }
289
- const Te = B(
290
- function(r, e) {
303
+ const Re = I(
304
+ function(n, e) {
291
305
  const {
292
- actions: n,
293
- className: d,
306
+ actions: r,
307
+ className: b,
294
308
  description: o,
295
- image: b,
296
- loading: u = !1,
309
+ image: u,
310
+ loading: a = !1,
297
311
  name: y,
298
- onClick: f,
312
+ onClick: m,
299
313
  ...g
300
- } = r, m = o != null && typeof o != "boolean", i = /* @__PURE__ */ D(J, { children: [
301
- /* @__PURE__ */ c(
302
- ve,
314
+ } = n, v = o != null && typeof o != "boolean", p = /* @__PURE__ */ A(K, { children: [
315
+ /* @__PURE__ */ d(
316
+ ge,
303
317
  {
304
318
  alt: y,
305
319
  "aria-hidden": !0,
306
320
  className: "nk-sidebar__user-avatar",
307
- image: b
321
+ image: u
308
322
  }
309
323
  ),
310
- /* @__PURE__ */ D("span", { className: "nk-sidebar__user-text", children: [
311
- /* @__PURE__ */ c(j, { as: "span", className: "nk-sidebar__user-name", children: y }),
312
- m ? /* @__PURE__ */ c(
313
- j,
324
+ /* @__PURE__ */ A("span", { className: "nk-sidebar__user-text", children: [
325
+ /* @__PURE__ */ d(U, { as: "span", className: "nk-sidebar__user-name", children: y }),
326
+ v ? /* @__PURE__ */ d(
327
+ U,
314
328
  {
315
329
  as: "span",
316
330
  className: "nk-sidebar__user-description",
@@ -321,155 +335,156 @@ const Te = B(
321
335
  ) : null
322
336
  ] })
323
337
  ] });
324
- return /* @__PURE__ */ c(
338
+ return /* @__PURE__ */ d(
325
339
  "div",
326
340
  {
327
341
  ...g,
328
342
  ref: e,
329
- className: ["nk-sidebar__user", d].filter(Boolean).join(" "),
330
- children: u ? /* @__PURE__ */ c(ge, { className: "nk-sidebar__user-spinner", size: 16 }) : /* @__PURE__ */ D(J, { children: [
331
- f ? /* @__PURE__ */ c(
343
+ className: ["nk-sidebar__user", b].filter(Boolean).join(" "),
344
+ children: a ? /* @__PURE__ */ d(he, { className: "nk-sidebar__user-spinner", size: 16 }) : /* @__PURE__ */ A(K, { children: [
345
+ m ? /* @__PURE__ */ d(
332
346
  "button",
333
347
  {
334
348
  className: "nk-sidebar__user-details",
335
- onClick: f,
349
+ onClick: m,
336
350
  type: "button",
337
- children: i
351
+ children: p
338
352
  }
339
- ) : /* @__PURE__ */ c("div", { className: "nk-sidebar__user-details", children: i }),
340
- n !== void 0 && n.length > 0 ? /* @__PURE__ */ c("div", { className: "nk-sidebar__user-actions", children: n.map((p) => {
353
+ ) : /* @__PURE__ */ d("div", { className: "nk-sidebar__user-details", children: p }),
354
+ r !== void 0 && r.length > 0 ? /* @__PURE__ */ d("div", { className: "nk-sidebar__user-actions", children: r.map((i) => {
341
355
  const {
342
- "aria-label": a,
343
- icon: s,
344
- label: l,
356
+ "aria-label": s,
357
+ icon: l,
358
+ label: c,
345
359
  ...S
346
- } = p;
347
- return /* @__PURE__ */ c(ye, { content: l, children: /* @__PURE__ */ c(
348
- ee,
360
+ } = i;
361
+ return /* @__PURE__ */ d(ye, { content: c, children: /* @__PURE__ */ d(
362
+ ne,
349
363
  {
350
364
  ...S,
351
- "aria-label": a ?? l,
365
+ "aria-label": s ?? c,
352
366
  className: "nk-sidebar__user-action",
353
- icon: s,
367
+ icon: l,
354
368
  shape: "rectangle",
355
369
  type: "button",
356
370
  variant: "ghost"
357
371
  }
358
- ) }, l);
372
+ ) }, c);
359
373
  }) }) : null
360
374
  ] })
361
375
  }
362
376
  );
363
377
  }
364
- ), Re = () => () => {
365
- }, V = () => {
378
+ ), Le = () => () => {
379
+ }, W = () => {
366
380
  };
367
- function Fe(t, r) {
368
- const e = t === "responsive" ? r : void 0, n = W(
369
- (e == null ? void 0 : e.subscribe) ?? Re,
370
- (e == null ? void 0 : e.read) ?? V,
371
- V
381
+ function xe(t, n) {
382
+ const e = t === "responsive" ? n : void 0, r = X(
383
+ (e == null ? void 0 : e.subscribe) ?? Le,
384
+ (e == null ? void 0 : e.read) ?? W,
385
+ W
372
386
  );
373
- return t !== "responsive" ? t : n === void 0 ? "pending" : n >= he("md") ? "inline" : "overlay";
387
+ return t !== "responsive" ? t : r === void 0 ? "pending" : r >= Se("md") ? "inline" : "overlay";
374
388
  }
375
- const Le = B(function(r, e) {
376
- var H;
389
+ const Ce = I(function(n, e) {
390
+ var J;
377
391
  const {
378
- defaultOpen: n = !1,
379
- initialFocusReference: d,
392
+ defaultOpen: r = !1,
393
+ initialFocusReference: b,
380
394
  top: o,
381
- lockScroll: b = !0,
382
- onOpenChange: u,
395
+ lockScroll: u = !0,
396
+ onOpenChange: a,
383
397
  open: y,
384
- restoreFocus: f = !0,
398
+ restoreFocus: m = !0,
385
399
  side: g = "start",
386
- variant: m = "responsive",
387
- width: i,
388
- ...p
389
- } = r, a = A("Sidebar"), s = `${X()}-sidebar`, l = O(Symbol("nk-sidebar")).current, S = O(null), v = Fe(m, a == null ? void 0 : a.width), E = y !== void 0, [L, x] = Y(n), N = E ? y : L, P = O(u);
400
+ variant: v = "responsive",
401
+ width: p,
402
+ ...i
403
+ } = n, s = z("Sidebar"), l = `${Y()}-sidebar`, c = B(Symbol("nk-sidebar")).current, S = B(null), f = xe(v, s == null ? void 0 : s.width), _ = y !== void 0, [C, D] = Z(r), N = _ ? y : C, P = B(a);
390
404
  R(() => {
391
- P.current = u;
405
+ P.current = a;
392
406
  });
393
- const k = _((h, I) => {
394
- var T;
395
- N !== h && (E || x(h), (T = P.current) == null || T.call(P, h, I));
396
- }, [E, N]), q = _((h) => {
397
- S.current = h, Z(e ?? void 0, h);
398
- }, [e]), w = K(
407
+ const E = k((h, O) => {
408
+ var F;
409
+ N !== h && (_ || D(h), (F = P.current) == null || F.call(P, h, O));
410
+ }, [_, N]), G = k((h) => {
411
+ S.current = h, ee(e ?? void 0, h);
412
+ }, [e]), w = Q(
399
413
  () => [S],
400
414
  []
401
- ), z = _((h) => {
415
+ ), q = k((h) => {
402
416
  w.push({ current: h });
403
- }, [w]), G = _((h) => {
404
- const I = w.findIndex((T) => T.current === h);
405
- I > 0 && w.splice(I, 1);
406
- }, [w]), C = K(() => ({
407
- id: s,
417
+ }, [w]), H = k((h) => {
418
+ const O = w.findIndex((F) => F.current === h);
419
+ O > 0 && w.splice(O, 1);
420
+ }, [w]), j = Q(() => ({
421
+ id: l,
408
422
  open: N,
409
- presentation: v,
410
- registerTrigger: z,
411
- requestOpenChange: k,
412
- unregisterTrigger: G,
413
- variant: m
423
+ presentation: f,
424
+ registerTrigger: q,
425
+ requestOpenChange: E,
426
+ unregisterTrigger: H,
427
+ variant: v
414
428
  }), [
415
429
  N,
416
- s,
417
- v,
418
- z,
419
- k,
420
- G,
421
- m
430
+ l,
431
+ f,
432
+ q,
433
+ E,
434
+ H,
435
+ v
422
436
  ]);
423
437
  R(() => {
424
- const h = a == null ? void 0 : a.boundaryElement;
438
+ const h = s == null ? void 0 : s.boundaryElement;
425
439
  if (!h) return;
426
- if (_e(h, l, C) === !1)
440
+ if (_e(h, c, j) === !1)
427
441
  throw new Error(
428
442
  "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."
429
443
  );
430
- }, [a == null ? void 0 : a.boundaryElement, l, C]), R(() => {
431
- const h = a == null ? void 0 : a.boundaryElement;
444
+ }, [s == null ? void 0 : s.boundaryElement, c, j]), R(() => {
445
+ const h = s == null ? void 0 : s.boundaryElement;
432
446
  if (h)
433
- return () => ke(h, l);
434
- }, [a == null ? void 0 : a.boundaryElement, l]), oe(() => {
435
- v === "inline" && k(!1, "variant");
436
- }, [v, k]);
437
- const M = ue(N && v === "overlay"), $ = ((H = a == null ? void 0 : a.boundaryElement) == null ? void 0 : H.ownerDocument) ?? (typeof document > "u" ? null : document);
438
- return v !== "overlay" ? /* @__PURE__ */ c(
439
- re,
447
+ return () => ke(h, c);
448
+ }, [s == null ? void 0 : s.boundaryElement, c]), le(() => {
449
+ f === "inline" && E(!1, "variant");
450
+ }, [f, E]);
451
+ const M = pe(N && f === "overlay"), $ = ((J = s == null ? void 0 : s.boundaryElement) == null ? void 0 : J.ownerDocument) ?? (typeof document > "u" ? null : document);
452
+ return f !== "overlay" ? /* @__PURE__ */ d(
453
+ te,
440
454
  {
441
- ...p,
455
+ ...i,
442
456
  top: o,
443
457
  open: !1,
444
- panelId: s,
445
- panelReference: q,
446
- presentation: v,
458
+ panelId: l,
459
+ panelReference: G,
460
+ presentation: f,
447
461
  side: g,
448
- width: i
462
+ width: p
449
463
  }
450
- ) : !M.present || !$ ? null : /* @__PURE__ */ c(pe, { children: /* @__PURE__ */ c(
451
- Oe,
464
+ ) : !M.present || !$ ? null : /* @__PURE__ */ d(be, { children: /* @__PURE__ */ d(
465
+ Te,
452
466
  {
453
- ...p,
454
- initialFocusReference: d,
455
- lockScroll: b,
467
+ ...i,
468
+ initialFocusReference: b,
469
+ lockScroll: u,
456
470
  ownerDocument: $,
457
471
  presenceState: M.state === "closing" ? "closing" : "open",
458
472
  boundaries: w,
459
- panelReference: q,
460
- restoreFocus: f,
461
- sidebar: C,
473
+ panelReference: G,
474
+ restoreFocus: m,
475
+ sidebar: j,
462
476
  side: g,
463
- width: i
477
+ width: p
464
478
  }
465
479
  ) });
466
- }), Qe = Object.assign(Le, {
467
- Footer: Se,
468
- Group: we,
469
- Item: Ie,
470
- Trigger: Be,
471
- User: Te
480
+ }), We = Object.assign(Ce, {
481
+ Footer: we,
482
+ Group: Ie,
483
+ Header: Oe,
484
+ Item: Be,
485
+ Trigger: Fe,
486
+ User: Re
472
487
  });
473
488
  export {
474
- Qe as default
489
+ We as default
475
490
  };