neatkit 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Avatar-Belo7qAY.cjs +1 -0
- package/dist/Avatar-DjDCFqNG.js +55 -0
- package/dist/Avatar.cjs +1 -1
- package/dist/Avatar.js +2 -52
- package/dist/Boundary.cjs +1 -0
- package/dist/Boundary.js +176 -0
- package/dist/{Button-BAsLfA0D.js → Button-Chv4O66e.js} +35 -35
- package/dist/Button-DCKtFvSo.cjs +1 -0
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +213 -2
- package/dist/Code-ClkozPlv.js +227 -0
- package/dist/Code-JDb4VFl7.cjs +4 -0
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/{Icon-uQmpr5P2.js → Icon-BoEUoOk7.js} +144 -177
- package/dist/Icon-DJ4BigRz.cjs +1 -0
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +2 -35
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +70 -79
- package/dist/Markdown.cjs +1 -31
- package/dist/Markdown.js +461 -18062
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +100 -122
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +1 -1
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +106 -106
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +86 -41
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +326 -315
- package/dist/Sidebar.cjs +1 -0
- package/dist/Sidebar.js +475 -0
- package/dist/Skeleton.cjs +1 -1
- package/dist/Skeleton.js +20 -16
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.js +1 -1
- package/dist/Table-B30TBckZ.js +402 -0
- package/dist/Table-DceR12X9.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TextArea.cjs +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/Tooltip-B4bajPtk.cjs +1 -0
- package/dist/Tooltip-BVqdnKK_.js +231 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +2 -3
- package/dist/aria-Bntn6ad_.cjs +1 -0
- package/dist/aria-CeA9QfD1.js +15 -0
- package/dist/components/Boundary/Boundary.d.ts +65 -0
- package/dist/components/Boundary/contexts/BoundaryContext.d.ts +28 -0
- package/dist/components/Boundary/hooks/useBoundary.d.ts +19 -0
- package/dist/components/Boundary/hooks/useBoundaryWidth.d.ts +23 -0
- package/dist/components/Boundary/index.d.ts +2 -0
- package/dist/components/Boundary/utils/width.d.ts +11 -0
- package/dist/components/Checkbox/Checkbox.d.ts +9 -1
- package/dist/components/{CheckboxGroup → Checkbox/components}/CheckboxGroup.d.ts +2 -2
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/utils/checkbox-option.d.ts +17 -0
- package/dist/components/Icon/Icon.d.ts +1 -0
- package/dist/components/Icon/index.d.ts +0 -33
- package/dist/components/Input/Input.d.ts +1 -9
- package/dist/components/Modal/Modal.d.ts +0 -4
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +2 -6
- package/dist/components/Portal/Portal.d.ts +11 -8
- package/dist/components/Portal/hooks/useDismissableLayer.d.ts +2 -0
- package/dist/components/Portal/hooks/useFloatingPosition.d.ts +4 -3
- package/dist/components/Portal/hooks/useFocusTrap.d.ts +2 -0
- package/dist/components/Portal/hooks/useScrollLock.d.ts +9 -3
- package/dist/components/Portal/utils/boundary-focus.d.ts +23 -0
- package/dist/components/Portal/utils/floating-position.d.ts +43 -9
- package/dist/components/Portal/utils/overlay-stack.d.ts +22 -10
- package/dist/components/Portal/utils/scroll-container.d.ts +13 -0
- package/dist/components/Radio/Radio.d.ts +9 -1
- package/dist/components/{RadioGroup → Radio/components}/RadioGroup.d.ts +9 -2
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +0 -2
- package/dist/components/Select/utils/listbox-position.d.ts +28 -0
- package/dist/components/Sidebar/Sidebar.d.ts +108 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +19 -0
- package/dist/components/Sidebar/components/SidebarGroup.d.ts +42 -0
- package/dist/components/Sidebar/components/SidebarItem.d.ts +43 -0
- package/dist/components/Sidebar/components/SidebarOverlay.d.ts +38 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +47 -0
- package/dist/components/Sidebar/components/SidebarTrigger.d.ts +47 -0
- package/dist/components/Sidebar/components/SidebarUser.d.ts +59 -0
- package/dist/components/Sidebar/hooks/usePresentation.d.ts +14 -0
- package/dist/components/Sidebar/hooks/useSidebar.d.ts +9 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/Sidebar/utils/state.d.ts +62 -0
- package/dist/components/Skeleton/Skeleton.d.ts +21 -5
- package/dist/components/Table/Table.d.ts +9 -49
- package/dist/components/Table/contexts/TableContext.d.ts +4 -0
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +10 -4
- package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts +0 -1
- package/dist/effects-D5CWf-Pl.js +8 -0
- package/dist/effects-D85L_7zM.cjs +1 -0
- package/dist/floating-position-5wJ5G5IT.js +48 -0
- package/dist/floating-position-Cy9xxdH4.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +1 -0
- package/dist/useFloatingPosition-BBEUHPqy.cjs +1 -0
- package/dist/useFloatingPosition-CMirP2-2.js +43 -0
- package/dist/useFocusTrap-BrFZdMqQ.cjs +1 -0
- package/dist/useFocusTrap-DhVnlboe.js +136 -0
- package/dist/usePresence-B5RYv4e1.cjs +1 -0
- package/dist/usePresence-CqegYqy4.js +221 -0
- package/dist/useScrollLock-Drd7OZRC.js +62 -0
- package/dist/useScrollLock-Dy8MZaSn.cjs +1 -0
- package/dist/utils/aria.d.ts +9 -0
- package/dist/utils/effects.d.ts +12 -0
- package/package.json +11 -16
- package/dist/Button-D7JUO6Fs.cjs +0 -1
- package/dist/Checkbox-BvXM9VyY.js +0 -68
- package/dist/Checkbox-VQifZrZZ.cjs +0 -1
- package/dist/CheckboxGroup.cjs +0 -1
- package/dist/CheckboxGroup.js +0 -144
- package/dist/Code-BP2ZCmUf.js +0 -7446
- package/dist/Code-eispVOW3.cjs +0 -6
- package/dist/Content.cjs +0 -1
- package/dist/Content.js +0 -144
- package/dist/Icon-D8IZceys.cjs +0 -1
- package/dist/RadioGroup.cjs +0 -1
- package/dist/RadioGroup.js +0 -51
- package/dist/RadioGroupContext-BX9KnDek.cjs +0 -1
- package/dist/RadioGroupContext-DbKM4zPZ.js +0 -5
- package/dist/Table-83unQQOi.cjs +0 -1
- package/dist/Table-Cw8u-pEW.js +0 -403
- package/dist/Tooltip-BB82wNOE.cjs +0 -1
- package/dist/Tooltip-CqWK_GRD.js +0 -236
- package/dist/aria-DHnOMyYp.js +0 -10
- package/dist/aria-DKxpE8cA.cjs +0 -1
- package/dist/components/CheckboxGroup/index.d.ts +0 -2
- package/dist/components/Content/Content.d.ts +0 -60
- package/dist/components/Content/hooks/useContentLayout.d.ts +0 -18
- package/dist/components/Content/index.d.ts +0 -2
- package/dist/components/Content/utils/layout.d.ts +0 -11
- package/dist/components/RadioGroup/index.d.ts +0 -2
- package/dist/useFloatingPosition-CxzhAvy8.js +0 -73
- package/dist/useFloatingPosition-D1FqYy0l.cjs +0 -1
- package/dist/useFocusTrap--cgjy78G.cjs +0 -1
- package/dist/useFocusTrap-Da4nEash.js +0 -134
- package/dist/usePresence-DSPt6aKi.js +0 -210
- package/dist/usePresence-qe92UTvK.cjs +0 -1
- /package/dist/components/{CheckboxGroup → Checkbox}/contexts/CheckboxGroupContext.d.ts +0 -0
- /package/dist/components/{CheckboxGroup → Checkbox}/hooks/useCheckboxGroup.d.ts +0 -0
- /package/dist/components/{RadioGroup → Radio}/contexts/RadioGroupContext.d.ts +0 -0
- /package/dist/components/{RadioGroup → Radio}/hooks/useRadioGroup.d.ts +0 -0
package/dist/Select.js
CHANGED
|
@@ -1,412 +1,430 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { h as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { jsx as h, jsxs as S } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as Oe, useId as xe, useRef as K, useState as j, useCallback as R, useEffect as U, useMemo as Re } from "react";
|
|
4
|
+
import { h as ue, r as fe } from "./aria-CeA9QfD1.js";
|
|
5
|
+
import { I as X } from "./Icon-BoEUoOk7.js";
|
|
6
|
+
import { b as oe, c as Se, P as Ne, d as Pe, e as Te } from "./usePresence-CqegYqy4.js";
|
|
7
|
+
import { g as He } from "./floating-position-5wJ5G5IT.js";
|
|
8
|
+
const G = 8, ee = 4, Ce = 160, Me = 72;
|
|
9
|
+
function Ve(n, t, l) {
|
|
10
|
+
const a = l.bottom - n.bottom - ee - G, u = n.top - l.top - ee - G, c = a < Ce && u > a, o = Math.max(
|
|
11
|
+
Me,
|
|
12
|
+
c ? u : a
|
|
13
|
+
), f = Math.max(
|
|
14
|
+
n.width,
|
|
15
|
+
(t == null ? void 0 : t.width) ?? n.width
|
|
16
|
+
), r = l.left + G, y = Math.min(
|
|
17
|
+
Math.max(r, n.left),
|
|
18
|
+
Math.max(
|
|
19
|
+
r,
|
|
20
|
+
l.right - G - f
|
|
21
|
+
)
|
|
22
|
+
), s = c ? Math.max(
|
|
23
|
+
l.top + G,
|
|
24
|
+
n.top - ee - Math.min((t == null ? void 0 : t.height) ?? o, o)
|
|
25
|
+
) : n.bottom + ee;
|
|
26
|
+
return {
|
|
27
|
+
left: y,
|
|
28
|
+
maxHeight: o,
|
|
29
|
+
minWidth: n.width,
|
|
30
|
+
top: s
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function ae(n, t, l) {
|
|
34
|
+
if (n.length === 0) return -1;
|
|
35
|
+
for (let a = 1; a <= n.length; a += 1) {
|
|
36
|
+
const u = (t + l * a + n.length) % n.length;
|
|
37
|
+
if (!n[u].disabled) return u;
|
|
12
38
|
}
|
|
13
39
|
return -1;
|
|
14
40
|
}
|
|
15
|
-
function
|
|
16
|
-
for (let
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
19
|
-
return
|
|
41
|
+
function Ae(n, t, l) {
|
|
42
|
+
for (let a = 1; a <= n.length; a += 1) {
|
|
43
|
+
const u = (l + a + n.length) % n.length, c = n[u];
|
|
44
|
+
if (!c.disabled && c.label.toLocaleLowerCase().startsWith(t))
|
|
45
|
+
return u;
|
|
20
46
|
}
|
|
21
47
|
return -1;
|
|
22
48
|
}
|
|
23
|
-
function
|
|
49
|
+
function We(n) {
|
|
24
50
|
const t = /* @__PURE__ */ new Set();
|
|
25
|
-
|
|
26
|
-
if (t.has(
|
|
51
|
+
n.forEach((l) => {
|
|
52
|
+
if (t.has(l.value))
|
|
27
53
|
throw new Error("Select option values must be unique");
|
|
28
|
-
t.add(
|
|
54
|
+
t.add(l.value);
|
|
29
55
|
});
|
|
30
56
|
}
|
|
31
|
-
function
|
|
32
|
-
t.current =
|
|
57
|
+
function $e(n, t, l) {
|
|
58
|
+
t.current = n, typeof l == "function" ? l(n) : l && (l.current = n);
|
|
33
59
|
}
|
|
34
|
-
function
|
|
60
|
+
function Ge(n) {
|
|
35
61
|
const {
|
|
36
62
|
"aria-invalid": t,
|
|
37
|
-
children:
|
|
38
|
-
className:
|
|
39
|
-
defaultValue:
|
|
40
|
-
disabled:
|
|
41
|
-
forwardedReference:
|
|
42
|
-
invalid:
|
|
43
|
-
placeholder:
|
|
44
|
-
style:
|
|
45
|
-
value:
|
|
46
|
-
...
|
|
47
|
-
} =
|
|
48
|
-
return /* @__PURE__ */
|
|
63
|
+
children: l,
|
|
64
|
+
className: a,
|
|
65
|
+
defaultValue: u,
|
|
66
|
+
disabled: c = !1,
|
|
67
|
+
forwardedReference: o,
|
|
68
|
+
invalid: f = !1,
|
|
69
|
+
placeholder: r,
|
|
70
|
+
style: y,
|
|
71
|
+
value: s,
|
|
72
|
+
...k
|
|
73
|
+
} = n, g = fe(f, t), I = f || ue(t);
|
|
74
|
+
return /* @__PURE__ */ S(
|
|
49
75
|
"span",
|
|
50
76
|
{
|
|
51
|
-
className: ["nk-select",
|
|
52
|
-
"data-disabled":
|
|
53
|
-
"data-invalid":
|
|
77
|
+
className: ["nk-select", a].filter(Boolean).join(" "),
|
|
78
|
+
"data-disabled": c || void 0,
|
|
79
|
+
"data-invalid": I || void 0,
|
|
54
80
|
"data-mode": "native",
|
|
55
|
-
style:
|
|
81
|
+
style: y,
|
|
56
82
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ S(
|
|
58
84
|
"select",
|
|
59
85
|
{
|
|
60
|
-
...
|
|
61
|
-
ref:
|
|
62
|
-
"aria-invalid":
|
|
86
|
+
...k,
|
|
87
|
+
ref: o,
|
|
88
|
+
"aria-invalid": g,
|
|
63
89
|
className: "nk-select__control",
|
|
64
|
-
defaultValue:
|
|
65
|
-
disabled:
|
|
66
|
-
value:
|
|
90
|
+
defaultValue: s === void 0 ? u ?? (r !== void 0 ? "" : void 0) : void 0,
|
|
91
|
+
disabled: c,
|
|
92
|
+
value: s,
|
|
67
93
|
children: [
|
|
68
|
-
|
|
69
|
-
|
|
94
|
+
r !== void 0 ? /* @__PURE__ */ h("option", { disabled: !0, value: "", children: r }) : null,
|
|
95
|
+
l
|
|
70
96
|
]
|
|
71
97
|
}
|
|
72
98
|
),
|
|
73
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ h(X, { className: "nk-select__icon", type: "chevron-down" })
|
|
74
100
|
]
|
|
75
101
|
}
|
|
76
102
|
);
|
|
77
103
|
}
|
|
78
|
-
function
|
|
79
|
-
const [
|
|
80
|
-
return
|
|
81
|
-
if (!
|
|
82
|
-
|
|
104
|
+
function Ke(n, t, l, a) {
|
|
105
|
+
const [u, c] = j(null);
|
|
106
|
+
return U(() => {
|
|
107
|
+
if (!n || !t || !a) {
|
|
108
|
+
c(null);
|
|
83
109
|
return;
|
|
84
110
|
}
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
87
|
-
const
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Math.max(p, u.left),
|
|
99
|
-
Math.max(
|
|
100
|
-
p,
|
|
101
|
-
s.innerWidth - p - V
|
|
102
|
-
)
|
|
103
|
-
), N = D ? Math.max(
|
|
104
|
-
p,
|
|
105
|
-
u.top - k - Math.min(
|
|
106
|
-
(y == null ? void 0 : y.height) ?? x,
|
|
107
|
-
x
|
|
111
|
+
const o = t.ownerDocument.defaultView;
|
|
112
|
+
if (!o) return;
|
|
113
|
+
const f = o;
|
|
114
|
+
function r() {
|
|
115
|
+
const k = t == null ? void 0 : t.getBoundingClientRect(), g = a == null ? void 0 : a.getBoundingClientRect();
|
|
116
|
+
if (!k || !g || !a) return;
|
|
117
|
+
const I = Ve(
|
|
118
|
+
k,
|
|
119
|
+
l == null ? void 0 : l.getBoundingClientRect(),
|
|
120
|
+
He(
|
|
121
|
+
g,
|
|
122
|
+
f.innerWidth,
|
|
123
|
+
f.innerHeight
|
|
108
124
|
)
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
top: N
|
|
125
|
+
);
|
|
126
|
+
c({
|
|
127
|
+
...I,
|
|
128
|
+
left: I.left - g.left - a.clientLeft + a.scrollLeft,
|
|
129
|
+
top: I.top - g.top - a.clientTop + a.scrollTop
|
|
115
130
|
});
|
|
116
131
|
}
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
return
|
|
120
|
-
|
|
132
|
+
r(), f.addEventListener("scroll", r, !0), f.addEventListener("resize", r);
|
|
133
|
+
const y = f.ResizeObserver, s = y ? new y(r) : null;
|
|
134
|
+
return s == null || s.observe(t), s == null || s.observe(a), l && (s == null || s.observe(l)), () => {
|
|
135
|
+
f.removeEventListener("scroll", r, !0), f.removeEventListener("resize", r), s == null || s.disconnect();
|
|
121
136
|
};
|
|
122
|
-
}, [a,
|
|
137
|
+
}, [n, a, l, t]), u;
|
|
123
138
|
}
|
|
124
|
-
function
|
|
139
|
+
function je(n) {
|
|
125
140
|
const {
|
|
126
141
|
active: t,
|
|
127
|
-
closeOnEscape:
|
|
128
|
-
closeOnOutsideInteraction:
|
|
129
|
-
highlightedIndex:
|
|
130
|
-
id:
|
|
131
|
-
listboxReference:
|
|
132
|
-
onEscapeDismiss:
|
|
133
|
-
onEscapeKeyDown:
|
|
134
|
-
onHighlight:
|
|
135
|
-
onOutsideDismiss:
|
|
136
|
-
onPointerDownOutside:
|
|
137
|
-
onSelect:
|
|
138
|
-
options:
|
|
139
|
-
ownerDocument:
|
|
142
|
+
closeOnEscape: l,
|
|
143
|
+
closeOnOutsideInteraction: a,
|
|
144
|
+
highlightedIndex: u,
|
|
145
|
+
id: c,
|
|
146
|
+
listboxReference: o,
|
|
147
|
+
onEscapeDismiss: f,
|
|
148
|
+
onEscapeKeyDown: r,
|
|
149
|
+
onHighlight: y,
|
|
150
|
+
onOutsideDismiss: s,
|
|
151
|
+
onPointerDownOutside: k,
|
|
152
|
+
onSelect: g,
|
|
153
|
+
options: I,
|
|
154
|
+
ownerDocument: M,
|
|
140
155
|
position: D,
|
|
141
|
-
selectedValue:
|
|
142
|
-
state:
|
|
143
|
-
triggerReference:
|
|
144
|
-
} =
|
|
145
|
-
() => [
|
|
146
|
-
[
|
|
147
|
-
),
|
|
148
|
-
(
|
|
149
|
-
|
|
156
|
+
selectedValue: L,
|
|
157
|
+
state: N,
|
|
158
|
+
triggerReference: q
|
|
159
|
+
} = n, m = K(null), F = oe("Select").boundaryElement, O = Pe(!0, F), Q = Re(
|
|
160
|
+
() => [q, m],
|
|
161
|
+
[q]
|
|
162
|
+
), z = R(
|
|
163
|
+
(d) => {
|
|
164
|
+
m.current = d, o(d);
|
|
150
165
|
},
|
|
151
|
-
[
|
|
166
|
+
[o]
|
|
152
167
|
);
|
|
153
|
-
return
|
|
168
|
+
return Te({
|
|
154
169
|
active: t,
|
|
155
|
-
boundaries:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
boundaries: Q,
|
|
171
|
+
boundary: F,
|
|
172
|
+
dismissOnEscape: l,
|
|
173
|
+
dismissOnPointerDownOutside: a,
|
|
174
|
+
layerId: O.id,
|
|
175
|
+
onEscapeDismiss: f,
|
|
176
|
+
onEscapeKeyDown: r,
|
|
177
|
+
onPointerDownOutside: k,
|
|
178
|
+
onPointerDownOutsideDismiss: s,
|
|
179
|
+
ownerDocument: M
|
|
180
|
+
}), /* @__PURE__ */ h(
|
|
165
181
|
"div",
|
|
166
182
|
{
|
|
167
183
|
"aria-hidden": t ? void 0 : !0,
|
|
168
|
-
"aria-labelledby":
|
|
184
|
+
"aria-labelledby": c,
|
|
169
185
|
className: "nk-select__listbox",
|
|
170
|
-
"data-state":
|
|
171
|
-
id: `${
|
|
172
|
-
ref:
|
|
186
|
+
"data-state": N,
|
|
187
|
+
id: `${c}-listbox`,
|
|
188
|
+
ref: z,
|
|
173
189
|
role: "listbox",
|
|
174
190
|
style: D ? {
|
|
175
191
|
left: D.left,
|
|
176
192
|
maxHeight: D.maxHeight,
|
|
177
193
|
minWidth: D.minWidth,
|
|
178
194
|
top: D.top,
|
|
179
|
-
zIndex:
|
|
180
|
-
} : { visibility: "hidden", zIndex:
|
|
181
|
-
children:
|
|
195
|
+
zIndex: O.zIndex
|
|
196
|
+
} : { visibility: "hidden", zIndex: O.zIndex },
|
|
197
|
+
children: I.map((d, V) => /* @__PURE__ */ S(
|
|
182
198
|
"div",
|
|
183
199
|
{
|
|
184
|
-
"aria-disabled":
|
|
185
|
-
"aria-selected":
|
|
200
|
+
"aria-disabled": d.disabled || void 0,
|
|
201
|
+
"aria-selected": d.value === L,
|
|
186
202
|
className: "nk-select__option",
|
|
187
|
-
"data-highlighted":
|
|
188
|
-
"data-selected":
|
|
189
|
-
id: `${
|
|
190
|
-
onPointerDown: (
|
|
191
|
-
|
|
203
|
+
"data-highlighted": V === u || void 0,
|
|
204
|
+
"data-selected": d.value === L || void 0,
|
|
205
|
+
id: `${c}-option-${V}`,
|
|
206
|
+
onPointerDown: (te) => {
|
|
207
|
+
te.preventDefault(), d.disabled || g(d);
|
|
192
208
|
},
|
|
193
209
|
onPointerMove: () => {
|
|
194
|
-
|
|
210
|
+
d.disabled || y(V);
|
|
195
211
|
},
|
|
196
212
|
role: "option",
|
|
197
213
|
children: [
|
|
198
|
-
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
|
|
214
|
+
d.icon ? /* @__PURE__ */ h(X, { type: d.icon }) : null,
|
|
215
|
+
/* @__PURE__ */ h("span", { className: "nk-select__option-label", children: d.label }),
|
|
216
|
+
d.value === L ? /* @__PURE__ */ h(X, { className: "nk-select__check", type: "checkmark" }) : null
|
|
201
217
|
]
|
|
202
218
|
},
|
|
203
|
-
|
|
219
|
+
d.value
|
|
204
220
|
))
|
|
205
221
|
}
|
|
206
222
|
);
|
|
207
223
|
}
|
|
208
|
-
function
|
|
209
|
-
var
|
|
224
|
+
function Ue(n) {
|
|
225
|
+
var de;
|
|
210
226
|
const {
|
|
211
227
|
"aria-invalid": t,
|
|
212
|
-
className:
|
|
213
|
-
closeOnEscape:
|
|
214
|
-
closeOnOutsideInteraction:
|
|
215
|
-
defaultValue:
|
|
216
|
-
disabled:
|
|
217
|
-
displayOverride:
|
|
218
|
-
form:
|
|
219
|
-
forwardedReference:
|
|
220
|
-
id:
|
|
221
|
-
invalid:
|
|
222
|
-
name:
|
|
223
|
-
onChange:
|
|
224
|
-
onClick:
|
|
228
|
+
className: l,
|
|
229
|
+
closeOnEscape: a = !0,
|
|
230
|
+
closeOnOutsideInteraction: u = !0,
|
|
231
|
+
defaultValue: c = "",
|
|
232
|
+
disabled: o = !1,
|
|
233
|
+
displayOverride: f,
|
|
234
|
+
form: r,
|
|
235
|
+
forwardedReference: y,
|
|
236
|
+
id: s,
|
|
237
|
+
invalid: k = !1,
|
|
238
|
+
name: g,
|
|
239
|
+
onChange: I,
|
|
240
|
+
onClick: M,
|
|
225
241
|
onEscapeKeyDown: D,
|
|
226
|
-
onKeyDown:
|
|
227
|
-
onOpenChange:
|
|
228
|
-
onPointerDownOutside:
|
|
229
|
-
options:
|
|
230
|
-
placeholder:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
),
|
|
242
|
+
onKeyDown: L,
|
|
243
|
+
onOpenChange: N,
|
|
244
|
+
onPointerDownOutside: q,
|
|
245
|
+
options: m,
|
|
246
|
+
placeholder: F,
|
|
247
|
+
required: O = !1,
|
|
248
|
+
style: Q,
|
|
249
|
+
value: z,
|
|
250
|
+
width: d,
|
|
251
|
+
...V
|
|
252
|
+
} = n;
|
|
253
|
+
We(m);
|
|
254
|
+
const te = xe(), P = s ?? te, b = K(null), se = K(null), T = K(null), Y = K(""), [A, me] = j(null), [p, he] = j(!1), [_, W] = j(-1), [pe, ce] = j(c), H = z !== void 0, x = H ? z : pe, ve = m.find(
|
|
255
|
+
(e) => e.value === x
|
|
256
|
+
), Ie = k || ue(t), we = fe(k, t), ne = Se(p), $ = ((de = b.current) == null ? void 0 : de.ownerDocument) ?? (typeof document > "u" ? null : document), ye = oe("Select").boundaryElement, ge = Ke(
|
|
257
|
+
ne.present,
|
|
258
|
+
b.current,
|
|
259
|
+
A,
|
|
260
|
+
ye
|
|
261
|
+
), ke = d === void 0 ? Q : { ...Q, width: d }, J = f ?? ve, be = R(
|
|
246
262
|
(e) => {
|
|
247
|
-
|
|
263
|
+
$e(
|
|
248
264
|
e,
|
|
249
|
-
|
|
250
|
-
|
|
265
|
+
b,
|
|
266
|
+
y
|
|
251
267
|
);
|
|
252
268
|
},
|
|
253
|
-
[
|
|
254
|
-
),
|
|
255
|
-
|
|
256
|
-
}, [
|
|
257
|
-
const
|
|
258
|
-
(
|
|
259
|
-
),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
),
|
|
263
|
-
}, [
|
|
264
|
-
var
|
|
265
|
-
e.disabled || (
|
|
266
|
-
}, [
|
|
269
|
+
[y]
|
|
270
|
+
), v = R((e) => {
|
|
271
|
+
p !== e && (he(e), N == null || N(e));
|
|
272
|
+
}, [N, p]), Z = R((e = 1) => {
|
|
273
|
+
const i = m.findIndex(
|
|
274
|
+
(E) => E.value === x && !E.disabled
|
|
275
|
+
), w = e === 1 ? -1 : m.length;
|
|
276
|
+
W(
|
|
277
|
+
i >= 0 ? i : ae(m, w, e)
|
|
278
|
+
), v(!0);
|
|
279
|
+
}, [m, x, v]), re = R((e) => {
|
|
280
|
+
var i;
|
|
281
|
+
o || e.disabled || (H || ce(e.value), v(!1), (i = b.current) == null || i.focus(), I == null || I(e.value));
|
|
282
|
+
}, [o, H, I, v]), _e = R(() => {
|
|
267
283
|
var e;
|
|
268
|
-
|
|
269
|
-
}, [
|
|
270
|
-
|
|
271
|
-
}, [
|
|
272
|
-
function
|
|
273
|
-
|
|
284
|
+
v(!1), (e = b.current) == null || e.focus();
|
|
285
|
+
}, [v]), Ee = R(() => {
|
|
286
|
+
v(!1);
|
|
287
|
+
}, [v]);
|
|
288
|
+
function De(e) {
|
|
289
|
+
M == null || M(e), !(e.defaultPrevented || o) && (p ? v(!1) : Z());
|
|
274
290
|
}
|
|
275
|
-
function
|
|
276
|
-
if (
|
|
291
|
+
function Le(e) {
|
|
292
|
+
if (L == null || L(e), !(e.defaultPrevented || o)) {
|
|
277
293
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
278
294
|
e.preventDefault();
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
(
|
|
282
|
-
) :
|
|
295
|
+
const i = e.key === "ArrowDown" ? 1 : -1;
|
|
296
|
+
p ? W(
|
|
297
|
+
(w) => ae(m, w, i)
|
|
298
|
+
) : Z(i);
|
|
283
299
|
return;
|
|
284
300
|
}
|
|
285
301
|
if (e.key === "Home" || e.key === "End") {
|
|
286
|
-
if (e.preventDefault(), !
|
|
302
|
+
if (e.preventDefault(), !p) Z(e.key === "Home" ? 1 : -1);
|
|
287
303
|
else {
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
304
|
+
const i = e.key === "Home" ? 1 : -1, w = i === 1 ? -1 : m.length;
|
|
305
|
+
W(
|
|
306
|
+
ae(m, w, i)
|
|
291
307
|
);
|
|
292
308
|
}
|
|
293
309
|
return;
|
|
294
310
|
}
|
|
295
311
|
if (e.key === "Enter" || e.key === " ") {
|
|
296
312
|
e.preventDefault();
|
|
297
|
-
const
|
|
298
|
-
|
|
313
|
+
const i = m[_];
|
|
314
|
+
p && i ? re(i) : p || Z();
|
|
299
315
|
return;
|
|
300
316
|
}
|
|
301
317
|
if (e.key === "Tab") {
|
|
302
|
-
|
|
318
|
+
v(!1);
|
|
303
319
|
return;
|
|
304
320
|
}
|
|
305
321
|
if (e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
306
|
-
const
|
|
307
|
-
if (!
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
322
|
+
const i = e.currentTarget.ownerDocument.defaultView;
|
|
323
|
+
if (!i) return;
|
|
324
|
+
const w = e.key.toLocaleLowerCase(), E = Y.current + w, le = Array.from(E).every((ie) => ie === w);
|
|
325
|
+
Y.current = le ? w : E, T.current !== null && i.clearTimeout(T.current), T.current = i.setTimeout(() => {
|
|
326
|
+
Y.current = "", T.current = null;
|
|
311
327
|
}, 500);
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
328
|
+
const C = Ae(
|
|
329
|
+
m,
|
|
330
|
+
Y.current,
|
|
331
|
+
_
|
|
316
332
|
);
|
|
317
|
-
|
|
333
|
+
C >= 0 && (e.preventDefault(), p || v(!0), W(C));
|
|
318
334
|
}
|
|
319
335
|
}
|
|
320
336
|
}
|
|
321
|
-
return
|
|
337
|
+
return U(() => {
|
|
338
|
+
o && v(!1);
|
|
339
|
+
}, [o, v]), U(() => {
|
|
322
340
|
var e;
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
`${
|
|
341
|
+
if (p && _ >= 0) {
|
|
342
|
+
const i = $ == null ? void 0 : $.getElementById(
|
|
343
|
+
`${P}-option-${_}`
|
|
326
344
|
);
|
|
327
|
-
|
|
345
|
+
i && (A != null && A.contains(i)) && ((e = i.scrollIntoView) == null || e.call(i, { block: "nearest" }));
|
|
328
346
|
}
|
|
329
|
-
}, [
|
|
330
|
-
var
|
|
331
|
-
const e = (
|
|
347
|
+
}, [_, P, A, p]), U(() => {
|
|
348
|
+
var w;
|
|
349
|
+
const e = (w = b.current) == null ? void 0 : w.form;
|
|
332
350
|
if (!e) return;
|
|
333
|
-
function
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
(
|
|
338
|
-
) ??
|
|
339
|
-
|
|
340
|
-
|
|
351
|
+
function i() {
|
|
352
|
+
const E = se.current, le = H ? x : c;
|
|
353
|
+
if (E) {
|
|
354
|
+
const C = Array.from(E.options), ie = C.find(
|
|
355
|
+
(B) => B.value === le
|
|
356
|
+
) ?? C[0];
|
|
357
|
+
C.forEach((B) => {
|
|
358
|
+
B.defaultSelected = B === ie;
|
|
341
359
|
});
|
|
342
360
|
}
|
|
343
|
-
|
|
361
|
+
H || ce(c), v(!1);
|
|
344
362
|
}
|
|
345
|
-
return e.addEventListener("reset",
|
|
346
|
-
}, [
|
|
347
|
-
var
|
|
348
|
-
const e = (
|
|
349
|
-
e &&
|
|
350
|
-
}, []), /* @__PURE__ */
|
|
363
|
+
return e.addEventListener("reset", i), () => e.removeEventListener("reset", i);
|
|
364
|
+
}, [c, r, H, x, v]), U(() => () => {
|
|
365
|
+
var i;
|
|
366
|
+
const e = (i = b.current) == null ? void 0 : i.ownerDocument.defaultView;
|
|
367
|
+
e && T.current !== null && e.clearTimeout(T.current);
|
|
368
|
+
}, []), /* @__PURE__ */ S(
|
|
351
369
|
"span",
|
|
352
370
|
{
|
|
353
|
-
className: ["nk-select",
|
|
354
|
-
"data-disabled":
|
|
355
|
-
"data-invalid":
|
|
371
|
+
className: ["nk-select", l].filter(Boolean).join(" "),
|
|
372
|
+
"data-disabled": o || void 0,
|
|
373
|
+
"data-invalid": Ie || void 0,
|
|
356
374
|
"data-mode": "custom",
|
|
357
|
-
"data-open":
|
|
358
|
-
style:
|
|
375
|
+
"data-open": p || void 0,
|
|
376
|
+
style: ke,
|
|
359
377
|
children: [
|
|
360
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ S(
|
|
361
379
|
"button",
|
|
362
380
|
{
|
|
363
|
-
...
|
|
381
|
+
...V,
|
|
364
382
|
ref: be,
|
|
365
|
-
"aria-activedescendant":
|
|
366
|
-
"aria-controls": `${
|
|
367
|
-
"aria-expanded":
|
|
383
|
+
"aria-activedescendant": p && _ >= 0 ? `${P}-option-${_}` : void 0,
|
|
384
|
+
"aria-controls": `${P}-listbox`,
|
|
385
|
+
"aria-expanded": p,
|
|
368
386
|
"aria-haspopup": "listbox",
|
|
369
|
-
"aria-invalid":
|
|
370
|
-
"aria-required":
|
|
387
|
+
"aria-invalid": we,
|
|
388
|
+
"aria-required": O || void 0,
|
|
371
389
|
"aria-autocomplete": "none",
|
|
372
390
|
className: "nk-select__trigger",
|
|
373
|
-
disabled:
|
|
374
|
-
form:
|
|
375
|
-
id:
|
|
376
|
-
onClick:
|
|
377
|
-
onKeyDown:
|
|
391
|
+
disabled: o,
|
|
392
|
+
form: r,
|
|
393
|
+
id: P,
|
|
394
|
+
onClick: De,
|
|
395
|
+
onKeyDown: Le,
|
|
378
396
|
role: "combobox",
|
|
379
397
|
type: "button",
|
|
380
398
|
children: [
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
] }) : /* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
399
|
+
J ? /* @__PURE__ */ S("span", { className: "nk-select__value", children: [
|
|
400
|
+
J.icon ? /* @__PURE__ */ h(X, { type: J.icon }) : null,
|
|
401
|
+
/* @__PURE__ */ h("span", { className: "nk-select__value-label", children: J.label })
|
|
402
|
+
] }) : /* @__PURE__ */ h("span", { className: "nk-select__placeholder", children: F }),
|
|
403
|
+
/* @__PURE__ */ h(X, { className: "nk-select__icon", type: "chevron-down" })
|
|
386
404
|
]
|
|
387
405
|
}
|
|
388
406
|
),
|
|
389
|
-
|
|
407
|
+
g || O ? /* @__PURE__ */ S(
|
|
390
408
|
"select",
|
|
391
409
|
{
|
|
392
|
-
ref:
|
|
410
|
+
ref: se,
|
|
393
411
|
"aria-hidden": "true",
|
|
394
412
|
className: "nk-select__form-control",
|
|
395
|
-
disabled:
|
|
396
|
-
form:
|
|
397
|
-
name:
|
|
413
|
+
disabled: o,
|
|
414
|
+
form: r,
|
|
415
|
+
name: g,
|
|
398
416
|
onChange: () => {
|
|
399
417
|
},
|
|
400
418
|
onInvalid: (e) => {
|
|
401
|
-
var
|
|
402
|
-
e.preventDefault(), (
|
|
419
|
+
var i;
|
|
420
|
+
e.preventDefault(), (i = b.current) == null || i.focus();
|
|
403
421
|
},
|
|
404
|
-
required:
|
|
422
|
+
required: O,
|
|
405
423
|
tabIndex: -1,
|
|
406
|
-
value:
|
|
424
|
+
value: x,
|
|
407
425
|
children: [
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
|
|
426
|
+
/* @__PURE__ */ h("option", { value: "" }),
|
|
427
|
+
m.map((e) => /* @__PURE__ */ h(
|
|
410
428
|
"option",
|
|
411
429
|
{
|
|
412
430
|
disabled: e.disabled,
|
|
@@ -418,56 +436,49 @@ function Ae(a) {
|
|
|
418
436
|
]
|
|
419
437
|
}
|
|
420
438
|
) : null,
|
|
421
|
-
|
|
422
|
-
|
|
439
|
+
ne.present && $ ? /* @__PURE__ */ h(Ne, { children: /* @__PURE__ */ h(
|
|
440
|
+
je,
|
|
423
441
|
{
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
ownerDocument: j,
|
|
443
|
-
position: ye,
|
|
444
|
-
selectedValue: P,
|
|
445
|
-
state: Z.state === "closing" ? "closing" : "open",
|
|
446
|
-
triggerReference: _
|
|
447
|
-
}
|
|
448
|
-
)
|
|
442
|
+
active: p,
|
|
443
|
+
closeOnEscape: a,
|
|
444
|
+
closeOnOutsideInteraction: u,
|
|
445
|
+
highlightedIndex: _,
|
|
446
|
+
id: P,
|
|
447
|
+
listboxReference: me,
|
|
448
|
+
onEscapeDismiss: _e,
|
|
449
|
+
onEscapeKeyDown: D,
|
|
450
|
+
onHighlight: W,
|
|
451
|
+
onOutsideDismiss: Ee,
|
|
452
|
+
onPointerDownOutside: q,
|
|
453
|
+
onSelect: re,
|
|
454
|
+
options: m,
|
|
455
|
+
ownerDocument: $,
|
|
456
|
+
position: ge,
|
|
457
|
+
selectedValue: x,
|
|
458
|
+
state: ne.state === "closing" ? "closing" : "open",
|
|
459
|
+
triggerReference: b
|
|
449
460
|
}
|
|
450
|
-
) : null
|
|
461
|
+
) }) : null
|
|
451
462
|
]
|
|
452
463
|
}
|
|
453
464
|
);
|
|
454
465
|
}
|
|
455
|
-
const
|
|
456
|
-
const { options:
|
|
457
|
-
return
|
|
458
|
-
|
|
466
|
+
const Je = Oe(function(t, l) {
|
|
467
|
+
const { options: a } = t;
|
|
468
|
+
return oe("Select"), a !== void 0 ? /* @__PURE__ */ h(
|
|
469
|
+
Ue,
|
|
459
470
|
{
|
|
460
471
|
...t,
|
|
461
|
-
forwardedReference:
|
|
472
|
+
forwardedReference: l
|
|
462
473
|
}
|
|
463
|
-
) : /* @__PURE__ */
|
|
464
|
-
|
|
474
|
+
) : /* @__PURE__ */ h(
|
|
475
|
+
Ge,
|
|
465
476
|
{
|
|
466
477
|
...t,
|
|
467
|
-
forwardedReference:
|
|
478
|
+
forwardedReference: l
|
|
468
479
|
}
|
|
469
480
|
);
|
|
470
481
|
});
|
|
471
482
|
export {
|
|
472
|
-
|
|
483
|
+
Je as default
|
|
473
484
|
};
|