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/Popover.js
CHANGED
|
@@ -1,52 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsxs as re, Fragment as Se, jsx as T } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as Fe, Fragment as Le, useId as Ne, useContext as Be, useState as K, useRef as b, useReducer as _e, useMemo as Ke, useCallback as v, useEffect as j, cloneElement as je } from "react";
|
|
4
|
+
import { m as qe } from "./aria-CeA9QfD1.js";
|
|
5
|
+
import { u as ze } from "./effects-D5CWf-Pl.js";
|
|
6
|
+
import { g as Ae, a as ne } from "./reference-CXMr27nM.js";
|
|
7
|
+
import { F as te, c as Me, b as $e, d as He, e as Ve, P as Ue } from "./usePresence-CqegYqy4.js";
|
|
8
|
+
import { u as Ge } from "./useFloatingPosition-CMirP2-2.js";
|
|
9
|
+
import { u as Je } from "./useFocusTrap-DhVnlboe.js";
|
|
10
|
+
import { S as Qe } from "./Surface-vEFsZC12.js";
|
|
11
|
+
function We(o) {
|
|
12
|
+
const { inert: a, panelElement: i } = o;
|
|
13
|
+
return ze(() => {
|
|
14
|
+
i && (i.inert = a);
|
|
15
|
+
}, [a, i]), null;
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
+
function Xe(o, a, i) {
|
|
18
|
+
a.current = o, ne(i, o);
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
+
function Ye(o, a, i) {
|
|
21
|
+
a.current = o, ne(i, o);
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
const a =
|
|
23
|
-
return
|
|
23
|
+
function Ze(o) {
|
|
24
|
+
const a = o.tagName.toLowerCase();
|
|
25
|
+
return o.getAttribute("role") === "button" && a !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(a) ? !0 : a === "a" && o.hasAttribute("href");
|
|
24
26
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
return r.getAttribute("role") === "button" && s !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(s) ? !0 : s === "a" && r.hasAttribute("href");
|
|
27
|
+
function er(o) {
|
|
28
|
+
return o === "grid" || o === "listbox" || o === "menu" || o === "tree" ? o : "dialog";
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
return r === "grid" || r === "listbox" || r === "menu" || r === "tree" ? r : "dialog";
|
|
31
|
-
}
|
|
32
|
-
const ct = Ce(function(s, a) {
|
|
30
|
+
const dr = Fe(function(a, i) {
|
|
33
31
|
const {
|
|
34
32
|
"aria-label": q,
|
|
35
33
|
"aria-labelledby": oe,
|
|
36
|
-
autoFocus:
|
|
34
|
+
autoFocus: D = !0,
|
|
37
35
|
children: se,
|
|
38
36
|
className: ae,
|
|
39
37
|
closeOnEscape: ie = !0,
|
|
40
38
|
closeOnOutsideInteraction: ce = !0,
|
|
41
39
|
defaultOpen: le = !1,
|
|
42
40
|
disabled: I = !1,
|
|
43
|
-
initialFocusReference:
|
|
41
|
+
initialFocusReference: y,
|
|
44
42
|
onEscapeKeyDown: ue,
|
|
45
43
|
onOpenChange: R,
|
|
46
44
|
onPointerDownOutside: x,
|
|
47
45
|
open: z,
|
|
48
46
|
placement: A = "bottom",
|
|
49
|
-
portalContainer: k,
|
|
50
47
|
restoreFocus: S = !0,
|
|
51
48
|
role: M = "dialog",
|
|
52
49
|
style: $,
|
|
@@ -54,173 +51,176 @@ const ct = Ce(function(s, a) {
|
|
|
54
51
|
trapFocus: p = !1,
|
|
55
52
|
trigger: l,
|
|
56
53
|
...fe
|
|
57
|
-
} =
|
|
54
|
+
} = a;
|
|
58
55
|
if (l.type === Le)
|
|
59
56
|
throw new Error("Popover requires a single non-Fragment trigger");
|
|
60
|
-
const H = Ne(), pe = Be(
|
|
57
|
+
const H = Ne(), pe = Be(te), V = `${H}-popover`, n = l.props, U = Ae(l), G = n.id ?? `${H}-trigger`, h = I || n.disabled === !0 || n["aria-disabled"] === !0 || n["aria-disabled"] === "true", P = z !== void 0, [me, ge] = K(le), r = P ? z : me, k = Me(r), J = b(null), Q = b(null), F = b("programmatic"), L = b(null), W = b(r), O = b(null), [be, ve] = _e(
|
|
61
58
|
(e) => e + 1,
|
|
62
59
|
0
|
|
63
|
-
), [c,
|
|
60
|
+
), [c, ye] = K(null), [u, he] = K(null), s = (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document), w = $e("Popover").boundaryElement, C = He(k.present, w), Pe = Ke(
|
|
64
61
|
() => [J, Q],
|
|
65
62
|
[]
|
|
66
|
-
), d =
|
|
67
|
-
|
|
63
|
+
), d = Ge(
|
|
64
|
+
k.present,
|
|
68
65
|
A,
|
|
69
66
|
c,
|
|
70
|
-
u
|
|
67
|
+
u,
|
|
68
|
+
w
|
|
71
69
|
), Ee = v(
|
|
72
70
|
(e) => {
|
|
73
|
-
|
|
71
|
+
Ye(
|
|
74
72
|
e,
|
|
75
73
|
J,
|
|
76
74
|
U
|
|
77
|
-
),
|
|
75
|
+
), ye(e);
|
|
78
76
|
},
|
|
79
77
|
[U]
|
|
80
78
|
), Te = v(
|
|
81
79
|
(e) => {
|
|
82
|
-
|
|
80
|
+
Xe(
|
|
83
81
|
e,
|
|
84
82
|
Q,
|
|
85
|
-
|
|
86
|
-
),
|
|
83
|
+
i
|
|
84
|
+
), he(e);
|
|
87
85
|
},
|
|
88
|
-
[
|
|
89
|
-
), f = v((e,
|
|
90
|
-
|
|
86
|
+
[i]
|
|
87
|
+
), f = v((e, t) => {
|
|
88
|
+
r !== e && (P ? (L.current = {
|
|
91
89
|
open: e,
|
|
92
|
-
reason:
|
|
93
|
-
}, ve()) : (
|
|
94
|
-
}, [P, R,
|
|
90
|
+
reason: t
|
|
91
|
+
}, ve()) : (F.current = t, ge(e)), R == null || R(e, t));
|
|
92
|
+
}, [P, R, r]), Ie = v(() => {
|
|
95
93
|
f(!1, "escape");
|
|
96
94
|
}, [f]), Re = v(() => {
|
|
97
95
|
f(!1, "outside");
|
|
98
96
|
}, [f]), xe = v((e) => {
|
|
99
97
|
var E;
|
|
100
98
|
if (x == null || x(e), e.defaultPrevented) return;
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
(
|
|
99
|
+
const t = (E = s == null ? void 0 : s.defaultView) == null ? void 0 : E.HTMLElement;
|
|
100
|
+
O.current = t ? e.composedPath().find(
|
|
101
|
+
(g) => g instanceof t && g.tabIndex >= 0
|
|
104
102
|
) ?? e.target : e.target;
|
|
105
|
-
}, [x,
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
}, [x, s]);
|
|
104
|
+
Ve({
|
|
105
|
+
boundary: w,
|
|
106
|
+
active: r,
|
|
108
107
|
boundaries: Pe,
|
|
109
108
|
dismissOnEscape: ie,
|
|
110
109
|
dismissOnPointerDownOutside: ce,
|
|
111
|
-
layerId:
|
|
110
|
+
layerId: C.id,
|
|
112
111
|
onEscapeDismiss: Ie,
|
|
113
112
|
onEscapeKeyDown: ue,
|
|
114
113
|
onPointerDownOutside: xe,
|
|
115
114
|
onPointerDownOutsideDismiss: Re,
|
|
116
|
-
ownerDocument:
|
|
115
|
+
ownerDocument: s
|
|
117
116
|
});
|
|
118
|
-
const ke =
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
const ke = Je({
|
|
118
|
+
boundary: w,
|
|
119
|
+
active: r && p,
|
|
120
|
+
autoFocus: D,
|
|
121
121
|
container: u,
|
|
122
|
-
initialFocusReference:
|
|
123
|
-
layerId:
|
|
122
|
+
initialFocusReference: y,
|
|
123
|
+
layerId: C.id,
|
|
124
124
|
restoreFocus: S
|
|
125
125
|
});
|
|
126
|
-
|
|
127
|
-
if (!
|
|
126
|
+
j(() => {
|
|
127
|
+
if (!r || p || !D || !u) return;
|
|
128
128
|
let e = !0;
|
|
129
129
|
return Promise.resolve().then(() => {
|
|
130
130
|
if (!e) return;
|
|
131
|
-
const
|
|
132
|
-
(
|
|
131
|
+
const t = y == null ? void 0 : y.current;
|
|
132
|
+
(t && u.contains(t) ? t : u).focus({ preventScroll: !0 });
|
|
133
133
|
}), () => {
|
|
134
134
|
e = !1;
|
|
135
135
|
};
|
|
136
|
-
}, [
|
|
136
|
+
}, [D, y, r, u, p]), j(() => {
|
|
137
137
|
var ee;
|
|
138
138
|
const e = W.current;
|
|
139
|
-
W.current =
|
|
140
|
-
const
|
|
141
|
-
if (L.current = null,
|
|
142
|
-
|
|
139
|
+
W.current = r;
|
|
140
|
+
const t = L.current, E = P ? e !== r && (t == null ? void 0 : t.open) === r ? t.reason : "programmatic" : F.current;
|
|
141
|
+
if (L.current = null, r) {
|
|
142
|
+
F.current = "programmatic", O.current = null;
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
const
|
|
146
|
-
e && !p && S && !
|
|
145
|
+
const g = s == null ? void 0 : s.activeElement, B = O.current, _ = (ee = s == null ? void 0 : s.defaultView) == null ? void 0 : ee.HTMLElement, De = E === "outside" && _ && B instanceof _ && g instanceof _ && (B === g || B.contains(g));
|
|
146
|
+
e && !p && S && !De && (c == null || c.focus({ preventScroll: !0 })), O.current = null;
|
|
147
147
|
}, [
|
|
148
148
|
be,
|
|
149
149
|
P,
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
r,
|
|
151
|
+
s,
|
|
152
152
|
S,
|
|
153
153
|
p,
|
|
154
154
|
c
|
|
155
|
-
]),
|
|
156
|
-
I &&
|
|
157
|
-
}, [I,
|
|
155
|
+
]), j(() => {
|
|
156
|
+
I && r && f(!1, "programmatic");
|
|
157
|
+
}, [I, r, f]);
|
|
158
158
|
function Oe(e) {
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
159
|
+
var t;
|
|
160
|
+
if (h) {
|
|
161
161
|
e.preventDefault(), e.stopPropagation();
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
(
|
|
164
|
+
(t = n.onClick) == null || t.call(n, e), !e.defaultPrevented && f(!r, "trigger");
|
|
165
165
|
}
|
|
166
166
|
function we(e) {
|
|
167
|
-
var
|
|
168
|
-
(
|
|
167
|
+
var t;
|
|
168
|
+
(t = n.onKeyDown) == null || t.call(n, e), !(e.defaultPrevented || h || Ze(e.currentTarget) || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), e.currentTarget.click());
|
|
169
169
|
}
|
|
170
170
|
if (I) return l;
|
|
171
|
-
const N = typeof l.type == "string",
|
|
171
|
+
const N = typeof l.type == "string", m = N ? l.type : null, X = m === "a" && typeof n.href == "string", Y = N && !(m === "button" || m === "input" || m === "select" || m === "summary" || m === "textarea" || X), Z = X && h, Ce = je(
|
|
172
172
|
l,
|
|
173
173
|
{
|
|
174
|
-
"aria-controls":
|
|
175
|
-
"aria-expanded":
|
|
176
|
-
"aria-haspopup":
|
|
177
|
-
"aria-disabled":
|
|
178
|
-
className: [
|
|
179
|
-
href: Z ? void 0 :
|
|
174
|
+
"aria-controls": r ? qe(n["aria-controls"], V) : n["aria-controls"],
|
|
175
|
+
"aria-expanded": r,
|
|
176
|
+
"aria-haspopup": n["aria-haspopup"] ?? er(M),
|
|
177
|
+
"aria-disabled": h ? !0 : n["aria-disabled"],
|
|
178
|
+
className: [n.className, "nk-popover__trigger"].filter(Boolean).join(" "),
|
|
179
|
+
href: Z ? void 0 : n.href,
|
|
180
180
|
id: G,
|
|
181
181
|
onClick: Oe,
|
|
182
|
-
onKeyDown: N ? we :
|
|
182
|
+
onKeyDown: N ? we : n.onKeyDown,
|
|
183
183
|
ref: Ee,
|
|
184
|
-
role:
|
|
185
|
-
tabIndex:
|
|
184
|
+
role: n.role ?? (Z ? "link" : Y ? "button" : void 0),
|
|
185
|
+
tabIndex: h ? -1 : n.tabIndex ?? (Y ? 0 : void 0)
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
|
|
188
|
+
return /* @__PURE__ */ re(Se, { children: [
|
|
189
|
+
Ce,
|
|
190
190
|
/* @__PURE__ */ T(
|
|
191
|
-
|
|
191
|
+
te.Provider,
|
|
192
192
|
{
|
|
193
|
-
value:
|
|
194
|
-
children:
|
|
195
|
-
|
|
193
|
+
value: r && p ? ke : pe,
|
|
194
|
+
children: k.present && s ? /* @__PURE__ */ T(Ue, { children: /* @__PURE__ */ re(
|
|
195
|
+
Qe,
|
|
196
196
|
{
|
|
197
197
|
...fe,
|
|
198
198
|
ref: Te,
|
|
199
|
-
"aria-hidden":
|
|
200
|
-
"aria-label":
|
|
201
|
-
"aria-labelledby":
|
|
199
|
+
"aria-hidden": r ? void 0 : !0,
|
|
200
|
+
"aria-label": r ? q : void 0,
|
|
201
|
+
"aria-labelledby": r ? oe ?? (q === void 0 ? G : void 0) : void 0,
|
|
202
202
|
className: ["nk-popover", ae].filter(Boolean).join(" "),
|
|
203
203
|
"data-placement": (d == null ? void 0 : d.placement) ?? A,
|
|
204
|
-
"data-state":
|
|
204
|
+
"data-state": k.state === "closing" ? "closing" : "open",
|
|
205
205
|
id: V,
|
|
206
|
-
role:
|
|
206
|
+
role: r ? M : void 0,
|
|
207
207
|
style: d ? {
|
|
208
208
|
...$,
|
|
209
209
|
"--nk-popover-arrow-offset": `${d.arrowOffset}px`,
|
|
210
210
|
left: d.left,
|
|
211
211
|
top: d.top,
|
|
212
|
-
zIndex:
|
|
212
|
+
zIndex: C.zIndex
|
|
213
213
|
} : {
|
|
214
214
|
...$,
|
|
215
215
|
visibility: "hidden",
|
|
216
|
-
zIndex:
|
|
216
|
+
zIndex: C.zIndex
|
|
217
217
|
},
|
|
218
218
|
tabIndex: de ?? -1,
|
|
219
219
|
children: [
|
|
220
220
|
/* @__PURE__ */ T(
|
|
221
|
-
|
|
221
|
+
We,
|
|
222
222
|
{
|
|
223
|
-
inert: !
|
|
223
|
+
inert: !r,
|
|
224
224
|
panelElement: u
|
|
225
225
|
}
|
|
226
226
|
),
|
|
@@ -234,5 +234,5 @@ const ct = Ce(function(s, a) {
|
|
|
234
234
|
] });
|
|
235
235
|
});
|
|
236
236
|
export {
|
|
237
|
-
|
|
237
|
+
dr as default
|
|
238
238
|
};
|
package/dist/Radio.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),R=require("./aria-Bntn6ad_.cjs"),g=require("./field-control-NfLwcPj6.cjs"),j=require("./Text-DWYlIcPj.cjs"),m=r.createContext(void 0),k=r.forwardRef(function(d,e){const{"aria-invalid":c,children:f,className:p,defaultValue:b,disabled:n=!1,invalid:v=!1,name:a,onChange:u,orientation:o="vertical",required:t=!1,value:h,...x}=d,s=v||R.hasInvalidState(c),C={defaultValue:b,disabled:n,name:a,onChange:u,required:t,value:h};return l.jsx(m.Provider,{value:C,children:l.jsx("div",{...x,ref:e,"aria-disabled":n||void 0,"aria-invalid":R.resolveAriaInvalid(v,c),"aria-required":t||void 0,className:["nk-radio-group",p].filter(Boolean).join(" "),"data-disabled":n||void 0,"data-invalid":s||void 0,"data-orientation":o,role:"radiogroup",children:f})})});g.markFieldGroupControl(k,"group");function q(){const i=r.useContext(m);if(!i)throw new Error("Radio must be rendered within RadioGroup");return i}function _(i,d,e){d.current=i,typeof e=="function"?e(i):e&&(e.current=i)}const G=r.forwardRef(function(d,e){const{children:c,className:f,disabled:p=!1,style:b,value:n,...v}=d,a=q(),u=r.useRef(null),o=a.disabled||p,t=a.value!==void 0,h=a.value===n,x=r.useCallback(s=>_(s,u,e),[e]);return r.useEffect(()=>{var s;!t&&o&&((s=u.current)!=null&&s.checked)&&(u.current.checked=!1)},[t,o]),l.jsxs("label",{className:["nk-radio",f].filter(Boolean).join(" "),"data-disabled":o||void 0,style:b,children:[l.jsx("input",{...v,ref:x,checked:t?!o&&h:void 0,className:"nk-radio__control",defaultChecked:t?void 0:!o&&a.defaultValue===n,disabled:o,name:a.name,onChange:a.onChange,required:a.required,type:"radio",value:n}),l.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),l.jsx(j.Text,{as:"span",className:"nk-radio__label",children:c})]})}),N=Object.assign(G,{Group:k});exports.default=N;
|
package/dist/Radio.js
CHANGED
|
@@ -1,65 +1,110 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { jsx as l, jsxs as g } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as x, forwardRef as b, useContext as G, useRef as N, useCallback as _, useEffect as j } from "react";
|
|
4
|
+
import { r as q, h as I } from "./aria-CeA9QfD1.js";
|
|
5
|
+
import { m as V } from "./field-control-XAn_FKks.js";
|
|
6
|
+
import { T as y } from "./Text-rN6iDo0V.js";
|
|
7
|
+
const k = x(void 0), R = b(
|
|
8
|
+
function(s, a) {
|
|
9
|
+
const {
|
|
10
|
+
"aria-invalid": u,
|
|
11
|
+
children: f,
|
|
12
|
+
className: p,
|
|
13
|
+
defaultValue: v,
|
|
14
|
+
disabled: n = !1,
|
|
15
|
+
invalid: c = !1,
|
|
16
|
+
name: e,
|
|
17
|
+
onChange: d,
|
|
18
|
+
orientation: o = "vertical",
|
|
19
|
+
required: r = !1,
|
|
20
|
+
value: m,
|
|
21
|
+
...h
|
|
22
|
+
} = s, t = c || I(u), C = {
|
|
23
|
+
defaultValue: v,
|
|
24
|
+
disabled: n,
|
|
25
|
+
name: e,
|
|
26
|
+
onChange: d,
|
|
27
|
+
required: r,
|
|
28
|
+
value: m
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ l(k.Provider, { value: C, children: /* @__PURE__ */ l(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
...h,
|
|
34
|
+
ref: a,
|
|
35
|
+
"aria-disabled": n || void 0,
|
|
36
|
+
"aria-invalid": q(c, u),
|
|
37
|
+
"aria-required": r || void 0,
|
|
38
|
+
className: ["nk-radio-group", p].filter(Boolean).join(" "),
|
|
39
|
+
"data-disabled": n || void 0,
|
|
40
|
+
"data-invalid": t || void 0,
|
|
41
|
+
"data-orientation": o,
|
|
42
|
+
role: "radiogroup",
|
|
43
|
+
children: f
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
V(R, "group");
|
|
49
|
+
function P() {
|
|
50
|
+
const i = G(k);
|
|
51
|
+
if (!i)
|
|
9
52
|
throw new Error("Radio must be rendered within RadioGroup");
|
|
10
|
-
return
|
|
53
|
+
return i;
|
|
11
54
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
55
|
+
function B(i, s, a) {
|
|
56
|
+
s.current = i, typeof a == "function" ? a(i) : a && (a.current = i);
|
|
14
57
|
}
|
|
15
|
-
const
|
|
58
|
+
const E = b(function(s, a) {
|
|
16
59
|
const {
|
|
17
|
-
children:
|
|
18
|
-
className:
|
|
19
|
-
disabled:
|
|
20
|
-
style:
|
|
21
|
-
value:
|
|
22
|
-
...
|
|
23
|
-
} =
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
60
|
+
children: u,
|
|
61
|
+
className: f,
|
|
62
|
+
disabled: p = !1,
|
|
63
|
+
style: v,
|
|
64
|
+
value: n,
|
|
65
|
+
...c
|
|
66
|
+
} = s, e = P(), d = N(null), o = e.disabled || p, r = e.value !== void 0, m = e.value === n, h = _(
|
|
67
|
+
(t) => B(
|
|
68
|
+
t,
|
|
69
|
+
d,
|
|
27
70
|
a
|
|
28
71
|
),
|
|
29
72
|
[a]
|
|
30
73
|
);
|
|
31
|
-
return
|
|
32
|
-
var
|
|
33
|
-
!
|
|
34
|
-
}, [
|
|
74
|
+
return j(() => {
|
|
75
|
+
var t;
|
|
76
|
+
!r && o && ((t = d.current) != null && t.checked) && (d.current.checked = !1);
|
|
77
|
+
}, [r, o]), /* @__PURE__ */ g(
|
|
35
78
|
"label",
|
|
36
79
|
{
|
|
37
|
-
className: ["nk-radio",
|
|
38
|
-
"data-disabled":
|
|
39
|
-
style:
|
|
80
|
+
className: ["nk-radio", f].filter(Boolean).join(" "),
|
|
81
|
+
"data-disabled": o || void 0,
|
|
82
|
+
style: v,
|
|
40
83
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ l(
|
|
42
85
|
"input",
|
|
43
86
|
{
|
|
44
|
-
...
|
|
45
|
-
ref:
|
|
46
|
-
checked:
|
|
87
|
+
...c,
|
|
88
|
+
ref: h,
|
|
89
|
+
checked: r ? !o && m : void 0,
|
|
47
90
|
className: "nk-radio__control",
|
|
48
|
-
defaultChecked:
|
|
49
|
-
disabled:
|
|
50
|
-
name:
|
|
51
|
-
onChange:
|
|
52
|
-
required:
|
|
91
|
+
defaultChecked: r ? void 0 : !o && e.defaultValue === n,
|
|
92
|
+
disabled: o,
|
|
93
|
+
name: e.name,
|
|
94
|
+
onChange: e.onChange,
|
|
95
|
+
required: e.required,
|
|
53
96
|
type: "radio",
|
|
54
|
-
value:
|
|
97
|
+
value: n
|
|
55
98
|
}
|
|
56
99
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ l("span", { "aria-hidden": "true", className: "nk-radio__visual" }),
|
|
101
|
+
/* @__PURE__ */ l(y, { as: "span", className: "nk-radio__label", children: u })
|
|
59
102
|
]
|
|
60
103
|
}
|
|
61
104
|
);
|
|
105
|
+
}), O = Object.assign(E, {
|
|
106
|
+
Group: R
|
|
62
107
|
});
|
|
63
108
|
export {
|
|
64
|
-
|
|
109
|
+
O as default
|
|
65
110
|
};
|
package/dist/Select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),a=require("react"),J=require("./aria-Bntn6ad_.cjs"),$=require("./Icon-DJ4BigRz.cjs"),O=require("./usePresence-B5RYv4e1.cjs"),ke=require("./floating-position-Cy9xxdH4.cjs"),q=8,B=4,ge=160,Ee=72;function _e(n,t,s){const i=s.bottom-n.bottom-B-q,h=n.top-s.top-B-q,d=i<ge&&h>i,c=Math.max(Ee,d?h:i),m=Math.max(n.width,(t==null?void 0:t.width)??n.width),u=s.left+q,w=Math.min(Math.max(u,n.left),Math.max(u,s.right-q-m)),r=d?Math.max(s.top+q,n.top-B-Math.min((t==null?void 0:t.height)??c,c)):n.bottom+B;return{left:w,maxHeight:c,minWidth:n.width,top:r}}function se(n,t,s){if(n.length===0)return-1;for(let i=1;i<=n.length;i+=1){const h=(t+s*i+n.length)%n.length;if(!n[h].disabled)return h}return-1}function De(n,t,s){for(let i=1;i<=n.length;i+=1){const h=(s+i+n.length)%n.length,d=n[h];if(!d.disabled&&d.label.toLocaleLowerCase().startsWith(t))return h}return-1}function Se(n){const t=new Set;n.forEach(s=>{if(t.has(s.value))throw new Error("Select option values must be unique");t.add(s.value)})}function Re(n,t,s){t.current=n,typeof s=="function"?s(n):s&&(s.current=n)}function je(n){const{"aria-invalid":t,children:s,className:i,defaultValue:h,disabled:d=!1,forwardedReference:c,invalid:m=!1,placeholder:u,style:w,value:r,...k}=n,b=J.resolveAriaInvalid(m,t),x=m||J.hasInvalidState(t);return o.jsxs("span",{className:["nk-select",i].filter(Boolean).join(" "),"data-disabled":d||void 0,"data-invalid":x||void 0,"data-mode":"native",style:w,children:[o.jsxs("select",{...k,ref:c,"aria-invalid":b,className:"nk-select__control",defaultValue:r===void 0?h??(u!==void 0?"":void 0):void 0,disabled:d,value:r,children:[u!==void 0?o.jsx("option",{disabled:!0,value:"",children:u}):null,s]}),o.jsx($.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}function Oe(n,t,s,i){const[h,d]=a.useState(null);return a.useEffect(()=>{if(!n||!t||!i){d(null);return}const c=t.ownerDocument.defaultView;if(!c)return;const m=c;function u(){const k=t==null?void 0:t.getBoundingClientRect(),b=i==null?void 0:i.getBoundingClientRect();if(!k||!b||!i)return;const x=_e(k,s==null?void 0:s.getBoundingClientRect(),ke.getVisibleBounds(b,m.innerWidth,m.innerHeight));d({...x,left:x.left-b.left-i.clientLeft+i.scrollLeft,top:x.top-b.top-i.clientTop+i.scrollTop})}u(),m.addEventListener("scroll",u,!0),m.addEventListener("resize",u);const w=m.ResizeObserver,r=w?new w(u):null;return r==null||r.observe(t),r==null||r.observe(i),s&&(r==null||r.observe(s)),()=>{m.removeEventListener("scroll",u,!0),m.removeEventListener("resize",u),r==null||r.disconnect()}},[n,i,s,t]),h}function Le(n){const{active:t,closeOnEscape:s,closeOnOutsideInteraction:i,highlightedIndex:h,id:d,listboxReference:c,onEscapeDismiss:m,onEscapeKeyDown:u,onHighlight:w,onOutsideDismiss:r,onPointerDownOutside:k,onSelect:b,options:x,ownerDocument:M,position:D,selectedValue:S,state:L,triggerReference:G}=n,v=a.useRef(null),K=O.useBoundary("Select").boundaryElement,R=O.useOverlayLayer(!0,K),U=a.useMemo(()=>[G,v],[G]),X=a.useCallback(f=>{v.current=f,c(f)},[c]);return O.useDismissableLayer({active:t,boundaries:U,boundary:K,dismissOnEscape:s,dismissOnPointerDownOutside:i,layerId:R.id,onEscapeDismiss:m,onEscapeKeyDown:u,onPointerDownOutside:k,onPointerDownOutsideDismiss:r,ownerDocument:M}),o.jsx("div",{"aria-hidden":t?void 0:!0,"aria-labelledby":d,className:"nk-select__listbox","data-state":L,id:`${d}-listbox`,ref:X,role:"listbox",style:D?{left:D.left,maxHeight:D.maxHeight,minWidth:D.minWidth,top:D.top,zIndex:R.zIndex}:{visibility:"hidden",zIndex:R.zIndex},children:x.map((f,H)=>o.jsxs("div",{"aria-disabled":f.disabled||void 0,"aria-selected":f.value===S,className:"nk-select__option","data-highlighted":H===h||void 0,"data-selected":f.value===S||void 0,id:`${d}-option-${H}`,onPointerDown:Z=>{Z.preventDefault(),f.disabled||b(f)},onPointerMove:()=>{f.disabled||w(H)},role:"option",children:[f.icon?o.jsx($.Icon,{type:f.icon}):null,o.jsx("span",{className:"nk-select__option-label",children:f.label}),f.value===S?o.jsx($.Icon,{className:"nk-select__check",type:"checkmark"}):null]},f.value))})}function Pe(n){var oe;const{"aria-invalid":t,className:s,closeOnEscape:i=!0,closeOnOutsideInteraction:h=!0,defaultValue:d="",disabled:c=!1,displayOverride:m,form:u,forwardedReference:w,id:r,invalid:k=!1,name:b,onChange:x,onClick:M,onEscapeKeyDown:D,onKeyDown:S,onOpenChange:L,onPointerDownOutside:G,options:v,placeholder:K,required:R=!1,style:U,value:X,width:f,...H}=n;Se(v);const Z=a.useId(),P=r??Z,g=a.useRef(null),le=a.useRef(null),C=a.useRef(null),F=a.useRef(""),[A,ce]=a.useState(null),[p,re]=a.useState(!1),[E,V]=a.useState(-1),[de,ie]=a.useState(d),N=X!==void 0,j=N?X:de,ue=v.find(e=>e.value===j),fe=k||J.hasInvalidState(t),he=J.resolveAriaInvalid(k,t),ee=O.usePresence(p),W=((oe=g.current)==null?void 0:oe.ownerDocument)??(typeof document>"u"?null:document),me=O.useBoundary("Select").boundaryElement,ve=Oe(ee.present,g.current,A,me),pe=f===void 0?U:{...U,width:f},Q=m??ue,Ie=a.useCallback(e=>{Re(e,g,w)},[w]),I=a.useCallback(e=>{p!==e&&(re(e),L==null||L(e))},[L,p]),z=a.useCallback((e=1)=>{const l=v.findIndex(_=>_.value===j&&!_.disabled),y=e===1?-1:v.length;V(l>=0?l:se(v,y,e)),I(!0)},[v,j,I]),ae=a.useCallback(e=>{var l;c||e.disabled||(N||ie(e.value),I(!1),(l=g.current)==null||l.focus(),x==null||x(e.value))},[c,N,x,I]),xe=a.useCallback(()=>{var e;I(!1),(e=g.current)==null||e.focus()},[I]),ye=a.useCallback(()=>{I(!1)},[I]);function we(e){M==null||M(e),!(e.defaultPrevented||c)&&(p?I(!1):z())}function be(e){if(S==null||S(e),!(e.defaultPrevented||c)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const l=e.key==="ArrowDown"?1:-1;p?V(y=>se(v,y,l)):z(l);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!p)z(e.key==="Home"?1:-1);else{const l=e.key==="Home"?1:-1,y=l===1?-1:v.length;V(se(v,y,l))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const l=v[E];p&&l?ae(l):p||z();return}if(e.key==="Tab"){I(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const l=e.currentTarget.ownerDocument.defaultView;if(!l)return;const y=e.key.toLocaleLowerCase(),_=F.current+y,te=Array.from(_).every(ne=>ne===y);F.current=te?y:_,C.current!==null&&l.clearTimeout(C.current),C.current=l.setTimeout(()=>{F.current="",C.current=null},500);const T=De(v,F.current,E);T>=0&&(e.preventDefault(),p||I(!0),V(T))}}}return a.useEffect(()=>{c&&I(!1)},[c,I]),a.useEffect(()=>{var e;if(p&&E>=0){const l=W==null?void 0:W.getElementById(`${P}-option-${E}`);l&&(A!=null&&A.contains(l))&&((e=l.scrollIntoView)==null||e.call(l,{block:"nearest"}))}},[E,P,A,p]),a.useEffect(()=>{var y;const e=(y=g.current)==null?void 0:y.form;if(!e)return;function l(){const _=le.current,te=N?j:d;if(_){const T=Array.from(_.options),ne=T.find(Y=>Y.value===te)??T[0];T.forEach(Y=>{Y.defaultSelected=Y===ne})}N||ie(d),I(!1)}return e.addEventListener("reset",l),()=>e.removeEventListener("reset",l)},[d,u,N,j,I]),a.useEffect(()=>()=>{var l;const e=(l=g.current)==null?void 0:l.ownerDocument.defaultView;e&&C.current!==null&&e.clearTimeout(C.current)},[]),o.jsxs("span",{className:["nk-select",s].filter(Boolean).join(" "),"data-disabled":c||void 0,"data-invalid":fe||void 0,"data-mode":"custom","data-open":p||void 0,style:pe,children:[o.jsxs("button",{...H,ref:Ie,"aria-activedescendant":p&&E>=0?`${P}-option-${E}`:void 0,"aria-controls":`${P}-listbox`,"aria-expanded":p,"aria-haspopup":"listbox","aria-invalid":he,"aria-required":R||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:c,form:u,id:P,onClick:we,onKeyDown:be,role:"combobox",type:"button",children:[Q?o.jsxs("span",{className:"nk-select__value",children:[Q.icon?o.jsx($.Icon,{type:Q.icon}):null,o.jsx("span",{className:"nk-select__value-label",children:Q.label})]}):o.jsx("span",{className:"nk-select__placeholder",children:K}),o.jsx($.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),b||R?o.jsxs("select",{ref:le,"aria-hidden":"true",className:"nk-select__form-control",disabled:c,form:u,name:b,onChange:()=>{},onInvalid:e=>{var l;e.preventDefault(),(l=g.current)==null||l.focus()},required:R,tabIndex:-1,value:j,children:[o.jsx("option",{value:""}),v.map(e=>o.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,ee.present&&W?o.jsx(O.Portal,{children:o.jsx(Le,{active:p,closeOnEscape:i,closeOnOutsideInteraction:h,highlightedIndex:E,id:P,listboxReference:ce,onEscapeDismiss:xe,onEscapeKeyDown:D,onHighlight:V,onOutsideDismiss:ye,onPointerDownOutside:G,onSelect:ae,options:v,ownerDocument:W,position:ve,selectedValue:j,state:ee.state==="closing"?"closing":"open",triggerReference:g})}):null]})}const Ce=a.forwardRef(function(t,s){const{options:i}=t;return O.useBoundary("Select"),i!==void 0?o.jsx(Pe,{...t,forwardedReference:s}):o.jsx(je,{...t,forwardedReference:s})});exports.default=Ce;
|