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
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C, jsxs as q, Fragment as he } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as X, createContext as ye, forwardRef as be, Fragment as Fe, useId as Le, useContext as ve, useRef as u, useState as z, useCallback as f, useEffect as G, cloneElement as J } from "react";
|
|
4
|
+
import { g as Me, a as K } from "./reference-CXMr27nM.js";
|
|
5
|
+
import { a as Oe, b as _e, c as xe, P as Ne } from "./usePresence-DSPt6aKi.js";
|
|
6
|
+
import { u as Pe } from "./useFloatingPosition-CxzhAvy8.js";
|
|
7
|
+
import { i as We } from "./focus-restoration-BvNZzrQA.js";
|
|
8
|
+
import { S as ke } from "./Surface-vEFsZC12.js";
|
|
9
|
+
const Ve = 500, Z = ye(null);
|
|
10
|
+
function Ge(r) {
|
|
11
|
+
const { children: a, delay: s = Ve } = r, l = X(() => ({
|
|
12
|
+
delay: s
|
|
13
|
+
}), [s]);
|
|
14
|
+
return /* @__PURE__ */ C(Z.Provider, { value: l, children: a });
|
|
15
|
+
}
|
|
16
|
+
const ee = 500, Q = 100;
|
|
17
|
+
function Ae(r, a, s, l) {
|
|
18
|
+
a.current = r, K(s, r), K(l, r);
|
|
19
|
+
}
|
|
20
|
+
function je(r) {
|
|
21
|
+
return Number.isFinite(r) ? Math.max(0, r) : ee;
|
|
22
|
+
}
|
|
23
|
+
function ze(r, a) {
|
|
24
|
+
const s = (r == null ? void 0 : r.split(/\s+/).filter(Boolean)) ?? [];
|
|
25
|
+
return s.includes(a) || s.push(a), s.join(" ");
|
|
26
|
+
}
|
|
27
|
+
const Je = be(function(a, s) {
|
|
28
|
+
const {
|
|
29
|
+
children: l,
|
|
30
|
+
className: ne,
|
|
31
|
+
content: p,
|
|
32
|
+
contentClassName: te,
|
|
33
|
+
contentStyle: S,
|
|
34
|
+
delay: re,
|
|
35
|
+
disabled: w = !1,
|
|
36
|
+
onOpenChange: F,
|
|
37
|
+
placement: B = "top",
|
|
38
|
+
portalContainer: L,
|
|
39
|
+
style: oe
|
|
40
|
+
} = a;
|
|
41
|
+
if (p == null || typeof p == "boolean" || typeof p == "string" && !p.trim())
|
|
42
|
+
throw new Error("Tooltip content must not be empty");
|
|
43
|
+
if (l.type === Fe)
|
|
44
|
+
throw new Error("Tooltip requires a single non-Fragment trigger");
|
|
45
|
+
const Y = `${Le()}-tooltip`, N = ve(Z), t = l.props, $ = Me(l), D = u(null), P = u(null), H = u(w), W = u(!1), v = u(null), M = u(null), O = u(null), _ = u(!1), E = u(!1), g = u(!1), d = u(!1), [I, se] = z(null), [ce, ie] = z(null), [x, ue] = z(!1);
|
|
46
|
+
H.current = w;
|
|
47
|
+
const k = je(
|
|
48
|
+
re ?? (N == null ? void 0 : N.delay) ?? ee
|
|
49
|
+
), R = Oe(x), V = (L == null ? void 0 : L.ownerDocument) ?? (I == null ? void 0 : I.ownerDocument) ?? (typeof document > "u" ? null : document), A = _e(R.present, V), m = Pe(
|
|
50
|
+
R.present,
|
|
51
|
+
B,
|
|
52
|
+
I,
|
|
53
|
+
ce
|
|
54
|
+
), le = X(
|
|
55
|
+
() => [D, P],
|
|
56
|
+
[]
|
|
57
|
+
), ae = ze(
|
|
58
|
+
t["aria-describedby"],
|
|
59
|
+
Y
|
|
60
|
+
), fe = x && R.present ? ae : t["aria-describedby"], U = f(
|
|
61
|
+
(e) => {
|
|
62
|
+
Ae(
|
|
63
|
+
e,
|
|
64
|
+
D,
|
|
65
|
+
$,
|
|
66
|
+
s
|
|
67
|
+
), se(e);
|
|
68
|
+
},
|
|
69
|
+
[s, $]
|
|
70
|
+
), de = f(
|
|
71
|
+
(e) => {
|
|
72
|
+
P.current = e, e || (d.current = !1), ie(e);
|
|
73
|
+
},
|
|
74
|
+
[]
|
|
75
|
+
), c = f(() => {
|
|
76
|
+
const e = v.current;
|
|
77
|
+
e && e.ownerWindow.clearTimeout(e.timerId), v.current = null;
|
|
78
|
+
}, []), i = f(() => {
|
|
79
|
+
const e = M.current;
|
|
80
|
+
e && e.ownerWindow.clearTimeout(e.timerId), M.current = null;
|
|
81
|
+
}, []), h = f(() => {
|
|
82
|
+
const e = O.current;
|
|
83
|
+
e && e.ownerWindow.clearTimeout(e.timerId), O.current = null;
|
|
84
|
+
}, []), o = f((e) => {
|
|
85
|
+
W.current !== e && (e || (d.current = !1), W.current = e, ue(e), F == null || F(e));
|
|
86
|
+
}, [F]), j = f((e) => {
|
|
87
|
+
var y, b;
|
|
88
|
+
if (i(), E.current || g.current || d.current)
|
|
89
|
+
return;
|
|
90
|
+
if (e === 0) {
|
|
91
|
+
o(!1);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const n = ((y = D.current) == null ? void 0 : y.ownerDocument.defaultView) ?? ((b = P.current) == null ? void 0 : b.ownerDocument.defaultView);
|
|
95
|
+
if (!n) {
|
|
96
|
+
o(!1);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const T = n.setTimeout(() => {
|
|
100
|
+
M.current = null, !E.current && !g.current && !d.current && o(!1);
|
|
101
|
+
}, e);
|
|
102
|
+
M.current = {
|
|
103
|
+
ownerWindow: n,
|
|
104
|
+
timerId: T
|
|
105
|
+
};
|
|
106
|
+
}, [i, o]), me = f(() => {
|
|
107
|
+
var T;
|
|
108
|
+
if (c(), i(), k === 0) {
|
|
109
|
+
o(!0);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const e = (T = D.current) == null ? void 0 : T.ownerDocument.defaultView;
|
|
113
|
+
if (!e) return;
|
|
114
|
+
const n = e.setTimeout(() => {
|
|
115
|
+
v.current = null, H.current || o(!0);
|
|
116
|
+
}, k);
|
|
117
|
+
v.current = { ownerWindow: e, timerId: n };
|
|
118
|
+
}, [i, c, k, o]);
|
|
119
|
+
function pe(e) {
|
|
120
|
+
var n;
|
|
121
|
+
if ((n = t.onFocus) == null || n.call(t, e), E.current = !0, i(), _.current || We(e.currentTarget)) {
|
|
122
|
+
c();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
c(), o(!0);
|
|
126
|
+
}
|
|
127
|
+
function Te(e) {
|
|
128
|
+
var n;
|
|
129
|
+
(n = t.onBlur) == null || n.call(t, e), !e.currentTarget.contains(e.relatedTarget) && (E.current = !1, c(), j(0));
|
|
130
|
+
}
|
|
131
|
+
function we(e) {
|
|
132
|
+
var n;
|
|
133
|
+
(n = t.onMouseEnter) == null || n.call(t, e), g.current = !0, me();
|
|
134
|
+
}
|
|
135
|
+
function De(e) {
|
|
136
|
+
var n;
|
|
137
|
+
(n = t.onMouseLeave) == null || n.call(t, e), g.current = !1, c(), j(Q);
|
|
138
|
+
}
|
|
139
|
+
function Ee() {
|
|
140
|
+
d.current = !0, i();
|
|
141
|
+
}
|
|
142
|
+
function ge() {
|
|
143
|
+
d.current = !1, j(Q);
|
|
144
|
+
}
|
|
145
|
+
function Ie(e) {
|
|
146
|
+
var y, b;
|
|
147
|
+
(y = t.onPointerDown) == null || y.call(t, e), c(), i(), o(!1);
|
|
148
|
+
const n = (b = D.current) == null ? void 0 : b.ownerDocument.defaultView;
|
|
149
|
+
if (!n) return;
|
|
150
|
+
_.current = !0, h();
|
|
151
|
+
const T = n.setTimeout(() => {
|
|
152
|
+
_.current = !1, O.current = null;
|
|
153
|
+
}, 0);
|
|
154
|
+
O.current = { ownerWindow: n, timerId: T };
|
|
155
|
+
}
|
|
156
|
+
if (xe({
|
|
157
|
+
active: x,
|
|
158
|
+
boundaries: le,
|
|
159
|
+
dismissOnPointerDownOutside: !0,
|
|
160
|
+
layerId: A.id,
|
|
161
|
+
onEscapeDismiss: () => o(!1),
|
|
162
|
+
onPointerDownOutsideDismiss: () => o(!1),
|
|
163
|
+
ownerDocument: V
|
|
164
|
+
}), G(() => {
|
|
165
|
+
w && (c(), i(), h(), _.current = !1, E.current = !1, g.current = !1, d.current = !1, W.current && o(!1));
|
|
166
|
+
}, [
|
|
167
|
+
i,
|
|
168
|
+
c,
|
|
169
|
+
h,
|
|
170
|
+
w,
|
|
171
|
+
o
|
|
172
|
+
]), G(() => () => {
|
|
173
|
+
c(), i(), h();
|
|
174
|
+
}, [i, c, h]), w)
|
|
175
|
+
return J(
|
|
176
|
+
l,
|
|
177
|
+
{ ref: U }
|
|
178
|
+
);
|
|
179
|
+
const Re = J(
|
|
180
|
+
l,
|
|
181
|
+
{
|
|
182
|
+
"aria-describedby": fe,
|
|
183
|
+
className: [t.className, "nk-tooltip__trigger", ne].filter(Boolean).join(" "),
|
|
184
|
+
onBlur: Te,
|
|
185
|
+
onFocus: pe,
|
|
186
|
+
onMouseEnter: we,
|
|
187
|
+
onMouseLeave: De,
|
|
188
|
+
onPointerDown: Ie,
|
|
189
|
+
ref: U,
|
|
190
|
+
style: { ...t.style, ...oe }
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
return /* @__PURE__ */ q(he, { children: [
|
|
194
|
+
Re,
|
|
195
|
+
R.present && V ? /* @__PURE__ */ C(
|
|
196
|
+
Ne,
|
|
197
|
+
{
|
|
198
|
+
container: L,
|
|
199
|
+
inheritFrom: I,
|
|
200
|
+
children: /* @__PURE__ */ q(
|
|
201
|
+
ke,
|
|
202
|
+
{
|
|
203
|
+
ref: de,
|
|
204
|
+
"aria-hidden": x ? void 0 : !0,
|
|
205
|
+
className: ["nk-tooltip", te].filter(Boolean).join(" "),
|
|
206
|
+
"data-placement": (m == null ? void 0 : m.placement) ?? B,
|
|
207
|
+
"data-state": R.state === "closing" ? "closing" : "open",
|
|
208
|
+
id: Y,
|
|
209
|
+
onMouseEnter: Ee,
|
|
210
|
+
onMouseLeave: ge,
|
|
211
|
+
role: "tooltip",
|
|
212
|
+
style: m ? {
|
|
213
|
+
...S,
|
|
214
|
+
"--nk-tooltip-arrow-offset": `${m.arrowOffset}px`,
|
|
215
|
+
left: m.left,
|
|
216
|
+
top: m.top,
|
|
217
|
+
zIndex: A.zIndex
|
|
218
|
+
} : {
|
|
219
|
+
...S,
|
|
220
|
+
visibility: "hidden",
|
|
221
|
+
zIndex: A.zIndex
|
|
222
|
+
},
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ C("span", { "aria-hidden": "true", className: "nk-tooltip__arrow" }),
|
|
225
|
+
p
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
) : null
|
|
231
|
+
] });
|
|
232
|
+
});
|
|
233
|
+
export {
|
|
234
|
+
Ge as T,
|
|
235
|
+
Je as a
|
|
236
|
+
};
|
package/dist/Tooltip.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-BB82wNOE.cjs");exports.TooltipProvider=e.TooltipProvider;exports.default=e.Tooltip;
|
package/dist/Tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function n(e){return e!==void 0&&e!==!1&&e!=="false"}function r(e,t){return e?!0:t}exports.hasInvalidState=n;exports.resolveAriaInvalid=r;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Alert";
|
|
2
2
|
export type { AlertProps, AlertTone } from "./Alert";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Avatar";
|
|
2
2
|
export type { AvatarProps } from "./Avatar";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Badge";
|
|
2
2
|
export type { BadgeProps, BadgeTone, BadgeVariant } from "./Badge";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Button";
|
|
2
2
|
export type { ButtonIconAlignment, ButtonProps, ButtonShape, ButtonTextAlignment, ButtonTone, ButtonVariant, } from "./Button";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Card";
|
|
2
2
|
export type { CardHeader, CardProps, CardSpacing, } from "./Card";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Checkbox";
|
|
2
2
|
export type { CheckboxProps } from "./Checkbox";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./CheckboxGroup";
|
|
2
2
|
export type { CheckboxGroupOrientation, CheckboxGroupProps, } from "./CheckboxGroup";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Code";
|
|
2
2
|
export type { CodeLanguage, CodeProps } from "./Code";
|
|
@@ -4,9 +4,11 @@ import "./styles/content.css";
|
|
|
4
4
|
export type ContentTheme = "light" | "dark";
|
|
5
5
|
/** A type representing Content's visual background modes. */
|
|
6
6
|
export type ContentMode = "grid" | "none";
|
|
7
|
+
/** A type representing Content's horizontal layout behavior. */
|
|
8
|
+
export type ContentWidth = "narrow" | "full";
|
|
7
9
|
/** A type representing Content's minimum-height behavior. */
|
|
8
|
-
export type
|
|
9
|
-
/** A type representing Content's
|
|
10
|
+
export type ContentHeight = "content" | "available" | "viewport";
|
|
11
|
+
/** A type representing Content's spacing behavior on both axes. */
|
|
10
12
|
export type ContentSpacing = "standard" | "none";
|
|
11
13
|
/** A type representing CSS custom properties accepted by Content styles. */
|
|
12
14
|
type ContentCustomProperties = {
|
|
@@ -24,12 +26,12 @@ type ContentOwnProps = {
|
|
|
24
26
|
accent?: string;
|
|
25
27
|
/** The visual background treatment applied to Content. */
|
|
26
28
|
mode?: ContentMode;
|
|
29
|
+
/** The horizontal layout applied to Content. */
|
|
30
|
+
width?: ContentWidth;
|
|
27
31
|
/** The minimum height applied to Content. */
|
|
28
|
-
|
|
29
|
-
/** The
|
|
32
|
+
height?: ContentHeight;
|
|
33
|
+
/** The spacing applied around content within Content. */
|
|
30
34
|
spacing?: ContentSpacing;
|
|
31
|
-
/** Whether Content applies its responsive cell-aligned inner width. */
|
|
32
|
-
constrain?: boolean;
|
|
33
35
|
};
|
|
34
36
|
/** A type representing properties for a polymorphic Content element. */
|
|
35
37
|
export type ContentProps<Component extends ElementType = "div"> = ContentOwnProps & {
|
|
@@ -10,9 +10,9 @@ type ContentLayout = {
|
|
|
10
10
|
* Measures a Content root and progressively enhances its inner width.
|
|
11
11
|
*
|
|
12
12
|
* @param forwardedReference - The public reference assigned to the root.
|
|
13
|
-
* @param
|
|
13
|
+
* @param snap - Whether cell-aligned inner-width sizing is enabled.
|
|
14
14
|
*
|
|
15
15
|
* @returns The merged root reference and calculated inner width.
|
|
16
16
|
*/
|
|
17
|
-
export declare function useContentLayout(forwardedReference: ForwardedRef<HTMLElement>,
|
|
17
|
+
export declare function useContentLayout(forwardedReference: ForwardedRef<HTMLElement>, snap: boolean): ContentLayout;
|
|
18
18
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export type {
|
|
1
|
+
export { default } from "./Content";
|
|
2
|
+
export type { ContentHeight, ContentMode, ContentProps, ContentSpacing, ContentTheme, ContentWidth, } from "./Content";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Divider";
|
|
2
2
|
export type { DividerOrientation, DividerProps } from "./Divider";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Field";
|
|
2
2
|
export type { FieldOrientation, FieldProps } from "./Field";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Input";
|
|
2
2
|
export type { InputProps, InputType } from "./Input";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Modal";
|
|
2
2
|
export type { ModalCloseReason, ModalProps } from "./Modal";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./PinInput";
|
|
2
2
|
export type { PinInputMode, PinInputProps } from "./PinInput";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Popover";
|
|
2
2
|
export type { PopoverOpenChangeReason, PopoverPlacement, PopoverProps, } from "./Popover";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Radio";
|
|
2
2
|
export type { RadioProps } from "./Radio";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./RadioGroup";
|
|
2
2
|
export type { RadioGroupOrientation, RadioGroupProps, } from "./RadioGroup";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Select";
|
|
2
2
|
export type { CustomSelectProps, NativeSelectProps, SelectDisplayOverride, SelectOption, SelectProps, } from "./Select";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Skeleton";
|
|
2
2
|
export type { SkeletonProps, SkeletonShape } from "./Skeleton";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Spinner";
|
|
2
2
|
export type { SpinnerProps } from "./Spinner";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Switch";
|
|
2
2
|
export type { SwitchProps } from "./Switch";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Table";
|
|
2
2
|
export type { TableActionCellProps, TableActionHeaderCellProps, TableActionProps, TableBodyProps, TableCellAlignment, TableCellProps, TableCellValue, TableFootProps, TableHeaderCellProps, TableHeadProps, TableProps, TableRowProps, } from "./Table";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Text";
|
|
2
2
|
export type { TextAlignment, TextProps, TextSize, TextTone, TextWeight, } from "./Text";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./TextArea";
|
|
2
2
|
export type { TextAreaProps, TextAreaResize } from "./TextArea";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Tooltip";
|
|
2
2
|
export type { TooltipPlacement, TooltipProps } from "./Tooltip";
|
|
3
3
|
export { default as TooltipProvider } from "./TooltipProvider";
|
|
4
4
|
export type { TooltipProviderProps } from "./TooltipProvider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=Symbol("nk-field-control-metadata");function e(t){if(typeof t!="function"&&typeof t!="object"||t===null)return;const o=t,r=o[a];return r||(o.type!==void 0&&o.type!==t?e(o.type):void 0)}function i(t,o){Object.assign(t,{[a]:{requiredCommunication:o}})}exports.getFieldControlMetadata=e;exports.markFieldGroupControl=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const i = Symbol("nk-field-control-metadata");
|
|
2
|
+
function n(t) {
|
|
3
|
+
if (typeof t != "function" && typeof t != "object" || t === null)
|
|
4
|
+
return;
|
|
5
|
+
const o = t, a = o[i];
|
|
6
|
+
return a || (o.type !== void 0 && o.type !== t ? n(o.type) : void 0);
|
|
7
|
+
}
|
|
8
|
+
function r(t, o) {
|
|
9
|
+
Object.assign(t, {
|
|
10
|
+
[i]: { requiredCommunication: o }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
n as g,
|
|
15
|
+
r as m
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=new WeakSet;function o(t){e.add(t);try{t.focus({preventScroll:!0})}finally{e.delete(t)}}function s(t){return e.has(t)}exports.isElementFocusRestoration=s;exports.restoreElementFocus=o;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./Table-B5izJmMG.cjs"),l=require("react/jsx-runtime"),r=require("react"),X=require("./Card-Ba5AcR4o.cjs"),nn=36,qe=[2,4,8,12,16,24,32,48],Me={sm:720,md:960,lg:1440,xl:1920},tn={color:{accent:{default:"var(--nk-accent)",soft:"var(--nk-accent-soft)",subtle:"var(--nk-accent-subtle)"},background:"var(--nk-color-background)",surface:"var(--nk-color-surface)",text:{default:"var(--nk-color-text)",muted:"var(--nk-color-text-muted)"},border:"var(--nk-color-border)",emphasis:{fill:"var(--nk-color-emphasis-fill)",fillForeground:"var(--nk-color-emphasis-fill-foreground)"},info:{foreground:"var(--nk-color-info-foreground)",fill:"var(--nk-color-info-fill)",fillForeground:"var(--nk-color-info-fill-foreground)"},success:{foreground:"var(--nk-color-success-foreground)",fill:"var(--nk-color-success-fill)",fillForeground:"var(--nk-color-success-fill-foreground)"},warning:{foreground:"var(--nk-color-warning-foreground)",fill:"var(--nk-color-warning-fill)",fillForeground:"var(--nk-color-warning-fill-foreground)"},danger:{foreground:"var(--nk-color-danger-foreground)",fill:"var(--nk-color-danger-fill)",fillForeground:"var(--nk-color-danger-fill-foreground)"}},radius:{small:"var(--nk-radius-small)",medium:"var(--nk-radius-medium)",large:"var(--nk-radius-large)"},shadow:{subtle:"var(--nk-shadow-subtle)",medium:"var(--nk-shadow-medium)",strong:"var(--nk-shadow-strong)"}};({...Object.fromEntries(qe.map(e=>[`--nk-space-${e}`,`${e}px`]))});function an(e){if(typeof e!="number"||!Number.isFinite(e))throw new RangeError("Cell amount must be a finite number.");const n=e*nn;if(!Number.isFinite(n))throw new RangeError("Calculated cell value must be finite.");return n}function rn(e){if(!qe.some(n=>n===e))throw new RangeError(`Unsupported spacing size: ${String(e)}.`);return e}function de(e){if(!Object.prototype.hasOwnProperty.call(Me,e))throw new RangeError(`Unsupported breakpoint: ${String(e)}.`);return Me[e]}function on(e){if(typeof e!="number"||!Number.isFinite(e))throw new RangeError("Pixel value must be a finite number.");return`${e}px`}function sn(e){return(Array.from((e==null?void 0:e.trim())??"")[0]??"?").trim().toUpperCase()||"?"}function ln(e){if(e==="?")return"neutral";const n=Array.from(e)[0]??"";if("AJO".includes(n))return"1";if("BNSV".includes(n))return"2";if("CFLQW".includes(n))return"3";if("EHKMPTX".includes(n))return"4";if("DGRUY".includes(n))return"5";if("IZ".includes(n))return"6";const t=n.codePointAt(0)??0;return String(t%6+1)}const cn=r.forwardRef(function(n,t){const{alt:a,className:o,image:c,size:s=32,style:u,...h}=n,[b,d]=r.useState(),i=!!c&&c!==b,f=(a==null?void 0:a.trim())??"",k=sn(f),m=typeof s=="number"?`${s}px`:s,x=f?{"aria-label":f,role:"img"}:{"aria-hidden":!0,role:void 0};function v(){d(c)}return l.jsx("div",{...h,...i?void 0:x,ref:t,className:["nk-avatar",o].filter(Boolean).join(" "),"data-palette":ln(k),"data-state":i?"image":"fallback",style:{...u,"--nk-avatar-size":m},children:i?l.jsx("img",{alt:f,className:"nk-avatar__image",onError:v,src:c}):l.jsx("span",{"aria-hidden":"true",className:"nk-avatar__initial",children:k})})}),un=r.forwardRef(function(n,t){const{children:a,className:o,tone:c="neutral",variant:s="outline",...u}=n;return l.jsx("span",{...u,ref:t,className:["nk-badge",o].filter(Boolean).join(" "),"data-tone":c,"data-variant":s,children:a})});function ie(e){return e!==void 0&&e!==!1&&e!=="false"}function le(e,n){return e?!0:n}const ze=r.createContext(void 0);function dn(){return r.useContext(ze)}const We=r.forwardRef(function(n,t){var C;const{"aria-invalid":a,checked:o,children:c,className:s,defaultChecked:u,disabled:h=!1,invalid:b=!1,name:d,onChange:i,required:f=!1,style:k,value:m="on",...x}=n,v=dn(),w=String(m),P=(v==null?void 0:v.value)!==void 0,E=h||!!(v!=null&&v.disabled),D=!!(v!=null&&v.required&&!v.hasSelection&&v.validationValue===w),I=b||ie(a);function j(_){i==null||i(_),_.defaultPrevented||v==null||v.handleChange(_)}return l.jsxs("label",{className:["nk-checkbox",s].filter(Boolean).join(" "),"data-disabled":E||void 0,"data-invalid":I||void 0,style:k,children:[l.jsx("input",{...x,ref:t,"aria-invalid":le(b,a),checked:v?P?(C=v.value)==null?void 0:C.includes(w):void 0:o,className:"nk-checkbox__control",defaultChecked:v&&!P?v.defaultValue.includes(w):u,disabled:E,name:(v==null?void 0:v.name)??d,onChange:j,required:f||D,type:"checkbox",value:m}),l.jsx("span",{"aria-hidden":"true",className:"nk-checkbox__visual",children:l.jsx(L.Icon,{className:"nk-checkbox__icon",size:12,type:"checkmark"})}),c!==void 0?l.jsxs(X.Text,{as:"span",className:"nk-checkbox__label",children:[c,f?l.jsx("span",{"aria-hidden":"true",className:"nk-checkbox__required",children:"*"}):null]}):null]})}),$e=Symbol("nk-field-control-metadata");function He(e){if(typeof e!="function"&&typeof e!="object"||e===null)return;const n=e,t=n[$e];return t||(n.type!==void 0&&n.type!==e?He(n.type):void 0)}function Ge(e,n){Object.assign(e,{[$e]:{requiredCommunication:n}})}const fn=Object.freeze([]);function Ke(e,n){r.Children.forEach(e,t=>{if(t==null||typeof t=="boolean")return;if(!r.isValidElement(t))throw new Error("CheckboxGroup children must be direct Checkbox elements or fragments");if(t.type===r.Fragment){Ke(t.props.children,n);return}if(t.type!==We)throw new Error("CheckboxGroup children must be direct Checkbox elements or fragments");const a=t;n.push({disabled:!!a.props.disabled,required:!!a.props.required,value:String(a.props.value??"on")})})}function pn(e){const n=[];Ke(e,n);const t=new Set;return n.forEach(a=>{if(t.has(a.value))throw new Error("CheckboxGroup Checkbox values must be unique");t.add(a.value)}),n}function hn(e,n,t){n.current=e,typeof t=="function"?t(e):t&&(t.current=e)}const Ue=r.forwardRef(function(n,t){const{"aria-invalid":a,children:o,className:c,defaultValue:s=fn,disabled:u=!1,invalid:h=!1,name:b,onChange:d,orientation:i="vertical",required:f=!1,value:k,...m}=n,x=r.useRef(null),[v,w]=r.useState(s),P=k!==void 0,E=P?k:v,D=h||ie(a),I=pn(o),j=u?[]:I.filter(p=>!p.disabled).map(p=>p.value),C=new Set(j),_=E.some(p=>C.has(p)),V=j[0],q=I.find(p=>!p.disabled&&p.value===V),$=s.some(p=>C.has(p)),F=!!(q!=null&&q.required),S=r.useCallback(p=>hn(p,x,t),[t]);r.useEffect(()=>{var R;if(P)return;const p=(R=x.current)==null?void 0:R.querySelector('input[type="checkbox"]'),N=p instanceof HTMLInputElement?p.form:null;if(!N)return;const A=N.getRootNode();function O(B){var G;if(B.target!==N||B.defaultPrevented)return;const Z=Array.from(((G=x.current)==null?void 0:G.querySelectorAll('input[type="checkbox"]'))??[]).find(Y=>!Y.disabled&&Y.value===V);Z&&(Z.required=!!(F||f&&!$)),w(s)}return A.addEventListener("reset",O),()=>A.removeEventListener("reset",O)},[o,s,$,P,f,F,V]);function K(p){if(!P){const N=p.currentTarget.value,A=p.currentTarget.checked;w(O=>A?[...new Set([...O,N])]:O.filter(R=>R!==N))}d==null||d(p)}const y={defaultValue:s,disabled:u,handleChange:K,hasSelection:_,name:b,required:f,value:k,validationValue:V};return l.jsx(ze.Provider,{value:y,children:l.jsx("div",{...m,ref:S,"aria-disabled":u||void 0,"aria-invalid":le(h,a),className:["nk-checkbox-group",c].filter(Boolean).join(" "),"data-disabled":u||void 0,"data-invalid":D||void 0,"data-orientation":i,role:"group",children:o})})});Ge(Ue,"label");const mn=[{minWidth:de("xl"),marginPercent:32,preferredWidth:1200},{minWidth:de("lg"),marginPercent:20,preferredWidth:1100},{minWidth:de("md"),marginPercent:14,preferredWidth:de("md")},{minWidth:de("sm"),marginPercent:8,preferredWidth:650}],vn=16;function gn(e){for(const n of mn)if(e>=n.minWidth)return n}function bn(e,n){if(!Number.isFinite(e)||!Number.isFinite(n)||e<de("sm")||n<=0)return;const t=gn(e);if(!t)return;const a=e*t.marginPercent/100,o=e-a*2,c=Math.min(t.preferredWidth,e-vn),s=Math.max(o,c);let u=Math.floor(s/n);return u%2===0&&(u-=1),u=Math.max(u,1),Math.min((u-1)*n,e)}const kn=typeof window>"u"?r.useEffect:r.useLayoutEffect;function xn(e,n){if(typeof e=="function"){e(n);return}e&&(e.current=n)}function yn(e){const n=window.getComputedStyle(e),t=Number.parseFloat(n.paddingLeft)+Number.parseFloat(n.paddingRight);return Math.max(e.clientWidth-t,0)}function wn(e){const t=window.getComputedStyle(e).getPropertyValue("--nk-cell").trim().match(/^([+]?(?:\d+\.?\d*|\.\d+))px$/i);if(!t)return;const a=Number.parseFloat(t[1]);return Number.isFinite(a)&&a>0?a:void 0}function In(e,n){const t=r.useRef(null),a=r.useRef(null),o=r.useRef(void 0),[c,s]=r.useState(void 0),u=r.useCallback(d=>{if(!n){if(o.current===void 0)return;o.current=void 0,s(void 0);return}const i=yn(d),f=wn(d),k=f===void 0?void 0:bn(i,f);o.current!==k&&(o.current=k,s(k))},[n]),h=r.useCallback(d=>{var f;if((f=a.current)==null||f.disconnect(),a.current=null,typeof ResizeObserver>"u")return;const i=new ResizeObserver(()=>u(d));i.observe(d),a.current=i},[u]),b=r.useCallback(d=>{var i;(i=a.current)==null||i.disconnect(),a.current=null,t.current=d,xn(e,d),!(!d||typeof window>"u"||!n)&&(u(d),h(d))},[h,n,e,u]);return kn(()=>{t.current&&u(t.current)}),r.useEffect(()=>(t.current&&n&&h(t.current),()=>{var d;(d=a.current)==null||d.disconnect(),a.current=null}),[h,n]),{rootReference:b,innerWidth:c}}const Cn=r.forwardRef(function(n,t){const{accent:a,as:o,children:c,className:s,constrain:u=!0,minHeight:h="auto",mode:b="grid",spacing:d="standard",style:i,theme:f="light",...k}=n,{rootReference:m,innerWidth:x}=In(t,u),v=o??"div",w=a!==void 0?{...i,"--nk-accent":a}:i;return r.createElement(v,{...k,ref:m,className:["nk-content",s].filter(Boolean).join(" "),"data-constrain":u,"data-min-height":h,"data-mode":b,"data-spacing":d,"data-theme":f,style:w},r.createElement("div",{className:"nk-content__inner",style:x===void 0?void 0:{width:`${x}px`}},c))});function _e(e){return typeof e=="string"?e.trim().length>0:e!=null&&e!==!1&&e!==!0}function Ve(...e){const n=e.flatMap(a=>(a==null?void 0:a.split(/\s+/).filter(Boolean))??[]),t=[...new Set(n)];return t.length>0?t.join(" "):void 0}const En=r.forwardRef(function(n,t){const{children:a,className:o,description:c,disabled:s=!1,error:u,label:h,orientation:b="vertical",required:d=!1,...i}=n,f=r.useId(),k=a.props.id??`${f}-control`,m=`${f}-label`,x=`${f}-description`,v=`${f}-error`,w=_e(h),P=_e(c),E=_e(u),D=He(a.type),I=D!==void 0,j=s||!!a.props.disabled,C=d||!!a.props.required,_=C&&(D==null?void 0:D.requiredCommunication)==="label",V=Ve(a.props["aria-describedby"],P?x:void 0,E?v:void 0),q=Ve(w?m:void 0,a.props["aria-labelledby"]),$=C?l.jsx("span",{"aria-hidden":"true",className:"nk-field__required",children:"*"}):null,F=_?l.jsx("span",{className:"nk-field__required-text",children:", select at least one"}):null,S=r.cloneElement(a,{"aria-describedby":V,"aria-invalid":E?!0:a.props["aria-invalid"],"aria-labelledby":q,disabled:j||void 0,id:k,required:C||void 0});return l.jsxs("div",{...i,ref:t,className:["nk-field",o].filter(Boolean).join(" "),"data-disabled":j||void 0,"data-has-label":w||void 0,"data-invalid":E||void 0,"data-orientation":b,"data-required":C||void 0,children:[w&&I?l.jsxs(X.Text,{as:"span",className:"nk-field__label",id:m,size:"caption",weight:"medium",children:[h,$,F]}):null,w&&!I?l.jsxs(X.Text,{as:"label",className:"nk-field__label",htmlFor:k,id:m,size:"caption",weight:"medium",children:[h,$]}):null,l.jsxs("div",{className:"nk-field__body",children:[S,P?l.jsx(X.Text,{as:"p",className:"nk-field__description",id:x,size:"caption",tone:"muted",children:c}):null,E?l.jsx(X.Text,{as:"p","aria-live":"polite",className:"nk-field__error",id:v,size:"caption",tone:"danger",children:u}):null]})]})});function je(e){return Array.isArray(e)?e.length>0:e!=null&&String(e).length>0}function Sn(e,n,t){n.current=e,typeof t=="function"?t(e):t&&(t.current=e)}function Fe(e){return e!=null&&e!==!1&&e!==!0&&e!==""}function Rn(e){var t;const n=(t=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value"))==null?void 0:t.set;n?n.call(e,""):e.value=""}const Nn=r.forwardRef(function(n,t){const{"aria-busy":a,"aria-invalid":o,className:c,clearable:s=!1,defaultValue:u,disabled:h=!1,id:b,invalid:d=!1,leading:i,loading:f=!1,onChange:k,readOnly:m=!1,style:x,trailing:v,type:w="text",value:P,...E}=n,D=r.useId(),I=r.useRef(null),[j,C]=r.useState(je(u)),[_,V]=r.useState(!1);r.useEffect(()=>{w!=="password"&&V(!1)},[w]);const q=r.useCallback(z=>Sn(z,I,t),[t]),$=b??`${D}-control`,F=h||f,S=d||ie(o),K=P!==void 0?je(P):j,y=w==="password"&&_?"text":w,p=le(d,o),N=s&&K&&!m&&!F,A=w==="password"&&!f,O=N||A,R=Fe(i),B=Fe(v)||O;function Z(z){P===void 0&&C(je(z.currentTarget.value)),k==null||k(z)}function G(){const z=I.current;z&&(Rn(z),z.dispatchEvent(new Event("input",{bubbles:!0})),z.focus())}function Y(){V(z=>!z)}return l.jsxs("div",{className:["nk-input",c].filter(Boolean).join(" "),"data-clearable":s||void 0,"data-disabled":F||void 0,"data-invalid":S||void 0,"data-leading":R||void 0,"data-loading":f||void 0,"data-read-only":m||void 0,"data-has-trailing-action":O||void 0,"data-trailing":B||void 0,style:x,children:[R?l.jsx("span",{className:"nk-input__leading",children:i}):null,l.jsx("input",{...E,ref:q,"aria-busy":f?!0:a,"aria-invalid":p,className:"nk-input__control",defaultValue:u,disabled:F,id:$,onChange:Z,readOnly:m,type:y,value:P}),B?l.jsxs("span",{className:"nk-input__trailing",children:[v,N?l.jsx(L.Button,{"aria-controls":$,"aria-label":"Clear input",className:"nk-input__action",icon:"cross",onClick:G,shape:"rectangle",type:"button",variant:"ghost"}):null,A?l.jsx(L.Button,{"aria-controls":$,"aria-label":_?"Hide password":"Show password","aria-pressed":_,className:"nk-input__action",disabled:F,icon:_?"eye-off":"eye",onClick:Y,shape:"rectangle",type:"button",variant:"ghost"}):null]}):null,f?l.jsx(L.Spinner,{"aria-hidden":"true","aria-label":void 0,className:"nk-input__spinner",role:void 0,size:14}):null]})}),_n=["a[href]","area[href]","button","input:not([type=hidden])","select","textarea","iframe","[contenteditable]:not([contenteditable='false'])","[tabindex]"].join(",");function jn(e,n){let t=e;for(;t;){if(t.hidden||t.inert||t.getAttribute("aria-hidden")==="true")return!0;const a=t.ownerDocument.defaultView,o=a==null?void 0:a.getComputedStyle(t);if((o==null?void 0:o.display)==="none"||(o==null?void 0:o.visibility)==="hidden")return!0;if(t===n)break;t=t.parentElement}return!1}function Pn(e,n){var c;const t=(c=e.ownerDocument.defaultView)==null?void 0:c.HTMLInputElement;if(!t||!(e instanceof t)||e.type!=="radio"||!e.name)return!0;const a=n.filter(s=>s instanceof t&&s.type==="radio"&&s.name===e.name&&s.form===e.form),o=a.find(s=>s.checked);return o?o===e:a[0]===e}function Ln(e){const n=Array.from(e.querySelectorAll(_n)).filter(t=>!t.matches(":disabled")&&t.tabIndex>=0&&!jn(t,e));return n.filter(t=>Pn(t,n))}function Ae(e,n){const t=[e,...n];return[...new Set(t.flatMap(o=>Ln(o)))].sort((o,c)=>{var h;if(o===c)return 0;const s=o.compareDocumentPosition(c),u=((h=o.ownerDocument.defaultView)==null?void 0:h.Node.DOCUMENT_POSITION_FOLLOWING)??4;return s&u?-1:1})}function Pe(e,n,t){return t?e.contains(t)||[...n].some(a=>a.contains(t)):!1}function Ze(e){const{active:n,autoFocus:t=!0,container:a,initialFocusReference:o,layerId:c,restoreFocus:s=!0}=e,u=(a==null?void 0:a.ownerDocument)??null,h=r.useRef(new Set),b=r.useCallback(i=>(h.current.add(i),()=>h.current.delete(i)),[]),d=r.useMemo(()=>({registerBranch:b}),[b]);return L.useOverlayFocusLayer(n&&!!a,u,c),r.useEffect(()=>{var E,D;if(!n||!a)return;const i=a.ownerDocument,f=(E=i.defaultView)==null?void 0:E.HTMLElement,k=(D=i.defaultView)==null?void 0:D.Node,m=f&&i.activeElement instanceof f?i.activeElement:null;let x=!0;function v(){const I=o==null?void 0:o.current;(I&&Pe(a,h.current,I)?I:Ae(a,h.current)[0]??a).focus({preventScroll:!0})}function w(I){if(I.key!=="Tab"||!L.isTopmostFocusLayer(i,c))return;const j=Ae(a,h.current);if(j.length===0){I.preventDefault(),a==null||a.focus({preventScroll:!0});return}const C=j[0],_=j[j.length-1],V=i.activeElement,q=Pe(a,h.current,V),F=!j.some(S=>S===V)&&(V===a||V===(o==null?void 0:o.current));if(!q||F){I.preventDefault(),(I.shiftKey?_:C).focus();return}I.shiftKey&&V===C?(I.preventDefault(),_.focus()):!I.shiftKey&&V===_&&(I.preventDefault(),C.focus())}function P(I){L.isTopmostFocusLayer(i,c)&&k&&I.target instanceof k&&!Pe(a,h.current,I.target)&&v()}return i.addEventListener("keydown",w,!0),i.addEventListener("focusin",P,!0),t&&Promise.resolve().then(()=>{x&&v()}),()=>{x=!1,i.removeEventListener("keydown",w,!0),i.removeEventListener("focusin",P,!0),s&&(m!=null&&m.isConnected)&&L.restoreElementFocus(m)}},[n,t,a,o,c,s]),d}const xe=new WeakMap;function On(e,n){r.useEffect(()=>{if(!e||!n)return;const t=xe.get(n);if(t)t.count+=1;else{const a=n.body,o=n.defaultView,c=o&&Number.parseFloat(o.getComputedStyle(a).paddingRight)||0,s=n.documentElement.clientWidth,u=o&&s>0?Math.max(0,o.innerWidth-s):0,h={count:1,overflow:a.style.overflow,paddingRight:a.style.paddingRight};xe.set(n,h),a.style.overflow="hidden",u>0&&(a.style.paddingRight=`${c+u}px`)}return()=>{const a=xe.get(n);a&&(a.count-=1,!(a.count>0)&&(n.body.style.overflow=a.overflow,n.body.style.paddingRight=a.paddingRight,xe.delete(n)))}},[e,n])}function Tn(e,n,t){n.current=e,typeof t=="function"?t(e):t&&(t.current=e)}function Dn(e){const{"aria-label":n,"aria-labelledby":t,children:a,className:o,closeButtonLabel:c="Close modal",exitable:s=!0,forwardedReference:u,initialFocusReference:h,lockScroll:b=!0,onClose:d,open:i,ownerDocument:f,presenceState:k,restoreFocus:m=!0,role:x="dialog",style:v,title:w,trapFocus:P=!0,...E}=e,D=r.useRef(null),I=r.useRef(null),j=r.useContext(L.FocusScopeContext),C=`${r.useId()}-title`,[_,V]=r.useState(null),q=L.useOverlayLayer(!0,f),$=r.useMemo(()=>[D],[]),F=!!(w!=null&&w.trim()),S=h??(F?I:void 0),K=t??(n===void 0&&F?C:void 0),y=r.useCallback(R=>{Tn(R,D,u),V(R)},[u]);r.useLayoutEffect(()=>{_&&(_.inert=!i)},[_,i]);const p=r.useCallback(()=>{d==null||d("escape")},[d]),N=r.useCallback(()=>{d==null||d("outside")},[d]);L.useDismissableLayer({active:i,boundaries:$,dismissOnEscape:s,dismissOnPointerDownOutside:s,layerId:q.id,onEscapeDismiss:p,onPointerDownOutsideDismiss:N,ownerDocument:f});const A=Ze({active:i&&P,container:_,initialFocusReference:S,layerId:q.id,restoreFocus:m});On(b,f);const O=s?l.jsx(L.Button,{"aria-label":c,className:"nk-modal__close",icon:"cross",onClick:()=>d==null?void 0:d("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return l.jsx(L.FocusScopeContext.Provider,{value:i&&P?A:j,children:l.jsx("div",{className:"nk-modal__overlay","data-state":k,role:"presentation",style:{zIndex:q.zIndex},children:l.jsxs(X.Surface,{...E,ref:y,"aria-hidden":i?void 0:!0,"aria-label":i?n:void 0,"aria-labelledby":i?K:void 0,"aria-modal":i?"true":void 0,className:["nk-modal",o].filter(Boolean).join(" "),"data-state":k,role:i?x:void 0,style:v,tabIndex:-1,children:[F?l.jsxs("div",{className:"nk-modal__header",children:[l.jsx(X.Text,{as:"h2",className:"nk-modal__title",id:C,ref:I,size:"subtitle",tabIndex:-1,weight:"semibold",children:w}),O]}):O,a]})})})}const Mn=r.forwardRef(function(n,t){const{open:a}=n,o=r.useRef(n);a&&(o.current=n);const c=a?n:o.current,{portalContainer:s}=c,u=L.usePresence(a),h=(s==null?void 0:s.ownerDocument)??(typeof document>"u"?null:document);return u.present?l.jsx(L.Portal,{container:s,children:l.jsx(Dn,{...c,forwardedReference:t,open:a,ownerDocument:h,presenceState:u.state==="closing"?"closing":"open"})}):null});function Vn(e){const{inert:n,panelElement:t}=e;return r.useLayoutEffect(()=>{t&&(t.inert=n)},[n,t]),null}function Fn(e,n,t){n.current=e,X.assignElementReference(t,e)}function An(e,n,t){n.current=e,X.assignElementReference(t,e)}function Bn(e,n){const t=(e==null?void 0:e.split(/\s+/).filter(Boolean))??[];return t.includes(n)||t.push(n),t.join(" ")}function qn(e){const n=e.tagName.toLowerCase();return e.getAttribute("role")==="button"&&n!=="button"?!1:["button","input","select","summary","textarea"].includes(n)?!0:n==="a"&&e.hasAttribute("href")}function zn(e){return e==="grid"||e==="listbox"||e==="menu"||e==="tree"?e:"dialog"}const Wn=r.forwardRef(function(n,t){const{"aria-label":a,"aria-labelledby":o,autoFocus:c=!0,children:s,className:u,closeOnEscape:h=!0,closeOnOutsideInteraction:b=!0,defaultOpen:d=!1,disabled:i=!1,initialFocusReference:f,onEscapeKeyDown:k,onOpenChange:m,onPointerDownOutside:x,open:v,placement:w="bottom",portalContainer:P,restoreFocus:E=!0,role:D="dialog",style:I,tabIndex:j,trapFocus:C=!1,trigger:_,...V}=n;if(_.type===r.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const q=r.useId(),$=r.useContext(L.FocusScopeContext),F=`${q}-popover`,S=_.props,K=X.getElementReference(_),y=S.id??`${q}-trigger`,p=i||S.disabled===!0||S["aria-disabled"]===!0||S["aria-disabled"]==="true",N=v!==void 0,[A,O]=r.useState(d),R=N?v:A,B=L.usePresence(R),Z=r.useRef(null),G=r.useRef(null),Y=r.useRef("programmatic"),z=r.useRef(null),te=r.useRef(R),fe=r.useRef(null),[ye,we]=r.useReducer(T=>T+1,0),[J,ce]=r.useState(null),[re,Ie]=r.useState(null),H=(P==null?void 0:P.ownerDocument)??(J==null?void 0:J.ownerDocument)??(typeof document>"u"?null:document),pe=L.useOverlayLayer(B.present,H),U=r.useMemo(()=>[Z,G],[]),ee=L.useFloatingPosition(B.present,w,J,re),ge=r.useCallback(T=>{An(T,Z,K),ce(T)},[K]),Ce=r.useCallback(T=>{Fn(T,G,t),Ie(T)},[t]),oe=r.useCallback((T,W)=>{R!==T&&(N?(z.current={open:T,reason:W},we()):(Y.current=W,O(T)),m==null||m(T,W))},[N,m,R]),Ee=r.useCallback(()=>{oe(!1,"escape")},[oe]),Se=r.useCallback(()=>{oe(!1,"outside")},[oe]),be=r.useCallback(T=>{var ve;if(x==null||x(T),T.defaultPrevented)return;const W=(ve=H==null?void 0:H.defaultView)==null?void 0:ve.HTMLElement;fe.current=W?T.composedPath().find(he=>he instanceof W&&he.tabIndex>=0)??T.target:T.target},[x,H]);L.useDismissableLayer({active:R,boundaries:U,dismissOnEscape:h,dismissOnPointerDownOutside:b,layerId:pe.id,onEscapeDismiss:Ee,onEscapeKeyDown:k,onPointerDownOutside:be,onPointerDownOutsideDismiss:Se,ownerDocument:H});const g=Ze({active:R&&C,autoFocus:c,container:re,initialFocusReference:f,layerId:pe.id,restoreFocus:E});r.useEffect(()=>{if(!R||C||!c||!re)return;let T=!0;return Promise.resolve().then(()=>{if(!T)return;const W=f==null?void 0:f.current;(W&&re.contains(W)?W:re).focus({preventScroll:!0})}),()=>{T=!1}},[c,f,R,re,C]),r.useEffect(()=>{var De;const T=te.current;te.current=R;const W=z.current,ve=N?T!==R&&(W==null?void 0:W.open)===R?W.reason:"programmatic":Y.current;if(z.current=null,R){Y.current="programmatic",fe.current=null;return}const he=H==null?void 0:H.activeElement,Re=fe.current,Ne=(De=H==null?void 0:H.defaultView)==null?void 0:De.HTMLElement,en=ve==="outside"&&Ne&&Re instanceof Ne&&he instanceof Ne&&(Re===he||Re.contains(he));T&&!C&&E&&!en&&(J==null||J.focus({preventScroll:!0})),fe.current=null},[ye,N,R,H,E,C,J]),r.useEffect(()=>{i&&R&&oe(!1,"programmatic")},[i,R,oe]);function M(T){var W;if(p){T.preventDefault(),T.stopPropagation();return}(W=S.onClick)==null||W.call(S,T),!T.defaultPrevented&&oe(!R,"trigger")}function Q(T){var W;(W=S.onKeyDown)==null||W.call(S,T),!(T.defaultPrevented||p||qn(T.currentTarget)||T.key!=="Enter"&&T.key!==" ")&&(T.preventDefault(),T.currentTarget.click())}if(i)return _;const ne=typeof _.type=="string",ae=ne?_.type:null,se=ae==="a"&&typeof S.href=="string",ue=ne&&!(ae==="button"||ae==="input"||ae==="select"||ae==="summary"||ae==="textarea"||se),Te=se&&p,Je=r.cloneElement(_,{"aria-controls":R?Bn(S["aria-controls"],F):S["aria-controls"],"aria-expanded":R,"aria-haspopup":S["aria-haspopup"]??zn(D),"aria-disabled":p?!0:S["aria-disabled"],className:[S.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:Te?void 0:S.href,id:y,onClick:M,onKeyDown:ne?Q:S.onKeyDown,ref:ge,role:S.role??(Te?"link":ue?"button":void 0),tabIndex:p?-1:S.tabIndex??(ue?0:void 0)});return l.jsxs(l.Fragment,{children:[Je,l.jsx(L.FocusScopeContext.Provider,{value:R&&C?g:$,children:B.present&&H?l.jsx(L.Portal,{container:P,inheritFrom:J,children:l.jsxs(X.Surface,{...V,ref:Ce,"aria-hidden":R?void 0:!0,"aria-label":R?a:void 0,"aria-labelledby":R?o??(a===void 0?y:void 0):void 0,className:["nk-popover",u].filter(Boolean).join(" "),"data-placement":(ee==null?void 0:ee.placement)??w,"data-state":B.state==="closing"?"closing":"open",id:F,role:R?D:void 0,style:ee?{...I,"--nk-popover-arrow-offset":`${ee.arrowOffset}px`,left:ee.left,top:ee.top,zIndex:pe.zIndex}:{...I,visibility:"hidden",zIndex:pe.zIndex},tabIndex:j??-1,children:[l.jsx(Vn,{inert:!R,panelElement:re}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:s})]})}):null})]})}),$n=3,Hn=10,Qe=4;function Gn(e){return Number.isFinite(e)?Math.min(Hn,Math.max($n,Math.trunc(e))):Qe}function me(e,n,t){return(n==="numeric"?e.replace(/[^0-9]/g,""):e.replace(/[^0-9a-z]/gi,"").toUpperCase()).slice(0,t)}function Kn(e,n,t){n.current=e,typeof t=="function"?t(e):t&&(t.current=e)}function Un(e,n){var a;const t=(a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value"))==null?void 0:a.set;t?t.call(e,n):e.value=n}function Le(e,n,t){const a=Math.min(t-1,Math.max(0,n)),o=Math.min(a+1,e.value.length);e.focus(),e.setSelectionRange(a,o)}function Zn(e){const{defaultValue:n,disabled:t,forwardedReference:a,length:o,mode:c,onChange:s,onComplete:u,onFocus:h,onKeyDown:b,onPaste:d,onSelect:i,readOnly:f,value:k}=e,m=Gn(o),x=me(n,c,m),v=r.useRef(null),[w,P]=r.useState(x),[E,D]=r.useState(0),I=k!==void 0,j=me(I?k:w,c,m),C=r.useCallback(y=>Kn(y,v,a),[a]);r.useEffect(()=>{!I&&w!==j&&P(j)},[I,j,w]),r.useEffect(()=>{var A;if(I)return;const y=(A=v.current)==null?void 0:A.form;if(!y)return;const p=y.getRootNode();function N(O){O.target!==y||O.defaultPrevented||(P(x),D(0))}return p.addEventListener("reset",N),()=>p.removeEventListener("reset",N)},[I,x]);function _(y){const p=y.selectionStart??j.length;return Math.min(m-1,Math.max(0,p))}function V(y){const p=y.currentTarget,N=p.selectionStart??p.value.length,A=me(p.value,c,m),O=me(p.value.slice(0,N),c,m).length;p.value=A,I||P(A),s==null||s(y),A.length===m&&A!==j&&(u==null||u(A));const R=Math.min(m-1,O);D(R),p.setSelectionRange(R,Math.min(R+1,A.length))}function q(y){if(d==null||d(y),y.defaultPrevented||t||f)return;const p=me(y.clipboardData.getData("text"),c,m);if(y.preventDefault(),p.length===0)return;const N=y.currentTarget,A=N.selectionStart??j.length,O=N.selectionEnd??A,R=p.length===m?p:me(j.slice(0,A)+p+j.slice(O),c,m),B=p.length===m?m:Math.min(m,A+p.length);Un(N,R),N.setSelectionRange(B,B),N.dispatchEvent(new Event("input",{bubbles:!0}))}function $(y){if(b==null||b(y),y.defaultPrevented||y.key!=="ArrowLeft"&&y.key!=="ArrowRight")return;y.preventDefault();const p=y.key==="ArrowLeft"?-1:1,N=Math.min(m-1,Math.max(0,_(y.currentTarget)+p));D(N),Le(y.currentTarget,N,m)}function F(y){h==null||h(y);const p=Math.min(m-1,j.length);D(p),Le(y.currentTarget,p,m)}function S(y){i==null||i(y),D(_(y.currentTarget))}function K(y,p){if(y.preventDefault(),t)return;const N=v.current;N&&(D(p),Le(N,p,m))}return{activeIndex:E,handleChange:V,handleFocus:F,handleKeyDown:$,handlePaste:q,handleSelect:S,handleSlotPointerDown:K,inputCallbackReference:C,length:m,renderedValue:j}}const Qn=r.forwardRef(function(n,t){const{"aria-invalid":a,autoCapitalize:o,autoComplete:c="one-time-code",className:s,censored:u=!1,defaultValue:h="",disabled:b=!1,invalid:d=!1,length:i=Qe,mode:f="numeric",onChange:k,onComplete:m,onFocus:x,onKeyDown:v,onPaste:w,onSelect:P,readOnly:E=!1,style:D,value:I,wrap:j=!1,...C}=n,{activeIndex:_,handleChange:V,handleFocus:q,handleKeyDown:$,handlePaste:F,handleSelect:S,handleSlotPointerDown:K,inputCallbackReference:y,length:p,renderedValue:N}=Zn({defaultValue:h,disabled:b,forwardedReference:t,length:i,mode:f,onChange:k,onComplete:m,onFocus:x,onKeyDown:v,onPaste:w,onSelect:P,readOnly:E,value:I}),A=d||ie(a),O=!j&&p>=6&&p%2===0,R=p/2,B={...D,"--nk-pin-input-columns":Math.ceil(p/2)};return l.jsxs("span",{className:["nk-pin-input",s].filter(Boolean).join(" "),"data-disabled":b||void 0,"data-invalid":A||void 0,"data-read-only":E||void 0,"data-wrap":j||void 0,style:B,children:[l.jsx("input",{...C,ref:y,"aria-invalid":le(d,a),autoCapitalize:o??(f==="alphanumeric"?"characters":"off"),autoComplete:c,className:"nk-pin-input__control",disabled:b,inputMode:f==="numeric"?"numeric":"text",maxLength:p,minLength:p,onChange:V,onFocus:q,onKeyDown:$,onPaste:F,onSelect:S,pattern:f==="numeric"?`[0-9]{${p}}`:`[0-9A-Za-z]{${p}}`,readOnly:E,spellCheck:!1,type:"text",value:N}),l.jsx("span",{"aria-hidden":"true",className:"nk-pin-input__slots",children:Array.from({length:p},(Z,G)=>l.jsxs("span",{className:"nk-pin-input__slot-group",children:[O&&G===R?l.jsx("span",{className:"nk-pin-input__separator",children:"-"}):null,l.jsx("span",{className:"nk-pin-input__slot","data-active":_===G||void 0,onPointerDown:Y=>K(Y,G),children:u&&N[G]?l.jsx("span",{className:"nk-pin-input__censor"}):N[G]??""})]},G))})]})}),Xe=r.createContext(void 0);function Xn(){const e=r.useContext(Xe);if(!e)throw new Error("Radio must be rendered within RadioGroup");return e}function Yn(e,n,t){n.current=e,typeof t=="function"?t(e):t&&(t.current=e)}const Jn=r.forwardRef(function(n,t){const{children:a,className:o,disabled:c=!1,style:s,value:u,...h}=n,b=Xn(),d=r.useRef(null),i=b.disabled||c,f=b.value!==void 0,k=b.value===u,m=r.useCallback(x=>Yn(x,d,t),[t]);return r.useEffect(()=>{var x;!f&&i&&((x=d.current)!=null&&x.checked)&&(d.current.checked=!1)},[f,i]),l.jsxs("label",{className:["nk-radio",o].filter(Boolean).join(" "),"data-disabled":i||void 0,style:s,children:[l.jsx("input",{...h,ref:m,checked:f?!i&&k:void 0,className:"nk-radio__control",defaultChecked:f?void 0:!i&&b.defaultValue===u,disabled:i,name:b.name,onChange:b.onChange,required:b.required,type:"radio",value:u}),l.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),l.jsx(X.Text,{as:"span",className:"nk-radio__label",children:a})]})}),Ye=r.forwardRef(function(n,t){const{"aria-invalid":a,children:o,className:c,defaultValue:s,disabled:u=!1,invalid:h=!1,name:b,onChange:d,orientation:i="vertical",required:f=!1,value:k,...m}=n,x=h||ie(a),v={defaultValue:s,disabled:u,name:b,onChange:d,required:f,value:k};return l.jsx(Xe.Provider,{value:v,children:l.jsx("div",{...m,ref:t,"aria-disabled":u||void 0,"aria-invalid":le(h,a),"aria-required":f||void 0,className:["nk-radio-group",c].filter(Boolean).join(" "),"data-disabled":u||void 0,"data-invalid":x||void 0,"data-orientation":i,role:"radiogroup",children:o})})});Ge(Ye,"group");function Oe(e,n,t){if(e.length===0)return-1;for(let a=1;a<=e.length;a+=1){const o=(n+t*a+e.length)%e.length;if(!e[o].disabled)return o}return-1}function et(e,n,t){for(let a=1;a<=e.length;a+=1){const o=(t+a+e.length)%e.length,c=e[o];if(!c.disabled&&c.label.toLocaleLowerCase().startsWith(n))return o}return-1}function nt(e){const n=new Set;e.forEach(t=>{if(n.has(t.value))throw new Error("Select option values must be unique");n.add(t.value)})}function tt(e,n,t){n.current=e,typeof t=="function"?t(e):t&&(t.current=e)}function at(e){const{"aria-invalid":n,children:t,className:a,defaultValue:o,disabled:c=!1,forwardedReference:s,invalid:u=!1,placeholder:h,style:b,value:d,...i}=e,f=le(u,n),k=u||ie(n);return l.jsxs("span",{className:["nk-select",a].filter(Boolean).join(" "),"data-disabled":c||void 0,"data-invalid":k||void 0,"data-mode":"native",style:b,children:[l.jsxs("select",{...i,ref:s,"aria-invalid":f,className:"nk-select__control",defaultValue:d===void 0?o??(h!==void 0?"":void 0):void 0,disabled:c,value:d,children:[h!==void 0?l.jsx("option",{disabled:!0,value:"",children:h}):null,t]}),l.jsx(L.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}function rt(e,n,t){const[a,o]=r.useState(null);return r.useEffect(()=>{if(!e||!n){o(null);return}const c=n.ownerDocument.defaultView;if(!c)return;const s=c;function u(){const d=n==null?void 0:n.getBoundingClientRect();if(!d)return;const i=8,f=4,k=s.innerHeight-d.bottom-f-i,m=d.top-f-i,x=k<160&&m>k,v=Math.max(72,x?m:k),w=t==null?void 0:t.getBoundingClientRect(),P=Math.max(d.width,(w==null?void 0:w.width)??d.width),E=Math.min(Math.max(i,d.left),Math.max(i,s.innerWidth-i-P)),D=x?Math.max(i,d.top-f-Math.min((w==null?void 0:w.height)??v,v)):d.bottom+f;o({left:E,maxHeight:v,minWidth:d.width,top:D})}u(),s.addEventListener("resize",u),s.addEventListener("scroll",u,!0);const h=s.ResizeObserver,b=h?new h(u):null;return b==null||b.observe(n),t&&(b==null||b.observe(t)),()=>{s.removeEventListener("resize",u),s.removeEventListener("scroll",u,!0),b==null||b.disconnect()}},[e,t,n]),a}function ot(e){const{active:n,closeOnEscape:t,closeOnOutsideInteraction:a,highlightedIndex:o,id:c,listboxReference:s,onEscapeDismiss:u,onEscapeKeyDown:h,onHighlight:b,onOutsideDismiss:d,onPointerDownOutside:i,onSelect:f,options:k,ownerDocument:m,position:x,selectedValue:v,state:w,triggerReference:P}=e,E=r.useRef(null),D=L.useOverlayLayer(!0,m),I=r.useMemo(()=>[P,E],[P]),j=r.useCallback(C=>{E.current=C,s(C)},[s]);return L.useDismissableLayer({active:n,boundaries:I,dismissOnEscape:t,dismissOnPointerDownOutside:a,layerId:D.id,onEscapeDismiss:u,onEscapeKeyDown:h,onPointerDownOutside:i,onPointerDownOutsideDismiss:d,ownerDocument:m}),l.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":c,className:"nk-select__listbox","data-state":w,id:`${c}-listbox`,ref:j,role:"listbox",style:x?{left:x.left,maxHeight:x.maxHeight,minWidth:x.minWidth,top:x.top,zIndex:D.zIndex}:{visibility:"hidden",zIndex:D.zIndex},children:k.map((C,_)=>l.jsxs("div",{"aria-disabled":C.disabled||void 0,"aria-selected":C.value===v,className:"nk-select__option","data-highlighted":_===o||void 0,"data-selected":C.value===v||void 0,id:`${c}-option-${_}`,onPointerDown:V=>{V.preventDefault(),C.disabled||f(C)},onPointerMove:()=>{C.disabled||b(_)},role:"option",children:[C.icon?l.jsx(L.Icon,{type:C.icon}):null,l.jsx("span",{className:"nk-select__option-label",children:C.label}),C.value===v?l.jsx(L.Icon,{className:"nk-select__check",type:"checkmark"}):null]},C.value))})}function st(e){var be;const{"aria-invalid":n,className:t,closeOnEscape:a=!0,closeOnOutsideInteraction:o=!0,defaultValue:c="",disabled:s=!1,displayOverride:u,form:h,forwardedReference:b,id:d,invalid:i=!1,name:f,onChange:k,onClick:m,onEscapeKeyDown:x,onKeyDown:v,onOpenChange:w,onPointerDownOutside:P,options:E,placeholder:D,portalContainer:I,required:j=!1,style:C,value:_,width:V,...q}=e;nt(E);const $=r.useId(),F=d??$,S=r.useRef(null),K=r.useRef(null),y=r.useRef(null),p=r.useRef(""),[N,A]=r.useState(null),[O,R]=r.useState(!1),[B,Z]=r.useState(-1),[G,Y]=r.useState(c),z=_!==void 0,te=z?_:G,fe=E.find(g=>g.value===te),ye=i||ie(n),we=le(i,n),J=L.usePresence(O),ce=(I==null?void 0:I.ownerDocument)??((be=S.current)==null?void 0:be.ownerDocument)??(typeof document>"u"?null:document),re=rt(J.present,S.current,N),Ie=V===void 0?C:{...C,width:V},H=u??fe,pe=r.useCallback(g=>{tt(g,S,b)},[b]),U=r.useCallback(g=>{O!==g&&(R(g),w==null||w(g))},[w,O]),ee=r.useCallback((g=1)=>{const M=E.findIndex(ne=>ne.value===te&&!ne.disabled),Q=g===1?-1:E.length;Z(M>=0?M:Oe(E,Q,g)),U(!0)},[E,te,U]),ge=r.useCallback(g=>{var M;g.disabled||(z||Y(g.value),U(!1),(M=S.current)==null||M.focus(),k==null||k(g.value))},[z,k,U]),Ce=r.useCallback(()=>{var g;U(!1),(g=S.current)==null||g.focus()},[U]),oe=r.useCallback(()=>{U(!1)},[U]);function Ee(g){m==null||m(g),!(g.defaultPrevented||s)&&(O?U(!1):ee())}function Se(g){if(v==null||v(g),!(g.defaultPrevented||s)){if(g.key==="ArrowDown"||g.key==="ArrowUp"){g.preventDefault();const M=g.key==="ArrowDown"?1:-1;O?Z(Q=>Oe(E,Q,M)):ee(M);return}if(g.key==="Home"||g.key==="End"){if(g.preventDefault(),!O)ee(g.key==="Home"?1:-1);else{const M=g.key==="Home"?1:-1,Q=M===1?-1:E.length;Z(Oe(E,Q,M))}return}if(g.key==="Enter"||g.key===" "){g.preventDefault();const M=E[B];O&&M?ge(M):O||ee();return}if(g.key==="Tab"){U(!1);return}if(g.key.length===1&&!g.altKey&&!g.ctrlKey&&!g.metaKey){const M=g.currentTarget.ownerDocument.defaultView;if(!M)return;const Q=g.key.toLocaleLowerCase(),ne=p.current+Q,ae=Array.from(ne).every(ke=>ke===Q);p.current=ae?Q:ne,y.current!==null&&M.clearTimeout(y.current),y.current=M.setTimeout(()=>{p.current="",y.current=null},500);const se=et(E,p.current,B);se>=0&&(g.preventDefault(),O||U(!0),Z(se))}}}return r.useEffect(()=>{var g;if(O&&B>=0){const M=ce==null?void 0:ce.getElementById(`${F}-option-${B}`);M&&(N!=null&&N.contains(M))&&((g=M.scrollIntoView)==null||g.call(M,{block:"nearest"}))}},[B,F,N,O]),r.useEffect(()=>{var Q;const g=(Q=S.current)==null?void 0:Q.form;if(!g)return;function M(){const ne=K.current,ae=z?te:c;if(ne){const se=Array.from(ne.options),ke=se.find(ue=>ue.value===ae)??se[0];se.forEach(ue=>{ue.defaultSelected=ue===ke})}z||Y(c),U(!1)}return g.addEventListener("reset",M),()=>g.removeEventListener("reset",M)},[c,h,z,te,U]),r.useEffect(()=>()=>{var M;const g=(M=S.current)==null?void 0:M.ownerDocument.defaultView;g&&y.current!==null&&g.clearTimeout(y.current)},[]),l.jsxs("span",{className:["nk-select",t].filter(Boolean).join(" "),"data-disabled":s||void 0,"data-invalid":ye||void 0,"data-mode":"custom","data-open":O||void 0,style:Ie,children:[l.jsxs("button",{...q,ref:pe,"aria-activedescendant":O&&B>=0?`${F}-option-${B}`:void 0,"aria-controls":`${F}-listbox`,"aria-expanded":O,"aria-haspopup":"listbox","aria-invalid":we,"aria-required":j||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:s,form:h,id:F,onClick:Ee,onKeyDown:Se,role:"combobox",type:"button",children:[H?l.jsxs("span",{className:"nk-select__value",children:[H.icon?l.jsx(L.Icon,{type:H.icon}):null,l.jsx("span",{className:"nk-select__value-label",children:H.label})]}):l.jsx("span",{className:"nk-select__placeholder",children:D}),l.jsx(L.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),f||j?l.jsxs("select",{ref:K,"aria-hidden":"true",className:"nk-select__form-control",disabled:s,form:h,name:f,onChange:()=>{},onInvalid:g=>{var M;g.preventDefault(),(M=S.current)==null||M.focus()},required:j,tabIndex:-1,value:te,children:[l.jsx("option",{value:""}),E.map(g=>l.jsx("option",{disabled:g.disabled,value:g.value,children:g.label},g.value))]}):null,J.present&&ce?l.jsx(L.Portal,{container:I,inheritFrom:S.current,children:l.jsx(ot,{active:O,closeOnEscape:a,closeOnOutsideInteraction:o,highlightedIndex:B,id:F,listboxReference:A,onEscapeDismiss:Ce,onEscapeKeyDown:x,onHighlight:Z,onOutsideDismiss:oe,onPointerDownOutside:P,onSelect:ge,options:E,ownerDocument:ce,position:re,selectedValue:te,state:J.state==="closing"?"closing":"open",triggerReference:S})}):null]})}const it=r.forwardRef(function(n,t){const{options:a}=n;return a!==void 0?l.jsx(st,{...n,forwardedReference:t}):l.jsx(at,{...n,forwardedReference:t})}),lt=r.forwardRef(function(n,t){const{"aria-hidden":a=!0,className:o,height:c="1em",shape:s="rectangle",style:u,width:h=s==="circle"?"1em":"100%",...b}=n;return l.jsx("div",{...b,ref:t,"aria-hidden":a,className:["nk-skeleton",o].filter(Boolean).join(" "),"data-shape":s,style:{...u,width:h,height:c}})}),ct=r.forwardRef(function(n,t){const{"aria-invalid":a,className:o,disabled:c=!1,style:s,...u}=n;return l.jsxs("span",{className:["nk-switch",o].filter(Boolean).join(" "),"data-disabled":c||void 0,"data-invalid":ie(a)||void 0,style:s,children:[l.jsx("input",{...u,ref:t,"aria-invalid":a,className:"nk-switch__control",disabled:c,role:"switch",type:"checkbox"}),l.jsx("span",{"aria-hidden":"true",className:"nk-switch__track",children:l.jsx("span",{className:"nk-switch__thumb"})})]})});function Be(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):1}const ut=r.forwardRef(function(n,t){const{"aria-invalid":a,className:o,disabled:c=!1,invalid:s=!1,minRows:u,readOnly:h=!1,resize:b="vertical",rows:d,style:i,...f}=n,k=Be(d??u??3),x=`calc(${Be(u??d??3)*1.25}em + var(--nk-text-area-padding) * 2 + var(--nk-text-area-border-width) * 2)`,v={...i,"--nk-text-area-min-height":x};return l.jsx("textarea",{...f,ref:t,"aria-invalid":le(s,a),className:["nk-text-area",o].filter(Boolean).join(" "),"data-invalid":s||ie(a)||void 0,"data-resize":b,disabled:c,readOnly:h,rows:k,style:v})});exports.Alert=L.Alert;exports.Button=L.Button;exports.Divider=L.Divider;exports.Icon=L.Icon;exports.Spinner=L.Spinner;exports.Table=L.Table;exports.Tooltip=L.Tooltip;exports.TooltipProvider=L.TooltipProvider;exports.Card=X.Card;exports.Text=X.Text;exports.Avatar=cn;exports.Badge=un;exports.Checkbox=We;exports.CheckboxGroup=Ue;exports.Content=Cn;exports.Field=En;exports.Input=Nn;exports.Modal=Mn;exports.PinInput=Qn;exports.Popover=Wn;exports.Radio=Jn;exports.RadioGroup=Ye;exports.Select=it;exports.Skeleton=lt;exports.Switch=ct;exports.TextArea=ut;exports.breakpoint=de;exports.cell=an;exports.px=on;exports.space=rn;exports.tokens=tn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./units-PzuiQNnw.cjs");exports.breakpoint=e.breakpoint;exports.cell=e.cell;exports.px=e.px;exports.space=e.space;exports.tokens=e.tokens;
|
package/dist/index.d.ts
ADDED