neatkit 0.10.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/Boundary.cjs +1 -1
- package/dist/Boundary.js +191 -120
- package/dist/{Button-CVe9T_Zw.cjs → Button-6oWs-pyF.cjs} +1 -1
- package/dist/{Button-D6rXvcqq.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 +2 -2
- 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/Field.cjs +1 -1
- package/dist/Field.js +57 -62
- package/dist/Icon-BFaHVAoQ.cjs +1 -0
- package/dist/{Icon-CxK1wlGk.js → Icon-Cj1s40xn.js} +308 -96
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +2 -2
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +76 -75
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +4 -4
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +228 -192
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +117 -119
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +1 -1
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +12 -11
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +441 -309
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.js +1 -1
- package/dist/{Table-DutHfiXR.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/TextArea.cjs +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/Tooltip-CpyROf6x.js +225 -0
- package/dist/Tooltip-DDPh_YFO.cjs +1 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/aria-Bv-xVREf.js +17 -0
- package/dist/aria-DM-xYEHQ.cjs +1 -0
- package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
- 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/AppleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChainIcon.d.ts +11 -0
- package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
- package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
- package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
- package/dist/components/Icon/utils/registry.d.ts +8 -0
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/PinInput/hooks/usePinInput.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +1 -1
- package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -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/effects-D98vUn6N.cjs +1 -0
- package/dist/effects-DGbA6Q2O.js +18 -0
- package/dist/style.css +1 -1
- package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
- package/dist/useFloatingPosition-MGoyautY.js +57 -0
- package/dist/{useFocusTrap-C0IcCdNf.js → useFocusTrap-BxPazAL6.js} +1 -1
- package/dist/{useFocusTrap-gAK_402D.cjs → useFocusTrap-CrMcAu8s.cjs} +1 -1
- package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
- package/dist/usePresence-Dm0mls5p.cjs +1 -0
- package/dist/utils/aria.d.ts +4 -5
- package/dist/utils/trigger.d.ts +46 -0
- 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-BIBzgznI.cjs +0 -1
- package/dist/Table-BqWBgMTU.cjs +0 -1
- package/dist/Tooltip-CCuE-hfp.cjs +0 -1
- package/dist/Tooltip-CeyRKNv4.js +0 -231
- package/dist/aria-Bntn6ad_.cjs +0 -1
- package/dist/aria-CeA9QfD1.js +0 -15
- package/dist/effects-D5CWf-Pl.js +0 -8
- package/dist/effects-D85L_7zM.cjs +0 -1
- package/dist/useFloatingPosition-Dq8xpr3E.js +0 -27
- package/dist/useFloatingPosition-g5kXywoB.cjs +0 -1
- package/dist/usePresence-B5RYv4e1.cjs +0 -1
package/dist/Switch.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),l=require("react"),d=require("./aria-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),l=require("react"),d=require("./aria-DM-xYEHQ.cjs"),o=l.forwardRef(function(s,t){const{"aria-invalid":e,className:n,disabled:i=!1,style:r,...c}=s;return a.jsxs("span",{className:["nk-switch",n].filter(Boolean).join(" "),"data-disabled":i||void 0,"data-invalid":d.hasInvalidState(e)||void 0,style:r,children:[a.jsx("input",{...c,ref:t,"aria-invalid":e,className:"nk-switch__control",disabled:i,role:"switch",type:"checkbox"}),a.jsx("span",{"aria-hidden":"true",className:"nk-switch__track",children:a.jsx("span",{className:"nk-switch__thumb"})})]})});exports.default=o;
|
package/dist/Switch.js
CHANGED
|
@@ -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
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-
|
|
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-DM-xYEHQ.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-
|
|
3
|
+
import { h as R, r as A } from "./aria-Bv-xVREf.js";
|
|
4
4
|
function o(a) {
|
|
5
5
|
return Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1;
|
|
6
6
|
}
|