neatkit 0.14.1 → 0.15.1

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 (50) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +1 -1
  3. package/dist/Markdown.cjs +1 -1
  4. package/dist/Markdown.js +1 -1
  5. package/dist/Popover.cjs +1 -1
  6. package/dist/Popover.js +104 -101
  7. package/dist/Select.cjs +1 -1
  8. package/dist/Select.js +325 -314
  9. package/dist/Sidebar.cjs +1 -1
  10. package/dist/Sidebar.js +3 -3
  11. package/dist/{Table-DYO-bPlD.cjs → Table-DBkiHOd0.cjs} +1 -1
  12. package/dist/{Table-BiRwd6PX.js → Table-DdTjtnRE.js} +1 -1
  13. package/dist/Table.cjs +1 -1
  14. package/dist/Table.js +1 -1
  15. package/dist/Tooltip-4RWCnb2Q.js +229 -0
  16. package/dist/Tooltip-B2rZmRCs.cjs +1 -0
  17. package/dist/Tooltip.cjs +1 -1
  18. package/dist/Tooltip.js +1 -1
  19. package/dist/components/Popover/Popover.d.ts +17 -0
  20. package/dist/components/Popover/index.d.ts +1 -1
  21. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +12 -10
  22. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +3 -1
  23. package/dist/components/Portal/utils/floating-alignment.d.ts +18 -0
  24. package/dist/components/Portal/utils/floating-position.d.ts +7 -36
  25. package/dist/components/Portal/utils/geometry.d.ts +45 -0
  26. package/dist/components/Select/Select.d.ts +1 -1
  27. package/dist/components/Select/components/CustomSelect.d.ts +9 -0
  28. package/dist/components/Select/components/SelectListbox.d.ts +3 -0
  29. package/dist/components/Select/hooks/useSelectPosition.d.ts +3 -1
  30. package/dist/components/Select/index.d.ts +1 -1
  31. package/dist/components/Select/utils/listbox-position.d.ts +8 -5
  32. package/dist/components/Tooltip/Tooltip.d.ts +10 -0
  33. package/dist/components/Tooltip/index.d.ts +1 -1
  34. package/dist/index.cjs +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/tokens.d.ts +2 -8
  38. package/dist/{units-CpnLv2H4.cjs → units-BEMW4BNr.cjs} +1 -1
  39. package/dist/{units-Bx_CBIy8.js → units-D4Waz9EO.js} +1 -5
  40. package/dist/useAnchoredPosition-CrdY2Eat.cjs +1 -0
  41. package/dist/useAnchoredPosition-xI79veB2.js +79 -0
  42. package/dist/useFloatingPosition-DPVO2E8O.cjs +1 -0
  43. package/dist/useFloatingPosition-DktY7k-t.js +110 -0
  44. package/package.json +1 -1
  45. package/dist/Tooltip-CxcO3Vu-.cjs +0 -1
  46. package/dist/Tooltip-WwAWQ_Kq.js +0 -226
  47. package/dist/useAnchoredPosition-C0VS7hm6.js +0 -105
  48. package/dist/useAnchoredPosition-D7GRFzoX.cjs +0 -1
  49. package/dist/useFloatingPosition-DQgw-w_Z.cjs +0 -1
  50. package/dist/useFloatingPosition-MGoyautY.js +0 -57
package/dist/Select.js CHANGED
@@ -1,112 +1,118 @@
1
1
  "use client";
2
- import { jsx as f, jsxs as R } from "react/jsx-runtime";
3
- import { useRef as T, useEffect as Y, useCallback as I, useMemo as ke, useId as Ee, useState as U, forwardRef as xe } from "react";
4
- import { u as B } from "./effects-DGbA6Q2O.js";
5
- import { h as le, r as ie } from "./aria-Bv-xVREf.js";
6
- import { a as De } from "./reference-CXMr27nM.js";
7
- import { I as $ } from "./Icon-DK4tkZtF.js";
8
- import { c as Oe, d as Re, b as Se, P as Le } from "./usePresence-BTRY1_l-.js";
9
- import { u as Ne } from "./useAnchoredPosition-C0VS7hm6.js";
10
- function Pe(t) {
11
- const { form: n, onReset: a, resetValue: l, triggerReference: o } = t, i = T(null);
12
- return Y(() => {
13
- var c;
14
- const s = (c = o.current) == null ? void 0 : c.form;
15
- if (!s) return;
16
- function m() {
17
- const v = i.current;
18
- if (v) {
19
- const b = Array.from(v.options), w = b.find(
20
- (y) => y.value === l
2
+ import { jsx as h, jsxs as O } from "react/jsx-runtime";
3
+ import { useRef as S, useEffect as Q, useCallback as I, useMemo as Ee, useId as xe, useState as Y, forwardRef as De } from "react";
4
+ import { u as ee } from "./effects-DGbA6Q2O.js";
5
+ import { h as le, r as oe } from "./aria-Bv-xVREf.js";
6
+ import { a as Oe } from "./reference-CXMr27nM.js";
7
+ import { I as G } from "./Icon-DK4tkZtF.js";
8
+ import { c as Re, d as Le, b as Ne, P as Pe } from "./usePresence-BTRY1_l-.js";
9
+ import { c as Ae, u as Te } from "./useAnchoredPosition-xI79veB2.js";
10
+ function Se(t) {
11
+ const { form: n, onReset: a, resetValue: i, triggerReference: s } = t, r = S(null);
12
+ return Q(() => {
13
+ var d;
14
+ const c = (d = s.current) == null ? void 0 : d.form;
15
+ if (!c) return;
16
+ function l() {
17
+ const u = r.current;
18
+ if (u) {
19
+ const b = Array.from(u.options), g = b.find(
20
+ (y) => y.value === i
21
21
  ) ?? b[0];
22
22
  b.forEach((y) => {
23
- y.defaultSelected = y === w;
23
+ y.defaultSelected = y === g;
24
24
  });
25
25
  }
26
26
  a();
27
27
  }
28
- return s.addEventListener("reset", m), () => s.removeEventListener("reset", m);
29
- }, [n, a, l, o]), i;
28
+ return c.addEventListener("reset", l), () => c.removeEventListener("reset", l);
29
+ }, [n, a, i, s]), r;
30
30
  }
31
- const W = 8, X = 4, Te = 160, Ae = 72;
32
- function He(t, n, a) {
33
- const l = a.bottom - t.bottom - X - W, o = t.top - a.top - X - W, i = l < Te && o > l, s = Math.max(
34
- Ae,
35
- i ? o : l
36
- ), m = Math.max(
31
+ const $ = 8, B = 4, He = 160, Me = 72;
32
+ function Ve(t, n, a, i = "start") {
33
+ const s = a.bottom - t.bottom - B - $, r = t.top - a.top - B - $, c = s < He && r > s, l = Math.max(
34
+ Me,
35
+ c ? r : s
36
+ ), d = Math.max(
37
37
  t.width,
38
38
  (n == null ? void 0 : n.width) ?? t.width
39
- ), c = a.left + W, v = Math.min(
40
- Math.max(c, t.left),
39
+ ), u = a.left + $, b = Ae(
40
+ i,
41
+ t.left,
42
+ t.width,
43
+ d
44
+ ), g = Math.min(
45
+ Math.max(u, b),
41
46
  Math.max(
42
- c,
43
- a.right - W - m
47
+ u,
48
+ a.right - $ - d
44
49
  )
45
- ), b = i ? Math.max(
46
- a.top + W,
47
- t.top - X - Math.min((n == null ? void 0 : n.height) ?? s, s)
48
- ) : t.bottom + X;
50
+ ), y = c ? Math.max(
51
+ a.top + $,
52
+ t.top - B - Math.min((n == null ? void 0 : n.height) ?? l, l)
53
+ ) : t.bottom + B;
49
54
  return {
50
- left: v,
51
- maxHeight: s,
55
+ left: g,
56
+ maxHeight: l,
52
57
  minWidth: t.width,
53
- top: b
58
+ top: y
54
59
  };
55
60
  }
56
- function Me(t, n, a, l) {
57
- const o = I(
58
- (i) => {
59
- const { panelBounds: s, triggerBounds: m, visibleBounds: c } = i;
60
- return He(
61
- m,
62
- s,
63
- c
61
+ function Ce(t, n, a, i, s = "start") {
62
+ const r = I(
63
+ (c) => {
64
+ const { panelSize: l, triggerBounds: d, visibleBounds: u } = c;
65
+ return Ve(
66
+ d,
67
+ l,
68
+ u,
69
+ s
64
70
  );
65
71
  },
66
- []
72
+ [s]
67
73
  );
68
- return Ne({
74
+ return Te({
69
75
  active: t,
70
- boundary: l,
71
- fit: o,
76
+ boundary: i,
77
+ fit: r,
72
78
  panel: a,
73
79
  trigger: n
74
80
  });
75
81
  }
76
- const Ve = 500;
77
- function Ce(t) {
78
- const n = T(""), a = T(null), l = T(null);
79
- return Y(() => () => {
80
- const o = l.current;
81
- o && a.current !== null && o.clearTimeout(a.current);
82
- }, []), I((o) => {
83
- var c;
84
- const i = (c = t.current) == null ? void 0 : c.ownerDocument.defaultView;
85
- if (!i) return null;
86
- l.current = i;
87
- const s = n.current + o, m = Array.from(s).every((v) => v === o);
88
- return n.current = m ? o : s, a.current !== null && i.clearTimeout(a.current), a.current = i.setTimeout(() => {
82
+ const We = 500;
83
+ function $e(t) {
84
+ const n = S(""), a = S(null), i = S(null);
85
+ return Q(() => () => {
86
+ const s = i.current;
87
+ s && a.current !== null && s.clearTimeout(a.current);
88
+ }, []), I((s) => {
89
+ var d;
90
+ const r = (d = t.current) == null ? void 0 : d.ownerDocument.defaultView;
91
+ if (!r) return null;
92
+ i.current = r;
93
+ const c = n.current + s, l = Array.from(c).every((u) => u === s);
94
+ return n.current = l ? s : c, a.current !== null && r.clearTimeout(a.current), a.current = r.setTimeout(() => {
89
95
  n.current = "", a.current = null;
90
- }, Ve), n.current;
96
+ }, We), n.current;
91
97
  }, [t]);
92
98
  }
93
- function Z(t, n, a) {
99
+ function z(t, n, a) {
94
100
  if (t.length === 0) return -1;
95
- for (let l = 1; l <= t.length; l += 1) {
96
- const o = (n + a * l + t.length) % t.length;
97
- if (!t[o].disabled) return o;
101
+ for (let i = 1; i <= t.length; i += 1) {
102
+ const s = (n + a * i + t.length) % t.length;
103
+ if (!t[s].disabled) return s;
98
104
  }
99
105
  return -1;
100
106
  }
101
- function We(t, n, a) {
102
- for (let l = 1; l <= t.length; l += 1) {
103
- const o = (a + l + t.length) % t.length, i = t[o];
104
- if (!i.disabled && i.label.toLocaleLowerCase().startsWith(n))
105
- return o;
107
+ function Ge(t, n, a) {
108
+ for (let i = 1; i <= t.length; i += 1) {
109
+ const s = (a + i + t.length) % t.length, r = t[s];
110
+ if (!r.disabled && r.label.toLocaleLowerCase().startsWith(n))
111
+ return s;
106
112
  }
107
113
  return -1;
108
114
  }
109
- function $e(t) {
115
+ function Ke(t) {
110
116
  const n = /* @__PURE__ */ new Set();
111
117
  t.forEach((a) => {
112
118
  if (n.has(a.value))
@@ -114,278 +120,282 @@ function $e(t) {
114
120
  n.add(a.value);
115
121
  });
116
122
  }
117
- function Ge(t) {
123
+ function qe(t) {
118
124
  const {
119
125
  active: n,
120
- closeOnEscape: a,
121
- closeOnOutsideInteraction: l,
122
- highlightedIndex: o,
123
- id: i,
124
- listboxReference: s,
125
- onEscapeDismiss: m,
126
- onEscapeKeyDown: c,
127
- onHighlight: v,
128
- onOutsideDismiss: b,
129
- onPointerDownOutside: w,
130
- onSelect: y,
131
- options: _,
132
- ownerDocument: A,
133
- position: x,
134
- selectedValue: D,
135
- state: S,
136
- triggerReference: G
137
- } = t, u = T(null), K = B("Select").boundaryElement, O = Oe(!0, K), q = ke(
138
- () => [G, u],
139
- [G]
140
- ), F = I(
141
- (d) => {
142
- u.current = d, s(d);
126
+ align: a,
127
+ closeOnEscape: i,
128
+ closeOnOutsideInteraction: s,
129
+ highlightedIndex: r,
130
+ id: c,
131
+ listboxReference: l,
132
+ onEscapeDismiss: d,
133
+ onEscapeKeyDown: u,
134
+ onHighlight: b,
135
+ onOutsideDismiss: g,
136
+ onPointerDownOutside: y,
137
+ onSelect: R,
138
+ options: L,
139
+ ownerDocument: H,
140
+ position: E,
141
+ selectedValue: x,
142
+ state: N,
143
+ triggerReference: K
144
+ } = t, m = S(null), q = ee("Select").boundaryElement, D = Re(!0, q), F = Ee(
145
+ () => [K, m],
146
+ [K]
147
+ ), j = I(
148
+ (f) => {
149
+ m.current = f, l(f);
143
150
  },
144
- [s]
151
+ [l]
145
152
  );
146
- return Re({
153
+ return Le({
147
154
  active: n,
148
- boundaries: q,
149
- boundary: K,
150
- dismissOnEscape: a,
151
- dismissOnPointerDownOutside: l,
152
- layerId: O.id,
153
- onEscapeDismiss: m,
154
- onEscapeKeyDown: c,
155
- onPointerDownOutside: w,
156
- onPointerDownOutsideDismiss: b,
157
- ownerDocument: A
158
- }), /* @__PURE__ */ f(
155
+ boundaries: F,
156
+ boundary: q,
157
+ dismissOnEscape: i,
158
+ dismissOnPointerDownOutside: s,
159
+ layerId: D.id,
160
+ onEscapeDismiss: d,
161
+ onEscapeKeyDown: u,
162
+ onPointerDownOutside: y,
163
+ onPointerDownOutsideDismiss: g,
164
+ ownerDocument: H
165
+ }), /* @__PURE__ */ h(
159
166
  "div",
160
167
  {
161
168
  "aria-hidden": n ? void 0 : !0,
162
- "aria-labelledby": i,
169
+ "aria-labelledby": c,
163
170
  className: "nk-select__listbox",
164
- "data-state": S,
165
- id: `${i}-listbox`,
166
- ref: F,
171
+ "data-align": a,
172
+ "data-state": N,
173
+ id: `${c}-listbox`,
174
+ ref: j,
167
175
  role: "listbox",
168
- style: x ? {
169
- left: x.left,
170
- maxHeight: x.maxHeight,
171
- minWidth: x.minWidth,
172
- top: x.top,
173
- zIndex: O.zIndex
174
- } : { visibility: "hidden", zIndex: O.zIndex },
175
- children: _.map((d, H) => /* @__PURE__ */ R(
176
+ style: E ? {
177
+ left: E.left,
178
+ maxHeight: E.maxHeight,
179
+ minWidth: E.minWidth,
180
+ top: E.top,
181
+ zIndex: D.zIndex
182
+ } : { visibility: "hidden", zIndex: D.zIndex },
183
+ children: L.map((f, M) => /* @__PURE__ */ O(
176
184
  "div",
177
185
  {
178
- "aria-disabled": d.disabled || void 0,
179
- "aria-selected": d.value === D,
186
+ "aria-disabled": f.disabled || void 0,
187
+ "aria-selected": f.value === x,
180
188
  className: "nk-select__option",
181
- "data-highlighted": H === o || void 0,
182
- "data-selected": d.value === D || void 0,
183
- id: `${i}-option-${H}`,
184
- onPointerDown: (Q) => {
185
- Q.preventDefault(), d.disabled || y(d);
189
+ "data-highlighted": M === r || void 0,
190
+ "data-selected": f.value === x || void 0,
191
+ id: `${c}-option-${M}`,
192
+ onPointerDown: (J) => {
193
+ J.preventDefault(), f.disabled || R(f);
186
194
  },
187
195
  onPointerMove: () => {
188
- d.disabled || v(H);
196
+ f.disabled || b(M);
189
197
  },
190
198
  role: "option",
191
199
  children: [
192
- d.icon ? /* @__PURE__ */ f($, { type: d.icon }) : null,
193
- /* @__PURE__ */ f("span", { className: "nk-select__option-label", children: d.label }),
194
- d.value === D ? /* @__PURE__ */ f($, { className: "nk-select__check", type: "checkmark" }) : null
200
+ f.icon ? /* @__PURE__ */ h(G, { type: f.icon }) : null,
201
+ /* @__PURE__ */ h("span", { className: "nk-select__option-label", children: f.label }),
202
+ f.value === x ? /* @__PURE__ */ h(G, { className: "nk-select__check", type: "checkmark" }) : null
195
203
  ]
196
204
  },
197
- d.value
205
+ f.value
198
206
  ))
199
207
  }
200
208
  );
201
209
  }
202
- function Ke(t, n, a) {
203
- n.current = t, De(a, t);
210
+ function Fe(t, n, a) {
211
+ n.current = t, Oe(a, t);
204
212
  }
205
- function qe(t) {
206
- var ne;
213
+ function je(t) {
214
+ var ae;
207
215
  const {
208
216
  "aria-invalid": n,
209
- className: a,
210
- closeOnEscape: l = !0,
211
- closeOnOutsideInteraction: o = !0,
212
- defaultValue: i = "",
213
- disabled: s = !1,
214
- displayOverride: m,
215
- form: c,
216
- forwardedReference: v,
217
- id: b,
218
- invalid: w = !1,
219
- name: y,
220
- onChange: _,
221
- onClick: A,
222
- onEscapeKeyDown: x,
223
- onKeyDown: D,
224
- onOpenChange: S,
225
- onPointerDownOutside: G,
226
- options: u,
227
- placeholder: K,
228
- required: O = !1,
229
- style: q,
230
- value: F,
231
- width: d,
232
- ...H
217
+ align: a = "start",
218
+ className: i,
219
+ closeOnEscape: s = !0,
220
+ closeOnOutsideInteraction: r = !0,
221
+ defaultValue: c = "",
222
+ disabled: l = !1,
223
+ displayOverride: d,
224
+ form: u,
225
+ forwardedReference: b,
226
+ id: g,
227
+ invalid: y = !1,
228
+ name: R,
229
+ onChange: L,
230
+ onClick: H,
231
+ onEscapeKeyDown: E,
232
+ onKeyDown: x,
233
+ onOpenChange: N,
234
+ onPointerDownOutside: K,
235
+ options: m,
236
+ placeholder: q,
237
+ required: D = !1,
238
+ style: F,
239
+ value: j,
240
+ width: f,
241
+ ...M
233
242
  } = t;
234
- $e(u);
235
- const Q = Ee(), L = b ?? Q, g = T(null), [M, se] = U(null), [h, oe] = U(!1), [k, V] = U(-1), [re, ee] = U(i), N = F !== void 0, P = N ? F : re, ce = u.find(
236
- (e) => e.value === P
237
- ), de = w || le(n), ue = ie(w, n), J = Se(h), C = ((ne = g.current) == null ? void 0 : ne.ownerDocument) ?? (typeof document > "u" ? null : document), fe = B("Select").boundaryElement, me = Me(
238
- J.present,
239
- g.current,
240
- M,
241
- fe
242
- ), he = Ce(g), pe = d === void 0 ? q : { ...q, width: d }, j = m ?? ce, ve = I(
243
- (e) => Ke(
243
+ Ke(m);
244
+ const J = xe(), P = g ?? J, w = S(null), [V, ie] = Y(null), [p, re] = Y(!1), [_, C] = Y(-1), [ce, te] = Y(c), A = j !== void 0, T = A ? j : ce, de = m.find(
245
+ (e) => e.value === T
246
+ ), ue = y || le(n), fe = oe(y, n), Z = Ne(p), W = ((ae = w.current) == null ? void 0 : ae.ownerDocument) ?? (typeof document > "u" ? null : document), me = ee("Select").boundaryElement, he = Ce(
247
+ Z.present,
248
+ w.current,
249
+ V,
250
+ me,
251
+ a
252
+ ), pe = $e(w), ve = f === void 0 ? F : { ...F, width: f }, U = d ?? de, be = I(
253
+ (e) => Fe(
244
254
  e,
245
- g,
246
- v
255
+ w,
256
+ b
247
257
  ),
248
- [v]
249
- ), p = I((e) => {
250
- h !== e && (oe(e), S == null || S(e));
251
- }, [S, h]), be = I(() => {
252
- N || ee(i), p(!1);
253
- }, [i, N, p]), ye = Pe({
254
- form: c,
255
- onReset: be,
256
- resetValue: N ? P : i,
257
- triggerReference: g
258
- }), z = I((e = 1) => {
259
- const r = u.findIndex(
260
- (ae) => ae.value === P && !ae.disabled
261
- ), E = e === 1 ? -1 : u.length;
262
- V(
263
- r >= 0 ? r : Z(u, E, e)
264
- ), p(!0);
265
- }, [u, P, p]), te = I((e) => {
266
- var r;
267
- s || e.disabled || (N || ee(e.value), p(!1), (r = g.current) == null || r.focus(), _ == null || _(e.value));
268
- }, [s, N, _, p]), Ie = I(() => {
258
+ [b]
259
+ ), v = I((e) => {
260
+ p !== e && (re(e), N == null || N(e));
261
+ }, [N, p]), ye = I(() => {
262
+ A || te(c), v(!1);
263
+ }, [c, A, v]), Ie = Se({
264
+ form: u,
265
+ onReset: ye,
266
+ resetValue: A ? T : c,
267
+ triggerReference: w
268
+ }), X = I((e = 1) => {
269
+ const o = m.findIndex(
270
+ (se) => se.value === T && !se.disabled
271
+ ), k = e === 1 ? -1 : m.length;
272
+ C(
273
+ o >= 0 ? o : z(m, k, e)
274
+ ), v(!0);
275
+ }, [m, T, v]), ne = I((e) => {
276
+ var o;
277
+ l || e.disabled || (A || te(e.value), v(!1), (o = w.current) == null || o.focus(), L == null || L(e.value));
278
+ }, [l, A, L, v]), ge = I(() => {
269
279
  var e;
270
- p(!1), (e = g.current) == null || e.focus();
271
- }, [p]), ge = I(() => {
272
- p(!1);
273
- }, [p]);
274
- function we(e) {
275
- A == null || A(e), !(e.defaultPrevented || s) && (h ? p(!1) : z());
276
- }
280
+ v(!1), (e = w.current) == null || e.focus();
281
+ }, [v]), we = I(() => {
282
+ v(!1);
283
+ }, [v]);
277
284
  function _e(e) {
278
- if (D == null || D(e), !(e.defaultPrevented || s)) {
285
+ H == null || H(e), !(e.defaultPrevented || l) && (p ? v(!1) : X());
286
+ }
287
+ function ke(e) {
288
+ if (x == null || x(e), !(e.defaultPrevented || l)) {
279
289
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
280
290
  e.preventDefault();
281
- const r = e.key === "ArrowDown" ? 1 : -1;
282
- h ? V(
283
- (E) => Z(u, E, r)
284
- ) : z(r);
291
+ const o = e.key === "ArrowDown" ? 1 : -1;
292
+ p ? C(
293
+ (k) => z(m, k, o)
294
+ ) : X(o);
285
295
  return;
286
296
  }
287
297
  if (e.key === "Home" || e.key === "End") {
288
- if (e.preventDefault(), !h) z(e.key === "Home" ? 1 : -1);
298
+ if (e.preventDefault(), !p) X(e.key === "Home" ? 1 : -1);
289
299
  else {
290
- const r = e.key === "Home" ? 1 : -1, E = r === 1 ? -1 : u.length;
291
- V(
292
- Z(u, E, r)
300
+ const o = e.key === "Home" ? 1 : -1, k = o === 1 ? -1 : m.length;
301
+ C(
302
+ z(m, k, o)
293
303
  );
294
304
  }
295
305
  return;
296
306
  }
297
307
  if (e.key === "Enter" || e.key === " ") {
298
308
  e.preventDefault();
299
- const r = u[k];
300
- h && r ? te(r) : h || z();
309
+ const o = m[_];
310
+ p && o ? ne(o) : p || X();
301
311
  return;
302
312
  }
303
313
  if (e.key === "Tab") {
304
- p(!1);
314
+ v(!1);
305
315
  return;
306
316
  }
307
317
  if (e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
308
- const r = he(e.key.toLocaleLowerCase());
309
- if (r === null) return;
310
- const E = We(
311
- u,
312
- r,
313
- k
318
+ const o = pe(e.key.toLocaleLowerCase());
319
+ if (o === null) return;
320
+ const k = Ge(
321
+ m,
322
+ o,
323
+ _
314
324
  );
315
- E >= 0 && (e.preventDefault(), h || p(!0), V(E));
325
+ k >= 0 && (e.preventDefault(), p || v(!0), C(k));
316
326
  }
317
327
  }
318
328
  }
319
- return Y(() => {
320
- s && p(!1);
321
- }, [s, p]), Y(() => {
329
+ return Q(() => {
330
+ l && v(!1);
331
+ }, [l, v]), Q(() => {
322
332
  var e;
323
- if (h && k >= 0) {
324
- const r = C == null ? void 0 : C.getElementById(
325
- `${L}-option-${k}`
333
+ if (p && _ >= 0) {
334
+ const o = W == null ? void 0 : W.getElementById(
335
+ `${P}-option-${_}`
326
336
  );
327
- r && (M != null && M.contains(r)) && ((e = r.scrollIntoView) == null || e.call(r, { block: "nearest" }));
337
+ o && (V != null && V.contains(o)) && ((e = o.scrollIntoView) == null || e.call(o, { block: "nearest" }));
328
338
  }
329
- }, [k, L, M, h]), /* @__PURE__ */ R(
339
+ }, [_, P, V, p]), /* @__PURE__ */ O(
330
340
  "span",
331
341
  {
332
- className: ["nk-select", a].filter(Boolean).join(" "),
333
- "data-disabled": s || void 0,
334
- "data-invalid": de || void 0,
342
+ className: ["nk-select", i].filter(Boolean).join(" "),
343
+ "data-disabled": l || void 0,
344
+ "data-invalid": ue || void 0,
335
345
  "data-mode": "custom",
336
- "data-open": h || void 0,
337
- style: pe,
346
+ "data-open": p || void 0,
347
+ style: ve,
338
348
  children: [
339
- /* @__PURE__ */ R(
349
+ /* @__PURE__ */ O(
340
350
  "button",
341
351
  {
342
- ...H,
343
- ref: ve,
344
- "aria-activedescendant": h && k >= 0 ? `${L}-option-${k}` : void 0,
345
- "aria-controls": `${L}-listbox`,
346
- "aria-expanded": h,
352
+ ...M,
353
+ ref: be,
354
+ "aria-activedescendant": p && _ >= 0 ? `${P}-option-${_}` : void 0,
355
+ "aria-controls": `${P}-listbox`,
356
+ "aria-expanded": p,
347
357
  "aria-haspopup": "listbox",
348
- "aria-invalid": ue,
349
- "aria-required": O || void 0,
358
+ "aria-invalid": fe,
359
+ "aria-required": D || void 0,
350
360
  "aria-autocomplete": "none",
351
361
  className: "nk-select__trigger",
352
- disabled: s,
353
- form: c,
354
- id: L,
355
- onClick: we,
356
- onKeyDown: _e,
362
+ disabled: l,
363
+ form: u,
364
+ id: P,
365
+ onClick: _e,
366
+ onKeyDown: ke,
357
367
  role: "combobox",
358
368
  type: "button",
359
369
  children: [
360
- j ? /* @__PURE__ */ R("span", { className: "nk-select__value", children: [
361
- j.icon ? /* @__PURE__ */ f($, { type: j.icon }) : null,
362
- /* @__PURE__ */ f("span", { className: "nk-select__value-label", children: j.label })
363
- ] }) : /* @__PURE__ */ f("span", { className: "nk-select__placeholder", children: K }),
364
- /* @__PURE__ */ f($, { className: "nk-select__icon", type: "chevron-down" })
370
+ U ? /* @__PURE__ */ O("span", { className: "nk-select__value", children: [
371
+ U.icon ? /* @__PURE__ */ h(G, { type: U.icon }) : null,
372
+ /* @__PURE__ */ h("span", { className: "nk-select__value-label", children: U.label })
373
+ ] }) : /* @__PURE__ */ h("span", { className: "nk-select__placeholder", children: q }),
374
+ /* @__PURE__ */ h(G, { className: "nk-select__icon", type: "chevron-down" })
365
375
  ]
366
376
  }
367
377
  ),
368
- y || O ? /* @__PURE__ */ R(
378
+ R || D ? /* @__PURE__ */ O(
369
379
  "select",
370
380
  {
371
- ref: ye,
381
+ ref: Ie,
372
382
  "aria-hidden": "true",
373
383
  className: "nk-select__form-control",
374
- disabled: s,
375
- form: c,
376
- name: y,
384
+ disabled: l,
385
+ form: u,
386
+ name: R,
377
387
  onChange: () => {
378
388
  },
379
389
  onInvalid: (e) => {
380
- var r;
381
- e.preventDefault(), (r = g.current) == null || r.focus();
390
+ var o;
391
+ e.preventDefault(), (o = w.current) == null || o.focus();
382
392
  },
383
- required: O,
393
+ required: D,
384
394
  tabIndex: -1,
385
- value: P,
395
+ value: T,
386
396
  children: [
387
- /* @__PURE__ */ f("option", { value: "" }),
388
- u.map((e) => /* @__PURE__ */ f(
397
+ /* @__PURE__ */ h("option", { value: "" }),
398
+ m.map((e) => /* @__PURE__ */ h(
389
399
  "option",
390
400
  {
391
401
  disabled: e.disabled,
@@ -397,87 +407,88 @@ function qe(t) {
397
407
  ]
398
408
  }
399
409
  ) : null,
400
- J.present && C ? /* @__PURE__ */ f(Le, { children: /* @__PURE__ */ f(
401
- Ge,
410
+ Z.present && W ? /* @__PURE__ */ h(Pe, { children: /* @__PURE__ */ h(
411
+ qe,
402
412
  {
403
- active: h,
404
- closeOnEscape: l,
405
- closeOnOutsideInteraction: o,
406
- highlightedIndex: k,
407
- id: L,
408
- listboxReference: se,
409
- onEscapeDismiss: Ie,
410
- onEscapeKeyDown: x,
411
- onHighlight: V,
412
- onOutsideDismiss: ge,
413
- onPointerDownOutside: G,
414
- onSelect: te,
415
- options: u,
416
- ownerDocument: C,
417
- position: me,
418
- selectedValue: P,
419
- state: J.state === "closing" ? "closing" : "open",
420
- triggerReference: g
413
+ active: p,
414
+ align: a,
415
+ closeOnEscape: s,
416
+ closeOnOutsideInteraction: r,
417
+ highlightedIndex: _,
418
+ id: P,
419
+ listboxReference: ie,
420
+ onEscapeDismiss: ge,
421
+ onEscapeKeyDown: E,
422
+ onHighlight: C,
423
+ onOutsideDismiss: we,
424
+ onPointerDownOutside: K,
425
+ onSelect: ne,
426
+ options: m,
427
+ ownerDocument: W,
428
+ position: he,
429
+ selectedValue: T,
430
+ state: Z.state === "closing" ? "closing" : "open",
431
+ triggerReference: w
421
432
  }
422
433
  ) }) : null
423
434
  ]
424
435
  }
425
436
  );
426
437
  }
427
- function Fe(t) {
438
+ function Ue(t) {
428
439
  const {
429
440
  "aria-invalid": n,
430
441
  children: a,
431
- className: l,
432
- defaultValue: o,
433
- disabled: i = !1,
434
- forwardedReference: s,
435
- invalid: m = !1,
436
- placeholder: c,
437
- style: v,
442
+ className: i,
443
+ defaultValue: s,
444
+ disabled: r = !1,
445
+ forwardedReference: c,
446
+ invalid: l = !1,
447
+ placeholder: d,
448
+ style: u,
438
449
  value: b,
439
- ...w
440
- } = t, y = ie(m, n), _ = m || le(n);
441
- return /* @__PURE__ */ R(
450
+ ...g
451
+ } = t, y = oe(l, n), R = l || le(n);
452
+ return /* @__PURE__ */ O(
442
453
  "span",
443
454
  {
444
- className: ["nk-select", l].filter(Boolean).join(" "),
445
- "data-disabled": i || void 0,
446
- "data-invalid": _ || void 0,
455
+ className: ["nk-select", i].filter(Boolean).join(" "),
456
+ "data-disabled": r || void 0,
457
+ "data-invalid": R || void 0,
447
458
  "data-mode": "native",
448
- style: v,
459
+ style: u,
449
460
  children: [
450
- /* @__PURE__ */ R(
461
+ /* @__PURE__ */ O(
451
462
  "select",
452
463
  {
453
- ...w,
454
- ref: s,
464
+ ...g,
465
+ ref: c,
455
466
  "aria-invalid": y,
456
467
  className: "nk-select__control",
457
- defaultValue: b === void 0 ? o ?? (c !== void 0 ? "" : void 0) : void 0,
458
- disabled: i,
468
+ defaultValue: b === void 0 ? s ?? (d !== void 0 ? "" : void 0) : void 0,
469
+ disabled: r,
459
470
  value: b,
460
471
  children: [
461
- c !== void 0 ? /* @__PURE__ */ f("option", { disabled: !0, value: "", children: c }) : null,
472
+ d !== void 0 ? /* @__PURE__ */ h("option", { disabled: !0, value: "", children: d }) : null,
462
473
  a
463
474
  ]
464
475
  }
465
476
  ),
466
- /* @__PURE__ */ f($, { className: "nk-select__icon", type: "chevron-down" })
477
+ /* @__PURE__ */ h(G, { className: "nk-select__icon", type: "chevron-down" })
467
478
  ]
468
479
  }
469
480
  );
470
481
  }
471
- const Be = xe(function(n, a) {
472
- const { options: l } = n;
473
- return B("Select"), l !== void 0 ? /* @__PURE__ */ f(
474
- qe,
482
+ const tt = De(function(n, a) {
483
+ const { options: i } = n;
484
+ return ee("Select"), i !== void 0 ? /* @__PURE__ */ h(
485
+ je,
475
486
  {
476
487
  ...n,
477
488
  forwardedReference: a
478
489
  }
479
- ) : /* @__PURE__ */ f(
480
- Fe,
490
+ ) : /* @__PURE__ */ h(
491
+ Ue,
481
492
  {
482
493
  ...n,
483
494
  forwardedReference: a
@@ -485,5 +496,5 @@ const Be = xe(function(n, a) {
485
496
  );
486
497
  });
487
498
  export {
488
- Be as default
499
+ tt as default
489
500
  };