neatkit 0.7.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 (179) hide show
  1. package/dist/Avatar-Belo7qAY.cjs +1 -0
  2. package/dist/Avatar-DjDCFqNG.js +55 -0
  3. package/dist/Avatar.cjs +1 -1
  4. package/dist/Avatar.js +2 -52
  5. package/dist/Boundary.cjs +1 -0
  6. package/dist/Boundary.js +176 -0
  7. package/dist/Button-BV5OUXpc.js +101 -0
  8. package/dist/Button-DU4j_IED.cjs +1 -0
  9. package/dist/Button.cjs +1 -1
  10. package/dist/Button.js +1 -1
  11. package/dist/Checkbox.cjs +1 -1
  12. package/dist/Checkbox.js +213 -2
  13. package/dist/Code-B7s_rN0G.cjs +4 -0
  14. package/dist/Code-Bp2X1k-g.js +224 -0
  15. package/dist/Code.cjs +1 -1
  16. package/dist/Code.js +1 -1
  17. package/dist/Divider-C7XGlr26.cjs +1 -0
  18. package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
  19. package/dist/Divider.cjs +1 -1
  20. package/dist/Divider.js +1 -1
  21. package/dist/Icon-BIBzgznI.cjs +1 -0
  22. package/dist/{Icon-uQmpr5P2.js → Icon-CxK1wlGk.js} +194 -181
  23. package/dist/Icon.cjs +1 -1
  24. package/dist/Icon.js +2 -35
  25. package/dist/Input.cjs +1 -1
  26. package/dist/Input.js +70 -79
  27. package/dist/Markdown.cjs +1 -31
  28. package/dist/Markdown.js +469 -18066
  29. package/dist/Modal.cjs +1 -1
  30. package/dist/Modal.js +100 -122
  31. package/dist/PinInput.cjs +1 -1
  32. package/dist/PinInput.js +1 -1
  33. package/dist/Popover.cjs +1 -1
  34. package/dist/Popover.js +171 -165
  35. package/dist/Radio.cjs +1 -1
  36. package/dist/Radio.js +86 -41
  37. package/dist/Select.cjs +1 -1
  38. package/dist/Select.js +326 -315
  39. package/dist/Sidebar.cjs +1 -0
  40. package/dist/Sidebar.js +490 -0
  41. package/dist/Skeleton.cjs +1 -1
  42. package/dist/Skeleton.js +20 -16
  43. package/dist/Switch.cjs +1 -1
  44. package/dist/Switch.js +1 -1
  45. package/dist/Table-CADupJEU.js +423 -0
  46. package/dist/Table-qetwZpTC.cjs +1 -0
  47. package/dist/Table.cjs +1 -1
  48. package/dist/Table.js +1 -1
  49. package/dist/TextArea.cjs +1 -1
  50. package/dist/TextArea.js +1 -1
  51. package/dist/Tooltip-B2d5ss7S.cjs +1 -0
  52. package/dist/Tooltip-BK64rkxV.js +231 -0
  53. package/dist/Tooltip.cjs +1 -1
  54. package/dist/Tooltip.js +2 -3
  55. package/dist/albert-sans-cb3e34c4.woff2 +0 -0
  56. package/dist/aria-Bntn6ad_.cjs +1 -0
  57. package/dist/aria-CeA9QfD1.js +15 -0
  58. package/dist/components/Boundary/Boundary.d.ts +65 -0
  59. package/dist/components/Boundary/contexts/BoundaryContext.d.ts +28 -0
  60. package/dist/components/Boundary/hooks/useBoundary.d.ts +19 -0
  61. package/dist/components/Boundary/hooks/useBoundaryWidth.d.ts +23 -0
  62. package/dist/components/Boundary/index.d.ts +2 -0
  63. package/dist/components/Boundary/utils/width.d.ts +11 -0
  64. package/dist/components/Checkbox/Checkbox.d.ts +9 -1
  65. package/dist/components/{CheckboxGroup → Checkbox/components}/CheckboxGroup.d.ts +2 -2
  66. package/dist/components/Checkbox/index.d.ts +1 -0
  67. package/dist/components/Checkbox/utils/checkbox-option.d.ts +17 -0
  68. package/dist/components/Icon/Icon.d.ts +1 -0
  69. package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
  70. package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
  71. package/dist/components/Icon/index.d.ts +0 -33
  72. package/dist/components/Icon/utils/registry.d.ts +2 -0
  73. package/dist/components/Input/Input.d.ts +1 -9
  74. package/dist/components/Modal/Modal.d.ts +0 -4
  75. package/dist/components/PinInput/PinInput.d.ts +1 -1
  76. package/dist/components/Popover/Popover.d.ts +2 -6
  77. package/dist/components/Portal/Portal.d.ts +11 -8
  78. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +2 -0
  79. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +4 -3
  80. package/dist/components/Portal/hooks/useFocusTrap.d.ts +2 -0
  81. package/dist/components/Portal/hooks/useScrollLock.d.ts +9 -3
  82. package/dist/components/Portal/utils/boundary-focus.d.ts +23 -0
  83. package/dist/components/Portal/utils/floating-position.d.ts +43 -9
  84. package/dist/components/Portal/utils/overlay-stack.d.ts +22 -10
  85. package/dist/components/Portal/utils/scroll-container.d.ts +13 -0
  86. package/dist/components/Radio/Radio.d.ts +9 -1
  87. package/dist/components/{RadioGroup → Radio/components}/RadioGroup.d.ts +9 -2
  88. package/dist/components/Radio/index.d.ts +1 -0
  89. package/dist/components/Select/Select.d.ts +0 -2
  90. package/dist/components/Select/utils/listbox-position.d.ts +28 -0
  91. package/dist/components/Sidebar/Sidebar.d.ts +113 -0
  92. package/dist/components/Sidebar/components/SidebarFooter.d.ts +24 -0
  93. package/dist/components/Sidebar/components/SidebarGroup.d.ts +31 -0
  94. package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
  95. package/dist/components/Sidebar/components/SidebarItem.d.ts +46 -0
  96. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +38 -0
  97. package/dist/components/Sidebar/components/SidebarPanel.d.ts +47 -0
  98. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +47 -0
  99. package/dist/components/Sidebar/components/SidebarUser.d.ts +59 -0
  100. package/dist/components/Sidebar/hooks/usePresentation.d.ts +14 -0
  101. package/dist/components/Sidebar/hooks/useSidebar.d.ts +9 -0
  102. package/dist/components/Sidebar/index.d.ts +2 -0
  103. package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
  104. package/dist/components/Sidebar/utils/state.d.ts +62 -0
  105. package/dist/components/Skeleton/Skeleton.d.ts +21 -5
  106. package/dist/components/Table/Table.d.ts +21 -249
  107. package/dist/components/Table/components/TableAction.d.ts +18 -0
  108. package/dist/components/Table/components/TableActionCell.d.ts +15 -0
  109. package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
  110. package/dist/components/Table/components/TableBody.d.ts +27 -0
  111. package/dist/components/Table/components/TableCell.d.ts +42 -0
  112. package/dist/components/Table/components/TableFoot.d.ts +19 -0
  113. package/dist/components/Table/components/TableHead.d.ts +19 -0
  114. package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
  115. package/dist/components/Table/components/TableRow.d.ts +67 -0
  116. package/dist/components/Table/contexts/TableContext.d.ts +4 -0
  117. package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
  118. package/dist/components/Table/index.d.ts +1 -1
  119. package/dist/components/Table/utils/cell.d.ts +25 -0
  120. package/dist/components/Table/utils/children.d.ts +18 -0
  121. package/dist/components/Table/utils/trigger.d.ts +54 -0
  122. package/dist/components/Tooltip/Tooltip.d.ts +10 -4
  123. package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
  124. package/dist/components/Tooltip/index.d.ts +0 -1
  125. package/dist/effects-D5CWf-Pl.js +8 -0
  126. package/dist/effects-D85L_7zM.cjs +1 -0
  127. package/dist/floating-position-DIjh2wnP.cjs +1 -0
  128. package/dist/floating-position-DvR6e334.js +50 -0
  129. package/dist/style.css +1 -1
  130. package/dist/tokens.d.ts +1 -0
  131. package/dist/useFloatingPosition-B3ZC-v3v.js +43 -0
  132. package/dist/useFloatingPosition-GzkP9dCc.cjs +1 -0
  133. package/dist/useFocusTrap-BrFZdMqQ.cjs +1 -0
  134. package/dist/useFocusTrap-DhVnlboe.js +136 -0
  135. package/dist/usePresence-B5RYv4e1.cjs +1 -0
  136. package/dist/usePresence-CqegYqy4.js +221 -0
  137. package/dist/useScrollLock-Drd7OZRC.js +62 -0
  138. package/dist/useScrollLock-Dy8MZaSn.cjs +1 -0
  139. package/dist/utils/aria.d.ts +9 -0
  140. package/dist/utils/effects.d.ts +12 -0
  141. package/package.json +12 -16
  142. package/dist/Button-BAsLfA0D.js +0 -99
  143. package/dist/Button-D7JUO6Fs.cjs +0 -1
  144. package/dist/Checkbox-BvXM9VyY.js +0 -68
  145. package/dist/Checkbox-VQifZrZZ.cjs +0 -1
  146. package/dist/CheckboxGroup.cjs +0 -1
  147. package/dist/CheckboxGroup.js +0 -144
  148. package/dist/Code-BP2ZCmUf.js +0 -7446
  149. package/dist/Code-eispVOW3.cjs +0 -6
  150. package/dist/Content.cjs +0 -1
  151. package/dist/Content.js +0 -144
  152. package/dist/Divider-CJYbFcSX.cjs +0 -1
  153. package/dist/Icon-D8IZceys.cjs +0 -1
  154. package/dist/RadioGroup.cjs +0 -1
  155. package/dist/RadioGroup.js +0 -51
  156. package/dist/RadioGroupContext-BX9KnDek.cjs +0 -1
  157. package/dist/RadioGroupContext-DbKM4zPZ.js +0 -5
  158. package/dist/Table-83unQQOi.cjs +0 -1
  159. package/dist/Table-Cw8u-pEW.js +0 -403
  160. package/dist/Tooltip-BB82wNOE.cjs +0 -1
  161. package/dist/Tooltip-CqWK_GRD.js +0 -236
  162. package/dist/aria-DHnOMyYp.js +0 -10
  163. package/dist/aria-DKxpE8cA.cjs +0 -1
  164. package/dist/components/CheckboxGroup/index.d.ts +0 -2
  165. package/dist/components/Content/Content.d.ts +0 -60
  166. package/dist/components/Content/hooks/useContentLayout.d.ts +0 -18
  167. package/dist/components/Content/index.d.ts +0 -2
  168. package/dist/components/Content/utils/layout.d.ts +0 -11
  169. package/dist/components/RadioGroup/index.d.ts +0 -2
  170. package/dist/useFloatingPosition-CxzhAvy8.js +0 -73
  171. package/dist/useFloatingPosition-D1FqYy0l.cjs +0 -1
  172. package/dist/useFocusTrap--cgjy78G.cjs +0 -1
  173. package/dist/useFocusTrap-Da4nEash.js +0 -134
  174. package/dist/usePresence-DSPt6aKi.js +0 -210
  175. package/dist/usePresence-qe92UTvK.cjs +0 -1
  176. /package/dist/components/{CheckboxGroup → Checkbox}/contexts/CheckboxGroupContext.d.ts +0 -0
  177. /package/dist/components/{CheckboxGroup → Checkbox}/hooks/useCheckboxGroup.d.ts +0 -0
  178. /package/dist/components/{RadioGroup → Radio}/contexts/RadioGroupContext.d.ts +0 -0
  179. /package/dist/components/{RadioGroup → Radio}/hooks/useRadioGroup.d.ts +0 -0
@@ -0,0 +1,423 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as E } from "react/jsx-runtime";
3
+ import { createContext as z, forwardRef as g, Children as B, isValidElement as L, Fragment as j, cloneElement as w, createElement as M, useRef as N, useContext as V, useState as x, useEffect as Y, useCallback as X } from "react";
4
+ import { a as $ } from "./reference-CXMr27nM.js";
5
+ import { B as q } from "./Button-BV5OUXpc.js";
6
+ import { T as G } from "./Tooltip-BK64rkxV.js";
7
+ const v = z("body"), A = g(function(l, e) {
8
+ const {
9
+ align: t = "left",
10
+ children: i,
11
+ className: r,
12
+ scope: c = "col",
13
+ sticky: f = !1,
14
+ ...s
15
+ } = l;
16
+ return /* @__PURE__ */ a(
17
+ "th",
18
+ {
19
+ ...s,
20
+ ref: e,
21
+ className: ["nk-table__header-cell", r].filter(Boolean).join(" "),
22
+ "data-align": t,
23
+ "data-sticky": f || void 0,
24
+ scope: c,
25
+ children: i
26
+ }
27
+ );
28
+ });
29
+ function I(n) {
30
+ for (const l of B.toArray(n)) {
31
+ if (L(l) && l.type === j) {
32
+ if (I(l.props.children)) return !0;
33
+ continue;
34
+ }
35
+ return !0;
36
+ }
37
+ return !1;
38
+ }
39
+ const J = g(
40
+ function(l, e) {
41
+ const {
42
+ children: t,
43
+ className: i,
44
+ emptyColumnCount: r = 1,
45
+ emptyMessage: c,
46
+ ...f
47
+ } = l, s = !I(t), b = Number.isFinite(r) ? Math.max(1, Math.floor(r)) : 1;
48
+ return /* @__PURE__ */ a(
49
+ "tbody",
50
+ {
51
+ ...f,
52
+ ref: e,
53
+ className: ["nk-table__body", i].filter(Boolean).join(" "),
54
+ children: s && c !== void 0 ? /* @__PURE__ */ a("tr", { className: "nk-table__row", children: /* @__PURE__ */ a(
55
+ "td",
56
+ {
57
+ className: "nk-table__cell nk-table__empty-cell",
58
+ colSpan: b,
59
+ children: /* @__PURE__ */ a("div", { className: "nk-table__empty-content", children: c })
60
+ }
61
+ ) }) : /* @__PURE__ */ a(v.Provider, { value: "body", children: t })
62
+ }
63
+ );
64
+ }
65
+ );
66
+ function Q(n, l, e) {
67
+ return n === void 0 ? l : e ? e(n) : n instanceof Date ? Number.isNaN(n.getTime()) ? "Invalid Date" : n.toISOString().slice(0, 10) : typeof n == "boolean" ? n ? "Yes" : "No" : n;
68
+ }
69
+ function U(n) {
70
+ if (typeof n == "number" || typeof n == "string")
71
+ return String(n);
72
+ }
73
+ const H = g(
74
+ function(l, e) {
75
+ const {
76
+ align: t = "left",
77
+ children: i,
78
+ className: r,
79
+ format: c,
80
+ title: f,
81
+ truncate: s,
82
+ value: b,
83
+ ...h
84
+ } = l, { rowTrigger: o, ...d } = h, p = Q(b, i, c), u = s === void 0 ? void 0 : { maxWidth: s }, k = f ?? (s === void 0 ? void 0 : U(p));
85
+ return /* @__PURE__ */ E(
86
+ "td",
87
+ {
88
+ ...d,
89
+ ref: e,
90
+ className: ["nk-table__cell", r].filter(Boolean).join(" "),
91
+ "data-align": t,
92
+ title: k,
93
+ children: [
94
+ (o == null ? void 0 : o.kind) === "link" && o.linkProperties ? /* @__PURE__ */ a(
95
+ "a",
96
+ {
97
+ ref: o.reference,
98
+ "aria-label": o.ariaLabel,
99
+ className: "nk-table__row-trigger",
100
+ download: o.linkProperties.download,
101
+ href: o.linkProperties.href,
102
+ hrefLang: o.linkProperties.hrefLang,
103
+ onClick: o.linkProperties.onNavigate,
104
+ rel: o.linkProperties.rel,
105
+ target: o.linkProperties.target
106
+ }
107
+ ) : null,
108
+ (o == null ? void 0 : o.kind) === "button" ? /* @__PURE__ */ a(
109
+ "button",
110
+ {
111
+ ref: o.reference,
112
+ "aria-label": o.ariaLabel,
113
+ className: "nk-table__row-trigger",
114
+ onClick: o.onClick,
115
+ type: "button"
116
+ }
117
+ ) : null,
118
+ s !== void 0 ? /* @__PURE__ */ a("span", { className: "nk-table__truncated-content", style: u, children: p }) : p
119
+ ]
120
+ }
121
+ );
122
+ }
123
+ ), W = g(
124
+ function(l, e) {
125
+ const { children: t, className: i, ...r } = l;
126
+ return /* @__PURE__ */ a(
127
+ "tfoot",
128
+ {
129
+ ...r,
130
+ ref: e,
131
+ className: ["nk-table__foot", i].filter(Boolean).join(" "),
132
+ children: /* @__PURE__ */ a(v.Provider, { value: "foot", children: t })
133
+ }
134
+ );
135
+ }
136
+ ), Z = g(
137
+ function(l, e) {
138
+ const { children: t, className: i, ...r } = l;
139
+ return /* @__PURE__ */ a(
140
+ "thead",
141
+ {
142
+ ...r,
143
+ ref: e,
144
+ className: ["nk-table__head", i].filter(Boolean).join(" "),
145
+ children: /* @__PURE__ */ a(v.Provider, { value: "head", children: t })
146
+ }
147
+ );
148
+ }
149
+ ), ee = [
150
+ "a[href]",
151
+ "audio[controls]",
152
+ "button",
153
+ "iframe",
154
+ "input",
155
+ "label",
156
+ "select",
157
+ "summary",
158
+ "textarea",
159
+ "video[controls]",
160
+ "[contenteditable]:not([contenteditable='false'])"
161
+ ].join(","), te = /* @__PURE__ */ new Set([
162
+ "button",
163
+ "checkbox",
164
+ "combobox",
165
+ "grid",
166
+ "link",
167
+ "listbox",
168
+ "menu",
169
+ "menubar",
170
+ "menuitem",
171
+ "menuitemcheckbox",
172
+ "menuitemradio",
173
+ "option",
174
+ "radio",
175
+ "radiogroup",
176
+ "scrollbar",
177
+ "searchbox",
178
+ "slider",
179
+ "spinbutton",
180
+ "switch",
181
+ "tab",
182
+ "tablist",
183
+ "textbox",
184
+ "tree",
185
+ "treegrid",
186
+ "treeitem"
187
+ ]);
188
+ function ne(n, l) {
189
+ var t;
190
+ let e = n;
191
+ for (; e && e !== l; ) {
192
+ if (e.matches(ee) || (((t = e.getAttribute("role")) == null ? void 0 : t.split(/\s+/)) ?? []).some((r) => te.has(r)))
193
+ return !0;
194
+ e = e.parentElement;
195
+ }
196
+ return !1;
197
+ }
198
+ function le(n, l) {
199
+ let e = !1;
200
+ function t(r) {
201
+ return B.map(r, (c) => L(c) ? c.type === j ? w(
202
+ c,
203
+ void 0,
204
+ t(
205
+ c.props.children
206
+ )
207
+ ) : !e && c.type === H ? (e = !0, w(
208
+ c,
209
+ { rowTrigger: l }
210
+ )) : c : c);
211
+ }
212
+ const i = t(n);
213
+ return { attached: e, content: i };
214
+ }
215
+ function oe(n) {
216
+ const {
217
+ "aria-label": l,
218
+ icon: e,
219
+ label: t,
220
+ ...i
221
+ } = n;
222
+ return /* @__PURE__ */ a(G, { content: t, children: /* @__PURE__ */ a(
223
+ q,
224
+ {
225
+ ...i,
226
+ "aria-label": l ?? t,
227
+ className: "nk-table__action",
228
+ icon: e,
229
+ shape: "rectangle",
230
+ type: "button",
231
+ variant: "ghost"
232
+ }
233
+ ) });
234
+ }
235
+ function re(n) {
236
+ const { actions: l } = n;
237
+ function e(t) {
238
+ t.stopPropagation();
239
+ }
240
+ return /* @__PURE__ */ a(
241
+ "td",
242
+ {
243
+ className: "nk-table__cell nk-table__action-cell",
244
+ "data-align": "right",
245
+ onClick: e,
246
+ children: l.length > 0 ? /* @__PURE__ */ a("span", { className: "nk-table__action-list", children: l.map((t) => /* @__PURE__ */ M(oe, { ...t, key: t.label })) }) : null
247
+ }
248
+ );
249
+ }
250
+ const ae = g(function(l, e) {
251
+ const { children: t, className: i, ...r } = l;
252
+ return /* @__PURE__ */ a(
253
+ A,
254
+ {
255
+ ...r,
256
+ ref: e,
257
+ align: "right",
258
+ className: ["nk-table__action-header-cell", i].filter(Boolean).join(" "),
259
+ children: t ?? /* @__PURE__ */ a("span", { className: "nk-table__visually-hidden", children: "Row actions" })
260
+ }
261
+ );
262
+ }), ie = g(
263
+ function(l, e) {
264
+ const {
265
+ "aria-label": t,
266
+ actions: i,
267
+ children: r,
268
+ className: c,
269
+ download: f,
270
+ href: s,
271
+ hrefLang: b,
272
+ onClick: h,
273
+ onNavigate: o,
274
+ rel: d,
275
+ target: p,
276
+ ...u
277
+ } = l, k = N(null), D = V(v), T = s !== void 0 || h !== void 0, y = (t == null ? void 0 : t.trim()) || (s !== void 0 ? "Open row" : "Activate row");
278
+ function R(m) {
279
+ k.current = m;
280
+ }
281
+ let C;
282
+ s !== void 0 ? C = {
283
+ ariaLabel: y,
284
+ kind: "link",
285
+ linkProperties: {
286
+ download: f,
287
+ href: s,
288
+ hrefLang: b,
289
+ onNavigate: o,
290
+ rel: d,
291
+ target: p
292
+ },
293
+ reference: R
294
+ } : h !== void 0 && (C = {
295
+ ariaLabel: y,
296
+ kind: "button",
297
+ onClick: h,
298
+ reference: R
299
+ });
300
+ const K = C ? le(r, C) : { content: r };
301
+ function O(m) {
302
+ if (m.defaultPrevented) return;
303
+ const P = m.target;
304
+ if (!(P instanceof Element) || ne(P, m.currentTarget)) return;
305
+ const _ = k.current;
306
+ if (!_) return;
307
+ const S = _.ownerDocument.defaultView;
308
+ if (!S) {
309
+ _.click();
310
+ return;
311
+ }
312
+ _.dispatchEvent(new S.MouseEvent("click", {
313
+ altKey: m.altKey,
314
+ bubbles: !0,
315
+ button: m.button,
316
+ buttons: m.buttons,
317
+ cancelable: !0,
318
+ clientX: m.clientX,
319
+ clientY: m.clientY,
320
+ ctrlKey: m.ctrlKey,
321
+ metaKey: m.metaKey,
322
+ shiftKey: m.shiftKey
323
+ }));
324
+ }
325
+ const F = D === "head" ? /* @__PURE__ */ a(ae, {}) : /* @__PURE__ */ a(re, { actions: i ?? [] });
326
+ return /* @__PURE__ */ E(
327
+ "tr",
328
+ {
329
+ ...u,
330
+ ref: e,
331
+ "aria-label": T ? void 0 : t,
332
+ className: ["nk-table__row", c].filter(Boolean).join(" "),
333
+ "data-interactive": T || void 0,
334
+ onClick: T ? O : void 0,
335
+ children: [
336
+ K.content,
337
+ F
338
+ ]
339
+ }
340
+ );
341
+ }
342
+ );
343
+ function ce() {
344
+ const n = N(null), l = N(null), [e, t] = x(!1), [i, r] = x(!1);
345
+ Y(() => {
346
+ const f = n.current, s = l.current;
347
+ if (!f || !s) return;
348
+ const b = f, h = s;
349
+ function o() {
350
+ const k = b.scrollWidth > b.clientWidth;
351
+ t(k), k || r(!1);
352
+ }
353
+ o();
354
+ const d = b.ownerDocument.defaultView;
355
+ d == null || d.addEventListener("resize", o);
356
+ const p = d == null ? void 0 : d.ResizeObserver, u = p ? new p(o) : void 0;
357
+ return u == null || u.observe(b), u == null || u.observe(h), () => {
358
+ d == null || d.removeEventListener("resize", o), u == null || u.disconnect();
359
+ };
360
+ }, []);
361
+ function c(f) {
362
+ r(e && f.currentTarget.scrollLeft > 1);
363
+ }
364
+ return {
365
+ containerReference: n,
366
+ contentReference: l,
367
+ isScrollable: e,
368
+ isScrolled: i,
369
+ handleScroll: c
370
+ };
371
+ }
372
+ const se = g(function(l, e) {
373
+ const {
374
+ "aria-label": t,
375
+ children: i,
376
+ className: r,
377
+ containerClassName: c,
378
+ ...f
379
+ } = l, {
380
+ containerReference: s,
381
+ contentReference: b,
382
+ isScrollable: h,
383
+ isScrolled: o,
384
+ handleScroll: d
385
+ } = ce(), p = t ? `${t} scroll area` : "Scrollable table", u = X(
386
+ (k) => {
387
+ b.current = k, $(e, k);
388
+ },
389
+ [b, e]
390
+ );
391
+ return /* @__PURE__ */ a(
392
+ "div",
393
+ {
394
+ ref: s,
395
+ "aria-label": h ? p : void 0,
396
+ className: ["nk-table", c].filter(Boolean).join(" "),
397
+ "data-scrolled": o || void 0,
398
+ onScroll: d,
399
+ role: h ? "region" : void 0,
400
+ tabIndex: h ? 0 : void 0,
401
+ children: /* @__PURE__ */ a(
402
+ "table",
403
+ {
404
+ ...f,
405
+ ref: u,
406
+ "aria-label": t,
407
+ className: ["nk-table__element", r].filter(Boolean).join(" "),
408
+ children: i
409
+ }
410
+ )
411
+ }
412
+ );
413
+ }), he = Object.assign(se, {
414
+ Body: J,
415
+ Cell: H,
416
+ Foot: W,
417
+ HeaderCell: A,
418
+ Head: Z,
419
+ Row: ie
420
+ });
421
+ export {
422
+ he as T
423
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";const a=require("react/jsx-runtime"),o=require("react"),A=require("./reference-C2guRuR0.cjs"),I=require("./Button-DU4j_IED.cjs"),H=require("./Tooltip-B2d5ss7S.cjs"),v=o.createContext("body"),R=o.forwardRef(function(r,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=r;return a.jsx("th",{...d,ref:e,className:["nk-table__header-cell",i].filter(Boolean).join(" "),"data-align":t,"data-sticky":b||void 0,scope:c,children:s})});function w(n){for(const r of o.Children.toArray(n)){if(o.isValidElement(r)&&r.type===o.Fragment){if(w(r.props.children))return!0;continue}return!0}return!1}const D=o.forwardRef(function(r,e){const{children:t,className:s,emptyColumnCount:i=1,emptyMessage:c,...b}=r,d=!w(t),m=Number.isFinite(i)?Math.max(1,Math.floor(i)):1;return a.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?a.jsx("tr",{className:"nk-table__row",children:a.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:m,children:a.jsx("div",{className:"nk-table__empty-content",children:c})})}):a.jsx(v.Provider,{value:"body",children:t})})});function K(n,r,e){return n===void 0?r:e?e(n):n instanceof Date?Number.isNaN(n.getTime())?"Invalid Date":n.toISOString().slice(0,10):typeof n=="boolean"?n?"Yes":"No":n}function O(n){if(typeof n=="number"||typeof n=="string")return String(n)}const S=o.forwardRef(function(r,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:m,...p}=r,{rowTrigger:l,...u}=p,k=K(m,s,c),f=d===void 0?void 0:{maxWidth:d},g=b??(d===void 0?void 0:O(k));return a.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:g,children:[(l==null?void 0:l.kind)==="link"&&l.linkProperties?a.jsx("a",{ref:l.reference,"aria-label":l.ariaLabel,className:"nk-table__row-trigger",download:l.linkProperties.download,href:l.linkProperties.href,hrefLang:l.linkProperties.hrefLang,onClick:l.linkProperties.onNavigate,rel:l.linkProperties.rel,target:l.linkProperties.target}):null,(l==null?void 0:l.kind)==="button"?a.jsx("button",{ref:l.reference,"aria-label":l.ariaLabel,className:"nk-table__row-trigger",onClick:l.onClick,type:"button"}):null,d!==void 0?a.jsx("span",{className:"nk-table__truncated-content",style:f,children:k}):k]})}),F=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:a.jsx(v.Provider,{value:"foot",children:t})})}),q=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:a.jsx(v.Provider,{value:"head",children:t})})}),z=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),V=new Set(["button","checkbox","combobox","grid","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","radiogroup","scrollbar","searchbox","slider","spinbutton","switch","tab","tablist","textbox","tree","treegrid","treeitem"]);function M(n,r){var t;let e=n;for(;e&&e!==r;){if(e.matches(z)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(i=>V.has(i)))return!0;e=e.parentElement}return!1}function Y(n,r){let e=!1;function t(i){return o.Children.map(i,c=>o.isValidElement(c)?c.type===o.Fragment?o.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===S?(e=!0,o.cloneElement(c,{rowTrigger:r})):c:c)}const s=t(n);return{attached:e,content:s}}function X(n){const{"aria-label":r,icon:e,label:t,...s}=n;return a.jsx(H.Tooltip2,{content:t,children:a.jsx(I.Button,{...s,"aria-label":r??t,className:"nk-table__action",icon:e,shape:"rectangle",type:"button",variant:"ghost"})})}function $(n){const{actions:r}=n;function e(t){t.stopPropagation()}return a.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:r.length>0?a.jsx("span",{className:"nk-table__action-list",children:r.map(t=>o.createElement(X,{...t,key:t.label}))}):null})}const G=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx(R,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??a.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),J=o.forwardRef(function(r,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:m,onClick:p,onNavigate:l,rel:u,target:k,...f}=r,g=o.useRef(null),P=o.useContext(v),x=d!==void 0||p!==void 0,T=(t==null?void 0:t.trim())||(d!==void 0?"Open row":"Activate row");function N(h){g.current=h}let C;d!==void 0?C={ariaLabel:T,kind:"link",linkProperties:{download:b,href:d,hrefLang:m,onNavigate:l,rel:u,target:k},reference:N}:p!==void 0&&(C={ariaLabel:T,kind:"button",onClick:p,reference:N});const E=C?Y(i,C):{content:i};function B(h){if(h.defaultPrevented)return;const j=h.target;if(!(j instanceof Element)||M(j,h.currentTarget))return;const _=g.current;if(!_)return;const y=_.ownerDocument.defaultView;if(!y){_.click();return}_.dispatchEvent(new y.MouseEvent("click",{altKey:h.altKey,bubbles:!0,button:h.button,buttons:h.buttons,cancelable:!0,clientX:h.clientX,clientY:h.clientY,ctrlKey:h.ctrlKey,metaKey:h.metaKey,shiftKey:h.shiftKey}))}const L=P==="head"?a.jsx(G,{}):a.jsx($,{actions:s??[]});return a.jsxs("tr",{...f,ref:e,"aria-label":x?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":x||void 0,onClick:x?B:void 0,children:[E.content,L]})});function Q(){const n=o.useRef(null),r=o.useRef(null),[e,t]=o.useState(!1),[s,i]=o.useState(!1);o.useEffect(()=>{const b=n.current,d=r.current;if(!b||!d)return;const m=b,p=d;function l(){const g=m.scrollWidth>m.clientWidth;t(g),g||i(!1)}l();const u=m.ownerDocument.defaultView;u==null||u.addEventListener("resize",l);const k=u==null?void 0:u.ResizeObserver,f=k?new k(l):void 0;return f==null||f.observe(m),f==null||f.observe(p),()=>{u==null||u.removeEventListener("resize",l),f==null||f.disconnect()}},[]);function c(b){i(e&&b.currentTarget.scrollLeft>1)}return{containerReference:n,contentReference:r,isScrollable:e,isScrolled:s,handleScroll:c}}const U=o.forwardRef(function(r,e){const{"aria-label":t,children:s,className:i,containerClassName:c,...b}=r,{containerReference:d,contentReference:m,isScrollable:p,isScrolled:l,handleScroll:u}=Q(),k=t?`${t} scroll area`:"Scrollable table",f=o.useCallback(g=>{m.current=g,A.assignElementReference(e,g)},[m,e]);return a.jsx("div",{ref:d,"aria-label":p?k:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-scrolled":l||void 0,onScroll:u,role:p?"region":void 0,tabIndex:p?0:void 0,children:a.jsx("table",{...b,ref:f,"aria-label":t,className:["nk-table__element",i].filter(Boolean).join(" "),children:s})})}),W=Object.assign(U,{Body:D,Cell:S,Foot:F,HeaderCell:R,Head:q,Row:J});exports.Table=W;
package/dist/Table.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-83unQQOi.cjs");exports.default=e.Table;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-qetwZpTC.cjs");exports.default=e.Table;
package/dist/Table.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { T as a } from "./Table-Cw8u-pEW.js";
2
+ import { T as a } from "./Table-CADupJEU.js";
3
3
  export {
4
4
  a as default
5
5
  };
package/dist/TextArea.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),M=require("react"),n=require("./aria-DKxpE8cA.cjs");function s(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):1}const b=M.forwardRef(function(o,l){const{"aria-invalid":a,className:d,disabled:c=!1,invalid:t=!1,minRows:r,readOnly:u=!1,resize:v="vertical",rows:i,style:m,...f}=o,x=s(i??r??3),w=`calc(${s(r??i??3)*1.25}em + var(--nk-text-area-padding) * 2 + var(--nk-text-area-border-width) * 2)`,h={...m,"--nk-text-area-min-height":w};return R.jsx("textarea",{...f,ref:l,"aria-invalid":n.resolveAriaInvalid(t,a),className:["nk-text-area",d].filter(Boolean).join(" "),"data-invalid":t||n.hasInvalidState(a)||void 0,"data-resize":v,disabled:c,readOnly:u,rows:x,style:h})});exports.default=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),M=require("react"),n=require("./aria-Bntn6ad_.cjs");function s(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):1}const b=M.forwardRef(function(o,l){const{"aria-invalid":a,className:d,disabled:c=!1,invalid:t=!1,minRows:r,readOnly:u=!1,resize:v="vertical",rows:i,style:m,...f}=o,x=s(i??r??3),w=`calc(${s(r??i??3)*1.25}em + var(--nk-text-area-padding) * 2 + var(--nk-text-area-border-width) * 2)`,h={...m,"--nk-text-area-min-height":w};return R.jsx("textarea",{...f,ref:l,"aria-invalid":n.resolveAriaInvalid(t,a),className:["nk-text-area",d].filter(Boolean).join(" "),"data-invalid":t||n.hasInvalidState(a)||void 0,"data-resize":v,disabled:c,readOnly:u,rows:x,style:h})});exports.default=b;
package/dist/TextArea.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
2
  import { forwardRef as p } from "react";
3
- import { h as R, r as A } from "./aria-DHnOMyYp.js";
3
+ import { h as R, r as A } from "./aria-CeA9QfD1.js";
4
4
  function o(a) {
5
5
  return Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1;
6
6
  }
@@ -0,0 +1 @@
1
+ "use client";"use strict";const T=require("react/jsx-runtime"),n=require("react"),S=require("./reference-C2guRuR0.cjs"),h=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-GzkP9dCc.cjs"),Ee=require("./focus-restoration-70WcQRr5.cjs"),be=require("./Surface-BttJYSDt.cjs"),ye=500,G=n.createContext(null);function De(o){const{children:a,delay:c=ye}=o,l=n.useMemo(()=>({delay:c}),[c]);return T.jsx(G.Provider,{value:l,children:a})}const J=500,$=100;function ge(o,a,c,l){a.current=o,S.assignElementReference(c,o),S.assignElementReference(l,o)}function Ie(o){return Number.isFinite(o)?Math.max(0,o):J}function he(o,a){const c=(o==null?void 0:o.split(/\s+/).filter(Boolean))??[];return c.includes(a)||c.push(a),c.join(" ")}const Le=n.forwardRef(function(a,c){const{children:l,className:K,content:m,contentClassName:Q,contentStyle:V,delay:X,disabled:R=!1,onOpenChange:L,placement:A="top",style:Z}=a;if(m==null||typeof m=="boolean"||typeof m=="string"&&!m.trim())throw new Error("Tooltip content must not be empty");if(l.type===n.Fragment)throw new Error("Tooltip requires a single non-Fragment trigger");const z=`${n.useId()}-tooltip`,_=n.useContext(G),r=l.props,B=S.getElementReference(l),w=n.useRef(null),x=n.useRef(null),Y=n.useRef(R),j=n.useRef(!1),v=n.useRef(null),F=n.useRef(null),k=n.useRef(null),C=n.useRef(!1),E=n.useRef(!1),b=n.useRef(!1),f=n.useRef(!1),[M,ee]=n.useState(null),[ne,te]=n.useState(null),[O,re]=n.useState(!1);Y.current=R;const P=Ie(X??(_==null?void 0:_.delay)??J),y=h.usePresence(O),H=(M==null?void 0:M.ownerDocument)??(typeof document>"u"?null:document),q=h.useBoundary("Tooltip").boundaryElement,N=h.useOverlayLayer(y.present,q),d=we.useFloatingPosition(y.present,A,M,ne,q),oe=n.useMemo(()=>[w,x],[]),se=he(r["aria-describedby"],z),ce=O&&y.present?se:r["aria-describedby"],U=n.useCallback(e=>{ge(e,w,B,c),ee(e)},[c,B]),ue=n.useCallback(e=>{x.current=e,e||(f.current=!1),te(e)},[]),u=n.useCallback(()=>{const e=v.current;e&&e.ownerWindow.clearTimeout(e.timerId),v.current=null},[]),i=n.useCallback(()=>{const e=F.current;e&&e.ownerWindow.clearTimeout(e.timerId),F.current=null},[]),D=n.useCallback(()=>{const e=k.current;e&&e.ownerWindow.clearTimeout(e.timerId),k.current=null},[]),s=n.useCallback(e=>{j.current!==e&&(e||(f.current=!1),j.current=e,re(e),L==null||L(e))},[L]),W=n.useCallback(e=>{var g,I;if(i(),E.current||b.current||f.current)return;if(e===0){s(!1);return}const t=((g=w.current)==null?void 0:g.ownerDocument.defaultView)??((I=x.current)==null?void 0:I.ownerDocument.defaultView);if(!t){s(!1);return}const p=t.setTimeout(()=>{F.current=null,!E.current&&!b.current&&!f.current&&s(!1)},e);F.current={ownerWindow:t,timerId:p}},[i,s]),ie=n.useCallback(()=>{var p;if(u(),i(),P===0){s(!0);return}const e=(p=w.current)==null?void 0:p.ownerDocument.defaultView;if(!e)return;const t=e.setTimeout(()=>{v.current=null,Y.current||s(!0)},P);v.current={ownerWindow:e,timerId:t}},[i,u,P,s]);function le(e){var t;if((t=r.onFocus)==null||t.call(r,e),E.current=!0,i(),C.current||Ee.isElementFocusRestoration(e.currentTarget)){u();return}u(),s(!0)}function ae(e){var t;(t=r.onBlur)==null||t.call(r,e),!e.currentTarget.contains(e.relatedTarget)&&(E.current=!1,u(),W(0))}function fe(e){var t;(t=r.onMouseEnter)==null||t.call(r,e),b.current=!0,ie()}function de(e){var t;(t=r.onMouseLeave)==null||t.call(r,e),b.current=!1,u(),W($)}function me(){f.current=!0,i()}function pe(){f.current=!1,W($)}function Te(e){var g,I;(g=r.onPointerDown)==null||g.call(r,e),u(),i(),s(!1);const t=(I=w.current)==null?void 0:I.ownerDocument.defaultView;if(!t)return;C.current=!0,D();const p=t.setTimeout(()=>{C.current=!1,k.current=null},0);k.current={ownerWindow:t,timerId:p}}if(h.useDismissableLayer({boundary:q,active:O,boundaries:oe,dismissOnPointerDownOutside:!0,layerId:N.id,onEscapeDismiss:()=>s(!1),onPointerDownOutsideDismiss:()=>s(!1),ownerDocument:H}),n.useEffect(()=>{R&&(u(),i(),D(),C.current=!1,E.current=!1,b.current=!1,f.current=!1,j.current&&s(!1))},[i,u,D,R,s]),n.useEffect(()=>()=>{u(),i(),D()},[i,u,D]),R)return n.cloneElement(l,{ref:U});const Re=n.cloneElement(l,{"aria-describedby":ce,className:[r.className,"nk-tooltip__trigger",K].filter(Boolean).join(" "),onBlur:ae,onFocus:le,onMouseEnter:fe,onMouseLeave:de,onPointerDown:Te,ref:U,style:{...r.style,...Z}});return T.jsxs(T.Fragment,{children:[Re,y.present&&H?T.jsx(h.Portal,{children:T.jsxs(be.Surface,{ref:ue,"aria-hidden":O?void 0:!0,className:["nk-tooltip",Q].filter(Boolean).join(" "),"data-placement":(d==null?void 0:d.placement)??A,"data-state":y.state==="closing"?"closing":"open",id:z,onMouseEnter:me,onMouseLeave:pe,role:"tooltip",style:d?{...V,"--nk-tooltip-arrow-offset":`${d.arrowOffset}px`,left:d.left,top:d.top,zIndex:N.zIndex}:{...V,visibility:"hidden",zIndex:N.zIndex},children:[T.jsx("span",{"aria-hidden":"true",className:"nk-tooltip__arrow"}),m]})}):null]})}),ve=Object.assign(Le,{Provider:De});exports.Tooltip2=ve;