neatkit 0.5.0 → 0.7.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/Alert-DQ5CCE0N.js +29 -0
- package/dist/Alert-LJDkNUqH.cjs +1 -0
- package/dist/Alert.cjs +1 -0
- package/dist/Alert.js +4 -0
- package/dist/Avatar.cjs +1 -0
- package/dist/Avatar.js +55 -0
- package/dist/Badge.cjs +1 -0
- package/dist/Badge.js +25 -0
- package/dist/Button-BAsLfA0D.js +99 -0
- package/dist/Button-D7JUO6Fs.cjs +1 -0
- package/dist/Button.cjs +1 -0
- package/dist/Button.js +5 -0
- package/dist/Card-CPq6dsut.js +34 -0
- package/dist/Card-CQ-8_1tO.cjs +1 -0
- package/dist/Card.cjs +1 -0
- package/dist/Card.js +4 -0
- package/dist/Checkbox-BvXM9VyY.js +68 -0
- package/dist/Checkbox-VQifZrZZ.cjs +1 -0
- package/dist/Checkbox.cjs +1 -0
- package/dist/Checkbox.js +5 -0
- package/dist/CheckboxGroup.cjs +1 -0
- package/dist/CheckboxGroup.js +144 -0
- package/dist/{Code-D4qqPnTN.js → Code-BP2ZCmUf.js} +4 -3
- package/dist/Code-eispVOW3.cjs +6 -0
- package/dist/Code.cjs +1 -0
- package/dist/Code.js +5 -0
- package/dist/Content.cjs +1 -0
- package/dist/Content.js +144 -0
- package/dist/Divider-BE15WVDI.js +42 -0
- package/dist/Divider-CJYbFcSX.cjs +1 -0
- package/dist/Divider.cjs +1 -0
- package/dist/Divider.js +4 -0
- package/dist/Field.cjs +1 -0
- package/dist/Field.js +115 -0
- package/dist/Icon-D8IZceys.cjs +1 -0
- package/dist/Icon-uQmpr5P2.js +1139 -0
- package/dist/Icon.cjs +1 -0
- package/dist/Icon.js +37 -0
- package/dist/Input.cjs +1 -0
- package/dist/Input.js +146 -0
- package/dist/{markdown.cjs → Markdown.cjs} +19 -19
- package/dist/{markdown.js → Markdown.js} +10 -8
- package/dist/Modal.cjs +1 -0
- package/dist/Modal.js +171 -0
- package/dist/PinInput.cjs +1 -0
- package/dist/PinInput.js +248 -0
- package/dist/Popover.cjs +1 -0
- package/dist/Popover.js +238 -0
- package/dist/Radio.cjs +1 -0
- package/dist/Radio.js +65 -0
- package/dist/RadioGroup.cjs +1 -0
- package/dist/RadioGroup.js +51 -0
- package/dist/RadioGroupContext-BX9KnDek.cjs +1 -0
- package/dist/RadioGroupContext-DbKM4zPZ.js +5 -0
- package/dist/Select.cjs +1 -0
- package/dist/Select.js +473 -0
- package/dist/Skeleton.cjs +1 -0
- package/dist/Skeleton.js +27 -0
- package/dist/Spinner-BXgw60UC.cjs +1 -0
- package/dist/Spinner-CVYvk6YK.js +25 -0
- package/dist/Spinner.cjs +1 -0
- package/dist/Spinner.js +4 -0
- package/dist/Surface-BttJYSDt.cjs +1 -0
- package/dist/Surface-vEFsZC12.js +17 -0
- package/dist/Switch.cjs +1 -0
- package/dist/Switch.js +39 -0
- package/dist/Table-83unQQOi.cjs +1 -0
- package/dist/Table-Cw8u-pEW.js +403 -0
- package/dist/Table.cjs +1 -0
- package/dist/Table.js +5 -0
- package/dist/Text-DWYlIcPj.cjs +1 -0
- package/dist/Text-rN6iDo0V.js +24 -0
- package/dist/Text.cjs +1 -0
- package/dist/Text.js +4 -0
- package/dist/TextArea.cjs +1 -0
- package/dist/TextArea.js +43 -0
- package/dist/Tooltip-BB82wNOE.cjs +1 -0
- package/dist/Tooltip-CqWK_GRD.js +236 -0
- package/dist/Tooltip.cjs +1 -0
- package/dist/Tooltip.js +6 -0
- package/dist/aria-DHnOMyYp.js +10 -0
- package/dist/aria-DKxpE8cA.cjs +1 -0
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/CheckboxGroup/index.d.ts +1 -1
- package/dist/components/Code/index.d.ts +1 -1
- package/dist/components/Content/Content.d.ts +8 -6
- package/dist/components/Content/hooks/useContentLayout.d.ts +2 -2
- package/dist/components/Content/index.d.ts +2 -2
- package/dist/components/Divider/index.d.ts +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Markdown/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/PinInput/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Radio/index.d.ts +1 -1
- package/dist/components/RadioGroup/index.d.ts +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/field-control-NfLwcPj6.cjs +1 -0
- package/dist/field-control-XAn_FKks.js +16 -0
- package/dist/focus-restoration-70WcQRr5.cjs +1 -0
- package/dist/focus-restoration-BvNZzrQA.js +16 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -2187
- package/dist/reference-C2guRuR0.cjs +1 -0
- package/dist/reference-CXMr27nM.js +12 -0
- package/dist/style.css +1 -1
- package/dist/units-BmjPCccF.js +90 -0
- package/dist/units-PzuiQNnw.cjs +1 -0
- package/dist/useFloatingPosition-CxzhAvy8.js +73 -0
- package/dist/useFloatingPosition-D1FqYy0l.cjs +1 -0
- package/dist/useFocusTrap--cgjy78G.cjs +1 -0
- package/dist/useFocusTrap-Da4nEash.js +134 -0
- package/dist/usePresence-DSPt6aKi.js +210 -0
- package/dist/usePresence-qe92UTvK.cjs +1 -0
- package/package.json +136 -11
- package/dist/Card-Ba5AcR4o.cjs +0 -1
- package/dist/Card-Cumb1Hon.js +0 -74
- package/dist/Code-CDHkXHVo.cjs +0 -6
- package/dist/Table-B5izJmMG.cjs +0 -1
- package/dist/Table-Gs5LkYRc.js +0 -2187
- package/dist/code.cjs +0 -1
- package/dist/code.js +0 -5
- package/dist/entries/code.d.ts +0 -1
- package/dist/entries/index.d.ts +0 -29
- package/dist/entries/markdown.d.ts +0 -1
package/dist/Select.js
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as f, jsxs as R } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as De, useId as _e, useRef as q, useState as z, useCallback as S, useEffect as Y, useMemo as Ee } from "react";
|
|
4
|
+
import { h as le, r as re } from "./aria-DHnOMyYp.js";
|
|
5
|
+
import { q as F } from "./Icon-uQmpr5P2.js";
|
|
6
|
+
import { a as Oe, P as Le, b as Ne, c as Pe } from "./usePresence-DSPt6aKi.js";
|
|
7
|
+
function te(a, t, i) {
|
|
8
|
+
if (a.length === 0) return -1;
|
|
9
|
+
for (let l = 1; l <= a.length; l += 1) {
|
|
10
|
+
const h = (t + i * l + a.length) % a.length;
|
|
11
|
+
if (!a[h].disabled) return h;
|
|
12
|
+
}
|
|
13
|
+
return -1;
|
|
14
|
+
}
|
|
15
|
+
function Se(a, t, i) {
|
|
16
|
+
for (let l = 1; l <= a.length; l += 1) {
|
|
17
|
+
const h = (i + l + a.length) % a.length, r = a[h];
|
|
18
|
+
if (!r.disabled && r.label.toLocaleLowerCase().startsWith(t))
|
|
19
|
+
return h;
|
|
20
|
+
}
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
function Re(a) {
|
|
24
|
+
const t = /* @__PURE__ */ new Set();
|
|
25
|
+
a.forEach((i) => {
|
|
26
|
+
if (t.has(i.value))
|
|
27
|
+
throw new Error("Select option values must be unique");
|
|
28
|
+
t.add(i.value);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function Ve(a, t, i) {
|
|
32
|
+
t.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
|
|
33
|
+
}
|
|
34
|
+
function Ce(a) {
|
|
35
|
+
const {
|
|
36
|
+
"aria-invalid": t,
|
|
37
|
+
children: i,
|
|
38
|
+
className: l,
|
|
39
|
+
defaultValue: h,
|
|
40
|
+
disabled: r = !1,
|
|
41
|
+
forwardedReference: s,
|
|
42
|
+
invalid: v = !1,
|
|
43
|
+
placeholder: b,
|
|
44
|
+
style: d,
|
|
45
|
+
value: u,
|
|
46
|
+
...p
|
|
47
|
+
} = a, k = re(v, t), w = v || le(t);
|
|
48
|
+
return /* @__PURE__ */ R(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: ["nk-select", l].filter(Boolean).join(" "),
|
|
52
|
+
"data-disabled": r || void 0,
|
|
53
|
+
"data-invalid": w || void 0,
|
|
54
|
+
"data-mode": "native",
|
|
55
|
+
style: d,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ R(
|
|
58
|
+
"select",
|
|
59
|
+
{
|
|
60
|
+
...p,
|
|
61
|
+
ref: s,
|
|
62
|
+
"aria-invalid": k,
|
|
63
|
+
className: "nk-select__control",
|
|
64
|
+
defaultValue: u === void 0 ? h ?? (b !== void 0 ? "" : void 0) : void 0,
|
|
65
|
+
disabled: r,
|
|
66
|
+
value: u,
|
|
67
|
+
children: [
|
|
68
|
+
b !== void 0 ? /* @__PURE__ */ f("option", { disabled: !0, value: "", children: b }) : null,
|
|
69
|
+
i
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ f(F, { className: "nk-select__icon", type: "chevron-down" })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function He(a, t, i) {
|
|
79
|
+
const [l, h] = z(null);
|
|
80
|
+
return Y(() => {
|
|
81
|
+
if (!a || !t) {
|
|
82
|
+
h(null);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const r = t.ownerDocument.defaultView;
|
|
86
|
+
if (!r) return;
|
|
87
|
+
const s = r;
|
|
88
|
+
function v() {
|
|
89
|
+
const u = t == null ? void 0 : t.getBoundingClientRect();
|
|
90
|
+
if (!u) return;
|
|
91
|
+
const p = 8, k = 4, w = s.innerHeight - u.bottom - k - p, E = u.top - k - p, D = w < 160 && E > w, x = Math.max(
|
|
92
|
+
72,
|
|
93
|
+
D ? E : w
|
|
94
|
+
), y = i == null ? void 0 : i.getBoundingClientRect(), V = Math.max(
|
|
95
|
+
u.width,
|
|
96
|
+
(y == null ? void 0 : y.width) ?? u.width
|
|
97
|
+
), o = Math.min(
|
|
98
|
+
Math.max(p, u.left),
|
|
99
|
+
Math.max(
|
|
100
|
+
p,
|
|
101
|
+
s.innerWidth - p - V
|
|
102
|
+
)
|
|
103
|
+
), N = D ? Math.max(
|
|
104
|
+
p,
|
|
105
|
+
u.top - k - Math.min(
|
|
106
|
+
(y == null ? void 0 : y.height) ?? x,
|
|
107
|
+
x
|
|
108
|
+
)
|
|
109
|
+
) : u.bottom + k;
|
|
110
|
+
h({
|
|
111
|
+
left: o,
|
|
112
|
+
maxHeight: x,
|
|
113
|
+
minWidth: u.width,
|
|
114
|
+
top: N
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
v(), s.addEventListener("resize", v), s.addEventListener("scroll", v, !0);
|
|
118
|
+
const b = s.ResizeObserver, d = b ? new b(v) : null;
|
|
119
|
+
return d == null || d.observe(t), i && (d == null || d.observe(i)), () => {
|
|
120
|
+
s.removeEventListener("resize", v), s.removeEventListener("scroll", v, !0), d == null || d.disconnect();
|
|
121
|
+
};
|
|
122
|
+
}, [a, i, t]), l;
|
|
123
|
+
}
|
|
124
|
+
function Me(a) {
|
|
125
|
+
const {
|
|
126
|
+
active: t,
|
|
127
|
+
closeOnEscape: i,
|
|
128
|
+
closeOnOutsideInteraction: l,
|
|
129
|
+
highlightedIndex: h,
|
|
130
|
+
id: r,
|
|
131
|
+
listboxReference: s,
|
|
132
|
+
onEscapeDismiss: v,
|
|
133
|
+
onEscapeKeyDown: b,
|
|
134
|
+
onHighlight: d,
|
|
135
|
+
onOutsideDismiss: u,
|
|
136
|
+
onPointerDownOutside: p,
|
|
137
|
+
onSelect: k,
|
|
138
|
+
options: w,
|
|
139
|
+
ownerDocument: E,
|
|
140
|
+
position: D,
|
|
141
|
+
selectedValue: x,
|
|
142
|
+
state: y,
|
|
143
|
+
triggerReference: V
|
|
144
|
+
} = a, o = q(null), N = Ne(!0, E), C = Ee(
|
|
145
|
+
() => [V, o],
|
|
146
|
+
[V]
|
|
147
|
+
), $ = S(
|
|
148
|
+
(c) => {
|
|
149
|
+
o.current = c, s(c);
|
|
150
|
+
},
|
|
151
|
+
[s]
|
|
152
|
+
);
|
|
153
|
+
return Pe({
|
|
154
|
+
active: t,
|
|
155
|
+
boundaries: C,
|
|
156
|
+
dismissOnEscape: i,
|
|
157
|
+
dismissOnPointerDownOutside: l,
|
|
158
|
+
layerId: N.id,
|
|
159
|
+
onEscapeDismiss: v,
|
|
160
|
+
onEscapeKeyDown: b,
|
|
161
|
+
onPointerDownOutside: p,
|
|
162
|
+
onPointerDownOutsideDismiss: u,
|
|
163
|
+
ownerDocument: E
|
|
164
|
+
}), /* @__PURE__ */ f(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
"aria-hidden": t ? void 0 : !0,
|
|
168
|
+
"aria-labelledby": r,
|
|
169
|
+
className: "nk-select__listbox",
|
|
170
|
+
"data-state": y,
|
|
171
|
+
id: `${r}-listbox`,
|
|
172
|
+
ref: $,
|
|
173
|
+
role: "listbox",
|
|
174
|
+
style: D ? {
|
|
175
|
+
left: D.left,
|
|
176
|
+
maxHeight: D.maxHeight,
|
|
177
|
+
minWidth: D.minWidth,
|
|
178
|
+
top: D.top,
|
|
179
|
+
zIndex: N.zIndex
|
|
180
|
+
} : { visibility: "hidden", zIndex: N.zIndex },
|
|
181
|
+
children: w.map((c, H) => /* @__PURE__ */ R(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
"aria-disabled": c.disabled || void 0,
|
|
185
|
+
"aria-selected": c.value === x,
|
|
186
|
+
className: "nk-select__option",
|
|
187
|
+
"data-highlighted": H === h || void 0,
|
|
188
|
+
"data-selected": c.value === x || void 0,
|
|
189
|
+
id: `${r}-option-${H}`,
|
|
190
|
+
onPointerDown: (Q) => {
|
|
191
|
+
Q.preventDefault(), c.disabled || k(c);
|
|
192
|
+
},
|
|
193
|
+
onPointerMove: () => {
|
|
194
|
+
c.disabled || d(H);
|
|
195
|
+
},
|
|
196
|
+
role: "option",
|
|
197
|
+
children: [
|
|
198
|
+
c.icon ? /* @__PURE__ */ f(F, { type: c.icon }) : null,
|
|
199
|
+
/* @__PURE__ */ f("span", { className: "nk-select__option-label", children: c.label }),
|
|
200
|
+
c.value === x ? /* @__PURE__ */ f(F, { className: "nk-select__check", type: "checkmark" }) : null
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
c.value
|
|
204
|
+
))
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function Ae(a) {
|
|
209
|
+
var oe;
|
|
210
|
+
const {
|
|
211
|
+
"aria-invalid": t,
|
|
212
|
+
className: i,
|
|
213
|
+
closeOnEscape: l = !0,
|
|
214
|
+
closeOnOutsideInteraction: h = !0,
|
|
215
|
+
defaultValue: r = "",
|
|
216
|
+
disabled: s = !1,
|
|
217
|
+
displayOverride: v,
|
|
218
|
+
form: b,
|
|
219
|
+
forwardedReference: d,
|
|
220
|
+
id: u,
|
|
221
|
+
invalid: p = !1,
|
|
222
|
+
name: k,
|
|
223
|
+
onChange: w,
|
|
224
|
+
onClick: E,
|
|
225
|
+
onEscapeKeyDown: D,
|
|
226
|
+
onKeyDown: x,
|
|
227
|
+
onOpenChange: y,
|
|
228
|
+
onPointerDownOutside: V,
|
|
229
|
+
options: o,
|
|
230
|
+
placeholder: N,
|
|
231
|
+
portalContainer: C,
|
|
232
|
+
required: $ = !1,
|
|
233
|
+
style: c,
|
|
234
|
+
value: H,
|
|
235
|
+
width: Q,
|
|
236
|
+
...ce
|
|
237
|
+
} = a;
|
|
238
|
+
Re(o);
|
|
239
|
+
const de = _e(), M = u ?? de, _ = q(null), ie = q(null), A = q(null), U = q(""), [K, ue] = z(null), [m, fe] = z(!1), [O, B] = z(-1), [me, ae] = z(r), W = H !== void 0, P = W ? H : me, he = o.find(
|
|
240
|
+
(e) => e.value === P
|
|
241
|
+
), ve = p || le(t), pe = re(p, t), Z = Oe(m), j = (C == null ? void 0 : C.ownerDocument) ?? ((oe = _.current) == null ? void 0 : oe.ownerDocument) ?? (typeof document > "u" ? null : document), ye = He(
|
|
242
|
+
Z.present,
|
|
243
|
+
_.current,
|
|
244
|
+
K
|
|
245
|
+
), ge = Q === void 0 ? c : { ...c, width: Q }, G = v ?? he, be = S(
|
|
246
|
+
(e) => {
|
|
247
|
+
Ve(
|
|
248
|
+
e,
|
|
249
|
+
_,
|
|
250
|
+
d
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
[d]
|
|
254
|
+
), g = S((e) => {
|
|
255
|
+
m !== e && (fe(e), y == null || y(e));
|
|
256
|
+
}, [y, m]), J = S((e = 1) => {
|
|
257
|
+
const n = o.findIndex(
|
|
258
|
+
(L) => L.value === P && !L.disabled
|
|
259
|
+
), I = e === 1 ? -1 : o.length;
|
|
260
|
+
B(
|
|
261
|
+
n >= 0 ? n : te(o, I, e)
|
|
262
|
+
), g(!0);
|
|
263
|
+
}, [o, P, g]), se = S((e) => {
|
|
264
|
+
var n;
|
|
265
|
+
e.disabled || (W || ae(e.value), g(!1), (n = _.current) == null || n.focus(), w == null || w(e.value));
|
|
266
|
+
}, [W, w, g]), we = S(() => {
|
|
267
|
+
var e;
|
|
268
|
+
g(!1), (e = _.current) == null || e.focus();
|
|
269
|
+
}, [g]), Ie = S(() => {
|
|
270
|
+
g(!1);
|
|
271
|
+
}, [g]);
|
|
272
|
+
function ke(e) {
|
|
273
|
+
E == null || E(e), !(e.defaultPrevented || s) && (m ? g(!1) : J());
|
|
274
|
+
}
|
|
275
|
+
function xe(e) {
|
|
276
|
+
if (x == null || x(e), !(e.defaultPrevented || s)) {
|
|
277
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
const n = e.key === "ArrowDown" ? 1 : -1;
|
|
280
|
+
m ? B(
|
|
281
|
+
(I) => te(o, I, n)
|
|
282
|
+
) : J(n);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (e.key === "Home" || e.key === "End") {
|
|
286
|
+
if (e.preventDefault(), !m) J(e.key === "Home" ? 1 : -1);
|
|
287
|
+
else {
|
|
288
|
+
const n = e.key === "Home" ? 1 : -1, I = n === 1 ? -1 : o.length;
|
|
289
|
+
B(
|
|
290
|
+
te(o, I, n)
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
const n = o[O];
|
|
298
|
+
m && n ? se(n) : m || J();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (e.key === "Tab") {
|
|
302
|
+
g(!1);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
306
|
+
const n = e.currentTarget.ownerDocument.defaultView;
|
|
307
|
+
if (!n) return;
|
|
308
|
+
const I = e.key.toLocaleLowerCase(), L = U.current + I, ee = Array.from(L).every((ne) => ne === I);
|
|
309
|
+
U.current = ee ? I : L, A.current !== null && n.clearTimeout(A.current), A.current = n.setTimeout(() => {
|
|
310
|
+
U.current = "", A.current = null;
|
|
311
|
+
}, 500);
|
|
312
|
+
const T = Se(
|
|
313
|
+
o,
|
|
314
|
+
U.current,
|
|
315
|
+
O
|
|
316
|
+
);
|
|
317
|
+
T >= 0 && (e.preventDefault(), m || g(!0), B(T));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return Y(() => {
|
|
322
|
+
var e;
|
|
323
|
+
if (m && O >= 0) {
|
|
324
|
+
const n = j == null ? void 0 : j.getElementById(
|
|
325
|
+
`${M}-option-${O}`
|
|
326
|
+
);
|
|
327
|
+
n && (K != null && K.contains(n)) && ((e = n.scrollIntoView) == null || e.call(n, { block: "nearest" }));
|
|
328
|
+
}
|
|
329
|
+
}, [O, M, K, m]), Y(() => {
|
|
330
|
+
var I;
|
|
331
|
+
const e = (I = _.current) == null ? void 0 : I.form;
|
|
332
|
+
if (!e) return;
|
|
333
|
+
function n() {
|
|
334
|
+
const L = ie.current, ee = W ? P : r;
|
|
335
|
+
if (L) {
|
|
336
|
+
const T = Array.from(L.options), ne = T.find(
|
|
337
|
+
(X) => X.value === ee
|
|
338
|
+
) ?? T[0];
|
|
339
|
+
T.forEach((X) => {
|
|
340
|
+
X.defaultSelected = X === ne;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
W || ae(r), g(!1);
|
|
344
|
+
}
|
|
345
|
+
return e.addEventListener("reset", n), () => e.removeEventListener("reset", n);
|
|
346
|
+
}, [r, b, W, P, g]), Y(() => () => {
|
|
347
|
+
var n;
|
|
348
|
+
const e = (n = _.current) == null ? void 0 : n.ownerDocument.defaultView;
|
|
349
|
+
e && A.current !== null && e.clearTimeout(A.current);
|
|
350
|
+
}, []), /* @__PURE__ */ R(
|
|
351
|
+
"span",
|
|
352
|
+
{
|
|
353
|
+
className: ["nk-select", i].filter(Boolean).join(" "),
|
|
354
|
+
"data-disabled": s || void 0,
|
|
355
|
+
"data-invalid": ve || void 0,
|
|
356
|
+
"data-mode": "custom",
|
|
357
|
+
"data-open": m || void 0,
|
|
358
|
+
style: ge,
|
|
359
|
+
children: [
|
|
360
|
+
/* @__PURE__ */ R(
|
|
361
|
+
"button",
|
|
362
|
+
{
|
|
363
|
+
...ce,
|
|
364
|
+
ref: be,
|
|
365
|
+
"aria-activedescendant": m && O >= 0 ? `${M}-option-${O}` : void 0,
|
|
366
|
+
"aria-controls": `${M}-listbox`,
|
|
367
|
+
"aria-expanded": m,
|
|
368
|
+
"aria-haspopup": "listbox",
|
|
369
|
+
"aria-invalid": pe,
|
|
370
|
+
"aria-required": $ || void 0,
|
|
371
|
+
"aria-autocomplete": "none",
|
|
372
|
+
className: "nk-select__trigger",
|
|
373
|
+
disabled: s,
|
|
374
|
+
form: b,
|
|
375
|
+
id: M,
|
|
376
|
+
onClick: ke,
|
|
377
|
+
onKeyDown: xe,
|
|
378
|
+
role: "combobox",
|
|
379
|
+
type: "button",
|
|
380
|
+
children: [
|
|
381
|
+
G ? /* @__PURE__ */ R("span", { className: "nk-select__value", children: [
|
|
382
|
+
G.icon ? /* @__PURE__ */ f(F, { type: G.icon }) : null,
|
|
383
|
+
/* @__PURE__ */ f("span", { className: "nk-select__value-label", children: G.label })
|
|
384
|
+
] }) : /* @__PURE__ */ f("span", { className: "nk-select__placeholder", children: N }),
|
|
385
|
+
/* @__PURE__ */ f(F, { className: "nk-select__icon", type: "chevron-down" })
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
),
|
|
389
|
+
k || $ ? /* @__PURE__ */ R(
|
|
390
|
+
"select",
|
|
391
|
+
{
|
|
392
|
+
ref: ie,
|
|
393
|
+
"aria-hidden": "true",
|
|
394
|
+
className: "nk-select__form-control",
|
|
395
|
+
disabled: s,
|
|
396
|
+
form: b,
|
|
397
|
+
name: k,
|
|
398
|
+
onChange: () => {
|
|
399
|
+
},
|
|
400
|
+
onInvalid: (e) => {
|
|
401
|
+
var n;
|
|
402
|
+
e.preventDefault(), (n = _.current) == null || n.focus();
|
|
403
|
+
},
|
|
404
|
+
required: $,
|
|
405
|
+
tabIndex: -1,
|
|
406
|
+
value: P,
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ f("option", { value: "" }),
|
|
409
|
+
o.map((e) => /* @__PURE__ */ f(
|
|
410
|
+
"option",
|
|
411
|
+
{
|
|
412
|
+
disabled: e.disabled,
|
|
413
|
+
value: e.value,
|
|
414
|
+
children: e.label
|
|
415
|
+
},
|
|
416
|
+
e.value
|
|
417
|
+
))
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
) : null,
|
|
421
|
+
Z.present && j ? /* @__PURE__ */ f(
|
|
422
|
+
Le,
|
|
423
|
+
{
|
|
424
|
+
container: C,
|
|
425
|
+
inheritFrom: _.current,
|
|
426
|
+
children: /* @__PURE__ */ f(
|
|
427
|
+
Me,
|
|
428
|
+
{
|
|
429
|
+
active: m,
|
|
430
|
+
closeOnEscape: l,
|
|
431
|
+
closeOnOutsideInteraction: h,
|
|
432
|
+
highlightedIndex: O,
|
|
433
|
+
id: M,
|
|
434
|
+
listboxReference: ue,
|
|
435
|
+
onEscapeDismiss: we,
|
|
436
|
+
onEscapeKeyDown: D,
|
|
437
|
+
onHighlight: B,
|
|
438
|
+
onOutsideDismiss: Ie,
|
|
439
|
+
onPointerDownOutside: V,
|
|
440
|
+
onSelect: se,
|
|
441
|
+
options: o,
|
|
442
|
+
ownerDocument: j,
|
|
443
|
+
position: ye,
|
|
444
|
+
selectedValue: P,
|
|
445
|
+
state: Z.state === "closing" ? "closing" : "open",
|
|
446
|
+
triggerReference: _
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
) : null
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
const je = De(function(t, i) {
|
|
456
|
+
const { options: l } = t;
|
|
457
|
+
return l !== void 0 ? /* @__PURE__ */ f(
|
|
458
|
+
Ae,
|
|
459
|
+
{
|
|
460
|
+
...t,
|
|
461
|
+
forwardedReference: i
|
|
462
|
+
}
|
|
463
|
+
) : /* @__PURE__ */ f(
|
|
464
|
+
Ce,
|
|
465
|
+
{
|
|
466
|
+
...t,
|
|
467
|
+
forwardedReference: i
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
});
|
|
471
|
+
export {
|
|
472
|
+
je as default
|
|
473
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),c=require("react"),u=c.forwardRef(function(t,r){const{"aria-hidden":a=!0,className:n,height:i="1em",shape:e="rectangle",style:s,width:l=e==="circle"?"1em":"100%",...o}=t;return d.jsx("div",{...o,ref:r,"aria-hidden":a,className:["nk-skeleton",n].filter(Boolean).join(" "),"data-shape":e,style:{...s,width:l,height:i}})});exports.default=u;
|
package/dist/Skeleton.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
const p = m(function(t, a) {
|
|
4
|
+
const {
|
|
5
|
+
"aria-hidden": r = !0,
|
|
6
|
+
className: n,
|
|
7
|
+
height: o = "1em",
|
|
8
|
+
shape: e = "rectangle",
|
|
9
|
+
style: i,
|
|
10
|
+
width: s = e === "circle" ? "1em" : "100%",
|
|
11
|
+
...l
|
|
12
|
+
} = t;
|
|
13
|
+
return /* @__PURE__ */ d(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
...l,
|
|
17
|
+
ref: a,
|
|
18
|
+
"aria-hidden": r,
|
|
19
|
+
className: ["nk-skeleton", n].filter(Boolean).join(" "),
|
|
20
|
+
"data-shape": e,
|
|
21
|
+
style: { ...i, width: s, height: o }
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
p as default
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),l=require("react"),p=l.forwardRef(function(r,i){const{className:s="",color:n,size:e=48,style:t,...o}=r,a=typeof e=="number"?`${e}px`:e;return c.jsx("div",{ref:i,className:["nk-spinner",s].filter(Boolean).join(" "),style:{...t,width:e,height:e,fontSize:a,...n?{color:n}:void 0},role:"status","aria-label":"Loading",...o})});exports.Spinner=p;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
const d = p(function(o, r) {
|
|
4
|
+
const { className: i = "", color: n, size: e = 48, style: t, ...s } = o, a = typeof e == "number" ? `${e}px` : e;
|
|
5
|
+
return /* @__PURE__ */ l(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
ref: r,
|
|
9
|
+
className: ["nk-spinner", i].filter(Boolean).join(" "),
|
|
10
|
+
style: {
|
|
11
|
+
...t,
|
|
12
|
+
width: e,
|
|
13
|
+
height: e,
|
|
14
|
+
fontSize: a,
|
|
15
|
+
...n ? { color: n } : void 0
|
|
16
|
+
},
|
|
17
|
+
role: "status",
|
|
18
|
+
"aria-label": "Loading",
|
|
19
|
+
...s
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
d as S
|
|
25
|
+
};
|
package/dist/Spinner.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Spinner-BXgw60UC.cjs");exports.default=e.Spinner;
|
package/dist/Spinner.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),a=require("react"),o=a.forwardRef(function(e,r){const{children:c,className:s,...n}=e;return t.jsx("div",{...n,ref:r,className:["nk-surface",s].filter(Boolean).join(" "),children:c})});exports.Surface=o;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
const m = s(function(r, e) {
|
|
4
|
+
const { children: o, className: a, ...f } = r;
|
|
5
|
+
return /* @__PURE__ */ n(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
...f,
|
|
9
|
+
ref: e,
|
|
10
|
+
className: ["nk-surface", a].filter(Boolean).join(" "),
|
|
11
|
+
children: o
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
m as S
|
|
17
|
+
};
|
package/dist/Switch.cjs
ADDED
|
@@ -0,0 +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-DKxpE8cA.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
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as o } from "react";
|
|
3
|
+
import { h as d } from "./aria-DHnOMyYp.js";
|
|
4
|
+
const w = o(function(t, n) {
|
|
5
|
+
const {
|
|
6
|
+
"aria-invalid": i,
|
|
7
|
+
className: e,
|
|
8
|
+
disabled: s = !1,
|
|
9
|
+
style: r,
|
|
10
|
+
...c
|
|
11
|
+
} = t;
|
|
12
|
+
return /* @__PURE__ */ l(
|
|
13
|
+
"span",
|
|
14
|
+
{
|
|
15
|
+
className: ["nk-switch", e].filter(Boolean).join(" "),
|
|
16
|
+
"data-disabled": s || void 0,
|
|
17
|
+
"data-invalid": d(i) || void 0,
|
|
18
|
+
style: r,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ a(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
...c,
|
|
24
|
+
ref: n,
|
|
25
|
+
"aria-invalid": i,
|
|
26
|
+
className: "nk-switch__control",
|
|
27
|
+
disabled: s,
|
|
28
|
+
role: "switch",
|
|
29
|
+
type: "checkbox"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ a("span", { "aria-hidden": "true", className: "nk-switch__track", children: /* @__PURE__ */ a("span", { className: "nk-switch__thumb" }) })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
w as default
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const c=require("react/jsx-runtime"),o=require("react"),P=require("./reference-C2guRuR0.cjs"),A=require("./Button-D7JUO6Fs.cjs"),B=require("./Tooltip-BB82wNOE.cjs"),L=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),I=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 D(r,n){var t;let e=r;for(;e&&e!==n;){if(e.matches(L)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(l=>I.has(l)))return!0;e=e.parentElement}return!1}function H(r,n,e){return r===void 0?n:e?e(r):r instanceof Date?Number.isNaN(r.getTime())?"Invalid Date":r.toISOString().slice(0,10):typeof r=="boolean"?r?"Yes":"No":r}function O(r){if(typeof r=="number"||typeof r=="string")return String(r)}function w(r){for(const n of o.Children.toArray(r)){if(o.isValidElement(n)&&n.type===o.Fragment){if(w(n.props.children))return!0;continue}return!0}return!1}function K(r,n){let e=!1;function t(l){return o.Children.map(l,i=>o.isValidElement(i)?i.type===o.Fragment?o.cloneElement(i,void 0,t(i.props.children)):!e&&i.type===S?(e=!0,o.cloneElement(i,{rowTrigger:n})):i:i)}const a=t(r);return{attached:e,content:a}}const F=o.forwardRef(function(n,e){const{children:t,className:a,...l}=n;return c.jsx("thead",{...l,ref:e,className:["nk-table__head",a].filter(Boolean).join(" "),children:t})}),V=o.forwardRef(function(n,e){const{children:t,className:a,emptyColumnCount:l=1,emptyMessage:i,...u}=n,f=!w(t),h=Number.isFinite(l)?Math.max(1,Math.floor(l)):1;return c.jsx("tbody",{...u,ref:e,className:["nk-table__body",a].filter(Boolean).join(" "),children:f&&i!==void 0?c.jsx("tr",{className:"nk-table__row",children:c.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:c.jsx("div",{className:"nk-table__empty-content",children:i})})}):t})}),q=o.forwardRef(function(n,e){const{children:t,className:a,...l}=n;return c.jsx("tfoot",{...l,ref:e,className:["nk-table__foot",a].filter(Boolean).join(" "),children:t})}),z=o.forwardRef(function(n,e){const{"aria-label":t,children:a,className:l,download:i,href:u,hrefLang:f,onClick:h,onNavigate:k,rel:s,target:R,...g}=n,C=o.useRef(null),_=u!==void 0||h!==void 0,j=(t==null?void 0:t.trim())||(u!==void 0?"Open row":"Activate row");function p(d){C.current=d}const y=u!==void 0?{ariaLabel:j,kind:"link",linkProperties:{download:i,href:u,hrefLang:f,onNavigate:k,rel:s,target:R},reference:p}:h!==void 0?{ariaLabel:j,kind:"button",onClick:h,reference:p}:void 0,N=y?K(a,y):{content:a};function v(d){if(d.defaultPrevented)return;const b=d.target;if(!(b instanceof Element)||D(b,d.currentTarget))return;const T=C.current;if(!T)return;const m=T.ownerDocument.defaultView;if(!m){T.click();return}T.dispatchEvent(new m.MouseEvent("click",{altKey:d.altKey,bubbles:!0,button:d.button,buttons:d.buttons,cancelable:!0,clientX:d.clientX,clientY:d.clientY,ctrlKey:d.ctrlKey,metaKey:d.metaKey,shiftKey:d.shiftKey}))}return c.jsx("tr",{...g,ref:e,"aria-label":_?void 0:t,className:["nk-table__row",l].filter(Boolean).join(" "),"data-interactive":_||void 0,onClick:_?v:void 0,children:N.content})}),E=o.forwardRef(function(n,e){const{align:t="left",children:a,className:l,scope:i="col",sticky:u=!1,...f}=n;return c.jsx("th",{...f,ref:e,className:["nk-table__header-cell",l].filter(Boolean).join(" "),"data-align":t,"data-sticky":u||void 0,scope:i,children:a})}),M=o.forwardRef(function(n,e){const{children:t,className:a,...l}=n;return c.jsx(E,{...l,ref:e,align:"right",className:["nk-table__action-header-cell",a].filter(Boolean).join(" "),children:t??c.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),S=o.forwardRef(function(n,e){const{align:t="left",children:a,className:l,format:i,title:u,truncate:f,value:h,...k}=n,{rowTrigger:s,...R}=k,g=H(h,a,i),C=f===void 0?void 0:{maxWidth:f},_=u??(f===void 0?void 0:O(g));return c.jsxs("td",{...R,ref:e,className:["nk-table__cell",l].filter(Boolean).join(" "),"data-align":t,title:_,children:[(s==null?void 0:s.kind)==="link"&&s.linkProperties?c.jsx("a",{ref:s.reference,"aria-label":s.ariaLabel,className:"nk-table__row-trigger",download:s.linkProperties.download,href:s.linkProperties.href,hrefLang:s.linkProperties.hrefLang,onClick:s.linkProperties.onNavigate,rel:s.linkProperties.rel,target:s.linkProperties.target}):null,(s==null?void 0:s.kind)==="button"?c.jsx("button",{ref:s.reference,"aria-label":s.ariaLabel,className:"nk-table__row-trigger",onClick:s.onClick,type:"button"}):null,f!==void 0?c.jsx("span",{className:"nk-table__truncated-content",style:C,children:g}):g]})}),Y=o.forwardRef(function(n,e){const{"aria-label":t,icon:a,label:l,...i}=n;return c.jsx(B.Tooltip,{content:l,children:c.jsx(A.Button,{...i,ref:e,"aria-label":t??l,className:"nk-table__action",icon:a,shape:"rectangle",type:"button",variant:"ghost"})})}),X=o.forwardRef(function(n,e){const{children:t,className:a,onClick:l,...i}=n;function u(f){f.stopPropagation(),l==null||l(f)}return c.jsx("td",{...i,ref:e,className:["nk-table__cell","nk-table__action-cell",a].filter(Boolean).join(" "),"data-align":"right",onClick:u,children:c.jsx("span",{className:"nk-table__action-list",children:t})})}),W=o.forwardRef(function(n,e){const{"aria-label":t,children:a,className:l,containerClassName:i,...u}=n,f=o.useRef(null),h=o.useRef(null),[k,s]=o.useState(!1),[R,g]=o.useState(!1),C=t?`${t} scroll area`:"Scrollable table",_=o.useCallback(p=>{h.current=p,P.assignElementReference(e,p)},[e]);o.useEffect(()=>{const p=f.current,y=h.current;if(!p||!y)return;const N=p,v=y;function d(){const x=N.scrollWidth>N.clientWidth;s(x),x||g(!1)}d();const b=N.ownerDocument.defaultView;b==null||b.addEventListener("resize",d);const T=b==null?void 0:b.ResizeObserver,m=T?new T(d):void 0;return m==null||m.observe(N),m==null||m.observe(v),()=>{b==null||b.removeEventListener("resize",d),m==null||m.disconnect()}},[]);function j(p){g(k&&p.currentTarget.scrollLeft>1)}return c.jsx("div",{ref:f,"aria-label":k?C:void 0,className:["nk-table__container",i].filter(Boolean).join(" "),"data-scrolled":R||void 0,onScroll:j,role:k?"region":void 0,tabIndex:k?0:void 0,children:c.jsx("table",{...u,ref:_,"aria-label":t,className:["nk-table",l].filter(Boolean).join(" "),children:a})})}),$=Object.assign(W,{Action:Y,ActionCell:X,ActionHeaderCell:M,Body:V,Cell:S,Foot:q,HeaderCell:E,Head:F,Row:z});exports.Table=$;
|