neatkit 0.8.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/Boundary.cjs +1 -1
- package/dist/Boundary.js +29 -29
- 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 +1 -1
- package/dist/{Code-JDb4VFl7.cjs → Code-B7s_rN0G.cjs} +1 -1
- package/dist/{Code-ClkozPlv.js → Code-Bp2X1k-g.js} +1 -4
- 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-BoEUoOk7.js → Icon-CxK1wlGk.js} +98 -52
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +1 -1
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +108 -104
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +1 -1
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +147 -141
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +2 -2
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +310 -295
- 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/{Tooltip-B4bajPtk.cjs → Tooltip-B2d5ss7S.cjs} +1 -1
- package/dist/{Tooltip-BVqdnKK_.js → Tooltip-BK64rkxV.js} +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/albert-sans-cb3e34c4.woff2 +0 -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/utils/registry.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.d.ts +6 -1
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarGroup.d.ts +5 -16
- package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
- package/dist/components/Sidebar/components/SidebarItem.d.ts +3 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +2 -2
- package/dist/components/Sidebar/hooks/usePresentation.d.ts +2 -2
- package/dist/components/Sidebar/index.d.ts +1 -1
- package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
- package/dist/components/Sidebar/utils/state.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +21 -209
- 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/hooks/useHorizontalOverflow.d.ts +25 -0
- 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/floating-position-DIjh2wnP.cjs +1 -0
- package/dist/floating-position-DvR6e334.js +50 -0
- package/dist/style.css +1 -1
- package/dist/{useFloatingPosition-CMirP2-2.js → useFloatingPosition-B3ZC-v3v.js} +1 -1
- package/dist/{useFloatingPosition-BBEUHPqy.cjs → useFloatingPosition-GzkP9dCc.cjs} +1 -1
- package/package.json +2 -1
- package/dist/Button-Chv4O66e.js +0 -99
- package/dist/Button-DCKtFvSo.cjs +0 -1
- package/dist/Divider-CJYbFcSX.cjs +0 -1
- package/dist/Icon-DJ4BigRz.cjs +0 -1
- package/dist/Table-B30TBckZ.js +0 -402
- package/dist/Table-DceR12X9.cjs +0 -1
- package/dist/floating-position-5wJ5G5IT.js +0 -48
- package/dist/floating-position-Cy9xxdH4.cjs +0 -1
package/dist/Popover.js
CHANGED
|
@@ -1,231 +1,237 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { m as
|
|
5
|
-
import { u as
|
|
6
|
-
import { g as
|
|
7
|
-
import { F as
|
|
8
|
-
import { u as
|
|
9
|
-
import { u as
|
|
10
|
-
import { S as
|
|
11
|
-
function
|
|
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
12
|
const { inert: a, panelElement: i } = o;
|
|
13
|
-
return
|
|
13
|
+
return Me(() => {
|
|
14
14
|
i && (i.inert = a);
|
|
15
15
|
}, [a, i]), null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
a.current = o,
|
|
17
|
+
function Ze(o, a, i) {
|
|
18
|
+
a.current = o, se(i, o);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
a.current = o,
|
|
20
|
+
function er(o, a, i) {
|
|
21
|
+
a.current = o, se(i, o);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function rr(o) {
|
|
24
24
|
const a = o.tagName.toLowerCase();
|
|
25
25
|
return o.getAttribute("role") === "button" && a !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(a) ? !0 : a === "a" && o.hasAttribute("href");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function tr(o) {
|
|
28
28
|
return o === "grid" || o === "listbox" || o === "menu" || o === "tree" ? o : "dialog";
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const pr = Ne(function(a, i) {
|
|
31
31
|
const {
|
|
32
|
-
"aria-label":
|
|
33
|
-
"aria-labelledby":
|
|
34
|
-
autoFocus:
|
|
35
|
-
children:
|
|
36
|
-
className:
|
|
37
|
-
closeOnEscape:
|
|
38
|
-
closeOnOutsideInteraction:
|
|
39
|
-
defaultOpen:
|
|
40
|
-
disabled:
|
|
41
|
-
initialFocusReference:
|
|
42
|
-
onEscapeKeyDown:
|
|
43
|
-
onOpenChange:
|
|
44
|
-
onPointerDownOutside:
|
|
45
|
-
open:
|
|
46
|
-
placement:
|
|
47
|
-
restoreFocus:
|
|
48
|
-
role:
|
|
49
|
-
style:
|
|
50
|
-
tabIndex:
|
|
51
|
-
trapFocus:
|
|
32
|
+
"aria-label": A,
|
|
33
|
+
"aria-labelledby": ae,
|
|
34
|
+
autoFocus: F = !0,
|
|
35
|
+
children: ie,
|
|
36
|
+
className: ce,
|
|
37
|
+
closeOnEscape: le = !0,
|
|
38
|
+
closeOnOutsideInteraction: ue = !0,
|
|
39
|
+
defaultOpen: de = !1,
|
|
40
|
+
disabled: R = !1,
|
|
41
|
+
initialFocusReference: h,
|
|
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,
|
|
52
52
|
trigger: l,
|
|
53
|
-
...
|
|
53
|
+
...me
|
|
54
54
|
} = a;
|
|
55
|
-
if (l.type ===
|
|
55
|
+
if (l.type === Be)
|
|
56
56
|
throw new Error("Popover requires a single non-Fragment trigger");
|
|
57
|
-
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(
|
|
58
58
|
(e) => e + 1,
|
|
59
59
|
0
|
|
60
|
-
), [c,
|
|
61
|
-
() => [
|
|
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],
|
|
62
62
|
[]
|
|
63
|
-
), d =
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
), d = Qe(
|
|
64
|
+
O.present,
|
|
65
|
+
$,
|
|
66
66
|
c,
|
|
67
67
|
u,
|
|
68
68
|
w
|
|
69
|
-
),
|
|
69
|
+
), Ie = y(
|
|
70
70
|
(e) => {
|
|
71
|
-
|
|
71
|
+
er(
|
|
72
72
|
e,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
),
|
|
73
|
+
W,
|
|
74
|
+
J
|
|
75
|
+
), Pe(e);
|
|
76
76
|
},
|
|
77
|
-
[
|
|
78
|
-
),
|
|
77
|
+
[J]
|
|
78
|
+
), Re = y(
|
|
79
79
|
(e) => {
|
|
80
|
-
|
|
80
|
+
Ze(
|
|
81
81
|
e,
|
|
82
|
-
|
|
82
|
+
X,
|
|
83
83
|
i
|
|
84
|
-
),
|
|
84
|
+
), Ee(e);
|
|
85
85
|
},
|
|
86
86
|
[i]
|
|
87
|
-
), f =
|
|
88
|
-
r !== e && (
|
|
87
|
+
), f = y((e, t) => {
|
|
88
|
+
r !== e && (E ? (B.current = {
|
|
89
89
|
open: e,
|
|
90
90
|
reason: t
|
|
91
|
-
},
|
|
92
|
-
}, [
|
|
91
|
+
}, he()) : (N.current = t, ve(e)), x == null || x(e, t));
|
|
92
|
+
}, [E, x, r]), xe = y(() => {
|
|
93
93
|
f(!1, "escape");
|
|
94
|
-
}, [f]),
|
|
94
|
+
}, [f]), ke = y(() => {
|
|
95
95
|
f(!1, "outside");
|
|
96
|
-
}, [f]),
|
|
97
|
-
var
|
|
98
|
-
if (
|
|
99
|
-
const t = (
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
) ?? e.target : e.target;
|
|
103
|
-
}, [
|
|
104
|
-
|
|
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
105
|
boundary: w,
|
|
106
106
|
active: r,
|
|
107
|
-
boundaries:
|
|
108
|
-
dismissOnEscape:
|
|
109
|
-
dismissOnPointerDownOutside:
|
|
107
|
+
boundaries: Te,
|
|
108
|
+
dismissOnEscape: le,
|
|
109
|
+
dismissOnPointerDownOutside: ue,
|
|
110
110
|
layerId: C.id,
|
|
111
|
-
onEscapeDismiss:
|
|
112
|
-
onEscapeKeyDown:
|
|
113
|
-
onPointerDownOutside:
|
|
114
|
-
onPointerDownOutsideDismiss:
|
|
111
|
+
onEscapeDismiss: xe,
|
|
112
|
+
onEscapeKeyDown: fe,
|
|
113
|
+
onPointerDownOutside: Oe,
|
|
114
|
+
onPointerDownOutsideDismiss: ke,
|
|
115
115
|
ownerDocument: s
|
|
116
116
|
});
|
|
117
|
-
const
|
|
117
|
+
const we = We({
|
|
118
118
|
boundary: w,
|
|
119
|
-
active: r &&
|
|
120
|
-
autoFocus:
|
|
119
|
+
active: r && m,
|
|
120
|
+
autoFocus: F,
|
|
121
121
|
container: u,
|
|
122
|
-
initialFocusReference:
|
|
122
|
+
initialFocusReference: h,
|
|
123
123
|
layerId: C.id,
|
|
124
|
-
restoreFocus:
|
|
124
|
+
restoreFocus: L
|
|
125
125
|
});
|
|
126
|
-
|
|
127
|
-
if (!r ||
|
|
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 t =
|
|
131
|
+
const t = h == null ? void 0 : h.current;
|
|
132
132
|
(t && u.contains(t) ? t : u).focus({ preventScroll: !0 });
|
|
133
133
|
}), () => {
|
|
134
134
|
e = !1;
|
|
135
135
|
};
|
|
136
|
-
}, [
|
|
137
|
-
var
|
|
138
|
-
const e =
|
|
139
|
-
|
|
140
|
-
const t =
|
|
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
|
-
|
|
149
|
+
ye,
|
|
150
|
+
E,
|
|
150
151
|
r,
|
|
151
152
|
s,
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
L,
|
|
154
|
+
m,
|
|
154
155
|
c
|
|
155
|
-
]),
|
|
156
|
-
|
|
157
|
-
}, [
|
|
158
|
-
function
|
|
156
|
+
]), z(() => {
|
|
157
|
+
R && r && f(!1, "programmatic");
|
|
158
|
+
}, [R, r, f]);
|
|
159
|
+
function Ce(e) {
|
|
159
160
|
var t;
|
|
160
|
-
if (
|
|
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
|
+
function De(e) {
|
|
167
168
|
var t;
|
|
168
|
-
(t = n.onKeyDown) == null || t.call(n, e), !(e.defaultPrevented ||
|
|
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": r ?
|
|
180
|
+
"aria-controls": r ? Ae(n["aria-controls"], G) : n["aria-controls"],
|
|
175
181
|
"aria-expanded": r,
|
|
176
|
-
"aria-haspopup": n["aria-haspopup"] ??
|
|
177
|
-
"aria-disabled":
|
|
182
|
+
"aria-haspopup": n["aria-haspopup"] ?? tr(H),
|
|
183
|
+
"aria-disabled": P ? !0 : n["aria-disabled"],
|
|
178
184
|
className: [n.className, "nk-popover__trigger"].filter(Boolean).join(" "),
|
|
179
|
-
href:
|
|
180
|
-
id:
|
|
181
|
-
onClick:
|
|
182
|
-
onKeyDown:
|
|
183
|
-
ref:
|
|
184
|
-
role:
|
|
185
|
-
tabIndex:
|
|
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: r &&
|
|
194
|
-
children:
|
|
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:
|
|
203
|
+
...me,
|
|
204
|
+
ref: Re,
|
|
199
205
|
"aria-hidden": r ? void 0 : !0,
|
|
200
|
-
"aria-label": r ?
|
|
201
|
-
"aria-labelledby": r ?
|
|
202
|
-
className: ["nk-popover",
|
|
203
|
-
"data-placement": (d == null ? void 0 : d.placement) ??
|
|
204
|
-
"data-state":
|
|
205
|
-
id:
|
|
206
|
-
role: r ?
|
|
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) ?? $,
|
|
210
|
+
"data-state": O.state === "closing" ? "closing" : "open",
|
|
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
218
|
zIndex: C.zIndex
|
|
213
219
|
} : {
|
|
214
|
-
|
|
220
|
+
...V,
|
|
215
221
|
visibility: "hidden",
|
|
216
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
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 dr = Fe(function(a, i) {
|
|
|
234
240
|
] });
|
|
235
241
|
});
|
|
236
242
|
export {
|
|
237
|
-
|
|
243
|
+
pr as default
|
|
238
244
|
};
|
package/dist/Select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-BIBzgznI.cjs"),O=require("./usePresence-B5RYv4e1.cjs"),ke=require("./floating-position-DIjh2wnP.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;
|
package/dist/Select.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as h, jsxs as S } from "react/jsx-runtime";
|
|
3
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
4
|
import { h as ue, r as fe } from "./aria-CeA9QfD1.js";
|
|
5
|
-
import { I as X } from "./Icon-
|
|
5
|
+
import { I as X } from "./Icon-CxK1wlGk.js";
|
|
6
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-
|
|
7
|
+
import { g as He } from "./floating-position-DvR6e334.js";
|
|
8
8
|
const G = 8, ee = 4, Ce = 160, Me = 72;
|
|
9
9
|
function Ve(n, t, l) {
|
|
10
10
|
const a = l.bottom - n.bottom - ee - G, u = n.top - l.top - ee - G, c = a < Ce && u > a, o = Math.max(
|
package/dist/Sidebar.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 i=require("react/jsx-runtime"),t=require("react"),C=require("./effects-D85L_7zM.cjs"),L=require("./reference-C2guRuR0.cjs"),x=require("./usePresence-B5RYv4e1.cjs"),D=require("./Text-DWYlIcPj.cjs"),J=require("./Button-DU4j_IED.cjs"),V=require("./useFocusTrap-BrFZdMqQ.cjs"),W=require("./useScrollLock-Dy8MZaSn.cjs"),X=require("./aria-Bntn6ad_.cjs"),Y=require("./Avatar-Belo7qAY.cjs"),Z=require("./Spinner-BXgw60UC.cjs"),ee=require("./Tooltip-B2d5ss7S.cjs"),ne=require("./units-PzuiQNnw.cjs"),B=new WeakMap;function K(s){const n=B.get(s);if(n)return n;const e={listeners:new Set,owner:null,state:void 0};return B.set(s,e),e}function re(s,n,e){const r=K(s);return r.owner!==null&&r.owner!==n?!1:(r.owner=n,r.state=e,r.listeners.forEach(p=>p()),!0)}function te(s,n){const e=B.get(s);!e||e.owner!==n||(e.owner=null,e.state=void 0,e.listeners.forEach(r=>r()))}function se(s){var n;return s?(n=B.get(s))==null?void 0:n.state:void 0}function ae(s,n){if(!s)return()=>{};const e=K(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ie=()=>{};function P(s){const n=x.useBoundary(s).boundaryElement,e=t.useCallback(p=>ae(n,p),[n]),r=t.useCallback(()=>se(n),[n]);return t.useSyncExternalStore(e,r,ie)}function O(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const oe=t.forwardRef(function(n,e){const{children:r,className:p,presentation:c="both",...b}=n,o=P("Sidebar.Footer");return O(c,o==null?void 0:o.presentation)?i.jsx("div",{...b,ref:e,className:["nk-sidebar__footer",p].filter(Boolean).join(" "),children:r}):null}),le=t.forwardRef(function(n,e){const{"aria-label":r,"aria-labelledby":p,children:c,className:b,label:o,presentation:S="both",...v}=n,g=P("Sidebar.Group"),y=`${t.useId()}-label`,f=o!=null&&typeof o!="boolean"&&(typeof o!="string"||o.trim()!=="");if(!O(S,g==null?void 0:g.presentation))return null;const l=p??(r===void 0&&f?y:void 0),a=!!(r??l);return t.createElement(a?"nav":"div",{...v,ref:e,"aria-label":r,"aria-labelledby":l,className:["nk-sidebar__group",b].filter(Boolean).join(" ")},f?i.jsx(D.Text,{as:"h2",className:"nk-sidebar__group-label",id:y,size:"subtitle",weight:"medium",children:o}):null,i.jsx("ul",{className:"nk-sidebar__list",children:c}))}),ce=t.forwardRef(function(n,e){const{children:r,className:p,presentation:c="both",...b}=n,o=P("Sidebar.Header");return O(c,o==null?void 0:o.presentation)?i.jsx("div",{...b,ref:e,className:["nk-sidebar__header",p].filter(Boolean).join(" "),children:r}):null}),ue=t.forwardRef(function(n,e){const{active:r=!1,as:p,children:c,className:b,disabled:o=!1,icon:S,onClick:v,presentation:g="both",type:y,...f}=n,l=P("Sidebar.Item"),a=p??"button",u=a==="button",d=f,k=d.href!==void 0||d.to!==void 0;function m(_){if(o){_.preventDefault();return}v==null||v(_),l!=null&&l.open&&l.presentation==="overlay"&&!_.defaultPrevented&&l.requestOpenChange(!1,"item")}return O(g,l==null?void 0:l.presentation)?i.jsx("li",{className:"nk-sidebar__item-container",children:i.jsx(J.Button,{...f,ref:e,"aria-current":r?k?"page":"true":void 0,as:a,className:["nk-sidebar__item",b].filter(Boolean).join(" "),"data-active":r||void 0,disabled:o,fullWidth:!0,href:d.href,icon:S,onClick:m,shape:"rectangle",textAlignment:"left",type:u?y??"button":y,variant:"ghost",children:i.jsx("span",{className:"nk-sidebar__item-label",children:c})})}):null});function Q(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:p,top:c,open:b,panelId:o,panelReference:S,presentation:v,side:g,state:y,style:f,width:l,...a}=s,u=v==="overlay",d=n??(e===void 0?"Sidebar":void 0),k=u&&b;let m=f;return(l!==void 0||c!==void 0)&&(m={...f},c!==void 0&&(m["--nk-sidebar-top-offset"]=c),l!==void 0&&(m["--nk-sidebar-width"]=l)),i.jsx("aside",{...a,ref:S,"aria-hidden":u&&!b?!0:void 0,"aria-label":u&&!b?void 0:d,"aria-labelledby":u&&!b?void 0:e,"aria-modal":k?"true":void 0,className:["nk-sidebar",p].filter(Boolean).join(" "),"data-responsive":v==="pending"||void 0,"data-side":g,"data-state":y,"data-variant":u?"overlay":"inline",id:o,role:k?"dialog":void 0,style:m,tabIndex:u?-1:void 0,children:i.jsx("div",{className:"nk-sidebar__body",children:r})})}function de(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:p,panelReference:c,presenceState:b,restoreFocus:o,sidebar:S,side:v,...g}=s,{id:y,open:f,requestOpenChange:l}=S,a=t.useContext(x.FocusScopeContext),u=t.useRef(null),[d,k]=t.useState(null),m=x.useBoundary("Sidebar").boundaryElement,_=x.useOverlayLayer(!0,m),T=t.useCallback(E=>{u.current=E,c(E),k(E)},[c]);C.useIsomorphicLayoutEffect(()=>{d&&(d.inert=!f)},[f,d]);const q=t.useCallback(()=>{l(!1,"escape")},[l]),j=t.useCallback(()=>{l(!1,"outside")},[l]);x.useDismissableLayer({boundary:m,active:f,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:_.id,onEscapeDismiss:q,onPointerDownOutsideDismiss:j,ownerDocument:p});const N=V.useFocusTrap({boundary:m,active:f,container:d,initialFocusReference:e??u,layerId:_.id,restoreFocus:o});return W.useScrollLock(r&&f,p,m),i.jsx(x.FocusScopeContext.Provider,{value:f?N:a,children:i.jsx("div",{className:"nk-sidebar__overlay","data-side":v,"data-state":b,role:"presentation",style:{zIndex:_.zIndex},children:i.jsx(Q,{...g,open:f,panelId:y,panelReference:T,presentation:"overlay",side:v,state:b})})})}function be(s){const{children:n}=s;if(n.type===t.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=P("Sidebar.Trigger"),r=n.props,p=L.getElementReference(n),c=e==null?void 0:e.registerTrigger,b=e==null?void 0:e.unregisterTrigger,o=t.useRef(null),S=t.useCallback(u=>{const d=o.current;d&&d!==u&&(b==null||b(d)),o.current=u,u&&(c==null||c(u)),L.assignElementReference(p,u)},[p,c,b]),v=t.useCallback(u=>{var d;(d=r.onClick)==null||d.call(r,u),!(u.defaultPrevented||!e)&&e.requestOpenChange(!e.open,"trigger")},[r,e]);if(!e)return null;const{id:g,open:y,presentation:f,variant:l}=e,a=y&&f==="overlay";return t.cloneElement(n,{"aria-controls":a?X.mergeIdentifiers(r["aria-controls"],g):r["aria-controls"],"aria-expanded":y,"aria-haspopup":r["aria-haspopup"]??"dialog",className:[r.className,"nk-sidebar__trigger"].filter(Boolean).join(" "),"data-sidebar-variant":l,onClick:v,ref:S})}const fe=t.forwardRef(function(n,e){const{actions:r,className:p,description:c,image:b,loading:o=!1,name:S,onClick:v,...g}=n,y=c!=null&&typeof c!="boolean",f=i.jsxs(i.Fragment,{children:[i.jsx(Y.Avatar,{alt:S,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:b}),i.jsxs("span",{className:"nk-sidebar__user-text",children:[i.jsx(D.Text,{as:"span",className:"nk-sidebar__user-name",children:S}),y?i.jsx(D.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:c}):null]})]});return i.jsx("div",{...g,ref:e,className:["nk-sidebar__user",p].filter(Boolean).join(" "),children:o?i.jsx(Z.Spinner,{className:"nk-sidebar__user-spinner",size:16}):i.jsxs(i.Fragment,{children:[v?i.jsx("button",{className:"nk-sidebar__user-details",onClick:v,type:"button",children:f}):i.jsx("div",{className:"nk-sidebar__user-details",children:f}),r!==void 0&&r.length>0?i.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(l=>{const{"aria-label":a,icon:u,label:d,...k}=l;return i.jsx(ee.Tooltip2,{content:d,children:i.jsx(J.Button,{...k,"aria-label":a??d,className:"nk-sidebar__user-action",icon:u,shape:"rectangle",type:"button",variant:"ghost"})},d)})}):null]})})}),pe=()=>()=>{},$=()=>{};function me(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??pe,(e==null?void 0:e.read)??$,$);return s!=="responsive"?s:r===void 0?"pending":r>=ne.breakpoint("md")?"inline":"overlay"}const ve=t.forwardRef(function(n,e){var H;const{defaultOpen:r=!1,initialFocusReference:p,top:c,lockScroll:b=!0,onOpenChange:o,open:S,restoreFocus:v=!0,side:g="start",variant:y="responsive",width:f,...l}=n,a=x.useBoundary("Sidebar"),u=`${t.useId()}-sidebar`,d=t.useRef(Symbol("nk-sidebar")).current,k=t.useRef(null),m=me(y,a==null?void 0:a.width),_=S!==void 0,[T,q]=t.useState(r),j=_?S:T,N=t.useRef(o);C.useIsomorphicLayoutEffect(()=>{N.current=o});const E=t.useCallback((h,R)=>{var I;j!==h&&(_||q(h),(I=N.current)==null||I.call(N,h,R))},[_,j]),A=t.useCallback(h=>{k.current=h,L.assignElementReference(e??void 0,h)},[e]),w=t.useMemo(()=>[k],[]),M=t.useCallback(h=>{w.push({current:h})},[w]),U=t.useCallback(h=>{const R=w.findIndex(I=>I.current===h);R>0&&w.splice(R,1)},[w]),F=t.useMemo(()=>({id:u,open:j,presentation:m,registerTrigger:M,requestOpenChange:E,unregisterTrigger:U,variant:y}),[j,u,m,M,E,U,y]);C.useIsomorphicLayoutEffect(()=>{const h=a==null?void 0:a.boundaryElement;if(!h)return;if(re(h,d,F)===!1)throw new Error("A Boundary supports one Sidebar. Neatkit resolves Trigger, Group, and Item interactions against the single Sidebar published to the nearest Boundary, so give each Sidebar a Boundary of its own.")},[a==null?void 0:a.boundaryElement,d,F]),C.useIsomorphicLayoutEffect(()=>{const h=a==null?void 0:a.boundaryElement;if(h)return()=>te(h,d)},[a==null?void 0:a.boundaryElement,d]),t.useEffect(()=>{m==="inline"&&E(!1,"variant")},[m,E]);const z=x.usePresence(j&&m==="overlay"),G=((H=a==null?void 0:a.boundaryElement)==null?void 0:H.ownerDocument)??(typeof document>"u"?null:document);return m!=="overlay"?i.jsx(Q,{...l,top:c,open:!1,panelId:u,panelReference:A,presentation:m,side:g,width:f}):!z.present||!G?null:i.jsx(x.Portal,{children:i.jsx(de,{...l,initialFocusReference:p,lockScroll:b,ownerDocument:G,presenceState:z.state==="closing"?"closing":"open",boundaries:w,panelReference:A,restoreFocus:v,sidebar:F,side:g,width:f})})}),ye=Object.assign(ve,{Footer:oe,Group:le,Header:ce,Item:ue,Trigger:be,User:fe});exports.default=ye;
|