neatkit 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Boundary.cjs +1 -1
- package/dist/Boundary.js +191 -120
- package/dist/{Button-CVe9T_Zw.cjs → Button-6oWs-pyF.cjs} +1 -1
- package/dist/{Button-D6rXvcqq.js → Button-B0E-M8mp.js} +1 -1
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.js +75 -2
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +2 -2
- package/dist/Code-f0GWveGp.cjs +4 -0
- package/dist/{Code-Bp2X1k-g.js → Code-pROJjsiG.js} +57 -58
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/Field.cjs +1 -1
- package/dist/Field.js +57 -62
- package/dist/Icon-BFaHVAoQ.cjs +1 -0
- package/dist/{Icon-CxK1wlGk.js → Icon-Cj1s40xn.js} +308 -96
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +2 -2
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +76 -75
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +4 -4
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +228 -192
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +117 -119
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +1 -1
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +12 -11
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +441 -309
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.js +1 -1
- package/dist/{Table-DutHfiXR.js → Table-B2G8CHJ9.js} +111 -108
- package/dist/Table-Z8Q6XRkc.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TextArea.cjs +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/Tooltip-CpyROf6x.js +225 -0
- package/dist/Tooltip-DDPh_YFO.cjs +1 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/aria-Bv-xVREf.js +17 -0
- package/dist/aria-DM-xYEHQ.cjs +1 -0
- package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
- package/dist/components/Card/Card.d.ts +22 -23
- package/dist/components/Card/components/CardBody.d.ts +24 -0
- package/dist/components/Card/components/CardFooter.d.ts +24 -0
- package/dist/components/Card/components/CardHeader.d.ts +24 -0
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Code/Code.d.ts +9 -7
- package/dist/components/Code/index.d.ts +1 -1
- package/dist/components/Icon/icons/AppleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ChainIcon.d.ts +11 -0
- package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
- package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
- package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
- package/dist/components/Icon/utils/registry.d.ts +8 -0
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/PinInput/hooks/usePinInput.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +1 -1
- package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -0
- package/dist/components/Sidebar/hooks/useContentBelow.d.ts +23 -0
- package/dist/components/Sidebar/utils/children.d.ts +16 -0
- package/dist/components/Table/Table.d.ts +8 -2
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/effects-D98vUn6N.cjs +1 -0
- package/dist/effects-DGbA6Q2O.js +18 -0
- package/dist/style.css +1 -1
- package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
- package/dist/useFloatingPosition-MGoyautY.js +57 -0
- package/dist/{useFocusTrap-C0IcCdNf.js → useFocusTrap-BxPazAL6.js} +1 -1
- package/dist/{useFocusTrap-gAK_402D.cjs → useFocusTrap-CrMcAu8s.cjs} +1 -1
- package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
- package/dist/usePresence-Dm0mls5p.cjs +1 -0
- package/dist/utils/aria.d.ts +4 -5
- package/dist/utils/trigger.d.ts +46 -0
- package/package.json +1 -1
- package/dist/Card-CPq6dsut.js +0 -34
- package/dist/Card-CQ-8_1tO.cjs +0 -1
- package/dist/Code-B7s_rN0G.cjs +0 -4
- package/dist/Icon-BIBzgznI.cjs +0 -1
- package/dist/Table-BqWBgMTU.cjs +0 -1
- package/dist/Tooltip-CCuE-hfp.cjs +0 -1
- package/dist/Tooltip-CeyRKNv4.js +0 -231
- package/dist/aria-Bntn6ad_.cjs +0 -1
- package/dist/aria-CeA9QfD1.js +0 -15
- package/dist/effects-D5CWf-Pl.js +0 -8
- package/dist/effects-D85L_7zM.cjs +0 -1
- package/dist/useFloatingPosition-Dq8xpr3E.js +0 -27
- package/dist/useFloatingPosition-g5kXywoB.cjs +0 -1
- package/dist/usePresence-B5RYv4e1.cjs +0 -1
package/dist/PinInput.js
CHANGED
|
@@ -1,249 +1,285 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { r as
|
|
5
|
-
import { a as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
return Number.isFinite(
|
|
9
|
-
|
|
10
|
-
Math.max(
|
|
11
|
-
) :
|
|
2
|
+
import { jsxs as q, jsx as w } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as H, useState as B, useCallback as Q, useEffect as K, forwardRef as Y, useId as ee } from "react";
|
|
4
|
+
import { r as te, h as ne } from "./aria-Bv-xVREf.js";
|
|
5
|
+
import { a as ae } from "./reference-CXMr27nM.js";
|
|
6
|
+
const re = 3, oe = 10, W = 4;
|
|
7
|
+
function le(a) {
|
|
8
|
+
return Number.isFinite(a) ? Math.min(
|
|
9
|
+
oe,
|
|
10
|
+
Math.max(re, Math.trunc(a))
|
|
11
|
+
) : W;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return (
|
|
13
|
+
function L(a, i, c) {
|
|
14
|
+
return (i === "numeric" ? a.replace(/[^0-9]/g, "") : a.replace(/[^0-9a-z]/gi, "").toUpperCase()).slice(0, c);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
function ie(a, i, c) {
|
|
17
|
+
i.current = a, ae(c, a);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function X(a) {
|
|
20
|
+
return a.getRootNode().activeElement === a;
|
|
21
|
+
}
|
|
22
|
+
function ce(a, i, c) {
|
|
23
|
+
const l = a.getRootNode();
|
|
24
|
+
function m() {
|
|
25
|
+
l.removeEventListener("pointercancel", u), l.removeEventListener("pointerup", u);
|
|
26
|
+
}
|
|
27
|
+
function u(f) {
|
|
28
|
+
const v = f.type === "pointerup" && f.target instanceof Node && i.contains(f.target);
|
|
29
|
+
m(), v || c();
|
|
30
|
+
}
|
|
31
|
+
return l.addEventListener("pointercancel", u), l.addEventListener("pointerup", u), m;
|
|
32
|
+
}
|
|
33
|
+
function se(a, i) {
|
|
34
|
+
var l;
|
|
35
|
+
const c = (l = Object.getOwnPropertyDescriptor(
|
|
36
|
+
Object.getPrototypeOf(a),
|
|
23
37
|
"value"
|
|
24
|
-
)) == null ? void 0 :
|
|
25
|
-
|
|
38
|
+
)) == null ? void 0 : l.set;
|
|
39
|
+
c ? c.call(a, i) : a.value = i;
|
|
26
40
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
|
|
41
|
+
function $(a, i, c) {
|
|
42
|
+
const l = Math.min(c - 1, Math.max(0, i)), m = Math.min(l + 1, a.value.length);
|
|
43
|
+
X(a) || a.focus(), a.setSelectionRange(l, m);
|
|
30
44
|
}
|
|
31
|
-
function
|
|
45
|
+
function ue(a) {
|
|
32
46
|
const {
|
|
33
|
-
defaultValue:
|
|
34
|
-
disabled:
|
|
35
|
-
forwardedReference:
|
|
36
|
-
length:
|
|
47
|
+
defaultValue: i,
|
|
48
|
+
disabled: c,
|
|
49
|
+
forwardedReference: l,
|
|
50
|
+
length: m,
|
|
37
51
|
mode: u,
|
|
38
|
-
onChange:
|
|
39
|
-
onComplete:
|
|
40
|
-
onFocus:
|
|
41
|
-
onKeyDown:
|
|
42
|
-
onPaste:
|
|
52
|
+
onChange: f,
|
|
53
|
+
onComplete: v,
|
|
54
|
+
onFocus: y,
|
|
55
|
+
onKeyDown: I,
|
|
56
|
+
onPaste: E,
|
|
43
57
|
onSelect: N,
|
|
44
|
-
readOnly:
|
|
45
|
-
value:
|
|
46
|
-
} =
|
|
47
|
-
|
|
58
|
+
readOnly: T,
|
|
59
|
+
value: P
|
|
60
|
+
} = a, o = le(m), b = L(
|
|
61
|
+
i,
|
|
48
62
|
u,
|
|
49
|
-
|
|
50
|
-
),
|
|
51
|
-
|
|
52
|
-
), [
|
|
53
|
-
|
|
63
|
+
o
|
|
64
|
+
), k = H(null), s = H(null), S = H(null), [D, x] = B(
|
|
65
|
+
b
|
|
66
|
+
), [A, h] = B(0), p = P !== void 0, d = L(
|
|
67
|
+
p ? P : D,
|
|
54
68
|
u,
|
|
55
|
-
|
|
56
|
-
),
|
|
57
|
-
(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
o
|
|
70
|
+
), F = Q(
|
|
71
|
+
(e) => ie(
|
|
72
|
+
e,
|
|
73
|
+
k,
|
|
74
|
+
l
|
|
61
75
|
),
|
|
62
|
-
[
|
|
76
|
+
[l]
|
|
63
77
|
);
|
|
64
78
|
K(() => {
|
|
65
|
-
!
|
|
66
|
-
}, [
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
!p && D !== d && x(d);
|
|
80
|
+
}, [p, d, D]), K(() => () => {
|
|
81
|
+
var e;
|
|
82
|
+
return (e = s.current) == null ? void 0 : e.call(s);
|
|
83
|
+
}, []), K(() => {
|
|
84
|
+
var r;
|
|
85
|
+
if (p) return;
|
|
86
|
+
const e = (r = k.current) == null ? void 0 : r.form;
|
|
87
|
+
if (!e) return;
|
|
88
|
+
const n = e.getRootNode();
|
|
89
|
+
function t(g) {
|
|
90
|
+
g.target !== e || g.defaultPrevented || (x(b), h(0));
|
|
74
91
|
}
|
|
75
|
-
return
|
|
76
|
-
}, [
|
|
77
|
-
function
|
|
78
|
-
const
|
|
79
|
-
return Math.min(
|
|
92
|
+
return n.addEventListener("reset", t), () => n.removeEventListener("reset", t);
|
|
93
|
+
}, [p, b]);
|
|
94
|
+
function R(e) {
|
|
95
|
+
const n = e.selectionStart ?? d.length;
|
|
96
|
+
return Math.min(o - 1, Math.max(0, n));
|
|
80
97
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
83
|
-
|
|
98
|
+
function z(e) {
|
|
99
|
+
const n = e.currentTarget, t = n.selectionStart ?? n.value.length, r = L(n.value, u, o), g = L(
|
|
100
|
+
n.value.slice(0, t),
|
|
84
101
|
u,
|
|
85
|
-
|
|
102
|
+
o
|
|
86
103
|
).length;
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Math.min(
|
|
104
|
+
n.value = r, p || x(r), f == null || f(e), r.length === o && r !== d && (v == null || v(r));
|
|
105
|
+
const M = Math.min(o - 1, g);
|
|
106
|
+
h(M), n.setSelectionRange(
|
|
107
|
+
M,
|
|
108
|
+
Math.min(M + 1, r.length)
|
|
92
109
|
);
|
|
93
110
|
}
|
|
94
|
-
function
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
|
|
111
|
+
function C(e) {
|
|
112
|
+
if (E == null || E(e), e.defaultPrevented || c || T) return;
|
|
113
|
+
const n = L(
|
|
114
|
+
e.clipboardData.getData("text"),
|
|
98
115
|
u,
|
|
99
|
-
|
|
116
|
+
o
|
|
100
117
|
);
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
|
|
118
|
+
if (e.preventDefault(), n.length === 0) return;
|
|
119
|
+
const t = e.currentTarget, r = t.selectionStart ?? d.length, g = t.selectionEnd ?? r, M = n.length === o ? n : L(
|
|
120
|
+
d.slice(0, r) + n + d.slice(g),
|
|
104
121
|
u,
|
|
105
|
-
|
|
106
|
-
),
|
|
107
|
-
|
|
122
|
+
o
|
|
123
|
+
), V = n.length === o ? o : Math.min(o, r + n.length);
|
|
124
|
+
se(t, M), t.setSelectionRange(V, V), t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
108
125
|
}
|
|
109
|
-
function
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
Math.max(0,
|
|
126
|
+
function O(e) {
|
|
127
|
+
if (I == null || I(e), e.defaultPrevented || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
const n = e.key === "ArrowLeft" ? -1 : 1, t = Math.min(
|
|
130
|
+
o - 1,
|
|
131
|
+
Math.max(0, R(e.currentTarget) + n)
|
|
115
132
|
);
|
|
116
|
-
|
|
133
|
+
h(t), $(e.currentTarget, t, o);
|
|
117
134
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
function j(e) {
|
|
136
|
+
var r;
|
|
137
|
+
y == null || y(e), (r = s.current) == null || r.call(s), s.current = null;
|
|
138
|
+
const n = S.current;
|
|
139
|
+
S.current = null;
|
|
140
|
+
const t = n ?? Math.min(o - 1, d.length);
|
|
141
|
+
h(t), $(e.currentTarget, t, o);
|
|
122
142
|
}
|
|
123
|
-
function
|
|
124
|
-
N == null || N(
|
|
143
|
+
function U(e) {
|
|
144
|
+
N == null || N(e), h(R(e.currentTarget));
|
|
125
145
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
function G(e, n) {
|
|
147
|
+
var r;
|
|
148
|
+
if (c) return;
|
|
149
|
+
const t = k.current;
|
|
150
|
+
if (t) {
|
|
151
|
+
if (!X(t)) {
|
|
152
|
+
(r = s.current) == null || r.call(s), S.current = n, h(n), s.current = ce(
|
|
153
|
+
t,
|
|
154
|
+
e.currentTarget,
|
|
155
|
+
() => {
|
|
156
|
+
S.current = null, s.current = null;
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
e.preventDefault(), S.current = null, h(n), $(t, n, o);
|
|
162
|
+
}
|
|
130
163
|
}
|
|
131
164
|
return {
|
|
132
|
-
activeIndex:
|
|
133
|
-
handleChange:
|
|
134
|
-
handleFocus:
|
|
135
|
-
handleKeyDown:
|
|
136
|
-
handlePaste:
|
|
137
|
-
handleSelect:
|
|
138
|
-
handleSlotPointerDown:
|
|
139
|
-
inputCallbackReference:
|
|
140
|
-
length:
|
|
141
|
-
renderedValue:
|
|
165
|
+
activeIndex: A,
|
|
166
|
+
handleChange: z,
|
|
167
|
+
handleFocus: j,
|
|
168
|
+
handleKeyDown: O,
|
|
169
|
+
handlePaste: C,
|
|
170
|
+
handleSelect: U,
|
|
171
|
+
handleSlotPointerDown: G,
|
|
172
|
+
inputCallbackReference: F,
|
|
173
|
+
length: o,
|
|
174
|
+
renderedValue: d
|
|
142
175
|
};
|
|
143
176
|
}
|
|
144
|
-
const
|
|
177
|
+
const ge = Y(function(i, c) {
|
|
145
178
|
const {
|
|
146
|
-
"aria-invalid":
|
|
147
|
-
autoCapitalize:
|
|
179
|
+
"aria-invalid": l,
|
|
180
|
+
autoCapitalize: m,
|
|
148
181
|
autoComplete: u = "one-time-code",
|
|
149
|
-
className:
|
|
150
|
-
censored:
|
|
151
|
-
defaultValue:
|
|
152
|
-
disabled:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
182
|
+
className: f,
|
|
183
|
+
censored: v = !1,
|
|
184
|
+
defaultValue: y = "",
|
|
185
|
+
disabled: I = !1,
|
|
186
|
+
id: E,
|
|
187
|
+
invalid: N = !1,
|
|
188
|
+
length: T = W,
|
|
189
|
+
mode: P = "numeric",
|
|
190
|
+
onChange: o,
|
|
191
|
+
onComplete: b,
|
|
192
|
+
onFocus: k,
|
|
193
|
+
onKeyDown: s,
|
|
194
|
+
onPaste: S,
|
|
195
|
+
onSelect: D,
|
|
196
|
+
readOnly: x = !1,
|
|
197
|
+
style: A,
|
|
198
|
+
value: h,
|
|
199
|
+
wrap: p = !1,
|
|
200
|
+
...d
|
|
201
|
+
} = i, F = ee(), R = E ?? `${F}-control`, {
|
|
202
|
+
activeIndex: z,
|
|
203
|
+
handleChange: C,
|
|
204
|
+
handleFocus: O,
|
|
205
|
+
handleKeyDown: j,
|
|
206
|
+
handlePaste: U,
|
|
207
|
+
handleSelect: G,
|
|
208
|
+
handleSlotPointerDown: e,
|
|
209
|
+
inputCallbackReference: n,
|
|
210
|
+
length: t,
|
|
211
|
+
renderedValue: r
|
|
212
|
+
} = ue({
|
|
213
|
+
defaultValue: y,
|
|
214
|
+
disabled: I,
|
|
215
|
+
forwardedReference: c,
|
|
216
|
+
length: T,
|
|
217
|
+
mode: P,
|
|
218
|
+
onChange: o,
|
|
219
|
+
onComplete: b,
|
|
220
|
+
onFocus: k,
|
|
221
|
+
onKeyDown: s,
|
|
222
|
+
onPaste: S,
|
|
223
|
+
onSelect: D,
|
|
224
|
+
readOnly: x,
|
|
225
|
+
value: h
|
|
226
|
+
}), g = N || ne(l), M = !p && t >= 6 && t % 2 === 0, V = t / 2, Z = {
|
|
227
|
+
...A,
|
|
228
|
+
"--nk-pin-input-columns": Math.ceil(t / 2)
|
|
195
229
|
};
|
|
196
|
-
return /* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ q(
|
|
197
231
|
"span",
|
|
198
232
|
{
|
|
199
|
-
className: ["nk-pin-input",
|
|
200
|
-
"data-disabled":
|
|
201
|
-
"data-invalid":
|
|
202
|
-
"data-read-only":
|
|
203
|
-
"data-wrap":
|
|
204
|
-
style:
|
|
233
|
+
className: ["nk-pin-input", f].filter(Boolean).join(" "),
|
|
234
|
+
"data-disabled": I || void 0,
|
|
235
|
+
"data-invalid": g || void 0,
|
|
236
|
+
"data-read-only": x || void 0,
|
|
237
|
+
"data-wrap": p || void 0,
|
|
238
|
+
style: Z,
|
|
205
239
|
children: [
|
|
206
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ w(
|
|
207
241
|
"input",
|
|
208
242
|
{
|
|
209
|
-
...
|
|
210
|
-
ref:
|
|
211
|
-
"aria-invalid":
|
|
212
|
-
autoCapitalize:
|
|
243
|
+
...d,
|
|
244
|
+
ref: n,
|
|
245
|
+
"aria-invalid": te(N, l),
|
|
246
|
+
autoCapitalize: m ?? (P === "alphanumeric" ? "characters" : "off"),
|
|
213
247
|
autoComplete: u,
|
|
214
248
|
className: "nk-pin-input__control",
|
|
215
|
-
disabled:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
249
|
+
disabled: I,
|
|
250
|
+
id: R,
|
|
251
|
+
inputMode: P === "numeric" ? "numeric" : "text",
|
|
252
|
+
maxLength: t,
|
|
253
|
+
minLength: t,
|
|
254
|
+
onChange: C,
|
|
255
|
+
onFocus: O,
|
|
256
|
+
onKeyDown: j,
|
|
257
|
+
onPaste: U,
|
|
258
|
+
onSelect: G,
|
|
259
|
+
pattern: P === "numeric" ? `[0-9]{${t}}` : `[0-9A-Za-z]{${t}}`,
|
|
260
|
+
readOnly: x,
|
|
226
261
|
spellCheck: !1,
|
|
227
262
|
type: "text",
|
|
228
|
-
value:
|
|
263
|
+
value: r
|
|
229
264
|
}
|
|
230
265
|
),
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
"
|
|
266
|
+
/* @__PURE__ */ w("span", { "aria-hidden": "true", className: "nk-pin-input__slots", children: Array.from({ length: t }, (de, _) => /* @__PURE__ */ q("span", { className: "nk-pin-input__slot-group", children: [
|
|
267
|
+
M && _ === V ? /* @__PURE__ */ w("span", { className: "nk-pin-input__separator", children: "-" }) : null,
|
|
268
|
+
/* @__PURE__ */ w(
|
|
269
|
+
"label",
|
|
235
270
|
{
|
|
236
271
|
className: "nk-pin-input__slot",
|
|
237
|
-
"data-active":
|
|
238
|
-
|
|
239
|
-
|
|
272
|
+
"data-active": z === _ || void 0,
|
|
273
|
+
htmlFor: R,
|
|
274
|
+
onPointerDown: (J) => e(J, _),
|
|
275
|
+
children: /* @__PURE__ */ w("span", { "aria-hidden": "true", children: v && r[_] ? /* @__PURE__ */ w("span", { className: "nk-pin-input__censor" }) : r[_] ?? "" })
|
|
240
276
|
}
|
|
241
277
|
)
|
|
242
|
-
] },
|
|
278
|
+
] }, _)) })
|
|
243
279
|
]
|
|
244
280
|
}
|
|
245
281
|
);
|
|
246
282
|
});
|
|
247
283
|
export {
|
|
248
|
-
|
|
284
|
+
ge as default
|
|
249
285
|
};
|
package/dist/Popover.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),we=require("./aria-DM-xYEHQ.cjs"),ne=require("./effects-D98vUn6N.cjs"),B=require("./reference-C2guRuR0.cjs"),te=require("./useFloatingPosition-DQgw-w_Z.cjs"),h=require("./usePresence-Dm0mls5p.cjs"),je=require("./useFocusTrap-CrMcAu8s.cjs"),De=require("./Surface-BttJYSDt.cjs");function Le(n){const{inert:i,panelElement:c}=n;return ne.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Ne(n,i,c){i.current=n,B.assignElementReference(c,n)}function _e(n,i,c){i.current=n,B.assignElementReference(c,n)}function Me(n){const i=n.tagName.toLowerCase();return n.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&n.hasAttribute("href")}function Be(n){return n==="grid"||n==="listbox"||n==="menu"||n==="tree"?n:"dialog"}const ze=r.forwardRef(function(i,c){const{"aria-label":z,"aria-labelledby":se,autoFocus:w=!0,children:oe,className:ae,closeOnEscape:ie=!0,closeOnOutsideInteraction:ce=!0,defaultOpen:ue=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:le,onOpenChange:k,onPointerDownOutside:I,open:A,placement:H="bottom",restoreFocus:j=!0,role:K="dialog",style:V,tabIndex:de,trapFocus:b=!1,trigger:d,...fe}=i;if(d.type===r.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const $=r.useId(),pe=r.useContext(h.FocusScopeContext),U=`${$}-popover`,o=d.props,G=B.getElementReference(d),J=o.id??`${$}-trigger`,v=x||o.disabled===!0||o["aria-disabled"]===!0||o["aria-disabled"]==="true",R=A!==void 0,[ge,me]=r.useState(ue),t=R?A:ge,C=h.usePresence(t),Q=r.useRef(null),W=r.useRef(null),D=r.useRef("programmatic"),L=r.useRef(null),X=r.useRef(t),T=r.useRef(null),[be,ve]=r.useReducer(e=>e+1,0),[u,ye]=r.useState(null),[f,Pe]=r.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),O=ne.useBoundary("Popover").boundaryElement,S=h.useOverlayLayer(C.present,O),he=r.useMemo(()=>[Q,W],[]),p=te.useFloatingPosition(C.present,H,u,f,O),Ee=r.useCallback(e=>{_e(e,Q,G),ye(e)},[G]),Re=r.useCallback(e=>{Ne(e,W,c),Pe(e)},[c]),g=r.useCallback((e,s)=>{t!==e&&(R?(L.current={open:e,reason:s},ve()):(D.current=s,me(e)),k==null||k(e,s))},[R,k,t]),Te=r.useCallback(()=>{g(!1,"escape")},[g]),xe=r.useCallback(()=>{g(!1,"outside")},[g]),ke=r.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const s=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;s?T.current=e.composedPath().find(P=>P instanceof s&&P.tabIndex>=0)??e.target:T.current=e.target},[I,a]);h.useDismissableLayer({boundary:O,active:t,boundaries:he,dismissOnEscape:ie,dismissOnPointerDownOutside:ce,layerId:S.id,onEscapeDismiss:Te,onEscapeKeyDown:le,onPointerDownOutside:ke,onPointerDownOutsideDismiss:xe,ownerDocument:a});const Ie=je.useFocusTrap({boundary:O,active:t&&b,autoFocus:w,container:f,initialFocusReference:E,layerId:S.id,restoreFocus:j});r.useEffect(()=>{if(!t||b||!w||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const s=E==null?void 0:E.current;(s&&f.contains(s)?s:f).focus({preventScroll:!0})}),()=>{e=!1}},[w,E,t,f,b]),r.useEffect(()=>{var re;const e=X.current;X.current=t;const s=L.current;let m=D.current;if(R&&(m="programmatic",e!==t&&(s==null?void 0:s.open)===t&&(m=s.reason)),L.current=null,t){D.current="programmatic",T.current=null;return}const P=a==null?void 0:a.activeElement,_=T.current,M=(re=a==null?void 0:a.defaultView)==null?void 0:re.HTMLElement,Fe=m==="outside"&&M&&_ instanceof M&&P instanceof M&&(_===P||_.contains(P));e&&!b&&j&&!Fe&&(u==null||u.focus({preventScroll:!0})),T.current=null},[be,R,t,a,j,b,u]),r.useEffect(()=>{x&&t&&g(!1,"programmatic")},[x,t,g]);function Ce(e){if(v){e.preventDefault(),e.stopPropagation();return}e.defaultPrevented||g(!t,"trigger")}function Oe(e){e.defaultPrevented||v||Me(e.currentTarget)||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Y=y==="a"&&typeof o.href=="string",Z=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Y),ee=Y&&v;let q=o.role;q===void 0&&(ee?q="link":Z&&(q="button"));let F=o.tabIndex;F===void 0&&Z&&(F=0),v&&(F=-1);const Se=v?{...o,onClick:void 0}:o,qe=r.cloneElement(d,te.resolveTriggerOverrides(Se,{"aria-controls":t?we.mergeIdentifiers(o["aria-controls"],U):o["aria-controls"],"aria-expanded":t,"aria-haspopup":o["aria-haspopup"]??Be(K),"aria-disabled":v?!0:o["aria-disabled"],className:"nk-popover__trigger",href:ee?void 0:o.href,id:J,onClick:Ce,onKeyDown:N?Oe:void 0,ref:Ee,role:q,tabIndex:F}));return l.jsxs(l.Fragment,{children:[qe,l.jsx(h.FocusScopeContext.Provider,{value:t&&b?Ie:pe,children:C.present&&a?l.jsx(h.Portal,{children:l.jsxs(De.Surface,{...fe,ref:Re,"aria-hidden":t?void 0:!0,"aria-label":t?z:void 0,"aria-labelledby":t?se??(z===void 0?J:void 0):void 0,className:["nk-popover",ae].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??H,"data-state":C.state==="closing"?"closing":"open",id:U,role:t?K:void 0,style:p?{...V,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:S.zIndex}:{...V,visibility:"hidden",zIndex:S.zIndex},tabIndex:de??-1,children:[l.jsx(Le,{inert:!t,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:oe})]})}):null})]})});exports.default=ze;
|