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