neatkit 0.7.0 → 0.9.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-BV5OUXpc.js +101 -0
- package/dist/Button-DU4j_IED.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-B7s_rN0G.cjs +4 -0
- package/dist/Code-Bp2X1k-g.js +224 -0
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/Divider-C7XGlr26.cjs +1 -0
- package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
- package/dist/Divider.cjs +1 -1
- package/dist/Divider.js +1 -1
- package/dist/Icon-BIBzgznI.cjs +1 -0
- package/dist/{Icon-uQmpr5P2.js → Icon-CxK1wlGk.js} +194 -181
- 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 +469 -18066
- 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 +171 -165
- 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 +490 -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-CADupJEU.js +423 -0
- package/dist/Table-qetwZpTC.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-B2d5ss7S.cjs +1 -0
- package/dist/Tooltip-BK64rkxV.js +231 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +2 -3
- package/dist/albert-sans-cb3e34c4.woff2 +0 -0
- 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/icons/GearIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
- package/dist/components/Icon/index.d.ts +0 -33
- package/dist/components/Icon/utils/registry.d.ts +2 -0
- 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 +113 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +24 -0
- package/dist/components/Sidebar/components/SidebarGroup.d.ts +31 -0
- package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
- package/dist/components/Sidebar/components/SidebarItem.d.ts +46 -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/presentation.d.ts +12 -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 +21 -249
- package/dist/components/Table/components/TableAction.d.ts +18 -0
- package/dist/components/Table/components/TableActionCell.d.ts +15 -0
- package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
- package/dist/components/Table/components/TableBody.d.ts +27 -0
- package/dist/components/Table/components/TableCell.d.ts +42 -0
- package/dist/components/Table/components/TableFoot.d.ts +19 -0
- package/dist/components/Table/components/TableHead.d.ts +19 -0
- package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
- package/dist/components/Table/components/TableRow.d.ts +67 -0
- package/dist/components/Table/contexts/TableContext.d.ts +4 -0
- package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/utils/cell.d.ts +25 -0
- package/dist/components/Table/utils/children.d.ts +18 -0
- package/dist/components/Table/utils/trigger.d.ts +54 -0
- 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-DIjh2wnP.cjs +1 -0
- package/dist/floating-position-DvR6e334.js +50 -0
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +1 -0
- package/dist/useFloatingPosition-B3ZC-v3v.js +43 -0
- package/dist/useFloatingPosition-GzkP9dCc.cjs +1 -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 +12 -16
- package/dist/Button-BAsLfA0D.js +0 -99
- 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/Divider-CJYbFcSX.cjs +0 -1
- 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,231 +1,237 @@
|
|
|
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 ne, Fragment as Le, jsx as I } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as Ne, Fragment as Be, useId as _e, useContext as Ke, useState as q, useRef as v, useReducer as je, useMemo as qe, useCallback as y, useEffect as z, cloneElement as ze } from "react";
|
|
4
|
+
import { m as Ae } from "./aria-CeA9QfD1.js";
|
|
5
|
+
import { u as Me } from "./effects-D5CWf-Pl.js";
|
|
6
|
+
import { g as $e, a as se } from "./reference-CXMr27nM.js";
|
|
7
|
+
import { F as oe, c as He, b as Ve, d as Ue, e as Ge, P as Je } from "./usePresence-CqegYqy4.js";
|
|
8
|
+
import { u as Qe } from "./useFloatingPosition-B3ZC-v3v.js";
|
|
9
|
+
import { u as We } from "./useFocusTrap-DhVnlboe.js";
|
|
10
|
+
import { S as Xe } from "./Surface-vEFsZC12.js";
|
|
11
|
+
function Ye(o) {
|
|
12
|
+
const { inert: a, panelElement: i } = o;
|
|
13
|
+
return Me(() => {
|
|
14
|
+
i && (i.inert = a);
|
|
15
|
+
}, [a, i]), null;
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
+
function Ze(o, a, i) {
|
|
18
|
+
a.current = o, se(i, o);
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
+
function er(o, a, i) {
|
|
21
|
+
a.current = o, se(i, o);
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
const a =
|
|
23
|
-
return
|
|
23
|
+
function rr(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 tr(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 pr = Ne(function(a, i) {
|
|
33
31
|
const {
|
|
34
|
-
"aria-label":
|
|
35
|
-
"aria-labelledby":
|
|
32
|
+
"aria-label": A,
|
|
33
|
+
"aria-labelledby": ae,
|
|
36
34
|
autoFocus: F = !0,
|
|
37
|
-
children:
|
|
38
|
-
className:
|
|
39
|
-
closeOnEscape:
|
|
40
|
-
closeOnOutsideInteraction:
|
|
41
|
-
defaultOpen:
|
|
42
|
-
disabled:
|
|
35
|
+
children: ie,
|
|
36
|
+
className: ce,
|
|
37
|
+
closeOnEscape: le = !0,
|
|
38
|
+
closeOnOutsideInteraction: ue = !0,
|
|
39
|
+
defaultOpen: de = !1,
|
|
40
|
+
disabled: R = !1,
|
|
43
41
|
initialFocusReference: h,
|
|
44
|
-
onEscapeKeyDown:
|
|
45
|
-
onOpenChange:
|
|
46
|
-
onPointerDownOutside:
|
|
47
|
-
open:
|
|
48
|
-
placement:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
trapFocus: p = !1,
|
|
42
|
+
onEscapeKeyDown: fe,
|
|
43
|
+
onOpenChange: x,
|
|
44
|
+
onPointerDownOutside: k,
|
|
45
|
+
open: M,
|
|
46
|
+
placement: $ = "bottom",
|
|
47
|
+
restoreFocus: L = !0,
|
|
48
|
+
role: H = "dialog",
|
|
49
|
+
style: V,
|
|
50
|
+
tabIndex: pe,
|
|
51
|
+
trapFocus: m = !1,
|
|
55
52
|
trigger: l,
|
|
56
|
-
...
|
|
57
|
-
} =
|
|
58
|
-
if (l.type ===
|
|
53
|
+
...me
|
|
54
|
+
} = a;
|
|
55
|
+
if (l.type === Be)
|
|
59
56
|
throw new Error("Popover requires a single non-Fragment trigger");
|
|
60
|
-
const
|
|
57
|
+
const U = _e(), ge = Ke(oe), G = `${U}-popover`, n = l.props, J = $e(l), Q = n.id ?? `${U}-trigger`, P = R || n.disabled === !0 || n["aria-disabled"] === !0 || n["aria-disabled"] === "true", E = M !== void 0, [be, ve] = q(de), r = E ? M : be, O = He(r), W = v(null), X = v(null), N = v("programmatic"), B = v(null), Y = v(r), T = v(null), [ye, he] = je(
|
|
61
58
|
(e) => e + 1,
|
|
62
59
|
0
|
|
63
|
-
), [c,
|
|
64
|
-
() => [
|
|
60
|
+
), [c, Pe] = q(null), [u, Ee] = q(null), s = (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document), w = Ve("Popover").boundaryElement, C = Ue(O.present, w), Te = qe(
|
|
61
|
+
() => [W, X],
|
|
65
62
|
[]
|
|
66
|
-
), d =
|
|
63
|
+
), d = Qe(
|
|
67
64
|
O.present,
|
|
68
|
-
|
|
65
|
+
$,
|
|
69
66
|
c,
|
|
70
|
-
u
|
|
71
|
-
|
|
67
|
+
u,
|
|
68
|
+
w
|
|
69
|
+
), Ie = y(
|
|
72
70
|
(e) => {
|
|
73
|
-
|
|
71
|
+
er(
|
|
74
72
|
e,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
),
|
|
73
|
+
W,
|
|
74
|
+
J
|
|
75
|
+
), Pe(e);
|
|
78
76
|
},
|
|
79
|
-
[
|
|
80
|
-
),
|
|
77
|
+
[J]
|
|
78
|
+
), Re = y(
|
|
81
79
|
(e) => {
|
|
82
|
-
|
|
80
|
+
Ze(
|
|
83
81
|
e,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
),
|
|
82
|
+
X,
|
|
83
|
+
i
|
|
84
|
+
), Ee(e);
|
|
87
85
|
},
|
|
88
|
-
[
|
|
89
|
-
), f =
|
|
90
|
-
|
|
86
|
+
[i]
|
|
87
|
+
), f = y((e, t) => {
|
|
88
|
+
r !== e && (E ? (B.current = {
|
|
91
89
|
open: e,
|
|
92
|
-
reason:
|
|
93
|
-
},
|
|
94
|
-
}, [
|
|
90
|
+
reason: t
|
|
91
|
+
}, he()) : (N.current = t, ve(e)), x == null || x(e, t));
|
|
92
|
+
}, [E, x, r]), xe = y(() => {
|
|
95
93
|
f(!1, "escape");
|
|
96
|
-
}, [f]),
|
|
94
|
+
}, [f]), ke = y(() => {
|
|
97
95
|
f(!1, "outside");
|
|
98
|
-
}, [f]),
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
(
|
|
104
|
-
) ?? e.target : e.target;
|
|
105
|
-
}, [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
96
|
+
}, [f]), Oe = y((e) => {
|
|
97
|
+
var p;
|
|
98
|
+
if (k == null || k(e), e.defaultPrevented) return;
|
|
99
|
+
const t = (p = s == null ? void 0 : s.defaultView) == null ? void 0 : p.HTMLElement;
|
|
100
|
+
t ? T.current = e.composedPath().find(
|
|
101
|
+
(b) => b instanceof t && b.tabIndex >= 0
|
|
102
|
+
) ?? e.target : T.current = e.target;
|
|
103
|
+
}, [k, s]);
|
|
104
|
+
Ge({
|
|
105
|
+
boundary: w,
|
|
106
|
+
active: r,
|
|
107
|
+
boundaries: Te,
|
|
108
|
+
dismissOnEscape: le,
|
|
109
|
+
dismissOnPointerDownOutside: ue,
|
|
110
|
+
layerId: C.id,
|
|
111
|
+
onEscapeDismiss: xe,
|
|
112
|
+
onEscapeKeyDown: fe,
|
|
113
|
+
onPointerDownOutside: Oe,
|
|
114
|
+
onPointerDownOutsideDismiss: ke,
|
|
115
|
+
ownerDocument: s
|
|
117
116
|
});
|
|
118
|
-
const
|
|
119
|
-
|
|
117
|
+
const we = We({
|
|
118
|
+
boundary: w,
|
|
119
|
+
active: r && m,
|
|
120
120
|
autoFocus: F,
|
|
121
121
|
container: u,
|
|
122
122
|
initialFocusReference: h,
|
|
123
|
-
layerId:
|
|
124
|
-
restoreFocus:
|
|
123
|
+
layerId: C.id,
|
|
124
|
+
restoreFocus: L
|
|
125
125
|
});
|
|
126
|
-
|
|
127
|
-
if (!
|
|
126
|
+
z(() => {
|
|
127
|
+
if (!r || m || !F || !u) return;
|
|
128
128
|
let e = !0;
|
|
129
129
|
return Promise.resolve().then(() => {
|
|
130
130
|
if (!e) return;
|
|
131
|
-
const
|
|
132
|
-
(
|
|
131
|
+
const t = h == null ? void 0 : h.current;
|
|
132
|
+
(t && u.contains(t) ? t : u).focus({ preventScroll: !0 });
|
|
133
133
|
}), () => {
|
|
134
134
|
e = !1;
|
|
135
135
|
};
|
|
136
|
-
}, [F, h,
|
|
137
|
-
var
|
|
138
|
-
const e =
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
}, [F, h, r, u, m]), z(() => {
|
|
137
|
+
var te;
|
|
138
|
+
const e = Y.current;
|
|
139
|
+
Y.current = r;
|
|
140
|
+
const t = B.current;
|
|
141
|
+
let p = N.current;
|
|
142
|
+
if (E && (p = "programmatic", e !== r && (t == null ? void 0 : t.open) === r && (p = t.reason)), B.current = null, r) {
|
|
143
|
+
N.current = "programmatic", T.current = null;
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
|
-
const
|
|
146
|
-
e && !
|
|
146
|
+
const b = s == null ? void 0 : s.activeElement, K = T.current, j = (te = s == null ? void 0 : s.defaultView) == null ? void 0 : te.HTMLElement, Fe = p === "outside" && j && K instanceof j && b instanceof j && (K === b || K.contains(b));
|
|
147
|
+
e && !m && L && !Fe && (c == null || c.focus({ preventScroll: !0 })), T.current = null;
|
|
147
148
|
}, [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
ye,
|
|
150
|
+
E,
|
|
151
|
+
r,
|
|
152
|
+
s,
|
|
153
|
+
L,
|
|
154
|
+
m,
|
|
154
155
|
c
|
|
155
|
-
]),
|
|
156
|
-
|
|
157
|
-
}, [
|
|
158
|
-
function
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
156
|
+
]), z(() => {
|
|
157
|
+
R && r && f(!1, "programmatic");
|
|
158
|
+
}, [R, r, f]);
|
|
159
|
+
function Ce(e) {
|
|
160
|
+
var t;
|
|
161
|
+
if (P) {
|
|
161
162
|
e.preventDefault(), e.stopPropagation();
|
|
162
163
|
return;
|
|
163
164
|
}
|
|
164
|
-
(
|
|
165
|
+
(t = n.onClick) == null || t.call(n, e), !e.defaultPrevented && f(!r, "trigger");
|
|
165
166
|
}
|
|
166
|
-
function
|
|
167
|
-
var
|
|
168
|
-
(
|
|
167
|
+
function De(e) {
|
|
168
|
+
var t;
|
|
169
|
+
(t = n.onKeyDown) == null || t.call(n, e), !(e.defaultPrevented || P || rr(e.currentTarget) || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), e.currentTarget.click());
|
|
169
170
|
}
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
171
|
+
if (R) return l;
|
|
172
|
+
const _ = typeof l.type == "string", g = _ ? l.type : null, Z = g === "a" && typeof n.href == "string", ee = _ && !(g === "button" || g === "input" || g === "select" || g === "summary" || g === "textarea" || Z), re = Z && P;
|
|
173
|
+
let D = n.role;
|
|
174
|
+
D === void 0 && (re ? D = "link" : ee && (D = "button"));
|
|
175
|
+
let S = n.tabIndex;
|
|
176
|
+
S === void 0 && ee && (S = 0), P && (S = -1);
|
|
177
|
+
const Se = ze(
|
|
172
178
|
l,
|
|
173
179
|
{
|
|
174
|
-
"aria-controls":
|
|
175
|
-
"aria-expanded":
|
|
176
|
-
"aria-haspopup":
|
|
177
|
-
"aria-disabled":
|
|
178
|
-
className: [
|
|
179
|
-
href:
|
|
180
|
-
id:
|
|
181
|
-
onClick:
|
|
182
|
-
onKeyDown:
|
|
183
|
-
ref:
|
|
184
|
-
role:
|
|
185
|
-
tabIndex:
|
|
180
|
+
"aria-controls": r ? Ae(n["aria-controls"], G) : n["aria-controls"],
|
|
181
|
+
"aria-expanded": r,
|
|
182
|
+
"aria-haspopup": n["aria-haspopup"] ?? tr(H),
|
|
183
|
+
"aria-disabled": P ? !0 : n["aria-disabled"],
|
|
184
|
+
className: [n.className, "nk-popover__trigger"].filter(Boolean).join(" "),
|
|
185
|
+
href: re ? void 0 : n.href,
|
|
186
|
+
id: Q,
|
|
187
|
+
onClick: Ce,
|
|
188
|
+
onKeyDown: _ ? De : n.onKeyDown,
|
|
189
|
+
ref: Ie,
|
|
190
|
+
role: D,
|
|
191
|
+
tabIndex: S
|
|
186
192
|
}
|
|
187
193
|
);
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
|
|
194
|
+
return /* @__PURE__ */ ne(Le, { children: [
|
|
195
|
+
Se,
|
|
196
|
+
/* @__PURE__ */ I(
|
|
197
|
+
oe.Provider,
|
|
192
198
|
{
|
|
193
|
-
value:
|
|
194
|
-
children: O.present &&
|
|
195
|
-
|
|
199
|
+
value: r && m ? we : ge,
|
|
200
|
+
children: O.present && s ? /* @__PURE__ */ I(Je, { children: /* @__PURE__ */ ne(
|
|
201
|
+
Xe,
|
|
196
202
|
{
|
|
197
|
-
...
|
|
198
|
-
ref:
|
|
199
|
-
"aria-hidden":
|
|
200
|
-
"aria-label":
|
|
201
|
-
"aria-labelledby":
|
|
202
|
-
className: ["nk-popover",
|
|
203
|
-
"data-placement": (d == null ? void 0 : d.placement) ??
|
|
203
|
+
...me,
|
|
204
|
+
ref: Re,
|
|
205
|
+
"aria-hidden": r ? void 0 : !0,
|
|
206
|
+
"aria-label": r ? A : void 0,
|
|
207
|
+
"aria-labelledby": r ? ae ?? (A === void 0 ? Q : void 0) : void 0,
|
|
208
|
+
className: ["nk-popover", ce].filter(Boolean).join(" "),
|
|
209
|
+
"data-placement": (d == null ? void 0 : d.placement) ?? $,
|
|
204
210
|
"data-state": O.state === "closing" ? "closing" : "open",
|
|
205
|
-
id:
|
|
206
|
-
role:
|
|
211
|
+
id: G,
|
|
212
|
+
role: r ? H : void 0,
|
|
207
213
|
style: d ? {
|
|
208
|
-
|
|
214
|
+
...V,
|
|
209
215
|
"--nk-popover-arrow-offset": `${d.arrowOffset}px`,
|
|
210
216
|
left: d.left,
|
|
211
217
|
top: d.top,
|
|
212
|
-
zIndex:
|
|
218
|
+
zIndex: C.zIndex
|
|
213
219
|
} : {
|
|
214
|
-
|
|
220
|
+
...V,
|
|
215
221
|
visibility: "hidden",
|
|
216
|
-
zIndex:
|
|
222
|
+
zIndex: C.zIndex
|
|
217
223
|
},
|
|
218
|
-
tabIndex:
|
|
224
|
+
tabIndex: pe ?? -1,
|
|
219
225
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
|
|
226
|
+
/* @__PURE__ */ I(
|
|
227
|
+
Ye,
|
|
222
228
|
{
|
|
223
|
-
inert: !
|
|
229
|
+
inert: !r,
|
|
224
230
|
panelElement: u
|
|
225
231
|
}
|
|
226
232
|
),
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ I("span", { "aria-hidden": "true", className: "nk-popover__arrow" }),
|
|
234
|
+
/* @__PURE__ */ I("div", { className: "nk-popover__content", children: ie })
|
|
229
235
|
]
|
|
230
236
|
}
|
|
231
237
|
) }) : null
|
|
@@ -234,5 +240,5 @@ const ct = Ce(function(s, a) {
|
|
|
234
240
|
] });
|
|
235
241
|
});
|
|
236
242
|
export {
|
|
237
|
-
|
|
243
|
+
pr as default
|
|
238
244
|
};
|
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
|
};
|