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.
- package/dist/{Button-DtrX4X-s.cjs → Button-6oWs-pyF.cjs} +1 -1
- package/dist/{Button-LmEHdRkW.js → Button-B0E-M8mp.js} +1 -1
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.js +75 -2
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/Code-f0GWveGp.cjs +4 -0
- package/dist/{Code-Bp2X1k-g.js → Code-pROJjsiG.js} +57 -58
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/Icon-BFaHVAoQ.cjs +1 -0
- package/dist/{Icon-NT3kRJYz.js → Icon-Cj1s40xn.js} +122 -91
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +1 -1
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +76 -75
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +1 -1
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +228 -192
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +1 -1
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +427 -344
- package/dist/{Table-GeoE4h-u.js → Table-B2G8CHJ9.js} +111 -108
- package/dist/Table-Z8Q6XRkc.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/components/Card/Card.d.ts +22 -23
- package/dist/components/Card/components/CardBody.d.ts +24 -0
- package/dist/components/Card/components/CardFooter.d.ts +24 -0
- package/dist/components/Card/components/CardHeader.d.ts +24 -0
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Code/Code.d.ts +9 -7
- package/dist/components/Code/index.d.ts +1 -1
- package/dist/components/Icon/icons/ChainIcon.d.ts +11 -0
- package/dist/components/Icon/utils/registry.d.ts +1 -0
- package/dist/components/PinInput/hooks/usePinInput.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
- package/dist/components/Sidebar/hooks/useContentBelow.d.ts +23 -0
- package/dist/components/Sidebar/utils/children.d.ts +16 -0
- package/dist/components/Table/Table.d.ts +8 -2
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/Card-CPq6dsut.js +0 -34
- package/dist/Card-CQ-8_1tO.cjs +0 -1
- package/dist/Code-B7s_rN0G.cjs +0 -4
- package/dist/Icon-CMSHMSDJ.cjs +0 -1
- package/dist/Table-Bjw9lUKS.cjs +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import { createContext as z, forwardRef as g, Children as
|
|
2
|
+
import { jsx as a, jsxs as B } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as z, forwardRef as g, Children as L, isValidElement as j, Fragment as A, cloneElement as x, createElement as M, useRef as y, useContext as V, useState as E, useEffect as Y, useCallback as X } from "react";
|
|
4
4
|
import { a as $ } from "./reference-CXMr27nM.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { S as q } from "./Surface-vEFsZC12.js";
|
|
6
|
+
import { B as G } from "./Button-B0E-M8mp.js";
|
|
7
|
+
import { T as J } from "./Tooltip-CpyROf6x.js";
|
|
8
|
+
const T = z("body"), I = g(function(l, e) {
|
|
8
9
|
const {
|
|
9
10
|
align: t = "left",
|
|
10
11
|
children: i,
|
|
@@ -26,17 +27,17 @@ const v = z("body"), A = g(function(l, e) {
|
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
});
|
|
29
|
-
function
|
|
30
|
-
for (const l of
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
30
|
+
function H(n) {
|
|
31
|
+
for (const l of L.toArray(n)) {
|
|
32
|
+
if (j(l) && l.type === A) {
|
|
33
|
+
if (H(l.props.children)) return !0;
|
|
33
34
|
continue;
|
|
34
35
|
}
|
|
35
36
|
return !0;
|
|
36
37
|
}
|
|
37
38
|
return !1;
|
|
38
39
|
}
|
|
39
|
-
const
|
|
40
|
+
const Q = g(
|
|
40
41
|
function(l, e) {
|
|
41
42
|
const {
|
|
42
43
|
children: t,
|
|
@@ -44,7 +45,7 @@ const J = g(
|
|
|
44
45
|
emptyColumnCount: r = 1,
|
|
45
46
|
emptyMessage: c,
|
|
46
47
|
...f
|
|
47
|
-
} = l, s = !
|
|
48
|
+
} = l, s = !H(t), m = Number.isFinite(r) ? Math.max(1, Math.floor(r)) : 1;
|
|
48
49
|
return /* @__PURE__ */ a(
|
|
49
50
|
"tbody",
|
|
50
51
|
{
|
|
@@ -55,22 +56,22 @@ const J = g(
|
|
|
55
56
|
"td",
|
|
56
57
|
{
|
|
57
58
|
className: "nk-table__cell nk-table__empty-cell",
|
|
58
|
-
colSpan:
|
|
59
|
+
colSpan: m,
|
|
59
60
|
children: /* @__PURE__ */ a("div", { className: "nk-table__empty-content", children: c })
|
|
60
61
|
}
|
|
61
|
-
) }) : /* @__PURE__ */ a(
|
|
62
|
+
) }) : /* @__PURE__ */ a(T.Provider, { value: "body", children: t })
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
);
|
|
66
|
-
function
|
|
67
|
+
function U(n, l, e) {
|
|
67
68
|
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
|
}
|
|
69
|
-
function
|
|
70
|
+
function W(n) {
|
|
70
71
|
if (typeof n == "number" || typeof n == "string")
|
|
71
72
|
return String(n);
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
+
const D = g(
|
|
74
75
|
function(l, e) {
|
|
75
76
|
const {
|
|
76
77
|
align: t = "left",
|
|
@@ -79,10 +80,10 @@ const H = g(
|
|
|
79
80
|
format: c,
|
|
80
81
|
title: f,
|
|
81
82
|
truncate: s,
|
|
82
|
-
value:
|
|
83
|
+
value: m,
|
|
83
84
|
...h
|
|
84
|
-
} = l, { rowTrigger: o, ...d } = h, p =
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
} = l, { rowTrigger: o, ...d } = h, p = U(m, i, c), u = s === void 0 ? void 0 : { maxWidth: s }, k = f ?? (s === void 0 ? void 0 : W(p));
|
|
86
|
+
return /* @__PURE__ */ B(
|
|
86
87
|
"td",
|
|
87
88
|
{
|
|
88
89
|
...d,
|
|
@@ -120,7 +121,7 @@ const H = g(
|
|
|
120
121
|
}
|
|
121
122
|
);
|
|
122
123
|
}
|
|
123
|
-
),
|
|
124
|
+
), Z = g(
|
|
124
125
|
function(l, e) {
|
|
125
126
|
const { children: t, className: i, ...r } = l;
|
|
126
127
|
return /* @__PURE__ */ a(
|
|
@@ -129,11 +130,11 @@ const H = g(
|
|
|
129
130
|
...r,
|
|
130
131
|
ref: e,
|
|
131
132
|
className: ["nk-table__foot", i].filter(Boolean).join(" "),
|
|
132
|
-
children: /* @__PURE__ */ a(
|
|
133
|
+
children: /* @__PURE__ */ a(T.Provider, { value: "foot", children: t })
|
|
133
134
|
}
|
|
134
135
|
);
|
|
135
136
|
}
|
|
136
|
-
),
|
|
137
|
+
), ee = g(
|
|
137
138
|
function(l, e) {
|
|
138
139
|
const { children: t, className: i, ...r } = l;
|
|
139
140
|
return /* @__PURE__ */ a(
|
|
@@ -142,11 +143,11 @@ const H = g(
|
|
|
142
143
|
...r,
|
|
143
144
|
ref: e,
|
|
144
145
|
className: ["nk-table__head", i].filter(Boolean).join(" "),
|
|
145
|
-
children: /* @__PURE__ */ a(
|
|
146
|
+
children: /* @__PURE__ */ a(T.Provider, { value: "head", children: t })
|
|
146
147
|
}
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
|
-
),
|
|
150
|
+
), te = [
|
|
150
151
|
"a[href]",
|
|
151
152
|
"audio[controls]",
|
|
152
153
|
"button",
|
|
@@ -158,7 +159,7 @@ const H = g(
|
|
|
158
159
|
"textarea",
|
|
159
160
|
"video[controls]",
|
|
160
161
|
"[contenteditable]:not([contenteditable='false'])"
|
|
161
|
-
].join(","),
|
|
162
|
+
].join(","), ne = /* @__PURE__ */ new Set([
|
|
162
163
|
"button",
|
|
163
164
|
"checkbox",
|
|
164
165
|
"combobox",
|
|
@@ -185,26 +186,26 @@ const H = g(
|
|
|
185
186
|
"treegrid",
|
|
186
187
|
"treeitem"
|
|
187
188
|
]);
|
|
188
|
-
function
|
|
189
|
+
function le(n, l) {
|
|
189
190
|
var t;
|
|
190
191
|
let e = n;
|
|
191
192
|
for (; e && e !== l; ) {
|
|
192
|
-
if (e.matches(
|
|
193
|
+
if (e.matches(te) || (((t = e.getAttribute("role")) == null ? void 0 : t.split(/\s+/)) ?? []).some((r) => ne.has(r)))
|
|
193
194
|
return !0;
|
|
194
195
|
e = e.parentElement;
|
|
195
196
|
}
|
|
196
197
|
return !1;
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function oe(n, l) {
|
|
199
200
|
let e = !1;
|
|
200
201
|
function t(r) {
|
|
201
|
-
return
|
|
202
|
+
return L.map(r, (c) => j(c) ? c.type === A ? x(
|
|
202
203
|
c,
|
|
203
204
|
void 0,
|
|
204
205
|
t(
|
|
205
206
|
c.props.children
|
|
206
207
|
)
|
|
207
|
-
) : !e && c.type ===
|
|
208
|
+
) : !e && c.type === D ? (e = !0, x(
|
|
208
209
|
c,
|
|
209
210
|
{ rowTrigger: l }
|
|
210
211
|
)) : c : c);
|
|
@@ -212,15 +213,15 @@ function le(n, l) {
|
|
|
212
213
|
const i = t(n);
|
|
213
214
|
return { attached: e, content: i };
|
|
214
215
|
}
|
|
215
|
-
function
|
|
216
|
+
function re(n) {
|
|
216
217
|
const {
|
|
217
218
|
"aria-label": l,
|
|
218
219
|
icon: e,
|
|
219
220
|
label: t,
|
|
220
221
|
...i
|
|
221
222
|
} = n;
|
|
222
|
-
return /* @__PURE__ */ a(
|
|
223
|
-
|
|
223
|
+
return /* @__PURE__ */ a(J, { content: t, children: /* @__PURE__ */ a(
|
|
224
|
+
G,
|
|
224
225
|
{
|
|
225
226
|
...i,
|
|
226
227
|
"aria-label": l ?? t,
|
|
@@ -232,7 +233,7 @@ function oe(n) {
|
|
|
232
233
|
}
|
|
233
234
|
) });
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function ae(n) {
|
|
236
237
|
const { actions: l } = n;
|
|
237
238
|
function e(t) {
|
|
238
239
|
t.stopPropagation();
|
|
@@ -243,14 +244,14 @@ function re(n) {
|
|
|
243
244
|
className: "nk-table__cell nk-table__action-cell",
|
|
244
245
|
"data-align": "right",
|
|
245
246
|
onClick: e,
|
|
246
|
-
children: l.length > 0 ? /* @__PURE__ */ a("span", { className: "nk-table__action-list", children: l.map((t) => /* @__PURE__ */ M(
|
|
247
|
+
children: l.length > 0 ? /* @__PURE__ */ a("span", { className: "nk-table__action-list", children: l.map((t) => /* @__PURE__ */ M(re, { ...t, key: t.label })) }) : null
|
|
247
248
|
}
|
|
248
249
|
);
|
|
249
250
|
}
|
|
250
|
-
const
|
|
251
|
+
const ie = g(function(l, e) {
|
|
251
252
|
const { children: t, className: i, ...r } = l;
|
|
252
253
|
return /* @__PURE__ */ a(
|
|
253
|
-
|
|
254
|
+
I,
|
|
254
255
|
{
|
|
255
256
|
...r,
|
|
256
257
|
ref: e,
|
|
@@ -259,7 +260,7 @@ const ae = g(function(l, e) {
|
|
|
259
260
|
children: t ?? /* @__PURE__ */ a("span", { className: "nk-table__visually-hidden", children: "Row actions" })
|
|
260
261
|
}
|
|
261
262
|
);
|
|
262
|
-
}),
|
|
263
|
+
}), ce = g(
|
|
263
264
|
function(l, e) {
|
|
264
265
|
const {
|
|
265
266
|
"aria-label": t,
|
|
@@ -268,70 +269,70 @@ const ae = g(function(l, e) {
|
|
|
268
269
|
className: c,
|
|
269
270
|
download: f,
|
|
270
271
|
href: s,
|
|
271
|
-
hrefLang:
|
|
272
|
+
hrefLang: m,
|
|
272
273
|
onClick: h,
|
|
273
274
|
onNavigate: o,
|
|
274
275
|
rel: d,
|
|
275
276
|
target: p,
|
|
276
277
|
...u
|
|
277
|
-
} = l, k =
|
|
278
|
-
function
|
|
279
|
-
k.current =
|
|
278
|
+
} = l, k = y(null), C = V(T), N = s !== void 0 || h !== void 0, R = (t == null ? void 0 : t.trim()) || (s !== void 0 ? "Open row" : "Activate row");
|
|
279
|
+
function S(b) {
|
|
280
|
+
k.current = b;
|
|
280
281
|
}
|
|
281
|
-
let
|
|
282
|
-
s !== void 0 ?
|
|
283
|
-
ariaLabel:
|
|
282
|
+
let _;
|
|
283
|
+
s !== void 0 ? _ = {
|
|
284
|
+
ariaLabel: R,
|
|
284
285
|
kind: "link",
|
|
285
286
|
linkProperties: {
|
|
286
287
|
download: f,
|
|
287
288
|
href: s,
|
|
288
|
-
hrefLang:
|
|
289
|
+
hrefLang: m,
|
|
289
290
|
onNavigate: o,
|
|
290
291
|
rel: d,
|
|
291
292
|
target: p
|
|
292
293
|
},
|
|
293
|
-
reference:
|
|
294
|
-
} : h !== void 0 && (
|
|
295
|
-
ariaLabel:
|
|
294
|
+
reference: S
|
|
295
|
+
} : h !== void 0 && (_ = {
|
|
296
|
+
ariaLabel: R,
|
|
296
297
|
kind: "button",
|
|
297
298
|
onClick: h,
|
|
298
|
-
reference:
|
|
299
|
+
reference: S
|
|
299
300
|
});
|
|
300
|
-
const K =
|
|
301
|
-
function O(
|
|
302
|
-
if (
|
|
303
|
-
const P =
|
|
304
|
-
if (!(P instanceof Element) ||
|
|
305
|
-
const
|
|
306
|
-
if (!
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
309
|
-
|
|
301
|
+
const K = _ ? oe(r, _) : { content: r };
|
|
302
|
+
function O(b) {
|
|
303
|
+
if (b.defaultPrevented) return;
|
|
304
|
+
const P = b.target;
|
|
305
|
+
if (!(P instanceof Element) || le(P, b.currentTarget)) return;
|
|
306
|
+
const v = k.current;
|
|
307
|
+
if (!v) return;
|
|
308
|
+
const w = v.ownerDocument.defaultView;
|
|
309
|
+
if (!w) {
|
|
310
|
+
v.click();
|
|
310
311
|
return;
|
|
311
312
|
}
|
|
312
|
-
|
|
313
|
-
altKey:
|
|
313
|
+
v.dispatchEvent(new w.MouseEvent("click", {
|
|
314
|
+
altKey: b.altKey,
|
|
314
315
|
bubbles: !0,
|
|
315
|
-
button:
|
|
316
|
-
buttons:
|
|
316
|
+
button: b.button,
|
|
317
|
+
buttons: b.buttons,
|
|
317
318
|
cancelable: !0,
|
|
318
|
-
clientX:
|
|
319
|
-
clientY:
|
|
320
|
-
ctrlKey:
|
|
321
|
-
metaKey:
|
|
322
|
-
shiftKey:
|
|
319
|
+
clientX: b.clientX,
|
|
320
|
+
clientY: b.clientY,
|
|
321
|
+
ctrlKey: b.ctrlKey,
|
|
322
|
+
metaKey: b.metaKey,
|
|
323
|
+
shiftKey: b.shiftKey
|
|
323
324
|
}));
|
|
324
325
|
}
|
|
325
|
-
const F =
|
|
326
|
-
return /* @__PURE__ */
|
|
326
|
+
const F = C === "head" ? /* @__PURE__ */ a(ie, {}) : /* @__PURE__ */ a(ae, { actions: i ?? [] });
|
|
327
|
+
return /* @__PURE__ */ B(
|
|
327
328
|
"tr",
|
|
328
329
|
{
|
|
329
330
|
...u,
|
|
330
331
|
ref: e,
|
|
331
|
-
"aria-label":
|
|
332
|
+
"aria-label": N ? void 0 : t,
|
|
332
333
|
className: ["nk-table__row", c].filter(Boolean).join(" "),
|
|
333
|
-
"data-interactive":
|
|
334
|
-
onClick:
|
|
334
|
+
"data-interactive": N || void 0,
|
|
335
|
+
onClick: N ? O : void 0,
|
|
335
336
|
children: [
|
|
336
337
|
K.content,
|
|
337
338
|
F
|
|
@@ -340,21 +341,21 @@ const ae = g(function(l, e) {
|
|
|
340
341
|
);
|
|
341
342
|
}
|
|
342
343
|
);
|
|
343
|
-
function
|
|
344
|
-
const n =
|
|
344
|
+
function se() {
|
|
345
|
+
const n = y(null), l = y(null), [e, t] = E(!1), [i, r] = E(!1);
|
|
345
346
|
Y(() => {
|
|
346
347
|
const f = n.current, s = l.current;
|
|
347
348
|
if (!f || !s) return;
|
|
348
|
-
const
|
|
349
|
+
const m = f, h = s;
|
|
349
350
|
function o() {
|
|
350
|
-
const k =
|
|
351
|
+
const k = m.scrollWidth > m.clientWidth;
|
|
351
352
|
t(k), k || r(!1);
|
|
352
353
|
}
|
|
353
354
|
o();
|
|
354
|
-
const d =
|
|
355
|
+
const d = m.ownerDocument.defaultView;
|
|
355
356
|
d == null || d.addEventListener("resize", o);
|
|
356
357
|
const p = d == null ? void 0 : d.ResizeObserver, u = p ? new p(o) : void 0;
|
|
357
|
-
return u == null || u.observe(
|
|
358
|
+
return u == null || u.observe(m), u == null || u.observe(h), () => {
|
|
358
359
|
d == null || d.removeEventListener("resize", o), u == null || u.disconnect();
|
|
359
360
|
};
|
|
360
361
|
}, []);
|
|
@@ -369,40 +370,42 @@ function ce() {
|
|
|
369
370
|
handleScroll: c
|
|
370
371
|
};
|
|
371
372
|
}
|
|
372
|
-
const
|
|
373
|
+
const de = g(function(l, e) {
|
|
373
374
|
const {
|
|
374
375
|
"aria-label": t,
|
|
375
376
|
children: i,
|
|
376
377
|
className: r,
|
|
377
378
|
containerClassName: c,
|
|
378
|
-
|
|
379
|
+
frame: f = "outline",
|
|
380
|
+
...s
|
|
379
381
|
} = l, {
|
|
380
|
-
containerReference:
|
|
381
|
-
contentReference:
|
|
382
|
-
isScrollable:
|
|
383
|
-
isScrolled:
|
|
384
|
-
handleScroll:
|
|
385
|
-
} =
|
|
386
|
-
(
|
|
387
|
-
|
|
382
|
+
containerReference: m,
|
|
383
|
+
contentReference: h,
|
|
384
|
+
isScrollable: o,
|
|
385
|
+
isScrolled: d,
|
|
386
|
+
handleScroll: p
|
|
387
|
+
} = se(), u = t ? `${t} scroll area` : "Scrollable table", k = X(
|
|
388
|
+
(C) => {
|
|
389
|
+
h.current = C, $(e, C);
|
|
388
390
|
},
|
|
389
|
-
[
|
|
391
|
+
[h, e]
|
|
390
392
|
);
|
|
391
393
|
return /* @__PURE__ */ a(
|
|
392
|
-
|
|
394
|
+
q,
|
|
393
395
|
{
|
|
394
|
-
ref:
|
|
395
|
-
"aria-label":
|
|
396
|
+
ref: m,
|
|
397
|
+
"aria-label": o ? u : void 0,
|
|
396
398
|
className: ["nk-table", c].filter(Boolean).join(" "),
|
|
397
|
-
"data-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
"data-frame": f,
|
|
400
|
+
"data-scrolled": d || void 0,
|
|
401
|
+
onScroll: p,
|
|
402
|
+
role: o ? "region" : void 0,
|
|
403
|
+
tabIndex: o ? 0 : void 0,
|
|
401
404
|
children: /* @__PURE__ */ a(
|
|
402
405
|
"table",
|
|
403
406
|
{
|
|
404
|
-
...
|
|
405
|
-
ref:
|
|
407
|
+
...s,
|
|
408
|
+
ref: k,
|
|
406
409
|
"aria-label": t,
|
|
407
410
|
className: ["nk-table__element", r].filter(Boolean).join(" "),
|
|
408
411
|
children: i
|
|
@@ -410,14 +413,14 @@ const se = g(function(l, e) {
|
|
|
410
413
|
)
|
|
411
414
|
}
|
|
412
415
|
);
|
|
413
|
-
}),
|
|
414
|
-
Body:
|
|
415
|
-
Cell:
|
|
416
|
-
Foot:
|
|
417
|
-
HeaderCell:
|
|
418
|
-
Head:
|
|
419
|
-
Row:
|
|
416
|
+
}), ke = Object.assign(de, {
|
|
417
|
+
Body: Q,
|
|
418
|
+
Cell: D,
|
|
419
|
+
Foot: Z,
|
|
420
|
+
HeaderCell: I,
|
|
421
|
+
Head: ee,
|
|
422
|
+
Row: ce
|
|
420
423
|
});
|
|
421
424
|
export {
|
|
422
|
-
|
|
425
|
+
ke as T
|
|
423
426
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const a=require("react/jsx-runtime"),o=require("react"),A=require("./reference-C2guRuR0.cjs"),I=require("./Surface-BttJYSDt.cjs"),H=require("./Button-6oWs-pyF.cjs"),D=require("./Tooltip-DDPh_YFO.cjs"),v=o.createContext("body"),w=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 S(n){for(const r of o.Children.toArray(n)){if(o.isValidElement(r)&&r.type===o.Fragment){if(S(r.props.children))return!0;continue}return!0}return!1}const K=o.forwardRef(function(r,e){const{children:t,className:s,emptyColumnCount:i=1,emptyMessage:c,...b}=r,d=!S(t),h=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:h,children:a.jsx("div",{className:"nk-table__empty-content",children:c})})}):a.jsx(v.Provider,{value:"body",children:t})})});function O(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 F(n){if(typeof n=="number"||typeof n=="string")return String(n)}const P=o.forwardRef(function(r,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...p}=r,{rowTrigger:l,...u}=p,k=O(h,s,c),f=d===void 0?void 0:{maxWidth:d},g=b??(d===void 0?void 0:F(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]})}),q=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})})}),z=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})})}),V=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),M=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 Y(n,r){var t;let e=n;for(;e&&e!==r;){if(e.matches(V)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(i=>M.has(i)))return!0;e=e.parentElement}return!1}function X(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===P?(e=!0,o.cloneElement(c,{rowTrigger:r})):c:c)}const s=t(n);return{attached:e,content:s}}function $(n){const{"aria-label":r,icon:e,label:t,...s}=n;return a.jsx(D.Tooltip2,{content:t,children:a.jsx(H.Button,{...s,"aria-label":r??t,className:"nk-table__action",icon:e,shape:"rectangle",type:"button",variant:"ghost"})})}function G(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($,{...t,key:t.label}))}):null})}const J=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx(w,{...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"})})}),Q=o.forwardRef(function(r,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:p,onNavigate:l,rel:u,target:k,...f}=r,g=o.useRef(null),C=o.useContext(v),T=d!==void 0||p!==void 0,N=(t==null?void 0:t.trim())||(d!==void 0?"Open row":"Activate row");function j(m){g.current=m}let _;d!==void 0?_={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:l,rel:u,target:k},reference:j}:p!==void 0&&(_={ariaLabel:N,kind:"button",onClick:p,reference:j});const E=_?X(i,_):{content:i};function B(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||Y(y,m.currentTarget))return;const x=g.current;if(!x)return;const R=x.ownerDocument.defaultView;if(!R){x.click();return}x.dispatchEvent(new R.MouseEvent("click",{altKey:m.altKey,bubbles:!0,button:m.button,buttons:m.buttons,cancelable:!0,clientX:m.clientX,clientY:m.clientY,ctrlKey:m.ctrlKey,metaKey:m.metaKey,shiftKey:m.shiftKey}))}const L=C==="head"?a.jsx(J,{}):a.jsx(G,{actions:s??[]});return a.jsxs("tr",{...f,ref:e,"aria-label":T?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":T||void 0,onClick:T?B:void 0,children:[E.content,L]})});function U(){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 h=b,p=d;function l(){const g=h.scrollWidth>h.clientWidth;t(g),g||i(!1)}l();const u=h.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(h),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 W=o.forwardRef(function(r,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",...d}=r,{containerReference:h,contentReference:p,isScrollable:l,isScrolled:u,handleScroll:k}=U(),f=t?`${t} scroll area`:"Scrollable table",g=o.useCallback(C=>{p.current=C,A.assignElementReference(e,C)},[p,e]);return a.jsx(I.Surface,{ref:h,"aria-label":l?f:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":u||void 0,onScroll:k,role:l?"region":void 0,tabIndex:l?0:void 0,children:a.jsx("table",{...d,ref:g,"aria-label":t,className:["nk-table__element",i].filter(Boolean).join(" "),children:s})})}),Z=Object.assign(W,{Body:K,Cell:P,Foot:q,HeaderCell:w,Head:z,Row:Q});exports.Table=Z;
|
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-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-Z8Q6XRkc.cjs");exports.default=e.Table;
|
package/dist/Table.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import CardBody from "./components/CardBody";
|
|
3
|
+
import CardFooter from "./components/CardFooter";
|
|
4
|
+
import CardHeader from "./components/CardHeader";
|
|
2
5
|
import "./styles/card.css";
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** The secondary label displayed after the primary label. */
|
|
8
|
-
subtitle?: string;
|
|
9
|
-
};
|
|
10
|
-
/** A type representing the internal spacing applied by a Card. */
|
|
6
|
+
export type { CardBodyProps } from "./components/CardBody";
|
|
7
|
+
export type { CardFooterProps } from "./components/CardFooter";
|
|
8
|
+
export type { CardHeaderProps } from "./components/CardHeader";
|
|
9
|
+
/** A type representing the internal spacing applied to a Card region. */
|
|
11
10
|
export type CardSpacing = "none" | "standard";
|
|
11
|
+
/** A type representing the complete compound Card component. */
|
|
12
|
+
type CardComponent = typeof CardRoot & {
|
|
13
|
+
/** The content region carrying optional internal spacing. */
|
|
14
|
+
Body: typeof CardBody;
|
|
15
|
+
/** The region separated from preceding Card content by a border. */
|
|
16
|
+
Footer: typeof CardFooter;
|
|
17
|
+
/** The region separated from following Card content by a border. */
|
|
18
|
+
Header: typeof CardHeader;
|
|
19
|
+
};
|
|
12
20
|
/** A type representing properties for the Card component. */
|
|
13
21
|
export type CardProps = HTMLAttributes<HTMLDivElement> & {
|
|
14
|
-
/** The
|
|
22
|
+
/** The regions composing the Card surface. */
|
|
15
23
|
children: ReactNode;
|
|
16
|
-
/** The optional fixed-format labels displayed above the Card content. */
|
|
17
|
-
header?: CardHeader;
|
|
18
|
-
/** The internal spacing applied to the Card content region. */
|
|
19
|
-
spacing?: CardSpacing;
|
|
20
24
|
};
|
|
21
25
|
/**
|
|
22
26
|
* Renders a bordered surface for grouping related content.
|
|
23
27
|
*
|
|
24
|
-
*
|
|
25
|
-
* Spacing can be removed for custom full-bleed layouts.
|
|
26
|
-
*
|
|
27
|
-
* @param props - The properties that configure the Card.
|
|
28
|
+
* @param props - The native properties that configure the Card surface.
|
|
28
29
|
* @param forwardedReference - The reference assigned to the Card element.
|
|
29
30
|
*
|
|
30
31
|
* @returns The rendered Card surface.
|
|
31
32
|
*/
|
|
32
|
-
declare const
|
|
33
|
-
/** The
|
|
33
|
+
declare const CardRoot: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
34
|
+
/** The regions composing the Card surface. */
|
|
34
35
|
children: ReactNode;
|
|
35
|
-
/** The optional fixed-format labels displayed above the Card content. */
|
|
36
|
-
header?: CardHeader;
|
|
37
|
-
/** The internal spacing applied to the Card content region. */
|
|
38
|
-
spacing?: CardSpacing;
|
|
39
36
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
/** The compound Card component and its structural regions. */
|
|
38
|
+
declare const Card: CardComponent;
|
|
40
39
|
export default Card;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { CardSpacing } from "../Card";
|
|
3
|
+
/** A type representing properties for the Card.Body component. */
|
|
4
|
+
export type CardBodyProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
/** The content rendered in the Card body. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** The internal spacing applied around the body content. */
|
|
8
|
+
spacing?: CardSpacing;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders the optionally spaced content region of a Card.
|
|
12
|
+
*
|
|
13
|
+
* @param props - The properties that configure the Card body.
|
|
14
|
+
* @param forwardedReference - The reference assigned to the body element.
|
|
15
|
+
*
|
|
16
|
+
* @returns The rendered Card body.
|
|
17
|
+
*/
|
|
18
|
+
declare const CardBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
/** The content rendered in the Card body. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The internal spacing applied around the body content. */
|
|
22
|
+
spacing?: CardSpacing;
|
|
23
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default CardBody;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { CardSpacing } from "../Card";
|
|
3
|
+
/** A type representing properties for the Card.Footer component. */
|
|
4
|
+
export type CardFooterProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
/** The content rendered after the Card body. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** The internal spacing applied around the footer content. */
|
|
8
|
+
spacing?: CardSpacing;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders a Card region separated from preceding content by a border.
|
|
12
|
+
*
|
|
13
|
+
* @param props - The native properties that configure the Card footer.
|
|
14
|
+
* @param forwardedReference - The reference assigned to the footer element.
|
|
15
|
+
*
|
|
16
|
+
* @returns The rendered Card footer.
|
|
17
|
+
*/
|
|
18
|
+
declare const CardFooter: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
/** The content rendered after the Card body. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The internal spacing applied around the footer content. */
|
|
22
|
+
spacing?: CardSpacing;
|
|
23
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default CardFooter;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { CardSpacing } from "../Card";
|
|
3
|
+
/** A type representing properties for the Card.Header component. */
|
|
4
|
+
export type CardHeaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
/** The content rendered before the Card body. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** The internal spacing applied around the header content. */
|
|
8
|
+
spacing?: CardSpacing;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders a Card region separated from following content by a border.
|
|
12
|
+
*
|
|
13
|
+
* @param props - The native properties that configure the Card header.
|
|
14
|
+
* @param forwardedReference - The reference assigned to the header element.
|
|
15
|
+
*
|
|
16
|
+
* @returns The rendered Card header.
|
|
17
|
+
*/
|
|
18
|
+
declare const CardHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
/** The content rendered before the Card body. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The internal spacing applied around the header content. */
|
|
22
|
+
spacing?: CardSpacing;
|
|
23
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default CardHeader;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./Card";
|
|
2
|
-
export type {
|
|
2
|
+
export type { CardBodyProps, CardFooterProps, CardHeaderProps, CardProps, CardSpacing, } from "./Card";
|