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.
Files changed (140) hide show
  1. package/dist/Alert-DQ5CCE0N.js +29 -0
  2. package/dist/Alert-LJDkNUqH.cjs +1 -0
  3. package/dist/Alert.cjs +1 -0
  4. package/dist/Alert.js +4 -0
  5. package/dist/Avatar.cjs +1 -0
  6. package/dist/Avatar.js +55 -0
  7. package/dist/Badge.cjs +1 -0
  8. package/dist/Badge.js +25 -0
  9. package/dist/Button-BAsLfA0D.js +99 -0
  10. package/dist/Button-D7JUO6Fs.cjs +1 -0
  11. package/dist/Button.cjs +1 -0
  12. package/dist/Button.js +5 -0
  13. package/dist/Card-CPq6dsut.js +34 -0
  14. package/dist/Card-CQ-8_1tO.cjs +1 -0
  15. package/dist/Card.cjs +1 -0
  16. package/dist/Card.js +4 -0
  17. package/dist/Checkbox-BvXM9VyY.js +68 -0
  18. package/dist/Checkbox-VQifZrZZ.cjs +1 -0
  19. package/dist/Checkbox.cjs +1 -0
  20. package/dist/Checkbox.js +5 -0
  21. package/dist/CheckboxGroup.cjs +1 -0
  22. package/dist/CheckboxGroup.js +144 -0
  23. package/dist/{Code-D4qqPnTN.js → Code-BP2ZCmUf.js} +4 -3
  24. package/dist/Code-eispVOW3.cjs +6 -0
  25. package/dist/Code.cjs +1 -0
  26. package/dist/Code.js +5 -0
  27. package/dist/Content.cjs +1 -0
  28. package/dist/Content.js +144 -0
  29. package/dist/Divider-BE15WVDI.js +42 -0
  30. package/dist/Divider-CJYbFcSX.cjs +1 -0
  31. package/dist/Divider.cjs +1 -0
  32. package/dist/Divider.js +4 -0
  33. package/dist/Field.cjs +1 -0
  34. package/dist/Field.js +115 -0
  35. package/dist/Icon-D8IZceys.cjs +1 -0
  36. package/dist/Icon-uQmpr5P2.js +1139 -0
  37. package/dist/Icon.cjs +1 -0
  38. package/dist/Icon.js +37 -0
  39. package/dist/Input.cjs +1 -0
  40. package/dist/Input.js +146 -0
  41. package/dist/{markdown.cjs → Markdown.cjs} +19 -19
  42. package/dist/{markdown.js → Markdown.js} +10 -8
  43. package/dist/Modal.cjs +1 -0
  44. package/dist/Modal.js +171 -0
  45. package/dist/PinInput.cjs +1 -0
  46. package/dist/PinInput.js +248 -0
  47. package/dist/Popover.cjs +1 -0
  48. package/dist/Popover.js +238 -0
  49. package/dist/Radio.cjs +1 -0
  50. package/dist/Radio.js +65 -0
  51. package/dist/RadioGroup.cjs +1 -0
  52. package/dist/RadioGroup.js +51 -0
  53. package/dist/RadioGroupContext-BX9KnDek.cjs +1 -0
  54. package/dist/RadioGroupContext-DbKM4zPZ.js +5 -0
  55. package/dist/Select.cjs +1 -0
  56. package/dist/Select.js +473 -0
  57. package/dist/Skeleton.cjs +1 -0
  58. package/dist/Skeleton.js +27 -0
  59. package/dist/Spinner-BXgw60UC.cjs +1 -0
  60. package/dist/Spinner-CVYvk6YK.js +25 -0
  61. package/dist/Spinner.cjs +1 -0
  62. package/dist/Spinner.js +4 -0
  63. package/dist/Surface-BttJYSDt.cjs +1 -0
  64. package/dist/Surface-vEFsZC12.js +17 -0
  65. package/dist/Switch.cjs +1 -0
  66. package/dist/Switch.js +39 -0
  67. package/dist/Table-83unQQOi.cjs +1 -0
  68. package/dist/Table-Cw8u-pEW.js +403 -0
  69. package/dist/Table.cjs +1 -0
  70. package/dist/Table.js +5 -0
  71. package/dist/Text-DWYlIcPj.cjs +1 -0
  72. package/dist/Text-rN6iDo0V.js +24 -0
  73. package/dist/Text.cjs +1 -0
  74. package/dist/Text.js +4 -0
  75. package/dist/TextArea.cjs +1 -0
  76. package/dist/TextArea.js +43 -0
  77. package/dist/Tooltip-BB82wNOE.cjs +1 -0
  78. package/dist/Tooltip-CqWK_GRD.js +236 -0
  79. package/dist/Tooltip.cjs +1 -0
  80. package/dist/Tooltip.js +6 -0
  81. package/dist/aria-DHnOMyYp.js +10 -0
  82. package/dist/aria-DKxpE8cA.cjs +1 -0
  83. package/dist/components/Alert/index.d.ts +1 -1
  84. package/dist/components/Avatar/index.d.ts +1 -1
  85. package/dist/components/Badge/index.d.ts +1 -1
  86. package/dist/components/Button/index.d.ts +1 -1
  87. package/dist/components/Card/index.d.ts +1 -1
  88. package/dist/components/Checkbox/index.d.ts +1 -1
  89. package/dist/components/CheckboxGroup/index.d.ts +1 -1
  90. package/dist/components/Code/index.d.ts +1 -1
  91. package/dist/components/Content/Content.d.ts +8 -6
  92. package/dist/components/Content/hooks/useContentLayout.d.ts +2 -2
  93. package/dist/components/Content/index.d.ts +2 -2
  94. package/dist/components/Divider/index.d.ts +1 -1
  95. package/dist/components/Field/index.d.ts +1 -1
  96. package/dist/components/Icon/index.d.ts +1 -1
  97. package/dist/components/Input/index.d.ts +1 -1
  98. package/dist/components/Markdown/index.d.ts +1 -1
  99. package/dist/components/Modal/index.d.ts +1 -1
  100. package/dist/components/PinInput/index.d.ts +1 -1
  101. package/dist/components/Popover/index.d.ts +1 -1
  102. package/dist/components/Radio/index.d.ts +1 -1
  103. package/dist/components/RadioGroup/index.d.ts +1 -1
  104. package/dist/components/Select/index.d.ts +1 -1
  105. package/dist/components/Skeleton/index.d.ts +1 -1
  106. package/dist/components/Spinner/index.d.ts +1 -1
  107. package/dist/components/Switch/index.d.ts +1 -1
  108. package/dist/components/Table/index.d.ts +1 -1
  109. package/dist/components/Text/index.d.ts +1 -1
  110. package/dist/components/TextArea/index.d.ts +1 -1
  111. package/dist/components/Tooltip/index.d.ts +1 -1
  112. package/dist/field-control-NfLwcPj6.cjs +1 -0
  113. package/dist/field-control-XAn_FKks.js +16 -0
  114. package/dist/focus-restoration-70WcQRr5.cjs +1 -0
  115. package/dist/focus-restoration-BvNZzrQA.js +16 -0
  116. package/dist/index.cjs +1 -1
  117. package/dist/index.d.ts +4 -0
  118. package/dist/index.js +6 -2187
  119. package/dist/reference-C2guRuR0.cjs +1 -0
  120. package/dist/reference-CXMr27nM.js +12 -0
  121. package/dist/style.css +1 -1
  122. package/dist/units-BmjPCccF.js +90 -0
  123. package/dist/units-PzuiQNnw.cjs +1 -0
  124. package/dist/useFloatingPosition-CxzhAvy8.js +73 -0
  125. package/dist/useFloatingPosition-D1FqYy0l.cjs +1 -0
  126. package/dist/useFocusTrap--cgjy78G.cjs +1 -0
  127. package/dist/useFocusTrap-Da4nEash.js +134 -0
  128. package/dist/usePresence-DSPt6aKi.js +210 -0
  129. package/dist/usePresence-qe92UTvK.cjs +1 -0
  130. package/package.json +136 -11
  131. package/dist/Card-Ba5AcR4o.cjs +0 -1
  132. package/dist/Card-Cumb1Hon.js +0 -74
  133. package/dist/Code-CDHkXHVo.cjs +0 -6
  134. package/dist/Table-B5izJmMG.cjs +0 -1
  135. package/dist/Table-Gs5LkYRc.js +0 -2187
  136. package/dist/code.cjs +0 -1
  137. package/dist/code.js +0 -5
  138. package/dist/entries/code.d.ts +0 -1
  139. package/dist/entries/index.d.ts +0 -29
  140. package/dist/entries/markdown.d.ts +0 -1
package/dist/index.js CHANGED
@@ -1,2189 +1,8 @@
1
- "use client";
2
- import { I as ke, B as We, S as wn, u as xn, r as In, i as Xe, a as $e, P as He, F as Se, b as Ge, c as Ke, d as Nn } from "./Table-Gs5LkYRc.js";
3
- import { A as Ut, D as Zt, T as Qt, e as Xt, f as Yt } from "./Table-Gs5LkYRc.js";
4
- import { jsx as v, jsxs as q, Fragment as En } from "react/jsx-runtime";
5
- import { forwardRef as Q, useState as U, createContext as an, useContext as Ce, useRef as W, useCallback as B, useEffect as Z, Children as _n, isValidElement as Sn, Fragment as on, useLayoutEffect as Ue, createElement as Ye, useId as xe, cloneElement as sn, useMemo as Pe, useReducer as Cn } from "react";
6
- import { T as he, S as ln, g as Pn, a as cn } from "./Card-Cumb1Hon.js";
7
- import { C as er } from "./Card-Cumb1Hon.js";
8
- const Rn = 36, dn = [2, 4, 8, 12, 16, 24, 32, 48], Je = {
9
- sm: 720,
10
- md: 960,
11
- lg: 1440,
12
- xl: 1920
13
- }, Pt = {
14
- color: {
15
- accent: {
16
- default: "var(--nk-accent)",
17
- soft: "var(--nk-accent-soft)",
18
- subtle: "var(--nk-accent-subtle)"
19
- },
20
- background: "var(--nk-color-background)",
21
- surface: "var(--nk-color-surface)",
22
- text: {
23
- default: "var(--nk-color-text)",
24
- muted: "var(--nk-color-text-muted)"
25
- },
26
- border: "var(--nk-color-border)",
27
- emphasis: {
28
- fill: "var(--nk-color-emphasis-fill)",
29
- fillForeground: "var(--nk-color-emphasis-fill-foreground)"
30
- },
31
- info: {
32
- foreground: "var(--nk-color-info-foreground)",
33
- fill: "var(--nk-color-info-fill)",
34
- fillForeground: "var(--nk-color-info-fill-foreground)"
35
- },
36
- success: {
37
- foreground: "var(--nk-color-success-foreground)",
38
- fill: "var(--nk-color-success-fill)",
39
- fillForeground: "var(--nk-color-success-fill-foreground)"
40
- },
41
- warning: {
42
- foreground: "var(--nk-color-warning-foreground)",
43
- fill: "var(--nk-color-warning-fill)",
44
- fillForeground: "var(--nk-color-warning-fill-foreground)"
45
- },
46
- danger: {
47
- foreground: "var(--nk-color-danger-foreground)",
48
- fill: "var(--nk-color-danger-fill)",
49
- fillForeground: "var(--nk-color-danger-fill-foreground)"
50
- }
51
- },
52
- radius: {
53
- small: "var(--nk-radius-small)",
54
- medium: "var(--nk-radius-medium)",
55
- large: "var(--nk-radius-large)"
56
- },
57
- shadow: {
58
- subtle: "var(--nk-shadow-subtle)",
59
- medium: "var(--nk-shadow-medium)",
60
- strong: "var(--nk-shadow-strong)"
61
- }
62
- };
63
- ({
64
- ...Object.fromEntries(
65
- dn.map((e) => [`--nk-space-${e}`, `${e}px`])
66
- )
67
- });
68
- function Rt(e) {
69
- if (typeof e != "number" || !Number.isFinite(e))
70
- throw new RangeError("Cell amount must be a finite number.");
71
- const n = e * Rn;
72
- if (!Number.isFinite(n))
73
- throw new RangeError("Calculated cell value must be finite.");
74
- return n;
75
- }
76
- function Ot(e) {
77
- if (!dn.some((n) => n === e))
78
- throw new RangeError(`Unsupported spacing size: ${String(e)}.`);
79
- return e;
80
- }
81
- function ye(e) {
82
- if (!Object.prototype.hasOwnProperty.call(Je, e))
83
- throw new RangeError(`Unsupported breakpoint: ${String(e)}.`);
84
- return Je[e];
85
- }
86
- function Dt(e) {
87
- if (typeof e != "number" || !Number.isFinite(e))
88
- throw new RangeError("Pixel value must be a finite number.");
89
- return `${e}px`;
90
- }
91
- function On(e) {
92
- return (Array.from((e == null ? void 0 : e.trim()) ?? "")[0] ?? "?").trim().toUpperCase() || "?";
93
- }
94
- function Dn(e) {
95
- if (e === "?") return "neutral";
96
- const n = Array.from(e)[0] ?? "";
97
- if ("AJO".includes(n)) return "1";
98
- if ("BNSV".includes(n)) return "2";
99
- if ("CFLQW".includes(n)) return "3";
100
- if ("EHKMPTX".includes(n)) return "4";
101
- if ("DGRUY".includes(n)) return "5";
102
- if ("IZ".includes(n)) return "6";
103
- const t = n.codePointAt(0) ?? 0;
104
- return String(t % 6 + 1);
105
- }
106
- const Lt = Q(function(n, t) {
107
- const {
108
- alt: r,
109
- className: a,
110
- image: s,
111
- size: o = 32,
112
- style: l,
113
- ...f
114
- } = n, [g, c] = U(), i = !!s && s !== g, d = (r == null ? void 0 : r.trim()) ?? "", b = On(d), p = typeof o == "number" ? `${o}px` : o, y = d ? { "aria-label": d, role: "img" } : { "aria-hidden": !0, role: void 0 };
115
- function h() {
116
- c(s);
117
- }
118
- return /* @__PURE__ */ v(
119
- "div",
120
- {
121
- ...f,
122
- ...i ? void 0 : y,
123
- ref: t,
124
- className: ["nk-avatar", a].filter(Boolean).join(" "),
125
- "data-palette": Dn(b),
126
- "data-state": i ? "image" : "fallback",
127
- style: { ...l, "--nk-avatar-size": p },
128
- children: i ? /* @__PURE__ */ v(
129
- "img",
130
- {
131
- alt: d,
132
- className: "nk-avatar__image",
133
- onError: h,
134
- src: s
135
- }
136
- ) : /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-avatar__initial", children: b })
137
- }
138
- );
139
- }), Tt = Q(function(n, t) {
140
- const {
141
- children: r,
142
- className: a,
143
- tone: s = "neutral",
144
- variant: o = "outline",
145
- ...l
146
- } = n;
147
- return /* @__PURE__ */ v(
148
- "span",
149
- {
150
- ...l,
151
- ref: t,
152
- className: ["nk-badge", a].filter(Boolean).join(" "),
153
- "data-tone": s,
154
- "data-variant": o,
155
- children: r
156
- }
157
- );
158
- });
159
- function de(e) {
160
- return e !== void 0 && e !== !1 && e !== "false";
161
- }
162
- function ue(e, n) {
163
- return e ? !0 : n;
164
- }
165
- const un = an(void 0);
166
- function Ln() {
167
- return Ce(un);
168
- }
169
- const Tn = Q(function(n, t) {
170
- var I;
171
- const {
172
- "aria-invalid": r,
173
- checked: a,
174
- children: s,
175
- className: o,
176
- defaultChecked: l,
177
- disabled: f = !1,
178
- invalid: g = !1,
179
- name: c,
180
- onChange: i,
181
- required: d = !1,
182
- style: b,
183
- value: p = "on",
184
- ...y
185
- } = n, h = Ln(), w = String(p), R = (h == null ? void 0 : h.value) !== void 0, N = f || !!(h != null && h.disabled), L = !!(h != null && h.required && !h.hasSelection && h.validationValue === w), x = g || de(r);
186
- function P(C) {
187
- i == null || i(C), C.defaultPrevented || h == null || h.handleChange(C);
188
- }
189
- return /* @__PURE__ */ q(
190
- "label",
191
- {
192
- className: ["nk-checkbox", o].filter(Boolean).join(" "),
193
- "data-disabled": N || void 0,
194
- "data-invalid": x || void 0,
195
- style: b,
196
- children: [
197
- /* @__PURE__ */ v(
198
- "input",
199
- {
200
- ...y,
201
- ref: t,
202
- "aria-invalid": ue(g, r),
203
- checked: h ? R ? (I = h.value) == null ? void 0 : I.includes(w) : void 0 : a,
204
- className: "nk-checkbox__control",
205
- defaultChecked: h && !R ? h.defaultValue.includes(w) : l,
206
- disabled: N,
207
- name: (h == null ? void 0 : h.name) ?? c,
208
- onChange: P,
209
- required: d || L,
210
- type: "checkbox",
211
- value: p
212
- }
213
- ),
214
- /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-checkbox__visual", children: /* @__PURE__ */ v(ke, { className: "nk-checkbox__icon", size: 12, type: "checkmark" }) }),
215
- s !== void 0 ? /* @__PURE__ */ q(he, { as: "span", className: "nk-checkbox__label", children: [
216
- s,
217
- d ? /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-checkbox__required", children: "*" }) : null
218
- ] }) : null
219
- ]
220
- }
221
- );
222
- }), fn = Symbol("nk-field-control-metadata");
223
- function pn(e) {
224
- if (typeof e != "function" && typeof e != "object" || e === null)
225
- return;
226
- const n = e, t = n[fn];
227
- return t || (n.type !== void 0 && n.type !== e ? pn(n.type) : void 0);
228
- }
229
- function hn(e, n) {
230
- Object.assign(e, {
231
- [fn]: { requiredCommunication: n }
232
- });
233
- }
234
- const Vn = Object.freeze([]);
235
- function mn(e, n) {
236
- _n.forEach(e, (t) => {
237
- if (t == null || typeof t == "boolean")
238
- return;
239
- if (!Sn(t))
240
- throw new Error(
241
- "CheckboxGroup children must be direct Checkbox elements or fragments"
242
- );
243
- if (t.type === on) {
244
- mn(t.props.children, n);
245
- return;
246
- }
247
- if (t.type !== Tn)
248
- throw new Error(
249
- "CheckboxGroup children must be direct Checkbox elements or fragments"
250
- );
251
- const r = t;
252
- n.push({
253
- disabled: !!r.props.disabled,
254
- required: !!r.props.required,
255
- value: String(r.props.value ?? "on")
256
- });
257
- });
258
- }
259
- function Mn(e) {
260
- const n = [];
261
- mn(e, n);
262
- const t = /* @__PURE__ */ new Set();
263
- return n.forEach((r) => {
264
- if (t.has(r.value))
265
- throw new Error("CheckboxGroup Checkbox values must be unique");
266
- t.add(r.value);
267
- }), n;
268
- }
269
- function Fn(e, n, t) {
270
- n.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
271
- }
272
- const An = Q(
273
- function(n, t) {
274
- const {
275
- "aria-invalid": r,
276
- children: a,
277
- className: s,
278
- defaultValue: o = Vn,
279
- disabled: l = !1,
280
- invalid: f = !1,
281
- name: g,
282
- onChange: c,
283
- orientation: i = "vertical",
284
- required: d = !1,
285
- value: b,
286
- ...p
287
- } = n, y = W(null), [h, w] = U(o), R = b !== void 0, N = R ? b : h, L = f || de(r), x = Mn(a), P = l ? [] : x.filter((u) => !u.disabled).map((u) => u.value), I = new Set(P), C = N.some(
288
- (u) => I.has(u)
289
- ), V = P[0], z = x.find(
290
- (u) => !u.disabled && u.value === V
291
- ), H = o.some(
292
- (u) => I.has(u)
293
- ), M = !!(z != null && z.required), E = B(
294
- (u) => Fn(
295
- u,
296
- y,
297
- t
298
- ),
299
- [t]
300
- );
301
- Z(() => {
302
- var _;
303
- if (R) return;
304
- const u = (_ = y.current) == null ? void 0 : _.querySelector(
305
- 'input[type="checkbox"]'
306
- ), S = u instanceof HTMLInputElement ? u.form : null;
307
- if (!S) return;
308
- const F = S.getRootNode();
309
- function O(A) {
310
- var K;
311
- if (A.target !== S || A.defaultPrevented) return;
312
- const J = Array.from(
313
- ((K = y.current) == null ? void 0 : K.querySelectorAll(
314
- 'input[type="checkbox"]'
315
- )) ?? []
316
- ).find(
317
- (ne) => !ne.disabled && ne.value === V
318
- );
319
- J && (J.required = !!(M || d && !H)), w(o);
320
- }
321
- return F.addEventListener("reset", O), () => F.removeEventListener("reset", O);
322
- }, [
323
- a,
324
- o,
325
- H,
326
- R,
327
- d,
328
- M,
329
- V
330
- ]);
331
- function X(u) {
332
- if (!R) {
333
- const S = u.currentTarget.value, F = u.currentTarget.checked;
334
- w((O) => F ? [.../* @__PURE__ */ new Set([...O, S])] : O.filter((_) => _ !== S));
335
- }
336
- c == null || c(u);
337
- }
338
- const k = {
339
- defaultValue: o,
340
- disabled: l,
341
- handleChange: X,
342
- hasSelection: C,
343
- name: g,
344
- required: d,
345
- value: b,
346
- validationValue: V
347
- };
348
- return /* @__PURE__ */ v(un.Provider, { value: k, children: /* @__PURE__ */ v(
349
- "div",
350
- {
351
- ...p,
352
- ref: E,
353
- "aria-disabled": l || void 0,
354
- "aria-invalid": ue(f, r),
355
- className: [
356
- "nk-checkbox-group",
357
- s
358
- ].filter(Boolean).join(" "),
359
- "data-disabled": l || void 0,
360
- "data-invalid": L || void 0,
361
- "data-orientation": i,
362
- role: "group",
363
- children: a
364
- }
365
- ) });
366
- }
367
- );
368
- hn(An, "label");
369
- const Bn = [
370
- {
371
- minWidth: ye("xl"),
372
- marginPercent: 32,
373
- preferredWidth: 1200
374
- },
375
- {
376
- minWidth: ye("lg"),
377
- marginPercent: 20,
378
- preferredWidth: 1100
379
- },
380
- {
381
- minWidth: ye("md"),
382
- marginPercent: 14,
383
- preferredWidth: ye("md")
384
- },
385
- {
386
- minWidth: ye("sm"),
387
- marginPercent: 8,
388
- preferredWidth: 650
389
- }
390
- ], qn = 16;
391
- function zn(e) {
392
- for (const n of Bn)
393
- if (e >= n.minWidth) return n;
394
- }
395
- function jn(e, n) {
396
- if (!Number.isFinite(e) || !Number.isFinite(n) || e < ye("sm") || n <= 0)
397
- return;
398
- const t = zn(e);
399
- if (!t) return;
400
- const r = e * t.marginPercent / 100, a = e - r * 2, s = Math.min(
401
- t.preferredWidth,
402
- e - qn
403
- ), o = Math.max(a, s);
404
- let l = Math.floor(o / n);
405
- return l % 2 === 0 && (l -= 1), l = Math.max(l, 1), Math.min((l - 1) * n, e);
406
- }
407
- const Wn = typeof window > "u" ? Z : Ue;
408
- function $n(e, n) {
409
- if (typeof e == "function") {
410
- e(n);
411
- return;
412
- }
413
- e && (e.current = n);
414
- }
415
- function Hn(e) {
416
- const n = window.getComputedStyle(e), t = Number.parseFloat(n.paddingLeft) + Number.parseFloat(n.paddingRight);
417
- return Math.max(e.clientWidth - t, 0);
418
- }
419
- function Gn(e) {
420
- const t = window.getComputedStyle(e).getPropertyValue("--nk-cell").trim().match(
421
- /^([+]?(?:\d+\.?\d*|\.\d+))px$/i
422
- );
423
- if (!t) return;
424
- const r = Number.parseFloat(t[1]);
425
- return Number.isFinite(r) && r > 0 ? r : void 0;
426
- }
427
- function Kn(e, n) {
428
- const t = W(null), r = W(null), a = W(void 0), [s, o] = U(void 0), l = B((c) => {
429
- if (!n) {
430
- if (a.current === void 0) return;
431
- a.current = void 0, o(void 0);
432
- return;
433
- }
434
- const i = Hn(c), d = Gn(c), b = d === void 0 ? void 0 : jn(i, d);
435
- a.current !== b && (a.current = b, o(b));
436
- }, [n]), f = B(
437
- (c) => {
438
- var d;
439
- if ((d = r.current) == null || d.disconnect(), r.current = null, typeof ResizeObserver > "u") return;
440
- const i = new ResizeObserver(
441
- () => l(c)
442
- );
443
- i.observe(c), r.current = i;
444
- },
445
- [l]
446
- ), g = B(
447
- (c) => {
448
- var i;
449
- (i = r.current) == null || i.disconnect(), r.current = null, t.current = c, $n(e, c), !(!c || typeof window > "u" || !n) && (l(c), f(c));
450
- },
451
- [
452
- f,
453
- n,
454
- e,
455
- l
456
- ]
457
- );
458
- return Wn(() => {
459
- t.current && l(t.current);
460
- }), Z(() => (t.current && n && f(t.current), () => {
461
- var c;
462
- (c = r.current) == null || c.disconnect(), r.current = null;
463
- }), [f, n]), { rootReference: g, innerWidth: s };
464
- }
465
- const Vt = Q(
466
- function(n, t) {
467
- const {
468
- accent: r,
469
- as: a,
470
- children: s,
471
- className: o,
472
- constrain: l = !0,
473
- minHeight: f = "auto",
474
- mode: g = "grid",
475
- spacing: c = "standard",
476
- style: i,
477
- theme: d = "light",
478
- ...b
479
- } = n, { rootReference: p, innerWidth: y } = Kn(
480
- t,
481
- l
482
- ), h = a ?? "div", w = r !== void 0 ? { ...i, "--nk-accent": r } : i;
483
- return Ye(
484
- h,
485
- {
486
- ...b,
487
- ref: p,
488
- className: ["nk-content", o].filter(Boolean).join(" "),
489
- "data-constrain": l,
490
- "data-min-height": f,
491
- "data-mode": g,
492
- "data-spacing": c,
493
- "data-theme": d,
494
- style: w
495
- },
496
- Ye(
497
- "div",
498
- {
499
- className: "nk-content__inner",
500
- style: y === void 0 ? void 0 : { width: `${y}px` }
501
- },
502
- s
503
- )
504
- );
505
- }
506
- );
507
- function Ae(e) {
508
- return typeof e == "string" ? e.trim().length > 0 : e != null && e !== !1 && e !== !0;
509
- }
510
- function en(...e) {
511
- const n = e.flatMap(
512
- (r) => (r == null ? void 0 : r.split(/\s+/).filter(Boolean)) ?? []
513
- ), t = [...new Set(n)];
514
- return t.length > 0 ? t.join(" ") : void 0;
515
- }
516
- const Mt = Q(function(n, t) {
517
- const {
518
- children: r,
519
- className: a,
520
- description: s,
521
- disabled: o = !1,
522
- error: l,
523
- label: f,
524
- orientation: g = "vertical",
525
- required: c = !1,
526
- ...i
527
- } = n, d = xe(), b = r.props.id ?? `${d}-control`, p = `${d}-label`, y = `${d}-description`, h = `${d}-error`, w = Ae(f), R = Ae(s), N = Ae(l), L = pn(r.type), x = L !== void 0, P = o || !!r.props.disabled, I = c || !!r.props.required, C = I && (L == null ? void 0 : L.requiredCommunication) === "label", V = en(
528
- r.props["aria-describedby"],
529
- R ? y : void 0,
530
- N ? h : void 0
531
- ), z = en(
532
- w ? p : void 0,
533
- r.props["aria-labelledby"]
534
- ), H = I ? /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-field__required", children: "*" }) : null, M = C ? /* @__PURE__ */ v("span", { className: "nk-field__required-text", children: ", select at least one" }) : null, E = sn(r, {
535
- "aria-describedby": V,
536
- "aria-invalid": N ? !0 : r.props["aria-invalid"],
537
- "aria-labelledby": z,
538
- disabled: P || void 0,
539
- id: b,
540
- required: I || void 0
541
- });
542
- return /* @__PURE__ */ q(
543
- "div",
544
- {
545
- ...i,
546
- ref: t,
547
- className: ["nk-field", a].filter(Boolean).join(" "),
548
- "data-disabled": P || void 0,
549
- "data-has-label": w || void 0,
550
- "data-invalid": N || void 0,
551
- "data-orientation": g,
552
- "data-required": I || void 0,
553
- children: [
554
- w && x ? /* @__PURE__ */ q(
555
- he,
556
- {
557
- as: "span",
558
- className: "nk-field__label",
559
- id: p,
560
- size: "caption",
561
- weight: "medium",
562
- children: [
563
- f,
564
- H,
565
- M
566
- ]
567
- }
568
- ) : null,
569
- w && !x ? /* @__PURE__ */ q(
570
- he,
571
- {
572
- as: "label",
573
- className: "nk-field__label",
574
- htmlFor: b,
575
- id: p,
576
- size: "caption",
577
- weight: "medium",
578
- children: [
579
- f,
580
- H
581
- ]
582
- }
583
- ) : null,
584
- /* @__PURE__ */ q("div", { className: "nk-field__body", children: [
585
- E,
586
- R ? /* @__PURE__ */ v(
587
- he,
588
- {
589
- as: "p",
590
- className: "nk-field__description",
591
- id: y,
592
- size: "caption",
593
- tone: "muted",
594
- children: s
595
- }
596
- ) : null,
597
- N ? /* @__PURE__ */ v(
598
- he,
599
- {
600
- as: "p",
601
- "aria-live": "polite",
602
- className: "nk-field__error",
603
- id: h,
604
- size: "caption",
605
- tone: "danger",
606
- children: l
607
- }
608
- ) : null
609
- ] })
610
- ]
611
- }
612
- );
613
- });
614
- function Be(e) {
615
- return Array.isArray(e) ? e.length > 0 : e != null && String(e).length > 0;
616
- }
617
- function Un(e, n, t) {
618
- n.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
619
- }
620
- function nn(e) {
621
- return e != null && e !== !1 && e !== !0 && e !== "";
622
- }
623
- function Zn(e) {
624
- var t;
625
- const n = (t = Object.getOwnPropertyDescriptor(
626
- Object.getPrototypeOf(e),
627
- "value"
628
- )) == null ? void 0 : t.set;
629
- n ? n.call(e, "") : e.value = "";
630
- }
631
- const Ft = Q(function(n, t) {
632
- const {
633
- "aria-busy": r,
634
- "aria-invalid": a,
635
- className: s,
636
- clearable: o = !1,
637
- defaultValue: l,
638
- disabled: f = !1,
639
- id: g,
640
- invalid: c = !1,
641
- leading: i,
642
- loading: d = !1,
643
- onChange: b,
644
- readOnly: p = !1,
645
- style: y,
646
- trailing: h,
647
- type: w = "text",
648
- value: R,
649
- ...N
650
- } = n, L = xe(), x = W(null), [P, I] = U(
651
- Be(l)
652
- ), [C, V] = U(!1);
653
- Z(() => {
654
- w !== "password" && V(!1);
655
- }, [w]);
656
- const z = B(
657
- (j) => Un(
658
- j,
659
- x,
660
- t
661
- ),
662
- [t]
663
- ), H = g ?? `${L}-control`, M = f || d, E = c || de(a), X = R !== void 0 ? Be(R) : P, k = w === "password" && C ? "text" : w, u = ue(c, a), S = o && X && !p && !M, F = w === "password" && !d, O = S || F, _ = nn(i), A = nn(h) || O;
664
- function J(j) {
665
- R === void 0 && I(Be(j.currentTarget.value)), b == null || b(j);
666
- }
667
- function K() {
668
- const j = x.current;
669
- j && (Zn(j), j.dispatchEvent(new Event("input", { bubbles: !0 })), j.focus());
670
- }
671
- function ne() {
672
- V((j) => !j);
673
- }
674
- return /* @__PURE__ */ q(
675
- "div",
676
- {
677
- className: ["nk-input", s].filter(Boolean).join(" "),
678
- "data-clearable": o || void 0,
679
- "data-disabled": M || void 0,
680
- "data-invalid": E || void 0,
681
- "data-leading": _ || void 0,
682
- "data-loading": d || void 0,
683
- "data-read-only": p || void 0,
684
- "data-has-trailing-action": O || void 0,
685
- "data-trailing": A || void 0,
686
- style: y,
687
- children: [
688
- _ ? /* @__PURE__ */ v("span", { className: "nk-input__leading", children: i }) : null,
689
- /* @__PURE__ */ v(
690
- "input",
691
- {
692
- ...N,
693
- ref: z,
694
- "aria-busy": d ? !0 : r,
695
- "aria-invalid": u,
696
- className: "nk-input__control",
697
- defaultValue: l,
698
- disabled: M,
699
- id: H,
700
- onChange: J,
701
- readOnly: p,
702
- type: k,
703
- value: R
704
- }
705
- ),
706
- A ? /* @__PURE__ */ q("span", { className: "nk-input__trailing", children: [
707
- h,
708
- S ? /* @__PURE__ */ v(
709
- We,
710
- {
711
- "aria-controls": H,
712
- "aria-label": "Clear input",
713
- className: "nk-input__action",
714
- icon: "cross",
715
- onClick: K,
716
- shape: "rectangle",
717
- type: "button",
718
- variant: "ghost"
719
- }
720
- ) : null,
721
- F ? /* @__PURE__ */ v(
722
- We,
723
- {
724
- "aria-controls": H,
725
- "aria-label": C ? "Hide password" : "Show password",
726
- "aria-pressed": C,
727
- className: "nk-input__action",
728
- disabled: M,
729
- icon: C ? "eye-off" : "eye",
730
- onClick: ne,
731
- shape: "rectangle",
732
- type: "button",
733
- variant: "ghost"
734
- }
735
- ) : null
736
- ] }) : null,
737
- d ? /* @__PURE__ */ v(
738
- wn,
739
- {
740
- "aria-hidden": "true",
741
- "aria-label": void 0,
742
- className: "nk-input__spinner",
743
- role: void 0,
744
- size: 14
745
- }
746
- ) : null
747
- ]
748
- }
749
- );
750
- }), Qn = [
751
- "a[href]",
752
- "area[href]",
753
- "button",
754
- "input:not([type=hidden])",
755
- "select",
756
- "textarea",
757
- "iframe",
758
- "[contenteditable]:not([contenteditable='false'])",
759
- "[tabindex]"
760
- ].join(",");
761
- function Xn(e, n) {
762
- let t = e;
763
- for (; t; ) {
764
- if (t.hidden || t.inert || t.getAttribute("aria-hidden") === "true")
765
- return !0;
766
- const r = t.ownerDocument.defaultView, a = r == null ? void 0 : r.getComputedStyle(t);
767
- if ((a == null ? void 0 : a.display) === "none" || (a == null ? void 0 : a.visibility) === "hidden")
768
- return !0;
769
- if (t === n) break;
770
- t = t.parentElement;
771
- }
772
- return !1;
773
- }
774
- function Yn(e, n) {
775
- var s;
776
- const t = (s = e.ownerDocument.defaultView) == null ? void 0 : s.HTMLInputElement;
777
- if (!t || !(e instanceof t) || e.type !== "radio" || !e.name)
778
- return !0;
779
- const r = n.filter(
780
- (o) => o instanceof t && o.type === "radio" && o.name === e.name && o.form === e.form
781
- ), a = r.find((o) => o.checked);
782
- return a ? a === e : r[0] === e;
783
- }
784
- function Jn(e) {
785
- const n = Array.from(
786
- e.querySelectorAll(Qn)
787
- ).filter((t) => !t.matches(":disabled") && t.tabIndex >= 0 && !Xn(t, e));
788
- return n.filter(
789
- (t) => Yn(t, n)
790
- );
791
- }
792
- function tn(e, n) {
793
- const t = [e, ...n];
794
- return [...new Set(
795
- t.flatMap(
796
- (a) => Jn(a)
797
- )
798
- )].sort((a, s) => {
799
- var f;
800
- if (a === s) return 0;
801
- const o = a.compareDocumentPosition(s), l = ((f = a.ownerDocument.defaultView) == null ? void 0 : f.Node.DOCUMENT_POSITION_FOLLOWING) ?? 4;
802
- return o & l ? -1 : 1;
803
- });
804
- }
805
- function qe(e, n, t) {
806
- return t ? e.contains(t) || [...n].some((r) => r.contains(t)) : !1;
807
- }
808
- function vn(e) {
809
- const {
810
- active: n,
811
- autoFocus: t = !0,
812
- container: r,
813
- initialFocusReference: a,
814
- layerId: s,
815
- restoreFocus: o = !0
816
- } = e, l = (r == null ? void 0 : r.ownerDocument) ?? null, f = W(/* @__PURE__ */ new Set()), g = B((i) => (f.current.add(i), () => f.current.delete(i)), []), c = Pe(() => ({ registerBranch: g }), [g]);
817
- return xn(n && !!r, l, s), Z(() => {
818
- var N, L;
819
- if (!n || !r) return;
820
- const i = r.ownerDocument, d = (N = i.defaultView) == null ? void 0 : N.HTMLElement, b = (L = i.defaultView) == null ? void 0 : L.Node, p = d && i.activeElement instanceof d ? i.activeElement : null;
821
- let y = !0;
822
- function h() {
823
- const x = a == null ? void 0 : a.current;
824
- (x && qe(
825
- r,
826
- f.current,
827
- x
828
- ) ? x : tn(
829
- r,
830
- f.current
831
- )[0] ?? r).focus({ preventScroll: !0 });
832
- }
833
- function w(x) {
834
- if (x.key !== "Tab" || !Xe(i, s))
835
- return;
836
- const P = tn(
837
- r,
838
- f.current
839
- );
840
- if (P.length === 0) {
841
- x.preventDefault(), r == null || r.focus({ preventScroll: !0 });
842
- return;
843
- }
844
- const I = P[0], C = P[P.length - 1], V = i.activeElement, z = qe(
845
- r,
846
- f.current,
847
- V
848
- ), M = !P.some(
849
- (E) => E === V
850
- ) && (V === r || V === (a == null ? void 0 : a.current));
851
- if (!z || M) {
852
- x.preventDefault(), (x.shiftKey ? C : I).focus();
853
- return;
854
- }
855
- x.shiftKey && V === I ? (x.preventDefault(), C.focus()) : !x.shiftKey && V === C && (x.preventDefault(), I.focus());
856
- }
857
- function R(x) {
858
- Xe(i, s) && b && x.target instanceof b && !qe(
859
- r,
860
- f.current,
861
- x.target
862
- ) && h();
863
- }
864
- return i.addEventListener("keydown", w, !0), i.addEventListener("focusin", R, !0), t && Promise.resolve().then(() => {
865
- y && h();
866
- }), () => {
867
- y = !1, i.removeEventListener("keydown", w, !0), i.removeEventListener("focusin", R, !0), o && (p != null && p.isConnected) && In(p);
868
- };
869
- }, [
870
- n,
871
- t,
872
- r,
873
- a,
874
- s,
875
- o
876
- ]), c;
877
- }
878
- const _e = /* @__PURE__ */ new WeakMap();
879
- function et(e, n) {
880
- Z(() => {
881
- if (!e || !n) return;
882
- const t = _e.get(n);
883
- if (t)
884
- t.count += 1;
885
- else {
886
- const r = n.body, a = n.defaultView, s = a && Number.parseFloat(
887
- a.getComputedStyle(r).paddingRight
888
- ) || 0, o = n.documentElement.clientWidth, l = a && o > 0 ? Math.max(
889
- 0,
890
- a.innerWidth - o
891
- ) : 0, f = {
892
- count: 1,
893
- overflow: r.style.overflow,
894
- paddingRight: r.style.paddingRight
895
- };
896
- _e.set(n, f), r.style.overflow = "hidden", l > 0 && (r.style.paddingRight = `${s + l}px`);
897
- }
898
- return () => {
899
- const r = _e.get(n);
900
- r && (r.count -= 1, !(r.count > 0) && (n.body.style.overflow = r.overflow, n.body.style.paddingRight = r.paddingRight, _e.delete(n)));
901
- };
902
- }, [e, n]);
903
- }
904
- function nt(e, n, t) {
905
- n.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
906
- }
907
- function tt(e) {
908
- const {
909
- "aria-label": n,
910
- "aria-labelledby": t,
911
- children: r,
912
- className: a,
913
- closeButtonLabel: s = "Close modal",
914
- exitable: o = !0,
915
- forwardedReference: l,
916
- initialFocusReference: f,
917
- lockScroll: g = !0,
918
- onClose: c,
919
- open: i,
920
- ownerDocument: d,
921
- presenceState: b,
922
- restoreFocus: p = !0,
923
- role: y = "dialog",
924
- style: h,
925
- title: w,
926
- trapFocus: R = !0,
927
- ...N
928
- } = e, L = W(null), x = W(null), P = Ce(Se), I = `${xe()}-title`, [C, V] = U(null), z = Ge(!0, d), H = Pe(() => [L], []), M = !!(w != null && w.trim()), E = f ?? (M ? x : void 0), X = t ?? (n === void 0 && M ? I : void 0), k = B(
929
- (_) => {
930
- nt(_, L, l), V(_);
931
- },
932
- [l]
933
- );
934
- Ue(() => {
935
- C && (C.inert = !i);
936
- }, [C, i]);
937
- const u = B(() => {
938
- c == null || c("escape");
939
- }, [c]), S = B(() => {
940
- c == null || c("outside");
941
- }, [c]);
942
- Ke({
943
- active: i,
944
- boundaries: H,
945
- dismissOnEscape: o,
946
- dismissOnPointerDownOutside: o,
947
- layerId: z.id,
948
- onEscapeDismiss: u,
949
- onPointerDownOutsideDismiss: S,
950
- ownerDocument: d
951
- });
952
- const F = vn({
953
- active: i && R,
954
- container: C,
955
- initialFocusReference: E,
956
- layerId: z.id,
957
- restoreFocus: p
958
- });
959
- et(g, d);
960
- const O = o ? /* @__PURE__ */ v(
961
- We,
962
- {
963
- "aria-label": s,
964
- className: "nk-modal__close",
965
- icon: "cross",
966
- onClick: () => c == null ? void 0 : c("close-button"),
967
- shape: "rectangle",
968
- type: "button",
969
- variant: "ghost"
970
- }
971
- ) : null;
972
- return /* @__PURE__ */ v(
973
- Se.Provider,
974
- {
975
- value: i && R ? F : P,
976
- children: /* @__PURE__ */ v(
977
- "div",
978
- {
979
- className: "nk-modal__overlay",
980
- "data-state": b,
981
- role: "presentation",
982
- style: { zIndex: z.zIndex },
983
- children: /* @__PURE__ */ q(
984
- ln,
985
- {
986
- ...N,
987
- ref: k,
988
- "aria-hidden": i ? void 0 : !0,
989
- "aria-label": i ? n : void 0,
990
- "aria-labelledby": i ? X : void 0,
991
- "aria-modal": i ? "true" : void 0,
992
- className: ["nk-modal", a].filter(Boolean).join(" "),
993
- "data-state": b,
994
- role: i ? y : void 0,
995
- style: h,
996
- tabIndex: -1,
997
- children: [
998
- M ? /* @__PURE__ */ q("div", { className: "nk-modal__header", children: [
999
- /* @__PURE__ */ v(
1000
- he,
1001
- {
1002
- as: "h2",
1003
- className: "nk-modal__title",
1004
- id: I,
1005
- ref: x,
1006
- size: "subtitle",
1007
- tabIndex: -1,
1008
- weight: "semibold",
1009
- children: w
1010
- }
1011
- ),
1012
- O
1013
- ] }) : O,
1014
- r
1015
- ]
1016
- }
1017
- )
1018
- }
1019
- )
1020
- }
1021
- );
1022
- }
1023
- const At = Q(function(n, t) {
1024
- const { open: r } = n, a = W(n);
1025
- r && (a.current = n);
1026
- const s = r ? n : a.current, { portalContainer: o } = s, l = $e(r), f = (o == null ? void 0 : o.ownerDocument) ?? (typeof document > "u" ? null : document);
1027
- return l.present ? /* @__PURE__ */ v(He, { container: o, children: /* @__PURE__ */ v(
1028
- tt,
1029
- {
1030
- ...s,
1031
- forwardedReference: t,
1032
- open: r,
1033
- ownerDocument: f,
1034
- presenceState: l.state === "closing" ? "closing" : "open"
1035
- }
1036
- ) }) : null;
1037
- });
1038
- function rt(e) {
1039
- const { inert: n, panelElement: t } = e;
1040
- return Ue(() => {
1041
- t && (t.inert = n);
1042
- }, [n, t]), null;
1043
- }
1044
- function at(e, n, t) {
1045
- n.current = e, cn(t, e);
1046
- }
1047
- function ot(e, n, t) {
1048
- n.current = e, cn(t, e);
1049
- }
1050
- function it(e, n) {
1051
- const t = (e == null ? void 0 : e.split(/\s+/).filter(Boolean)) ?? [];
1052
- return t.includes(n) || t.push(n), t.join(" ");
1053
- }
1054
- function st(e) {
1055
- const n = e.tagName.toLowerCase();
1056
- return e.getAttribute("role") === "button" && n !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(n) ? !0 : n === "a" && e.hasAttribute("href");
1057
- }
1058
- function lt(e) {
1059
- return e === "grid" || e === "listbox" || e === "menu" || e === "tree" ? e : "dialog";
1060
- }
1061
- const Bt = Q(function(n, t) {
1062
- const {
1063
- "aria-label": r,
1064
- "aria-labelledby": a,
1065
- autoFocus: s = !0,
1066
- children: o,
1067
- className: l,
1068
- closeOnEscape: f = !0,
1069
- closeOnOutsideInteraction: g = !0,
1070
- defaultOpen: c = !1,
1071
- disabled: i = !1,
1072
- initialFocusReference: d,
1073
- onEscapeKeyDown: b,
1074
- onOpenChange: p,
1075
- onPointerDownOutside: y,
1076
- open: h,
1077
- placement: w = "bottom",
1078
- portalContainer: R,
1079
- restoreFocus: N = !0,
1080
- role: L = "dialog",
1081
- style: x,
1082
- tabIndex: P,
1083
- trapFocus: I = !1,
1084
- trigger: C,
1085
- ...V
1086
- } = n;
1087
- if (C.type === on)
1088
- throw new Error("Popover requires a single non-Fragment trigger");
1089
- const z = xe(), H = Ce(Se), M = `${z}-popover`, E = C.props, X = Pn(C), k = E.id ?? `${z}-trigger`, u = i || E.disabled === !0 || E["aria-disabled"] === !0 || E["aria-disabled"] === "true", S = h !== void 0, [F, O] = U(c), _ = S ? h : F, A = $e(_), J = W(null), K = W(null), ne = W("programmatic"), j = W(null), oe = W(_), me = W(null), [Re, Oe] = Cn(
1090
- (D) => D + 1,
1091
- 0
1092
- ), [te, fe] = U(null), [se, De] = U(null), G = (R == null ? void 0 : R.ownerDocument) ?? (te == null ? void 0 : te.ownerDocument) ?? (typeof document > "u" ? null : document), ve = Ge(A.present, G), Y = Pe(
1093
- () => [J, K],
1094
- []
1095
- ), re = Nn(
1096
- A.present,
1097
- w,
1098
- te,
1099
- se
1100
- ), Ie = B(
1101
- (D) => {
1102
- ot(
1103
- D,
1104
- J,
1105
- X
1106
- ), fe(D);
1107
- },
1108
- [X]
1109
- ), Le = B(
1110
- (D) => {
1111
- at(
1112
- D,
1113
- K,
1114
- t
1115
- ), De(D);
1116
- },
1117
- [t]
1118
- ), le = B((D, $) => {
1119
- _ !== D && (S ? (j.current = {
1120
- open: D,
1121
- reason: $
1122
- }, Oe()) : (ne.current = $, O(D)), p == null || p(D, $));
1123
- }, [S, p, _]), Te = B(() => {
1124
- le(!1, "escape");
1125
- }, [le]), Ve = B(() => {
1126
- le(!1, "outside");
1127
- }, [le]), Ne = B((D) => {
1128
- var we;
1129
- if (y == null || y(D), D.defaultPrevented) return;
1130
- const $ = (we = G == null ? void 0 : G.defaultView) == null ? void 0 : we.HTMLElement;
1131
- me.current = $ ? D.composedPath().find(
1132
- (ge) => ge instanceof $ && ge.tabIndex >= 0
1133
- ) ?? D.target : D.target;
1134
- }, [y, G]);
1135
- Ke({
1136
- active: _,
1137
- boundaries: Y,
1138
- dismissOnEscape: f,
1139
- dismissOnPointerDownOutside: g,
1140
- layerId: ve.id,
1141
- onEscapeDismiss: Te,
1142
- onEscapeKeyDown: b,
1143
- onPointerDownOutside: Ne,
1144
- onPointerDownOutsideDismiss: Ve,
1145
- ownerDocument: G
1146
- });
1147
- const m = vn({
1148
- active: _ && I,
1149
- autoFocus: s,
1150
- container: se,
1151
- initialFocusReference: d,
1152
- layerId: ve.id,
1153
- restoreFocus: N
1154
- });
1155
- Z(() => {
1156
- if (!_ || I || !s || !se) return;
1157
- let D = !0;
1158
- return Promise.resolve().then(() => {
1159
- if (!D) return;
1160
- const $ = d == null ? void 0 : d.current;
1161
- ($ && se.contains($) ? $ : se).focus({ preventScroll: !0 });
1162
- }), () => {
1163
- D = !1;
1164
- };
1165
- }, [s, d, _, se, I]), Z(() => {
1166
- var Qe;
1167
- const D = oe.current;
1168
- oe.current = _;
1169
- const $ = j.current, we = S ? D !== _ && ($ == null ? void 0 : $.open) === _ ? $.reason : "programmatic" : ne.current;
1170
- if (j.current = null, _) {
1171
- ne.current = "programmatic", me.current = null;
1172
- return;
1173
- }
1174
- const ge = G == null ? void 0 : G.activeElement, Me = me.current, Fe = (Qe = G == null ? void 0 : G.defaultView) == null ? void 0 : Qe.HTMLElement, kn = we === "outside" && Fe && Me instanceof Fe && ge instanceof Fe && (Me === ge || Me.contains(ge));
1175
- D && !I && N && !kn && (te == null || te.focus({ preventScroll: !0 })), me.current = null;
1176
- }, [
1177
- Re,
1178
- S,
1179
- _,
1180
- G,
1181
- N,
1182
- I,
1183
- te
1184
- ]), Z(() => {
1185
- i && _ && le(!1, "programmatic");
1186
- }, [i, _, le]);
1187
- function T(D) {
1188
- var $;
1189
- if (u) {
1190
- D.preventDefault(), D.stopPropagation();
1191
- return;
1192
- }
1193
- ($ = E.onClick) == null || $.call(E, D), !D.defaultPrevented && le(!_, "trigger");
1194
- }
1195
- function ee(D) {
1196
- var $;
1197
- ($ = E.onKeyDown) == null || $.call(E, D), !(D.defaultPrevented || u || st(D.currentTarget) || D.key !== "Enter" && D.key !== " ") && (D.preventDefault(), D.currentTarget.click());
1198
- }
1199
- if (i) return C;
1200
- const ae = typeof C.type == "string", ie = ae ? C.type : null, ce = ie === "a" && typeof E.href == "string", pe = ae && !(ie === "button" || ie === "input" || ie === "select" || ie === "summary" || ie === "textarea" || ce), Ze = ce && u, yn = sn(
1201
- C,
1202
- {
1203
- "aria-controls": _ ? it(E["aria-controls"], M) : E["aria-controls"],
1204
- "aria-expanded": _,
1205
- "aria-haspopup": E["aria-haspopup"] ?? lt(L),
1206
- "aria-disabled": u ? !0 : E["aria-disabled"],
1207
- className: [E.className, "nk-popover__trigger"].filter(Boolean).join(" "),
1208
- href: Ze ? void 0 : E.href,
1209
- id: k,
1210
- onClick: T,
1211
- onKeyDown: ae ? ee : E.onKeyDown,
1212
- ref: Ie,
1213
- role: E.role ?? (Ze ? "link" : pe ? "button" : void 0),
1214
- tabIndex: u ? -1 : E.tabIndex ?? (pe ? 0 : void 0)
1215
- }
1216
- );
1217
- return /* @__PURE__ */ q(En, { children: [
1218
- yn,
1219
- /* @__PURE__ */ v(
1220
- Se.Provider,
1221
- {
1222
- value: _ && I ? m : H,
1223
- children: A.present && G ? /* @__PURE__ */ v(He, { container: R, inheritFrom: te, children: /* @__PURE__ */ q(
1224
- ln,
1225
- {
1226
- ...V,
1227
- ref: Le,
1228
- "aria-hidden": _ ? void 0 : !0,
1229
- "aria-label": _ ? r : void 0,
1230
- "aria-labelledby": _ ? a ?? (r === void 0 ? k : void 0) : void 0,
1231
- className: ["nk-popover", l].filter(Boolean).join(" "),
1232
- "data-placement": (re == null ? void 0 : re.placement) ?? w,
1233
- "data-state": A.state === "closing" ? "closing" : "open",
1234
- id: M,
1235
- role: _ ? L : void 0,
1236
- style: re ? {
1237
- ...x,
1238
- "--nk-popover-arrow-offset": `${re.arrowOffset}px`,
1239
- left: re.left,
1240
- top: re.top,
1241
- zIndex: ve.zIndex
1242
- } : {
1243
- ...x,
1244
- visibility: "hidden",
1245
- zIndex: ve.zIndex
1246
- },
1247
- tabIndex: P ?? -1,
1248
- children: [
1249
- /* @__PURE__ */ v(
1250
- rt,
1251
- {
1252
- inert: !_,
1253
- panelElement: se
1254
- }
1255
- ),
1256
- /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-popover__arrow" }),
1257
- /* @__PURE__ */ v("div", { className: "nk-popover__content", children: o })
1258
- ]
1259
- }
1260
- ) }) : null
1261
- }
1262
- )
1263
- ] });
1264
- }), ct = 3, dt = 10, gn = 4;
1265
- function ut(e) {
1266
- return Number.isFinite(e) ? Math.min(
1267
- dt,
1268
- Math.max(ct, Math.trunc(e))
1269
- ) : gn;
1270
- }
1271
- function be(e, n, t) {
1272
- return (n === "numeric" ? e.replace(/[^0-9]/g, "") : e.replace(/[^0-9a-z]/gi, "").toUpperCase()).slice(0, t);
1273
- }
1274
- function ft(e, n, t) {
1275
- n.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
1276
- }
1277
- function pt(e, n) {
1278
- var r;
1279
- const t = (r = Object.getOwnPropertyDescriptor(
1280
- Object.getPrototypeOf(e),
1281
- "value"
1282
- )) == null ? void 0 : r.set;
1283
- t ? t.call(e, n) : e.value = n;
1284
- }
1285
- function ze(e, n, t) {
1286
- const r = Math.min(t - 1, Math.max(0, n)), a = Math.min(r + 1, e.value.length);
1287
- e.focus(), e.setSelectionRange(r, a);
1288
- }
1289
- function ht(e) {
1290
- const {
1291
- defaultValue: n,
1292
- disabled: t,
1293
- forwardedReference: r,
1294
- length: a,
1295
- mode: s,
1296
- onChange: o,
1297
- onComplete: l,
1298
- onFocus: f,
1299
- onKeyDown: g,
1300
- onPaste: c,
1301
- onSelect: i,
1302
- readOnly: d,
1303
- value: b
1304
- } = e, p = ut(a), y = be(
1305
- n,
1306
- s,
1307
- p
1308
- ), h = W(null), [w, R] = U(
1309
- y
1310
- ), [N, L] = U(0), x = b !== void 0, P = be(
1311
- x ? b : w,
1312
- s,
1313
- p
1314
- ), I = B(
1315
- (k) => ft(
1316
- k,
1317
- h,
1318
- r
1319
- ),
1320
- [r]
1321
- );
1322
- Z(() => {
1323
- !x && w !== P && R(P);
1324
- }, [x, P, w]), Z(() => {
1325
- var F;
1326
- if (x) return;
1327
- const k = (F = h.current) == null ? void 0 : F.form;
1328
- if (!k) return;
1329
- const u = k.getRootNode();
1330
- function S(O) {
1331
- O.target !== k || O.defaultPrevented || (R(y), L(0));
1332
- }
1333
- return u.addEventListener("reset", S), () => u.removeEventListener("reset", S);
1334
- }, [x, y]);
1335
- function C(k) {
1336
- const u = k.selectionStart ?? P.length;
1337
- return Math.min(p - 1, Math.max(0, u));
1338
- }
1339
- function V(k) {
1340
- const u = k.currentTarget, S = u.selectionStart ?? u.value.length, F = be(u.value, s, p), O = be(
1341
- u.value.slice(0, S),
1342
- s,
1343
- p
1344
- ).length;
1345
- u.value = F, x || R(F), o == null || o(k), F.length === p && F !== P && (l == null || l(F));
1346
- const _ = Math.min(p - 1, O);
1347
- L(_), u.setSelectionRange(
1348
- _,
1349
- Math.min(_ + 1, F.length)
1350
- );
1351
- }
1352
- function z(k) {
1353
- if (c == null || c(k), k.defaultPrevented || t || d) return;
1354
- const u = be(
1355
- k.clipboardData.getData("text"),
1356
- s,
1357
- p
1358
- );
1359
- if (k.preventDefault(), u.length === 0) return;
1360
- const S = k.currentTarget, F = S.selectionStart ?? P.length, O = S.selectionEnd ?? F, _ = u.length === p ? u : be(
1361
- P.slice(0, F) + u + P.slice(O),
1362
- s,
1363
- p
1364
- ), A = u.length === p ? p : Math.min(p, F + u.length);
1365
- pt(S, _), S.setSelectionRange(A, A), S.dispatchEvent(new Event("input", { bubbles: !0 }));
1366
- }
1367
- function H(k) {
1368
- if (g == null || g(k), k.defaultPrevented || k.key !== "ArrowLeft" && k.key !== "ArrowRight") return;
1369
- k.preventDefault();
1370
- const u = k.key === "ArrowLeft" ? -1 : 1, S = Math.min(
1371
- p - 1,
1372
- Math.max(0, C(k.currentTarget) + u)
1373
- );
1374
- L(S), ze(k.currentTarget, S, p);
1375
- }
1376
- function M(k) {
1377
- f == null || f(k);
1378
- const u = Math.min(p - 1, P.length);
1379
- L(u), ze(k.currentTarget, u, p);
1380
- }
1381
- function E(k) {
1382
- i == null || i(k), L(C(k.currentTarget));
1383
- }
1384
- function X(k, u) {
1385
- if (k.preventDefault(), t) return;
1386
- const S = h.current;
1387
- S && (L(u), ze(S, u, p));
1388
- }
1389
- return {
1390
- activeIndex: N,
1391
- handleChange: V,
1392
- handleFocus: M,
1393
- handleKeyDown: H,
1394
- handlePaste: z,
1395
- handleSelect: E,
1396
- handleSlotPointerDown: X,
1397
- inputCallbackReference: I,
1398
- length: p,
1399
- renderedValue: P
1400
- };
1401
- }
1402
- const qt = Q(function(n, t) {
1403
- const {
1404
- "aria-invalid": r,
1405
- autoCapitalize: a,
1406
- autoComplete: s = "one-time-code",
1407
- className: o,
1408
- censored: l = !1,
1409
- defaultValue: f = "",
1410
- disabled: g = !1,
1411
- invalid: c = !1,
1412
- length: i = gn,
1413
- mode: d = "numeric",
1414
- onChange: b,
1415
- onComplete: p,
1416
- onFocus: y,
1417
- onKeyDown: h,
1418
- onPaste: w,
1419
- onSelect: R,
1420
- readOnly: N = !1,
1421
- style: L,
1422
- value: x,
1423
- wrap: P = !1,
1424
- ...I
1425
- } = n, {
1426
- activeIndex: C,
1427
- handleChange: V,
1428
- handleFocus: z,
1429
- handleKeyDown: H,
1430
- handlePaste: M,
1431
- handleSelect: E,
1432
- handleSlotPointerDown: X,
1433
- inputCallbackReference: k,
1434
- length: u,
1435
- renderedValue: S
1436
- } = ht({
1437
- defaultValue: f,
1438
- disabled: g,
1439
- forwardedReference: t,
1440
- length: i,
1441
- mode: d,
1442
- onChange: b,
1443
- onComplete: p,
1444
- onFocus: y,
1445
- onKeyDown: h,
1446
- onPaste: w,
1447
- onSelect: R,
1448
- readOnly: N,
1449
- value: x
1450
- }), F = c || de(r), O = !P && u >= 6 && u % 2 === 0, _ = u / 2, A = {
1451
- ...L,
1452
- "--nk-pin-input-columns": Math.ceil(u / 2)
1453
- };
1454
- return /* @__PURE__ */ q(
1455
- "span",
1456
- {
1457
- className: ["nk-pin-input", o].filter(Boolean).join(" "),
1458
- "data-disabled": g || void 0,
1459
- "data-invalid": F || void 0,
1460
- "data-read-only": N || void 0,
1461
- "data-wrap": P || void 0,
1462
- style: A,
1463
- children: [
1464
- /* @__PURE__ */ v(
1465
- "input",
1466
- {
1467
- ...I,
1468
- ref: k,
1469
- "aria-invalid": ue(c, r),
1470
- autoCapitalize: a ?? (d === "alphanumeric" ? "characters" : "off"),
1471
- autoComplete: s,
1472
- className: "nk-pin-input__control",
1473
- disabled: g,
1474
- inputMode: d === "numeric" ? "numeric" : "text",
1475
- maxLength: u,
1476
- minLength: u,
1477
- onChange: V,
1478
- onFocus: z,
1479
- onKeyDown: H,
1480
- onPaste: M,
1481
- onSelect: E,
1482
- pattern: d === "numeric" ? `[0-9]{${u}}` : `[0-9A-Za-z]{${u}}`,
1483
- readOnly: N,
1484
- spellCheck: !1,
1485
- type: "text",
1486
- value: S
1487
- }
1488
- ),
1489
- /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-pin-input__slots", children: Array.from({ length: u }, (J, K) => /* @__PURE__ */ q("span", { className: "nk-pin-input__slot-group", children: [
1490
- O && K === _ ? /* @__PURE__ */ v("span", { className: "nk-pin-input__separator", children: "-" }) : null,
1491
- /* @__PURE__ */ v(
1492
- "span",
1493
- {
1494
- className: "nk-pin-input__slot",
1495
- "data-active": C === K || void 0,
1496
- onPointerDown: (ne) => X(ne, K),
1497
- children: l && S[K] ? /* @__PURE__ */ v("span", { className: "nk-pin-input__censor" }) : S[K] ?? ""
1498
- }
1499
- )
1500
- ] }, K)) })
1501
- ]
1502
- }
1503
- );
1504
- }), bn = an(void 0);
1505
- function mt() {
1506
- const e = Ce(bn);
1507
- if (!e)
1508
- throw new Error("Radio must be rendered within RadioGroup");
1509
- return e;
1510
- }
1511
- function vt(e, n, t) {
1512
- n.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
1513
- }
1514
- const zt = Q(function(n, t) {
1515
- const {
1516
- children: r,
1517
- className: a,
1518
- disabled: s = !1,
1519
- style: o,
1520
- value: l,
1521
- ...f
1522
- } = n, g = mt(), c = W(null), i = g.disabled || s, d = g.value !== void 0, b = g.value === l, p = B(
1523
- (y) => vt(
1524
- y,
1525
- c,
1526
- t
1527
- ),
1528
- [t]
1529
- );
1530
- return Z(() => {
1531
- var y;
1532
- !d && i && ((y = c.current) != null && y.checked) && (c.current.checked = !1);
1533
- }, [d, i]), /* @__PURE__ */ q(
1534
- "label",
1535
- {
1536
- className: ["nk-radio", a].filter(Boolean).join(" "),
1537
- "data-disabled": i || void 0,
1538
- style: o,
1539
- children: [
1540
- /* @__PURE__ */ v(
1541
- "input",
1542
- {
1543
- ...f,
1544
- ref: p,
1545
- checked: d ? !i && b : void 0,
1546
- className: "nk-radio__control",
1547
- defaultChecked: d ? void 0 : !i && g.defaultValue === l,
1548
- disabled: i,
1549
- name: g.name,
1550
- onChange: g.onChange,
1551
- required: g.required,
1552
- type: "radio",
1553
- value: l
1554
- }
1555
- ),
1556
- /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-radio__visual" }),
1557
- /* @__PURE__ */ v(he, { as: "span", className: "nk-radio__label", children: r })
1558
- ]
1559
- }
1560
- );
1561
- }), gt = Q(
1562
- function(n, t) {
1563
- const {
1564
- "aria-invalid": r,
1565
- children: a,
1566
- className: s,
1567
- defaultValue: o,
1568
- disabled: l = !1,
1569
- invalid: f = !1,
1570
- name: g,
1571
- onChange: c,
1572
- orientation: i = "vertical",
1573
- required: d = !1,
1574
- value: b,
1575
- ...p
1576
- } = n, y = f || de(r), h = {
1577
- defaultValue: o,
1578
- disabled: l,
1579
- name: g,
1580
- onChange: c,
1581
- required: d,
1582
- value: b
1583
- };
1584
- return /* @__PURE__ */ v(bn.Provider, { value: h, children: /* @__PURE__ */ v(
1585
- "div",
1586
- {
1587
- ...p,
1588
- ref: t,
1589
- "aria-disabled": l || void 0,
1590
- "aria-invalid": ue(f, r),
1591
- "aria-required": d || void 0,
1592
- className: ["nk-radio-group", s].filter(Boolean).join(" "),
1593
- "data-disabled": l || void 0,
1594
- "data-invalid": y || void 0,
1595
- "data-orientation": i,
1596
- role: "radiogroup",
1597
- children: a
1598
- }
1599
- ) });
1600
- }
1601
- );
1602
- hn(gt, "group");
1603
- function je(e, n, t) {
1604
- if (e.length === 0) return -1;
1605
- for (let r = 1; r <= e.length; r += 1) {
1606
- const a = (n + t * r + e.length) % e.length;
1607
- if (!e[a].disabled) return a;
1608
- }
1609
- return -1;
1610
- }
1611
- function bt(e, n, t) {
1612
- for (let r = 1; r <= e.length; r += 1) {
1613
- const a = (t + r + e.length) % e.length, s = e[a];
1614
- if (!s.disabled && s.label.toLocaleLowerCase().startsWith(n))
1615
- return a;
1616
- }
1617
- return -1;
1618
- }
1619
- function yt(e) {
1620
- const n = /* @__PURE__ */ new Set();
1621
- e.forEach((t) => {
1622
- if (n.has(t.value))
1623
- throw new Error("Select option values must be unique");
1624
- n.add(t.value);
1625
- });
1626
- }
1627
- function kt(e, n, t) {
1628
- n.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
1629
- }
1630
- function wt(e) {
1631
- const {
1632
- "aria-invalid": n,
1633
- children: t,
1634
- className: r,
1635
- defaultValue: a,
1636
- disabled: s = !1,
1637
- forwardedReference: o,
1638
- invalid: l = !1,
1639
- placeholder: f,
1640
- style: g,
1641
- value: c,
1642
- ...i
1643
- } = e, d = ue(l, n), b = l || de(n);
1644
- return /* @__PURE__ */ q(
1645
- "span",
1646
- {
1647
- className: ["nk-select", r].filter(Boolean).join(" "),
1648
- "data-disabled": s || void 0,
1649
- "data-invalid": b || void 0,
1650
- "data-mode": "native",
1651
- style: g,
1652
- children: [
1653
- /* @__PURE__ */ q(
1654
- "select",
1655
- {
1656
- ...i,
1657
- ref: o,
1658
- "aria-invalid": d,
1659
- className: "nk-select__control",
1660
- defaultValue: c === void 0 ? a ?? (f !== void 0 ? "" : void 0) : void 0,
1661
- disabled: s,
1662
- value: c,
1663
- children: [
1664
- f !== void 0 ? /* @__PURE__ */ v("option", { disabled: !0, value: "", children: f }) : null,
1665
- t
1666
- ]
1667
- }
1668
- ),
1669
- /* @__PURE__ */ v(ke, { className: "nk-select__icon", type: "chevron-down" })
1670
- ]
1671
- }
1672
- );
1673
- }
1674
- function xt(e, n, t) {
1675
- const [r, a] = U(null);
1676
- return Z(() => {
1677
- if (!e || !n) {
1678
- a(null);
1679
- return;
1680
- }
1681
- const s = n.ownerDocument.defaultView;
1682
- if (!s) return;
1683
- const o = s;
1684
- function l() {
1685
- const c = n == null ? void 0 : n.getBoundingClientRect();
1686
- if (!c) return;
1687
- const i = 8, d = 4, b = o.innerHeight - c.bottom - d - i, p = c.top - d - i, y = b < 160 && p > b, h = Math.max(
1688
- 72,
1689
- y ? p : b
1690
- ), w = t == null ? void 0 : t.getBoundingClientRect(), R = Math.max(
1691
- c.width,
1692
- (w == null ? void 0 : w.width) ?? c.width
1693
- ), N = Math.min(
1694
- Math.max(i, c.left),
1695
- Math.max(
1696
- i,
1697
- o.innerWidth - i - R
1698
- )
1699
- ), L = y ? Math.max(
1700
- i,
1701
- c.top - d - Math.min(
1702
- (w == null ? void 0 : w.height) ?? h,
1703
- h
1704
- )
1705
- ) : c.bottom + d;
1706
- a({
1707
- left: N,
1708
- maxHeight: h,
1709
- minWidth: c.width,
1710
- top: L
1711
- });
1712
- }
1713
- l(), o.addEventListener("resize", l), o.addEventListener("scroll", l, !0);
1714
- const f = o.ResizeObserver, g = f ? new f(l) : null;
1715
- return g == null || g.observe(n), t && (g == null || g.observe(t)), () => {
1716
- o.removeEventListener("resize", l), o.removeEventListener("scroll", l, !0), g == null || g.disconnect();
1717
- };
1718
- }, [e, t, n]), r;
1719
- }
1720
- function It(e) {
1721
- const {
1722
- active: n,
1723
- closeOnEscape: t,
1724
- closeOnOutsideInteraction: r,
1725
- highlightedIndex: a,
1726
- id: s,
1727
- listboxReference: o,
1728
- onEscapeDismiss: l,
1729
- onEscapeKeyDown: f,
1730
- onHighlight: g,
1731
- onOutsideDismiss: c,
1732
- onPointerDownOutside: i,
1733
- onSelect: d,
1734
- options: b,
1735
- ownerDocument: p,
1736
- position: y,
1737
- selectedValue: h,
1738
- state: w,
1739
- triggerReference: R
1740
- } = e, N = W(null), L = Ge(!0, p), x = Pe(
1741
- () => [R, N],
1742
- [R]
1743
- ), P = B(
1744
- (I) => {
1745
- N.current = I, o(I);
1746
- },
1747
- [o]
1748
- );
1749
- return Ke({
1750
- active: n,
1751
- boundaries: x,
1752
- dismissOnEscape: t,
1753
- dismissOnPointerDownOutside: r,
1754
- layerId: L.id,
1755
- onEscapeDismiss: l,
1756
- onEscapeKeyDown: f,
1757
- onPointerDownOutside: i,
1758
- onPointerDownOutsideDismiss: c,
1759
- ownerDocument: p
1760
- }), /* @__PURE__ */ v(
1761
- "div",
1762
- {
1763
- "aria-hidden": n ? void 0 : !0,
1764
- "aria-labelledby": s,
1765
- className: "nk-select__listbox",
1766
- "data-state": w,
1767
- id: `${s}-listbox`,
1768
- ref: P,
1769
- role: "listbox",
1770
- style: y ? {
1771
- left: y.left,
1772
- maxHeight: y.maxHeight,
1773
- minWidth: y.minWidth,
1774
- top: y.top,
1775
- zIndex: L.zIndex
1776
- } : { visibility: "hidden", zIndex: L.zIndex },
1777
- children: b.map((I, C) => /* @__PURE__ */ q(
1778
- "div",
1779
- {
1780
- "aria-disabled": I.disabled || void 0,
1781
- "aria-selected": I.value === h,
1782
- className: "nk-select__option",
1783
- "data-highlighted": C === a || void 0,
1784
- "data-selected": I.value === h || void 0,
1785
- id: `${s}-option-${C}`,
1786
- onPointerDown: (V) => {
1787
- V.preventDefault(), I.disabled || d(I);
1788
- },
1789
- onPointerMove: () => {
1790
- I.disabled || g(C);
1791
- },
1792
- role: "option",
1793
- children: [
1794
- I.icon ? /* @__PURE__ */ v(ke, { type: I.icon }) : null,
1795
- /* @__PURE__ */ v("span", { className: "nk-select__option-label", children: I.label }),
1796
- I.value === h ? /* @__PURE__ */ v(ke, { className: "nk-select__check", type: "checkmark" }) : null
1797
- ]
1798
- },
1799
- I.value
1800
- ))
1801
- }
1802
- );
1803
- }
1804
- function Nt(e) {
1805
- var Ne;
1806
- const {
1807
- "aria-invalid": n,
1808
- className: t,
1809
- closeOnEscape: r = !0,
1810
- closeOnOutsideInteraction: a = !0,
1811
- defaultValue: s = "",
1812
- disabled: o = !1,
1813
- displayOverride: l,
1814
- form: f,
1815
- forwardedReference: g,
1816
- id: c,
1817
- invalid: i = !1,
1818
- name: d,
1819
- onChange: b,
1820
- onClick: p,
1821
- onEscapeKeyDown: y,
1822
- onKeyDown: h,
1823
- onOpenChange: w,
1824
- onPointerDownOutside: R,
1825
- options: N,
1826
- placeholder: L,
1827
- portalContainer: x,
1828
- required: P = !1,
1829
- style: I,
1830
- value: C,
1831
- width: V,
1832
- ...z
1833
- } = e;
1834
- yt(N);
1835
- const H = xe(), M = c ?? H, E = W(null), X = W(null), k = W(null), u = W(""), [S, F] = U(null), [O, _] = U(!1), [A, J] = U(-1), [K, ne] = U(s), j = C !== void 0, oe = j ? C : K, me = N.find(
1836
- (m) => m.value === oe
1837
- ), Re = i || de(n), Oe = ue(i, n), te = $e(O), fe = (x == null ? void 0 : x.ownerDocument) ?? ((Ne = E.current) == null ? void 0 : Ne.ownerDocument) ?? (typeof document > "u" ? null : document), se = xt(
1838
- te.present,
1839
- E.current,
1840
- S
1841
- ), De = V === void 0 ? I : { ...I, width: V }, G = l ?? me, ve = B(
1842
- (m) => {
1843
- kt(
1844
- m,
1845
- E,
1846
- g
1847
- );
1848
- },
1849
- [g]
1850
- ), Y = B((m) => {
1851
- O !== m && (_(m), w == null || w(m));
1852
- }, [w, O]), re = B((m = 1) => {
1853
- const T = N.findIndex(
1854
- (ae) => ae.value === oe && !ae.disabled
1855
- ), ee = m === 1 ? -1 : N.length;
1856
- J(
1857
- T >= 0 ? T : je(N, ee, m)
1858
- ), Y(!0);
1859
- }, [N, oe, Y]), Ie = B((m) => {
1860
- var T;
1861
- m.disabled || (j || ne(m.value), Y(!1), (T = E.current) == null || T.focus(), b == null || b(m.value));
1862
- }, [j, b, Y]), Le = B(() => {
1863
- var m;
1864
- Y(!1), (m = E.current) == null || m.focus();
1865
- }, [Y]), le = B(() => {
1866
- Y(!1);
1867
- }, [Y]);
1868
- function Te(m) {
1869
- p == null || p(m), !(m.defaultPrevented || o) && (O ? Y(!1) : re());
1870
- }
1871
- function Ve(m) {
1872
- if (h == null || h(m), !(m.defaultPrevented || o)) {
1873
- if (m.key === "ArrowDown" || m.key === "ArrowUp") {
1874
- m.preventDefault();
1875
- const T = m.key === "ArrowDown" ? 1 : -1;
1876
- O ? J(
1877
- (ee) => je(N, ee, T)
1878
- ) : re(T);
1879
- return;
1880
- }
1881
- if (m.key === "Home" || m.key === "End") {
1882
- if (m.preventDefault(), !O) re(m.key === "Home" ? 1 : -1);
1883
- else {
1884
- const T = m.key === "Home" ? 1 : -1, ee = T === 1 ? -1 : N.length;
1885
- J(
1886
- je(N, ee, T)
1887
- );
1888
- }
1889
- return;
1890
- }
1891
- if (m.key === "Enter" || m.key === " ") {
1892
- m.preventDefault();
1893
- const T = N[A];
1894
- O && T ? Ie(T) : O || re();
1895
- return;
1896
- }
1897
- if (m.key === "Tab") {
1898
- Y(!1);
1899
- return;
1900
- }
1901
- if (m.key.length === 1 && !m.altKey && !m.ctrlKey && !m.metaKey) {
1902
- const T = m.currentTarget.ownerDocument.defaultView;
1903
- if (!T) return;
1904
- const ee = m.key.toLocaleLowerCase(), ae = u.current + ee, ie = Array.from(ae).every((Ee) => Ee === ee);
1905
- u.current = ie ? ee : ae, k.current !== null && T.clearTimeout(k.current), k.current = T.setTimeout(() => {
1906
- u.current = "", k.current = null;
1907
- }, 500);
1908
- const ce = bt(
1909
- N,
1910
- u.current,
1911
- A
1912
- );
1913
- ce >= 0 && (m.preventDefault(), O || Y(!0), J(ce));
1914
- }
1915
- }
1916
- }
1917
- return Z(() => {
1918
- var m;
1919
- if (O && A >= 0) {
1920
- const T = fe == null ? void 0 : fe.getElementById(
1921
- `${M}-option-${A}`
1922
- );
1923
- T && (S != null && S.contains(T)) && ((m = T.scrollIntoView) == null || m.call(T, { block: "nearest" }));
1924
- }
1925
- }, [A, M, S, O]), Z(() => {
1926
- var ee;
1927
- const m = (ee = E.current) == null ? void 0 : ee.form;
1928
- if (!m) return;
1929
- function T() {
1930
- const ae = X.current, ie = j ? oe : s;
1931
- if (ae) {
1932
- const ce = Array.from(ae.options), Ee = ce.find(
1933
- (pe) => pe.value === ie
1934
- ) ?? ce[0];
1935
- ce.forEach((pe) => {
1936
- pe.defaultSelected = pe === Ee;
1937
- });
1938
- }
1939
- j || ne(s), Y(!1);
1940
- }
1941
- return m.addEventListener("reset", T), () => m.removeEventListener("reset", T);
1942
- }, [s, f, j, oe, Y]), Z(() => () => {
1943
- var T;
1944
- const m = (T = E.current) == null ? void 0 : T.ownerDocument.defaultView;
1945
- m && k.current !== null && m.clearTimeout(k.current);
1946
- }, []), /* @__PURE__ */ q(
1947
- "span",
1948
- {
1949
- className: ["nk-select", t].filter(Boolean).join(" "),
1950
- "data-disabled": o || void 0,
1951
- "data-invalid": Re || void 0,
1952
- "data-mode": "custom",
1953
- "data-open": O || void 0,
1954
- style: De,
1955
- children: [
1956
- /* @__PURE__ */ q(
1957
- "button",
1958
- {
1959
- ...z,
1960
- ref: ve,
1961
- "aria-activedescendant": O && A >= 0 ? `${M}-option-${A}` : void 0,
1962
- "aria-controls": `${M}-listbox`,
1963
- "aria-expanded": O,
1964
- "aria-haspopup": "listbox",
1965
- "aria-invalid": Oe,
1966
- "aria-required": P || void 0,
1967
- "aria-autocomplete": "none",
1968
- className: "nk-select__trigger",
1969
- disabled: o,
1970
- form: f,
1971
- id: M,
1972
- onClick: Te,
1973
- onKeyDown: Ve,
1974
- role: "combobox",
1975
- type: "button",
1976
- children: [
1977
- G ? /* @__PURE__ */ q("span", { className: "nk-select__value", children: [
1978
- G.icon ? /* @__PURE__ */ v(ke, { type: G.icon }) : null,
1979
- /* @__PURE__ */ v("span", { className: "nk-select__value-label", children: G.label })
1980
- ] }) : /* @__PURE__ */ v("span", { className: "nk-select__placeholder", children: L }),
1981
- /* @__PURE__ */ v(ke, { className: "nk-select__icon", type: "chevron-down" })
1982
- ]
1983
- }
1984
- ),
1985
- d || P ? /* @__PURE__ */ q(
1986
- "select",
1987
- {
1988
- ref: X,
1989
- "aria-hidden": "true",
1990
- className: "nk-select__form-control",
1991
- disabled: o,
1992
- form: f,
1993
- name: d,
1994
- onChange: () => {
1995
- },
1996
- onInvalid: (m) => {
1997
- var T;
1998
- m.preventDefault(), (T = E.current) == null || T.focus();
1999
- },
2000
- required: P,
2001
- tabIndex: -1,
2002
- value: oe,
2003
- children: [
2004
- /* @__PURE__ */ v("option", { value: "" }),
2005
- N.map((m) => /* @__PURE__ */ v(
2006
- "option",
2007
- {
2008
- disabled: m.disabled,
2009
- value: m.value,
2010
- children: m.label
2011
- },
2012
- m.value
2013
- ))
2014
- ]
2015
- }
2016
- ) : null,
2017
- te.present && fe ? /* @__PURE__ */ v(
2018
- He,
2019
- {
2020
- container: x,
2021
- inheritFrom: E.current,
2022
- children: /* @__PURE__ */ v(
2023
- It,
2024
- {
2025
- active: O,
2026
- closeOnEscape: r,
2027
- closeOnOutsideInteraction: a,
2028
- highlightedIndex: A,
2029
- id: M,
2030
- listboxReference: F,
2031
- onEscapeDismiss: Le,
2032
- onEscapeKeyDown: y,
2033
- onHighlight: J,
2034
- onOutsideDismiss: le,
2035
- onPointerDownOutside: R,
2036
- onSelect: Ie,
2037
- options: N,
2038
- ownerDocument: fe,
2039
- position: se,
2040
- selectedValue: oe,
2041
- state: te.state === "closing" ? "closing" : "open",
2042
- triggerReference: E
2043
- }
2044
- )
2045
- }
2046
- ) : null
2047
- ]
2048
- }
2049
- );
2050
- }
2051
- const jt = Q(function(n, t) {
2052
- const { options: r } = n;
2053
- return r !== void 0 ? /* @__PURE__ */ v(
2054
- Nt,
2055
- {
2056
- ...n,
2057
- forwardedReference: t
2058
- }
2059
- ) : /* @__PURE__ */ v(
2060
- wt,
2061
- {
2062
- ...n,
2063
- forwardedReference: t
2064
- }
2065
- );
2066
- }), Wt = Q(function(n, t) {
2067
- const {
2068
- "aria-hidden": r = !0,
2069
- className: a,
2070
- height: s = "1em",
2071
- shape: o = "rectangle",
2072
- style: l,
2073
- width: f = o === "circle" ? "1em" : "100%",
2074
- ...g
2075
- } = n;
2076
- return /* @__PURE__ */ v(
2077
- "div",
2078
- {
2079
- ...g,
2080
- ref: t,
2081
- "aria-hidden": r,
2082
- className: ["nk-skeleton", a].filter(Boolean).join(" "),
2083
- "data-shape": o,
2084
- style: { ...l, width: f, height: s }
2085
- }
2086
- );
2087
- }), $t = Q(function(n, t) {
2088
- const {
2089
- "aria-invalid": r,
2090
- className: a,
2091
- disabled: s = !1,
2092
- style: o,
2093
- ...l
2094
- } = n;
2095
- return /* @__PURE__ */ q(
2096
- "span",
2097
- {
2098
- className: ["nk-switch", a].filter(Boolean).join(" "),
2099
- "data-disabled": s || void 0,
2100
- "data-invalid": de(r) || void 0,
2101
- style: o,
2102
- children: [
2103
- /* @__PURE__ */ v(
2104
- "input",
2105
- {
2106
- ...l,
2107
- ref: t,
2108
- "aria-invalid": r,
2109
- className: "nk-switch__control",
2110
- disabled: s,
2111
- role: "switch",
2112
- type: "checkbox"
2113
- }
2114
- ),
2115
- /* @__PURE__ */ v("span", { "aria-hidden": "true", className: "nk-switch__track", children: /* @__PURE__ */ v("span", { className: "nk-switch__thumb" }) })
2116
- ]
2117
- }
2118
- );
2119
- });
2120
- function rn(e) {
2121
- return Number.isFinite(e) ? Math.max(1, Math.floor(e)) : 1;
2122
- }
2123
- const Ht = Q(
2124
- function(n, t) {
2125
- const {
2126
- "aria-invalid": r,
2127
- className: a,
2128
- disabled: s = !1,
2129
- invalid: o = !1,
2130
- minRows: l,
2131
- readOnly: f = !1,
2132
- resize: g = "vertical",
2133
- rows: c,
2134
- style: i,
2135
- ...d
2136
- } = n, b = rn(c ?? l ?? 3), y = `calc(${rn(l ?? c ?? 3) * 1.25}em + var(--nk-text-area-padding) * 2 + var(--nk-text-area-border-width) * 2)`, h = {
2137
- ...i,
2138
- "--nk-text-area-min-height": y
2139
- };
2140
- return /* @__PURE__ */ v(
2141
- "textarea",
2142
- {
2143
- ...d,
2144
- ref: t,
2145
- "aria-invalid": ue(o, r),
2146
- className: ["nk-text-area", a].filter(Boolean).join(" "),
2147
- "data-invalid": o || de(r) || void 0,
2148
- "data-resize": g,
2149
- disabled: s,
2150
- readOnly: f,
2151
- rows: b,
2152
- style: h
2153
- }
2154
- );
2155
- }
2156
- );
1
+ import { b as e, c as p, p as o, s as t, t as c } from "./units-BmjPCccF.js";
2157
2
  export {
2158
- Ut as Alert,
2159
- Lt as Avatar,
2160
- Tt as Badge,
2161
- We as Button,
2162
- er as Card,
2163
- Tn as Checkbox,
2164
- An as CheckboxGroup,
2165
- Vt as Content,
2166
- Zt as Divider,
2167
- Mt as Field,
2168
- ke as Icon,
2169
- Ft as Input,
2170
- At as Modal,
2171
- qt as PinInput,
2172
- Bt as Popover,
2173
- zt as Radio,
2174
- gt as RadioGroup,
2175
- jt as Select,
2176
- Wt as Skeleton,
2177
- wn as Spinner,
2178
- $t as Switch,
2179
- Qt as Table,
2180
- he as Text,
2181
- Ht as TextArea,
2182
- Xt as Tooltip,
2183
- Yt as TooltipProvider,
2184
- ye as breakpoint,
2185
- Rt as cell,
2186
- Dt as px,
2187
- Ot as space,
2188
- Pt as tokens
3
+ e as breakpoint,
4
+ p as cell,
5
+ o as px,
6
+ t as space,
7
+ c as tokens
2189
8
  };