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.
- package/dist/Boundary.cjs +1 -1
- package/dist/Boundary.js +1 -1
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +1 -1
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +104 -101
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +325 -314
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +3 -3
- package/dist/{Table-DYO-bPlD.cjs → Table-DBkiHOd0.cjs} +1 -1
- package/dist/{Table-BiRwd6PX.js → Table-DdTjtnRE.js} +1 -1
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tooltip-4RWCnb2Q.js +229 -0
- package/dist/Tooltip-B2rZmRCs.cjs +1 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components/Popover/Popover.d.ts +17 -0
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +12 -10
- package/dist/components/Portal/hooks/useFloatingPosition.d.ts +3 -1
- package/dist/components/Portal/utils/floating-alignment.d.ts +18 -0
- package/dist/components/Portal/utils/floating-position.d.ts +7 -36
- package/dist/components/Portal/utils/geometry.d.ts +45 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/components/CustomSelect.d.ts +9 -0
- package/dist/components/Select/components/SelectListbox.d.ts +3 -0
- package/dist/components/Select/hooks/useSelectPosition.d.ts +3 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/utils/listbox-position.d.ts +8 -5
- package/dist/components/Tooltip/Tooltip.d.ts +10 -0
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +2 -8
- package/dist/{units-CpnLv2H4.cjs → units-BEMW4BNr.cjs} +1 -1
- package/dist/{units-Bx_CBIy8.js → units-D4Waz9EO.js} +1 -5
- package/dist/useAnchoredPosition-CrdY2Eat.cjs +1 -0
- package/dist/useAnchoredPosition-xI79veB2.js +79 -0
- package/dist/useFloatingPosition-DPVO2E8O.cjs +1 -0
- package/dist/useFloatingPosition-DktY7k-t.js +110 -0
- package/package.json +1 -1
- package/dist/Tooltip-CxcO3Vu-.cjs +0 -1
- package/dist/Tooltip-WwAWQ_Kq.js +0 -226
- package/dist/useAnchoredPosition-C0VS7hm6.js +0 -105
- package/dist/useAnchoredPosition-D7GRFzoX.cjs +0 -1
- package/dist/useFloatingPosition-DQgw-w_Z.cjs +0 -1
- package/dist/useFloatingPosition-MGoyautY.js +0 -57
package/dist/Select.js
CHANGED
|
@@ -1,112 +1,118 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { u as
|
|
5
|
-
import { h as le, r as
|
|
6
|
-
import { a as
|
|
7
|
-
import { I as
|
|
8
|
-
import { c as
|
|
9
|
-
import { u as
|
|
10
|
-
function
|
|
11
|
-
const { form: n, onReset: a, resetValue:
|
|
12
|
-
return
|
|
13
|
-
var
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
const b = Array.from(
|
|
20
|
-
(y) => y.value ===
|
|
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 ===
|
|
23
|
+
y.defaultSelected = y === g;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
a();
|
|
27
27
|
}
|
|
28
|
-
return
|
|
29
|
-
}, [n, a,
|
|
28
|
+
return c.addEventListener("reset", l), () => c.removeEventListener("reset", l);
|
|
29
|
+
}, [n, a, i, s]), r;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
),
|
|
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
|
-
),
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
a.right -
|
|
47
|
+
u,
|
|
48
|
+
a.right - $ - d
|
|
44
49
|
)
|
|
45
|
-
),
|
|
46
|
-
a.top +
|
|
47
|
-
t.top -
|
|
48
|
-
) : t.bottom +
|
|
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:
|
|
51
|
-
maxHeight:
|
|
55
|
+
left: g,
|
|
56
|
+
maxHeight: l,
|
|
52
57
|
minWidth: t.width,
|
|
53
|
-
top:
|
|
58
|
+
top: y
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
(
|
|
59
|
-
const {
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
74
|
+
return Te({
|
|
69
75
|
active: t,
|
|
70
|
-
boundary:
|
|
71
|
-
fit:
|
|
76
|
+
boundary: i,
|
|
77
|
+
fit: r,
|
|
72
78
|
panel: a,
|
|
73
79
|
trigger: n
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
|
-
const
|
|
77
|
-
function
|
|
78
|
-
const n =
|
|
79
|
-
return
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
}, []), I((
|
|
83
|
-
var
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
return n.current =
|
|
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
|
-
},
|
|
96
|
+
}, We), n.current;
|
|
91
97
|
}, [t]);
|
|
92
98
|
}
|
|
93
|
-
function
|
|
99
|
+
function z(t, n, a) {
|
|
94
100
|
if (t.length === 0) return -1;
|
|
95
|
-
for (let
|
|
96
|
-
const
|
|
97
|
-
if (!t[
|
|
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
|
|
102
|
-
for (let
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
105
|
-
return
|
|
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
|
|
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
|
|
123
|
+
function qe(t) {
|
|
118
124
|
const {
|
|
119
125
|
active: n,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
[
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
[
|
|
151
|
+
[l]
|
|
145
152
|
);
|
|
146
|
-
return
|
|
153
|
+
return Le({
|
|
147
154
|
active: n,
|
|
148
|
-
boundaries:
|
|
149
|
-
boundary:
|
|
150
|
-
dismissOnEscape:
|
|
151
|
-
dismissOnPointerDownOutside:
|
|
152
|
-
layerId:
|
|
153
|
-
onEscapeDismiss:
|
|
154
|
-
onEscapeKeyDown:
|
|
155
|
-
onPointerDownOutside:
|
|
156
|
-
onPointerDownOutsideDismiss:
|
|
157
|
-
ownerDocument:
|
|
158
|
-
}), /* @__PURE__ */
|
|
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":
|
|
169
|
+
"aria-labelledby": c,
|
|
163
170
|
className: "nk-select__listbox",
|
|
164
|
-
"data-
|
|
165
|
-
|
|
166
|
-
|
|
171
|
+
"data-align": a,
|
|
172
|
+
"data-state": N,
|
|
173
|
+
id: `${c}-listbox`,
|
|
174
|
+
ref: j,
|
|
167
175
|
role: "listbox",
|
|
168
|
-
style:
|
|
169
|
-
left:
|
|
170
|
-
maxHeight:
|
|
171
|
-
minWidth:
|
|
172
|
-
top:
|
|
173
|
-
zIndex:
|
|
174
|
-
} : { visibility: "hidden", zIndex:
|
|
175
|
-
children:
|
|
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":
|
|
179
|
-
"aria-selected":
|
|
186
|
+
"aria-disabled": f.disabled || void 0,
|
|
187
|
+
"aria-selected": f.value === x,
|
|
180
188
|
className: "nk-select__option",
|
|
181
|
-
"data-highlighted":
|
|
182
|
-
"data-selected":
|
|
183
|
-
id: `${
|
|
184
|
-
onPointerDown: (
|
|
185
|
-
|
|
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
|
-
|
|
196
|
+
f.disabled || b(M);
|
|
189
197
|
},
|
|
190
198
|
role: "option",
|
|
191
199
|
children: [
|
|
192
|
-
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
|
|
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
|
-
|
|
205
|
+
f.value
|
|
198
206
|
))
|
|
199
207
|
}
|
|
200
208
|
);
|
|
201
209
|
}
|
|
202
|
-
function
|
|
203
|
-
n.current = t,
|
|
210
|
+
function Fe(t, n, a) {
|
|
211
|
+
n.current = t, Oe(a, t);
|
|
204
212
|
}
|
|
205
|
-
function
|
|
206
|
-
var
|
|
213
|
+
function je(t) {
|
|
214
|
+
var ae;
|
|
207
215
|
const {
|
|
208
216
|
"aria-invalid": n,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
235
|
-
const
|
|
236
|
-
(e) => e.value ===
|
|
237
|
-
),
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
246
|
-
|
|
255
|
+
w,
|
|
256
|
+
b
|
|
247
257
|
),
|
|
248
|
-
[
|
|
249
|
-
),
|
|
250
|
-
|
|
251
|
-
}, [
|
|
252
|
-
|
|
253
|
-
}, [
|
|
254
|
-
form:
|
|
255
|
-
onReset:
|
|
256
|
-
resetValue:
|
|
257
|
-
triggerReference:
|
|
258
|
-
}),
|
|
259
|
-
const
|
|
260
|
-
(
|
|
261
|
-
),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
),
|
|
265
|
-
}, [
|
|
266
|
-
var
|
|
267
|
-
|
|
268
|
-
}, [
|
|
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
|
-
|
|
271
|
-
}, [
|
|
272
|
-
|
|
273
|
-
}, [
|
|
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
|
-
|
|
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
|
|
282
|
-
|
|
283
|
-
(
|
|
284
|
-
) :
|
|
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(), !
|
|
298
|
+
if (e.preventDefault(), !p) X(e.key === "Home" ? 1 : -1);
|
|
289
299
|
else {
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
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
|
|
300
|
-
|
|
309
|
+
const o = m[_];
|
|
310
|
+
p && o ? ne(o) : p || X();
|
|
301
311
|
return;
|
|
302
312
|
}
|
|
303
313
|
if (e.key === "Tab") {
|
|
304
|
-
|
|
314
|
+
v(!1);
|
|
305
315
|
return;
|
|
306
316
|
}
|
|
307
317
|
if (e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
318
|
+
const o = pe(e.key.toLocaleLowerCase());
|
|
319
|
+
if (o === null) return;
|
|
320
|
+
const k = Ge(
|
|
321
|
+
m,
|
|
322
|
+
o,
|
|
323
|
+
_
|
|
314
324
|
);
|
|
315
|
-
|
|
325
|
+
k >= 0 && (e.preventDefault(), p || v(!0), C(k));
|
|
316
326
|
}
|
|
317
327
|
}
|
|
318
328
|
}
|
|
319
|
-
return
|
|
320
|
-
|
|
321
|
-
}, [
|
|
329
|
+
return Q(() => {
|
|
330
|
+
l && v(!1);
|
|
331
|
+
}, [l, v]), Q(() => {
|
|
322
332
|
var e;
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
`${
|
|
333
|
+
if (p && _ >= 0) {
|
|
334
|
+
const o = W == null ? void 0 : W.getElementById(
|
|
335
|
+
`${P}-option-${_}`
|
|
326
336
|
);
|
|
327
|
-
|
|
337
|
+
o && (V != null && V.contains(o)) && ((e = o.scrollIntoView) == null || e.call(o, { block: "nearest" }));
|
|
328
338
|
}
|
|
329
|
-
}, [
|
|
339
|
+
}, [_, P, V, p]), /* @__PURE__ */ O(
|
|
330
340
|
"span",
|
|
331
341
|
{
|
|
332
|
-
className: ["nk-select",
|
|
333
|
-
"data-disabled":
|
|
334
|
-
"data-invalid":
|
|
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":
|
|
337
|
-
style:
|
|
346
|
+
"data-open": p || void 0,
|
|
347
|
+
style: ve,
|
|
338
348
|
children: [
|
|
339
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ O(
|
|
340
350
|
"button",
|
|
341
351
|
{
|
|
342
|
-
...
|
|
343
|
-
ref:
|
|
344
|
-
"aria-activedescendant":
|
|
345
|
-
"aria-controls": `${
|
|
346
|
-
"aria-expanded":
|
|
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":
|
|
349
|
-
"aria-required":
|
|
358
|
+
"aria-invalid": fe,
|
|
359
|
+
"aria-required": D || void 0,
|
|
350
360
|
"aria-autocomplete": "none",
|
|
351
361
|
className: "nk-select__trigger",
|
|
352
|
-
disabled:
|
|
353
|
-
form:
|
|
354
|
-
id:
|
|
355
|
-
onClick:
|
|
356
|
-
onKeyDown:
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
] }) : /* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
378
|
+
R || D ? /* @__PURE__ */ O(
|
|
369
379
|
"select",
|
|
370
380
|
{
|
|
371
|
-
ref:
|
|
381
|
+
ref: Ie,
|
|
372
382
|
"aria-hidden": "true",
|
|
373
383
|
className: "nk-select__form-control",
|
|
374
|
-
disabled:
|
|
375
|
-
form:
|
|
376
|
-
name:
|
|
384
|
+
disabled: l,
|
|
385
|
+
form: u,
|
|
386
|
+
name: R,
|
|
377
387
|
onChange: () => {
|
|
378
388
|
},
|
|
379
389
|
onInvalid: (e) => {
|
|
380
|
-
var
|
|
381
|
-
e.preventDefault(), (
|
|
390
|
+
var o;
|
|
391
|
+
e.preventDefault(), (o = w.current) == null || o.focus();
|
|
382
392
|
},
|
|
383
|
-
required:
|
|
393
|
+
required: D,
|
|
384
394
|
tabIndex: -1,
|
|
385
|
-
value:
|
|
395
|
+
value: T,
|
|
386
396
|
children: [
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
|
|
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
|
-
|
|
401
|
-
|
|
410
|
+
Z.present && W ? /* @__PURE__ */ h(Pe, { children: /* @__PURE__ */ h(
|
|
411
|
+
qe,
|
|
402
412
|
{
|
|
403
|
-
active:
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
|
438
|
+
function Ue(t) {
|
|
428
439
|
const {
|
|
429
440
|
"aria-invalid": n,
|
|
430
441
|
children: a,
|
|
431
|
-
className:
|
|
432
|
-
defaultValue:
|
|
433
|
-
disabled:
|
|
434
|
-
forwardedReference:
|
|
435
|
-
invalid:
|
|
436
|
-
placeholder:
|
|
437
|
-
style:
|
|
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
|
-
...
|
|
440
|
-
} = t, y =
|
|
441
|
-
return /* @__PURE__ */
|
|
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",
|
|
445
|
-
"data-disabled":
|
|
446
|
-
"data-invalid":
|
|
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:
|
|
459
|
+
style: u,
|
|
449
460
|
children: [
|
|
450
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ O(
|
|
451
462
|
"select",
|
|
452
463
|
{
|
|
453
|
-
...
|
|
454
|
-
ref:
|
|
464
|
+
...g,
|
|
465
|
+
ref: c,
|
|
455
466
|
"aria-invalid": y,
|
|
456
467
|
className: "nk-select__control",
|
|
457
|
-
defaultValue: b === void 0 ?
|
|
458
|
-
disabled:
|
|
468
|
+
defaultValue: b === void 0 ? s ?? (d !== void 0 ? "" : void 0) : void 0,
|
|
469
|
+
disabled: r,
|
|
459
470
|
value: b,
|
|
460
471
|
children: [
|
|
461
|
-
|
|
472
|
+
d !== void 0 ? /* @__PURE__ */ h("option", { disabled: !0, value: "", children: d }) : null,
|
|
462
473
|
a
|
|
463
474
|
]
|
|
464
475
|
}
|
|
465
476
|
),
|
|
466
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ h(G, { className: "nk-select__icon", type: "chevron-down" })
|
|
467
478
|
]
|
|
468
479
|
}
|
|
469
480
|
);
|
|
470
481
|
}
|
|
471
|
-
const
|
|
472
|
-
const { options:
|
|
473
|
-
return
|
|
474
|
-
|
|
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__ */
|
|
480
|
-
|
|
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
|
-
|
|
499
|
+
tt as default
|
|
489
500
|
};
|