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
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as A } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as V, forwardRef as k, useRef as x, useState as L, useCallback as z, useEffect as M, useContext as Y, Children as I, isValidElement as D, Fragment as O, cloneElement as j, createElement as X } from "react";
|
|
4
|
+
import { a as W } from "./reference-CXMr27nM.js";
|
|
5
|
+
import { B as $ } from "./Button-Chv4O66e.js";
|
|
6
|
+
import { T as q } from "./Tooltip-BVqdnKK_.js";
|
|
7
|
+
const S = V("body"), G = [
|
|
8
|
+
"a[href]",
|
|
9
|
+
"audio[controls]",
|
|
10
|
+
"button",
|
|
11
|
+
"iframe",
|
|
12
|
+
"input",
|
|
13
|
+
"label",
|
|
14
|
+
"select",
|
|
15
|
+
"summary",
|
|
16
|
+
"textarea",
|
|
17
|
+
"video[controls]",
|
|
18
|
+
"[contenteditable]:not([contenteditable='false'])"
|
|
19
|
+
].join(","), J = /* @__PURE__ */ new Set([
|
|
20
|
+
"button",
|
|
21
|
+
"checkbox",
|
|
22
|
+
"combobox",
|
|
23
|
+
"grid",
|
|
24
|
+
"link",
|
|
25
|
+
"listbox",
|
|
26
|
+
"menu",
|
|
27
|
+
"menubar",
|
|
28
|
+
"menuitem",
|
|
29
|
+
"menuitemcheckbox",
|
|
30
|
+
"menuitemradio",
|
|
31
|
+
"option",
|
|
32
|
+
"radio",
|
|
33
|
+
"radiogroup",
|
|
34
|
+
"scrollbar",
|
|
35
|
+
"searchbox",
|
|
36
|
+
"slider",
|
|
37
|
+
"spinbutton",
|
|
38
|
+
"switch",
|
|
39
|
+
"tab",
|
|
40
|
+
"tablist",
|
|
41
|
+
"textbox",
|
|
42
|
+
"tree",
|
|
43
|
+
"treegrid",
|
|
44
|
+
"treeitem"
|
|
45
|
+
]);
|
|
46
|
+
function Q(n, l) {
|
|
47
|
+
var e;
|
|
48
|
+
let t = n;
|
|
49
|
+
for (; t && t !== l; ) {
|
|
50
|
+
if (t.matches(G) || (((e = t.getAttribute("role")) == null ? void 0 : e.split(/\s+/)) ?? []).some((i) => J.has(i)))
|
|
51
|
+
return !0;
|
|
52
|
+
t = t.parentElement;
|
|
53
|
+
}
|
|
54
|
+
return !1;
|
|
55
|
+
}
|
|
56
|
+
function U(n, l, t) {
|
|
57
|
+
return n === void 0 ? l : t ? t(n) : n instanceof Date ? Number.isNaN(n.getTime()) ? "Invalid Date" : n.toISOString().slice(0, 10) : typeof n == "boolean" ? n ? "Yes" : "No" : n;
|
|
58
|
+
}
|
|
59
|
+
function Z(n) {
|
|
60
|
+
if (typeof n == "number" || typeof n == "string")
|
|
61
|
+
return String(n);
|
|
62
|
+
}
|
|
63
|
+
function H(n) {
|
|
64
|
+
for (const l of I.toArray(n)) {
|
|
65
|
+
if (D(l) && l.type === O) {
|
|
66
|
+
if (H(l.props.children)) return !0;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
return !0;
|
|
70
|
+
}
|
|
71
|
+
return !1;
|
|
72
|
+
}
|
|
73
|
+
function ee(n, l) {
|
|
74
|
+
let t = !1;
|
|
75
|
+
function e(i) {
|
|
76
|
+
return I.map(i, (s) => D(s) ? s.type === O ? j(
|
|
77
|
+
s,
|
|
78
|
+
void 0,
|
|
79
|
+
e(
|
|
80
|
+
s.props.children
|
|
81
|
+
)
|
|
82
|
+
) : !t && s.type === F ? (t = !0, j(
|
|
83
|
+
s,
|
|
84
|
+
{ rowTrigger: l }
|
|
85
|
+
)) : s : s);
|
|
86
|
+
}
|
|
87
|
+
const c = e(n);
|
|
88
|
+
return { attached: t, content: c };
|
|
89
|
+
}
|
|
90
|
+
const te = k(
|
|
91
|
+
function(l, t) {
|
|
92
|
+
const { children: e, className: c, ...i } = l;
|
|
93
|
+
return /* @__PURE__ */ r(
|
|
94
|
+
"thead",
|
|
95
|
+
{
|
|
96
|
+
...i,
|
|
97
|
+
ref: t,
|
|
98
|
+
className: ["nk-table__head", c].filter(Boolean).join(" "),
|
|
99
|
+
children: /* @__PURE__ */ r(S.Provider, { value: "head", children: e })
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
), ne = k(
|
|
104
|
+
function(l, t) {
|
|
105
|
+
const {
|
|
106
|
+
children: e,
|
|
107
|
+
className: c,
|
|
108
|
+
emptyColumnCount: i = 1,
|
|
109
|
+
emptyMessage: s,
|
|
110
|
+
...m
|
|
111
|
+
} = l, d = !H(e), h = Number.isFinite(i) ? Math.max(1, Math.floor(i)) : 1;
|
|
112
|
+
return /* @__PURE__ */ r(
|
|
113
|
+
"tbody",
|
|
114
|
+
{
|
|
115
|
+
...m,
|
|
116
|
+
ref: t,
|
|
117
|
+
className: ["nk-table__body", c].filter(Boolean).join(" "),
|
|
118
|
+
children: d && s !== void 0 ? /* @__PURE__ */ r("tr", { className: "nk-table__row", children: /* @__PURE__ */ r(
|
|
119
|
+
"td",
|
|
120
|
+
{
|
|
121
|
+
className: "nk-table__cell nk-table__empty-cell",
|
|
122
|
+
colSpan: h,
|
|
123
|
+
children: /* @__PURE__ */ r("div", { className: "nk-table__empty-content", children: s })
|
|
124
|
+
}
|
|
125
|
+
) }) : /* @__PURE__ */ r(S.Provider, { value: "body", children: e })
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
), le = k(
|
|
130
|
+
function(l, t) {
|
|
131
|
+
const { children: e, className: c, ...i } = l;
|
|
132
|
+
return /* @__PURE__ */ r(
|
|
133
|
+
"tfoot",
|
|
134
|
+
{
|
|
135
|
+
...i,
|
|
136
|
+
ref: t,
|
|
137
|
+
className: ["nk-table__foot", c].filter(Boolean).join(" "),
|
|
138
|
+
children: /* @__PURE__ */ r(S.Provider, { value: "foot", children: e })
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
), oe = k(
|
|
143
|
+
function(l, t) {
|
|
144
|
+
const {
|
|
145
|
+
"aria-label": e,
|
|
146
|
+
actions: c,
|
|
147
|
+
children: i,
|
|
148
|
+
className: s,
|
|
149
|
+
download: m,
|
|
150
|
+
href: d,
|
|
151
|
+
hrefLang: h,
|
|
152
|
+
onClick: f,
|
|
153
|
+
onNavigate: a,
|
|
154
|
+
rel: T,
|
|
155
|
+
target: p,
|
|
156
|
+
...N
|
|
157
|
+
} = l, _ = x(null), w = Y(S), u = d !== void 0 || f !== void 0, v = (e == null ? void 0 : e.trim()) || (d !== void 0 ? "Open row" : "Activate row");
|
|
158
|
+
function g(o) {
|
|
159
|
+
_.current = o;
|
|
160
|
+
}
|
|
161
|
+
const R = d !== void 0 ? {
|
|
162
|
+
ariaLabel: v,
|
|
163
|
+
kind: "link",
|
|
164
|
+
linkProperties: {
|
|
165
|
+
download: m,
|
|
166
|
+
href: d,
|
|
167
|
+
hrefLang: h,
|
|
168
|
+
onNavigate: a,
|
|
169
|
+
rel: T,
|
|
170
|
+
target: p
|
|
171
|
+
},
|
|
172
|
+
reference: g
|
|
173
|
+
} : f !== void 0 ? {
|
|
174
|
+
ariaLabel: v,
|
|
175
|
+
kind: "button",
|
|
176
|
+
onClick: f,
|
|
177
|
+
reference: g
|
|
178
|
+
} : void 0, C = R ? ee(i, R) : { content: i }, b = w === "head" ? /* @__PURE__ */ r(re, {}) : /* @__PURE__ */ r(ie, { actions: c ?? [] });
|
|
179
|
+
function E(o) {
|
|
180
|
+
if (o.defaultPrevented) return;
|
|
181
|
+
const y = o.target;
|
|
182
|
+
if (!(y instanceof Element) || Q(y, o.currentTarget)) return;
|
|
183
|
+
const P = _.current;
|
|
184
|
+
if (!P) return;
|
|
185
|
+
const B = P.ownerDocument.defaultView;
|
|
186
|
+
if (!B) {
|
|
187
|
+
P.click();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
P.dispatchEvent(new B.MouseEvent("click", {
|
|
191
|
+
altKey: o.altKey,
|
|
192
|
+
bubbles: !0,
|
|
193
|
+
button: o.button,
|
|
194
|
+
buttons: o.buttons,
|
|
195
|
+
cancelable: !0,
|
|
196
|
+
clientX: o.clientX,
|
|
197
|
+
clientY: o.clientY,
|
|
198
|
+
ctrlKey: o.ctrlKey,
|
|
199
|
+
metaKey: o.metaKey,
|
|
200
|
+
shiftKey: o.shiftKey
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ A(
|
|
204
|
+
"tr",
|
|
205
|
+
{
|
|
206
|
+
...N,
|
|
207
|
+
ref: t,
|
|
208
|
+
"aria-label": u ? void 0 : e,
|
|
209
|
+
className: ["nk-table__row", s].filter(Boolean).join(" "),
|
|
210
|
+
"data-interactive": u || void 0,
|
|
211
|
+
onClick: u ? E : void 0,
|
|
212
|
+
children: [
|
|
213
|
+
C.content,
|
|
214
|
+
b
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
), K = k(function(l, t) {
|
|
220
|
+
const {
|
|
221
|
+
align: e = "left",
|
|
222
|
+
children: c,
|
|
223
|
+
className: i,
|
|
224
|
+
scope: s = "col",
|
|
225
|
+
sticky: m = !1,
|
|
226
|
+
...d
|
|
227
|
+
} = l;
|
|
228
|
+
return /* @__PURE__ */ r(
|
|
229
|
+
"th",
|
|
230
|
+
{
|
|
231
|
+
...d,
|
|
232
|
+
ref: t,
|
|
233
|
+
className: ["nk-table__header-cell", i].filter(Boolean).join(" "),
|
|
234
|
+
"data-align": e,
|
|
235
|
+
"data-sticky": m || void 0,
|
|
236
|
+
scope: s,
|
|
237
|
+
children: c
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}), re = k(function(l, t) {
|
|
241
|
+
const { children: e, className: c, ...i } = l;
|
|
242
|
+
return /* @__PURE__ */ r(
|
|
243
|
+
K,
|
|
244
|
+
{
|
|
245
|
+
...i,
|
|
246
|
+
ref: t,
|
|
247
|
+
align: "right",
|
|
248
|
+
className: ["nk-table__action-header-cell", c].filter(Boolean).join(" "),
|
|
249
|
+
children: e ?? /* @__PURE__ */ r("span", { className: "nk-table__visually-hidden", children: "Row actions" })
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}), F = k(
|
|
253
|
+
function(l, t) {
|
|
254
|
+
const {
|
|
255
|
+
align: e = "left",
|
|
256
|
+
children: c,
|
|
257
|
+
className: i,
|
|
258
|
+
format: s,
|
|
259
|
+
title: m,
|
|
260
|
+
truncate: d,
|
|
261
|
+
value: h,
|
|
262
|
+
...f
|
|
263
|
+
} = l, { rowTrigger: a, ...T } = f, p = U(h, c, s), N = d === void 0 ? void 0 : { maxWidth: d }, _ = m ?? (d === void 0 ? void 0 : Z(p));
|
|
264
|
+
return /* @__PURE__ */ A(
|
|
265
|
+
"td",
|
|
266
|
+
{
|
|
267
|
+
...T,
|
|
268
|
+
ref: t,
|
|
269
|
+
className: ["nk-table__cell", i].filter(Boolean).join(" "),
|
|
270
|
+
"data-align": e,
|
|
271
|
+
title: _,
|
|
272
|
+
children: [
|
|
273
|
+
(a == null ? void 0 : a.kind) === "link" && a.linkProperties ? /* @__PURE__ */ r(
|
|
274
|
+
"a",
|
|
275
|
+
{
|
|
276
|
+
ref: a.reference,
|
|
277
|
+
"aria-label": a.ariaLabel,
|
|
278
|
+
className: "nk-table__row-trigger",
|
|
279
|
+
download: a.linkProperties.download,
|
|
280
|
+
href: a.linkProperties.href,
|
|
281
|
+
hrefLang: a.linkProperties.hrefLang,
|
|
282
|
+
onClick: a.linkProperties.onNavigate,
|
|
283
|
+
rel: a.linkProperties.rel,
|
|
284
|
+
target: a.linkProperties.target
|
|
285
|
+
}
|
|
286
|
+
) : null,
|
|
287
|
+
(a == null ? void 0 : a.kind) === "button" ? /* @__PURE__ */ r(
|
|
288
|
+
"button",
|
|
289
|
+
{
|
|
290
|
+
ref: a.reference,
|
|
291
|
+
"aria-label": a.ariaLabel,
|
|
292
|
+
className: "nk-table__row-trigger",
|
|
293
|
+
onClick: a.onClick,
|
|
294
|
+
type: "button"
|
|
295
|
+
}
|
|
296
|
+
) : null,
|
|
297
|
+
d !== void 0 ? /* @__PURE__ */ r("span", { className: "nk-table__truncated-content", style: N, children: p }) : p
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
function ae(n) {
|
|
304
|
+
const {
|
|
305
|
+
"aria-label": l,
|
|
306
|
+
icon: t,
|
|
307
|
+
label: e,
|
|
308
|
+
...c
|
|
309
|
+
} = n;
|
|
310
|
+
return /* @__PURE__ */ r(q, { content: e, children: /* @__PURE__ */ r(
|
|
311
|
+
$,
|
|
312
|
+
{
|
|
313
|
+
...c,
|
|
314
|
+
"aria-label": l ?? e,
|
|
315
|
+
className: "nk-table__action",
|
|
316
|
+
icon: t,
|
|
317
|
+
shape: "rectangle",
|
|
318
|
+
type: "button",
|
|
319
|
+
variant: "ghost"
|
|
320
|
+
}
|
|
321
|
+
) });
|
|
322
|
+
}
|
|
323
|
+
function ie(n) {
|
|
324
|
+
const { actions: l } = n;
|
|
325
|
+
function t(e) {
|
|
326
|
+
e.stopPropagation();
|
|
327
|
+
}
|
|
328
|
+
return /* @__PURE__ */ r(
|
|
329
|
+
"td",
|
|
330
|
+
{
|
|
331
|
+
className: "nk-table__cell nk-table__action-cell",
|
|
332
|
+
"data-align": "right",
|
|
333
|
+
onClick: t,
|
|
334
|
+
children: l.length > 0 ? /* @__PURE__ */ r("span", { className: "nk-table__action-list", children: l.map((e) => /* @__PURE__ */ X(ae, { ...e, key: e.label })) }) : null
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
const ce = k(function(l, t) {
|
|
339
|
+
const {
|
|
340
|
+
"aria-label": e,
|
|
341
|
+
children: c,
|
|
342
|
+
className: i,
|
|
343
|
+
containerClassName: s,
|
|
344
|
+
...m
|
|
345
|
+
} = l, d = x(null), h = x(null), [f, a] = L(!1), [T, p] = L(!1), N = e ? `${e} scroll area` : "Scrollable table", _ = z(
|
|
346
|
+
(u) => {
|
|
347
|
+
h.current = u, W(t, u);
|
|
348
|
+
},
|
|
349
|
+
[t]
|
|
350
|
+
);
|
|
351
|
+
M(() => {
|
|
352
|
+
const u = d.current, v = h.current;
|
|
353
|
+
if (!u || !v) return;
|
|
354
|
+
const g = u, R = v;
|
|
355
|
+
function C() {
|
|
356
|
+
const y = g.scrollWidth > g.clientWidth;
|
|
357
|
+
a(y), y || p(!1);
|
|
358
|
+
}
|
|
359
|
+
C();
|
|
360
|
+
const b = g.ownerDocument.defaultView;
|
|
361
|
+
b == null || b.addEventListener("resize", C);
|
|
362
|
+
const E = b == null ? void 0 : b.ResizeObserver, o = E ? new E(C) : void 0;
|
|
363
|
+
return o == null || o.observe(g), o == null || o.observe(R), () => {
|
|
364
|
+
b == null || b.removeEventListener("resize", C), o == null || o.disconnect();
|
|
365
|
+
};
|
|
366
|
+
}, []);
|
|
367
|
+
function w(u) {
|
|
368
|
+
p(f && u.currentTarget.scrollLeft > 1);
|
|
369
|
+
}
|
|
370
|
+
return /* @__PURE__ */ r(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
ref: d,
|
|
374
|
+
"aria-label": f ? N : void 0,
|
|
375
|
+
className: ["nk-table__container", s].filter(Boolean).join(" "),
|
|
376
|
+
"data-scrolled": T || void 0,
|
|
377
|
+
onScroll: w,
|
|
378
|
+
role: f ? "region" : void 0,
|
|
379
|
+
tabIndex: f ? 0 : void 0,
|
|
380
|
+
children: /* @__PURE__ */ r(
|
|
381
|
+
"table",
|
|
382
|
+
{
|
|
383
|
+
...m,
|
|
384
|
+
ref: _,
|
|
385
|
+
"aria-label": e,
|
|
386
|
+
className: ["nk-table", i].filter(Boolean).join(" "),
|
|
387
|
+
children: c
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}), me = Object.assign(ce, {
|
|
393
|
+
Body: ne,
|
|
394
|
+
Cell: F,
|
|
395
|
+
Foot: le,
|
|
396
|
+
HeaderCell: K,
|
|
397
|
+
Head: te,
|
|
398
|
+
Row: oe
|
|
399
|
+
});
|
|
400
|
+
export {
|
|
401
|
+
me as T
|
|
402
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const o=require("react/jsx-runtime"),l=require("react"),A=require("./reference-C2guRuR0.cjs"),I=require("./Button-DCKtFvSo.cjs"),D=require("./Tooltip-B4bajPtk.cjs"),w=l.createContext("body"),O=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),H=new Set(["button","checkbox","combobox","grid","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","radiogroup","scrollbar","searchbox","slider","spinbutton","switch","tab","tablist","textbox","tree","treegrid","treeitem"]);function K(n,r){var e;let t=n;for(;t&&t!==r;){if(t.matches(O)||(((e=t.getAttribute("role"))==null?void 0:e.split(/\s+/))??[]).some(s=>H.has(s)))return!0;t=t.parentElement}return!1}function F(n,r,t){return n===void 0?r:t?t(n):n instanceof Date?Number.isNaN(n.getTime())?"Invalid Date":n.toISOString().slice(0,10):typeof n=="boolean"?n?"Yes":"No":n}function V(n){if(typeof n=="number"||typeof n=="string")return String(n)}function S(n){for(const r of l.Children.toArray(n)){if(l.isValidElement(r)&&r.type===l.Fragment){if(S(r.props.children))return!0;continue}return!0}return!1}function q(n,r){let t=!1;function e(s){return l.Children.map(s,d=>l.isValidElement(d)?d.type===l.Fragment?l.cloneElement(d,void 0,e(d.props.children)):!t&&d.type===L?(t=!0,l.cloneElement(d,{rowTrigger:r})):d:d)}const c=e(n);return{attached:t,content:c}}const z=l.forwardRef(function(r,t){const{children:e,className:c,...s}=r;return o.jsx("thead",{...s,ref:t,className:["nk-table__head",c].filter(Boolean).join(" "),children:o.jsx(w.Provider,{value:"head",children:e})})}),M=l.forwardRef(function(r,t){const{children:e,className:c,emptyColumnCount:s=1,emptyMessage:d,...h}=r,u=!S(e),p=Number.isFinite(s)?Math.max(1,Math.floor(s)):1;return o.jsx("tbody",{...h,ref:t,className:["nk-table__body",c].filter(Boolean).join(" "),children:u&&d!==void 0?o.jsx("tr",{className:"nk-table__row",children:o.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:p,children:o.jsx("div",{className:"nk-table__empty-content",children:d})})}):o.jsx(w.Provider,{value:"body",children:e})})}),Y=l.forwardRef(function(r,t){const{children:e,className:c,...s}=r;return o.jsx("tfoot",{...s,ref:t,className:["nk-table__foot",c].filter(Boolean).join(" "),children:o.jsx(w.Provider,{value:"foot",children:e})})}),X=l.forwardRef(function(r,t){const{"aria-label":e,actions:c,children:s,className:d,download:h,href:u,hrefLang:p,onClick:m,onNavigate:i,rel:T,target:k,...x}=r,_=l.useRef(null),E=l.useContext(w),f=u!==void 0||m!==void 0,N=(e==null?void 0:e.trim())||(u!==void 0?"Open row":"Activate row");function g(a){_.current=a}const j=u!==void 0?{ariaLabel:N,kind:"link",linkProperties:{download:h,href:u,hrefLang:p,onNavigate:i,rel:T,target:k},reference:g}:m!==void 0?{ariaLabel:N,kind:"button",onClick:m,reference:g}:void 0,C=j?q(s,j):{content:s},b=E==="head"?o.jsx(W,{}):o.jsx(G,{actions:c??[]});function y(a){if(a.defaultPrevented)return;const v=a.target;if(!(v instanceof Element)||K(v,a.currentTarget))return;const R=_.current;if(!R)return;const P=R.ownerDocument.defaultView;if(!P){R.click();return}R.dispatchEvent(new P.MouseEvent("click",{altKey:a.altKey,bubbles:!0,button:a.button,buttons:a.buttons,cancelable:!0,clientX:a.clientX,clientY:a.clientY,ctrlKey:a.ctrlKey,metaKey:a.metaKey,shiftKey:a.shiftKey}))}return o.jsxs("tr",{...x,ref:t,"aria-label":f?void 0:e,className:["nk-table__row",d].filter(Boolean).join(" "),"data-interactive":f||void 0,onClick:f?y:void 0,children:[C.content,b]})}),B=l.forwardRef(function(r,t){const{align:e="left",children:c,className:s,scope:d="col",sticky:h=!1,...u}=r;return o.jsx("th",{...u,ref:t,className:["nk-table__header-cell",s].filter(Boolean).join(" "),"data-align":e,"data-sticky":h||void 0,scope:d,children:c})}),W=l.forwardRef(function(r,t){const{children:e,className:c,...s}=r;return o.jsx(B,{...s,ref:t,align:"right",className:["nk-table__action-header-cell",c].filter(Boolean).join(" "),children:e??o.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),L=l.forwardRef(function(r,t){const{align:e="left",children:c,className:s,format:d,title:h,truncate:u,value:p,...m}=r,{rowTrigger:i,...T}=m,k=F(p,c,d),x=u===void 0?void 0:{maxWidth:u},_=h??(u===void 0?void 0:V(k));return o.jsxs("td",{...T,ref:t,className:["nk-table__cell",s].filter(Boolean).join(" "),"data-align":e,title:_,children:[(i==null?void 0:i.kind)==="link"&&i.linkProperties?o.jsx("a",{ref:i.reference,"aria-label":i.ariaLabel,className:"nk-table__row-trigger",download:i.linkProperties.download,href:i.linkProperties.href,hrefLang:i.linkProperties.hrefLang,onClick:i.linkProperties.onNavigate,rel:i.linkProperties.rel,target:i.linkProperties.target}):null,(i==null?void 0:i.kind)==="button"?o.jsx("button",{ref:i.reference,"aria-label":i.ariaLabel,className:"nk-table__row-trigger",onClick:i.onClick,type:"button"}):null,u!==void 0?o.jsx("span",{className:"nk-table__truncated-content",style:x,children:k}):k]})});function $(n){const{"aria-label":r,icon:t,label:e,...c}=n;return o.jsx(D.Tooltip2,{content:e,children:o.jsx(I.Button,{...c,"aria-label":r??e,className:"nk-table__action",icon:t,shape:"rectangle",type:"button",variant:"ghost"})})}function G(n){const{actions:r}=n;function t(e){e.stopPropagation()}return o.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:t,children:r.length>0?o.jsx("span",{className:"nk-table__action-list",children:r.map(e=>l.createElement($,{...e,key:e.label}))}):null})}const J=l.forwardRef(function(r,t){const{"aria-label":e,children:c,className:s,containerClassName:d,...h}=r,u=l.useRef(null),p=l.useRef(null),[m,i]=l.useState(!1),[T,k]=l.useState(!1),x=e?`${e} scroll area`:"Scrollable table",_=l.useCallback(f=>{p.current=f,A.assignElementReference(t,f)},[t]);l.useEffect(()=>{const f=u.current,N=p.current;if(!f||!N)return;const g=f,j=N;function C(){const v=g.scrollWidth>g.clientWidth;i(v),v||k(!1)}C();const b=g.ownerDocument.defaultView;b==null||b.addEventListener("resize",C);const y=b==null?void 0:b.ResizeObserver,a=y?new y(C):void 0;return a==null||a.observe(g),a==null||a.observe(j),()=>{b==null||b.removeEventListener("resize",C),a==null||a.disconnect()}},[]);function E(f){k(m&&f.currentTarget.scrollLeft>1)}return o.jsx("div",{ref:u,"aria-label":m?x:void 0,className:["nk-table__container",d].filter(Boolean).join(" "),"data-scrolled":T||void 0,onScroll:E,role:m?"region":void 0,tabIndex:m?0:void 0,children:o.jsx("table",{...h,ref:_,"aria-label":e,className:["nk-table",s].filter(Boolean).join(" "),children:c})})}),Q=Object.assign(J,{Body:M,Cell:L,Foot:Y,HeaderCell:B,Head:z,Row:X});exports.Table=Q;
|
package/dist/Table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-DceR12X9.cjs");exports.default=e.Table;
|
package/dist/Table.js
CHANGED
package/dist/TextArea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),M=require("react"),n=require("./aria-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),M=require("react"),n=require("./aria-Bntn6ad_.cjs");function s(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):1}const b=M.forwardRef(function(o,l){const{"aria-invalid":a,className:d,disabled:c=!1,invalid:t=!1,minRows:r,readOnly:u=!1,resize:v="vertical",rows:i,style:m,...f}=o,x=s(i??r??3),w=`calc(${s(r??i??3)*1.25}em + var(--nk-text-area-padding) * 2 + var(--nk-text-area-border-width) * 2)`,h={...m,"--nk-text-area-min-height":w};return R.jsx("textarea",{...f,ref:l,"aria-invalid":n.resolveAriaInvalid(t,a),className:["nk-text-area",d].filter(Boolean).join(" "),"data-invalid":t||n.hasInvalidState(a)||void 0,"data-resize":v,disabled:c,readOnly:u,rows:x,style:h})});exports.default=b;
|
package/dist/TextArea.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as p } from "react";
|
|
3
|
-
import { h as R, r as A } from "./aria-
|
|
3
|
+
import { h as R, r as A } from "./aria-CeA9QfD1.js";
|
|
4
4
|
function o(a) {
|
|
5
5
|
return Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1;
|
|
6
6
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const T=require("react/jsx-runtime"),n=require("react"),S=require("./reference-C2guRuR0.cjs"),h=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-BBEUHPqy.cjs"),Ee=require("./focus-restoration-70WcQRr5.cjs"),be=require("./Surface-BttJYSDt.cjs"),ye=500,G=n.createContext(null);function De(o){const{children:a,delay:c=ye}=o,l=n.useMemo(()=>({delay:c}),[c]);return T.jsx(G.Provider,{value:l,children:a})}const J=500,$=100;function ge(o,a,c,l){a.current=o,S.assignElementReference(c,o),S.assignElementReference(l,o)}function Ie(o){return Number.isFinite(o)?Math.max(0,o):J}function he(o,a){const c=(o==null?void 0:o.split(/\s+/).filter(Boolean))??[];return c.includes(a)||c.push(a),c.join(" ")}const Le=n.forwardRef(function(a,c){const{children:l,className:K,content:m,contentClassName:Q,contentStyle:V,delay:X,disabled:R=!1,onOpenChange:L,placement:A="top",style:Z}=a;if(m==null||typeof m=="boolean"||typeof m=="string"&&!m.trim())throw new Error("Tooltip content must not be empty");if(l.type===n.Fragment)throw new Error("Tooltip requires a single non-Fragment trigger");const z=`${n.useId()}-tooltip`,_=n.useContext(G),r=l.props,B=S.getElementReference(l),w=n.useRef(null),x=n.useRef(null),Y=n.useRef(R),j=n.useRef(!1),v=n.useRef(null),F=n.useRef(null),k=n.useRef(null),C=n.useRef(!1),E=n.useRef(!1),b=n.useRef(!1),f=n.useRef(!1),[M,ee]=n.useState(null),[ne,te]=n.useState(null),[O,re]=n.useState(!1);Y.current=R;const P=Ie(X??(_==null?void 0:_.delay)??J),y=h.usePresence(O),H=(M==null?void 0:M.ownerDocument)??(typeof document>"u"?null:document),q=h.useBoundary("Tooltip").boundaryElement,N=h.useOverlayLayer(y.present,q),d=we.useFloatingPosition(y.present,A,M,ne,q),oe=n.useMemo(()=>[w,x],[]),se=he(r["aria-describedby"],z),ce=O&&y.present?se:r["aria-describedby"],U=n.useCallback(e=>{ge(e,w,B,c),ee(e)},[c,B]),ue=n.useCallback(e=>{x.current=e,e||(f.current=!1),te(e)},[]),u=n.useCallback(()=>{const e=v.current;e&&e.ownerWindow.clearTimeout(e.timerId),v.current=null},[]),i=n.useCallback(()=>{const e=F.current;e&&e.ownerWindow.clearTimeout(e.timerId),F.current=null},[]),D=n.useCallback(()=>{const e=k.current;e&&e.ownerWindow.clearTimeout(e.timerId),k.current=null},[]),s=n.useCallback(e=>{j.current!==e&&(e||(f.current=!1),j.current=e,re(e),L==null||L(e))},[L]),W=n.useCallback(e=>{var g,I;if(i(),E.current||b.current||f.current)return;if(e===0){s(!1);return}const t=((g=w.current)==null?void 0:g.ownerDocument.defaultView)??((I=x.current)==null?void 0:I.ownerDocument.defaultView);if(!t){s(!1);return}const p=t.setTimeout(()=>{F.current=null,!E.current&&!b.current&&!f.current&&s(!1)},e);F.current={ownerWindow:t,timerId:p}},[i,s]),ie=n.useCallback(()=>{var p;if(u(),i(),P===0){s(!0);return}const e=(p=w.current)==null?void 0:p.ownerDocument.defaultView;if(!e)return;const t=e.setTimeout(()=>{v.current=null,Y.current||s(!0)},P);v.current={ownerWindow:e,timerId:t}},[i,u,P,s]);function le(e){var t;if((t=r.onFocus)==null||t.call(r,e),E.current=!0,i(),C.current||Ee.isElementFocusRestoration(e.currentTarget)){u();return}u(),s(!0)}function ae(e){var t;(t=r.onBlur)==null||t.call(r,e),!e.currentTarget.contains(e.relatedTarget)&&(E.current=!1,u(),W(0))}function fe(e){var t;(t=r.onMouseEnter)==null||t.call(r,e),b.current=!0,ie()}function de(e){var t;(t=r.onMouseLeave)==null||t.call(r,e),b.current=!1,u(),W($)}function me(){f.current=!0,i()}function pe(){f.current=!1,W($)}function Te(e){var g,I;(g=r.onPointerDown)==null||g.call(r,e),u(),i(),s(!1);const t=(I=w.current)==null?void 0:I.ownerDocument.defaultView;if(!t)return;C.current=!0,D();const p=t.setTimeout(()=>{C.current=!1,k.current=null},0);k.current={ownerWindow:t,timerId:p}}if(h.useDismissableLayer({boundary:q,active:O,boundaries:oe,dismissOnPointerDownOutside:!0,layerId:N.id,onEscapeDismiss:()=>s(!1),onPointerDownOutsideDismiss:()=>s(!1),ownerDocument:H}),n.useEffect(()=>{R&&(u(),i(),D(),C.current=!1,E.current=!1,b.current=!1,f.current=!1,j.current&&s(!1))},[i,u,D,R,s]),n.useEffect(()=>()=>{u(),i(),D()},[i,u,D]),R)return n.cloneElement(l,{ref:U});const Re=n.cloneElement(l,{"aria-describedby":ce,className:[r.className,"nk-tooltip__trigger",K].filter(Boolean).join(" "),onBlur:ae,onFocus:le,onMouseEnter:fe,onMouseLeave:de,onPointerDown:Te,ref:U,style:{...r.style,...Z}});return T.jsxs(T.Fragment,{children:[Re,y.present&&H?T.jsx(h.Portal,{children:T.jsxs(be.Surface,{ref:ue,"aria-hidden":O?void 0:!0,className:["nk-tooltip",Q].filter(Boolean).join(" "),"data-placement":(d==null?void 0:d.placement)??A,"data-state":y.state==="closing"?"closing":"open",id:z,onMouseEnter:me,onMouseLeave:pe,role:"tooltip",style:d?{...V,"--nk-tooltip-arrow-offset":`${d.arrowOffset}px`,left:d.left,top:d.top,zIndex:N.zIndex}:{...V,visibility:"hidden",zIndex:N.zIndex},children:[T.jsx("span",{"aria-hidden":"true",className:"nk-tooltip__arrow"}),m]})}):null]})}),ve=Object.assign(Le,{Provider:De});exports.Tooltip2=ve;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C, jsxs as q, Fragment as Ie } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as X, createContext as be, forwardRef as he, Fragment as Le, useId as ve, useContext as Fe, useRef as u, useState as A, useCallback as f, useEffect as G, cloneElement as J } from "react";
|
|
4
|
+
import { g as Oe, a as K } from "./reference-CXMr27nM.js";
|
|
5
|
+
import { c as Me, b as _e, d as Pe, e as xe, P as Ne } from "./usePresence-CqegYqy4.js";
|
|
6
|
+
import { u as We } from "./useFloatingPosition-CMirP2-2.js";
|
|
7
|
+
import { i as ke } from "./focus-restoration-BvNZzrQA.js";
|
|
8
|
+
import { S as Ve } from "./Surface-vEFsZC12.js";
|
|
9
|
+
const je = 500, Z = be(null);
|
|
10
|
+
function Ae(r) {
|
|
11
|
+
const { children: a, delay: s = je } = r, l = X(() => ({
|
|
12
|
+
delay: s
|
|
13
|
+
}), [s]);
|
|
14
|
+
return /* @__PURE__ */ C(Z.Provider, { value: l, children: a });
|
|
15
|
+
}
|
|
16
|
+
const ee = 500, Q = 100;
|
|
17
|
+
function Ce(r, a, s, l) {
|
|
18
|
+
a.current = r, K(s, r), K(l, r);
|
|
19
|
+
}
|
|
20
|
+
function ze(r) {
|
|
21
|
+
return Number.isFinite(r) ? Math.max(0, r) : ee;
|
|
22
|
+
}
|
|
23
|
+
function Be(r, a) {
|
|
24
|
+
const s = (r == null ? void 0 : r.split(/\s+/).filter(Boolean)) ?? [];
|
|
25
|
+
return s.includes(a) || s.push(a), s.join(" ");
|
|
26
|
+
}
|
|
27
|
+
const Se = he(function(a, s) {
|
|
28
|
+
const {
|
|
29
|
+
children: l,
|
|
30
|
+
className: ne,
|
|
31
|
+
content: p,
|
|
32
|
+
contentClassName: te,
|
|
33
|
+
contentStyle: z,
|
|
34
|
+
delay: re,
|
|
35
|
+
disabled: w = !1,
|
|
36
|
+
onOpenChange: h,
|
|
37
|
+
placement: B = "top",
|
|
38
|
+
style: oe
|
|
39
|
+
} = a;
|
|
40
|
+
if (p == null || typeof p == "boolean" || typeof p == "string" && !p.trim())
|
|
41
|
+
throw new Error("Tooltip content must not be empty");
|
|
42
|
+
if (l.type === Le)
|
|
43
|
+
throw new Error("Tooltip requires a single non-Fragment trigger");
|
|
44
|
+
const S = `${ve()}-tooltip`, P = Fe(Z), t = l.props, Y = Oe(l), E = u(null), x = u(null), $ = u(w), N = u(!1), L = u(null), v = u(null), F = u(null), O = u(!1), y = u(!1), D = u(!1), d = u(!1), [M, se] = A(null), [ce, ie] = A(null), [_, ue] = A(!1);
|
|
45
|
+
$.current = w;
|
|
46
|
+
const W = ze(
|
|
47
|
+
re ?? (P == null ? void 0 : P.delay) ?? ee
|
|
48
|
+
), g = Me(_), H = (M == null ? void 0 : M.ownerDocument) ?? (typeof document > "u" ? null : document), k = _e("Tooltip").boundaryElement, V = Pe(g.present, k), m = We(
|
|
49
|
+
g.present,
|
|
50
|
+
B,
|
|
51
|
+
M,
|
|
52
|
+
ce,
|
|
53
|
+
k
|
|
54
|
+
), le = X(
|
|
55
|
+
() => [E, x],
|
|
56
|
+
[]
|
|
57
|
+
), ae = Be(
|
|
58
|
+
t["aria-describedby"],
|
|
59
|
+
S
|
|
60
|
+
), fe = _ && g.present ? ae : t["aria-describedby"], U = f(
|
|
61
|
+
(e) => {
|
|
62
|
+
Ce(
|
|
63
|
+
e,
|
|
64
|
+
E,
|
|
65
|
+
Y,
|
|
66
|
+
s
|
|
67
|
+
), se(e);
|
|
68
|
+
},
|
|
69
|
+
[s, Y]
|
|
70
|
+
), de = f(
|
|
71
|
+
(e) => {
|
|
72
|
+
x.current = e, e || (d.current = !1), ie(e);
|
|
73
|
+
},
|
|
74
|
+
[]
|
|
75
|
+
), c = f(() => {
|
|
76
|
+
const e = L.current;
|
|
77
|
+
e && e.ownerWindow.clearTimeout(e.timerId), L.current = null;
|
|
78
|
+
}, []), i = f(() => {
|
|
79
|
+
const e = v.current;
|
|
80
|
+
e && e.ownerWindow.clearTimeout(e.timerId), v.current = null;
|
|
81
|
+
}, []), R = f(() => {
|
|
82
|
+
const e = F.current;
|
|
83
|
+
e && e.ownerWindow.clearTimeout(e.timerId), F.current = null;
|
|
84
|
+
}, []), o = f((e) => {
|
|
85
|
+
N.current !== e && (e || (d.current = !1), N.current = e, ue(e), h == null || h(e));
|
|
86
|
+
}, [h]), j = f((e) => {
|
|
87
|
+
var I, b;
|
|
88
|
+
if (i(), y.current || D.current || d.current)
|
|
89
|
+
return;
|
|
90
|
+
if (e === 0) {
|
|
91
|
+
o(!1);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const n = ((I = E.current) == null ? void 0 : I.ownerDocument.defaultView) ?? ((b = x.current) == null ? void 0 : b.ownerDocument.defaultView);
|
|
95
|
+
if (!n) {
|
|
96
|
+
o(!1);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const T = n.setTimeout(() => {
|
|
100
|
+
v.current = null, !y.current && !D.current && !d.current && o(!1);
|
|
101
|
+
}, e);
|
|
102
|
+
v.current = {
|
|
103
|
+
ownerWindow: n,
|
|
104
|
+
timerId: T
|
|
105
|
+
};
|
|
106
|
+
}, [i, o]), me = f(() => {
|
|
107
|
+
var T;
|
|
108
|
+
if (c(), i(), W === 0) {
|
|
109
|
+
o(!0);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const e = (T = E.current) == null ? void 0 : T.ownerDocument.defaultView;
|
|
113
|
+
if (!e) return;
|
|
114
|
+
const n = e.setTimeout(() => {
|
|
115
|
+
L.current = null, $.current || o(!0);
|
|
116
|
+
}, W);
|
|
117
|
+
L.current = { ownerWindow: e, timerId: n };
|
|
118
|
+
}, [i, c, W, o]);
|
|
119
|
+
function pe(e) {
|
|
120
|
+
var n;
|
|
121
|
+
if ((n = t.onFocus) == null || n.call(t, e), y.current = !0, i(), O.current || ke(e.currentTarget)) {
|
|
122
|
+
c();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
c(), o(!0);
|
|
126
|
+
}
|
|
127
|
+
function Te(e) {
|
|
128
|
+
var n;
|
|
129
|
+
(n = t.onBlur) == null || n.call(t, e), !e.currentTarget.contains(e.relatedTarget) && (y.current = !1, c(), j(0));
|
|
130
|
+
}
|
|
131
|
+
function we(e) {
|
|
132
|
+
var n;
|
|
133
|
+
(n = t.onMouseEnter) == null || n.call(t, e), D.current = !0, me();
|
|
134
|
+
}
|
|
135
|
+
function Ee(e) {
|
|
136
|
+
var n;
|
|
137
|
+
(n = t.onMouseLeave) == null || n.call(t, e), D.current = !1, c(), j(Q);
|
|
138
|
+
}
|
|
139
|
+
function ye() {
|
|
140
|
+
d.current = !0, i();
|
|
141
|
+
}
|
|
142
|
+
function De() {
|
|
143
|
+
d.current = !1, j(Q);
|
|
144
|
+
}
|
|
145
|
+
function ge(e) {
|
|
146
|
+
var I, b;
|
|
147
|
+
(I = t.onPointerDown) == null || I.call(t, e), c(), i(), o(!1);
|
|
148
|
+
const n = (b = E.current) == null ? void 0 : b.ownerDocument.defaultView;
|
|
149
|
+
if (!n) return;
|
|
150
|
+
O.current = !0, R();
|
|
151
|
+
const T = n.setTimeout(() => {
|
|
152
|
+
O.current = !1, F.current = null;
|
|
153
|
+
}, 0);
|
|
154
|
+
F.current = { ownerWindow: n, timerId: T };
|
|
155
|
+
}
|
|
156
|
+
if (xe({
|
|
157
|
+
boundary: k,
|
|
158
|
+
active: _,
|
|
159
|
+
boundaries: le,
|
|
160
|
+
dismissOnPointerDownOutside: !0,
|
|
161
|
+
layerId: V.id,
|
|
162
|
+
onEscapeDismiss: () => o(!1),
|
|
163
|
+
onPointerDownOutsideDismiss: () => o(!1),
|
|
164
|
+
ownerDocument: H
|
|
165
|
+
}), G(() => {
|
|
166
|
+
w && (c(), i(), R(), O.current = !1, y.current = !1, D.current = !1, d.current = !1, N.current && o(!1));
|
|
167
|
+
}, [
|
|
168
|
+
i,
|
|
169
|
+
c,
|
|
170
|
+
R,
|
|
171
|
+
w,
|
|
172
|
+
o
|
|
173
|
+
]), G(() => () => {
|
|
174
|
+
c(), i(), R();
|
|
175
|
+
}, [i, c, R]), w)
|
|
176
|
+
return J(
|
|
177
|
+
l,
|
|
178
|
+
{ ref: U }
|
|
179
|
+
);
|
|
180
|
+
const Re = J(
|
|
181
|
+
l,
|
|
182
|
+
{
|
|
183
|
+
"aria-describedby": fe,
|
|
184
|
+
className: [t.className, "nk-tooltip__trigger", ne].filter(Boolean).join(" "),
|
|
185
|
+
onBlur: Te,
|
|
186
|
+
onFocus: pe,
|
|
187
|
+
onMouseEnter: we,
|
|
188
|
+
onMouseLeave: Ee,
|
|
189
|
+
onPointerDown: ge,
|
|
190
|
+
ref: U,
|
|
191
|
+
style: { ...t.style, ...oe }
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
return /* @__PURE__ */ q(Ie, { children: [
|
|
195
|
+
Re,
|
|
196
|
+
g.present && H ? /* @__PURE__ */ C(Ne, { children: /* @__PURE__ */ q(
|
|
197
|
+
Ve,
|
|
198
|
+
{
|
|
199
|
+
ref: de,
|
|
200
|
+
"aria-hidden": _ ? void 0 : !0,
|
|
201
|
+
className: ["nk-tooltip", te].filter(Boolean).join(" "),
|
|
202
|
+
"data-placement": (m == null ? void 0 : m.placement) ?? B,
|
|
203
|
+
"data-state": g.state === "closing" ? "closing" : "open",
|
|
204
|
+
id: S,
|
|
205
|
+
onMouseEnter: ye,
|
|
206
|
+
onMouseLeave: De,
|
|
207
|
+
role: "tooltip",
|
|
208
|
+
style: m ? {
|
|
209
|
+
...z,
|
|
210
|
+
"--nk-tooltip-arrow-offset": `${m.arrowOffset}px`,
|
|
211
|
+
left: m.left,
|
|
212
|
+
top: m.top,
|
|
213
|
+
zIndex: V.zIndex
|
|
214
|
+
} : {
|
|
215
|
+
...z,
|
|
216
|
+
visibility: "hidden",
|
|
217
|
+
zIndex: V.zIndex
|
|
218
|
+
},
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ C("span", { "aria-hidden": "true", className: "nk-tooltip__arrow" }),
|
|
221
|
+
p
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
) }) : null
|
|
225
|
+
] });
|
|
226
|
+
}), Qe = Object.assign(Se, {
|
|
227
|
+
Provider: Ae
|
|
228
|
+
});
|
|
229
|
+
export {
|
|
230
|
+
Qe as T
|
|
231
|
+
};
|
package/dist/Tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-B4bajPtk.cjs");exports.default=e.Tooltip2;
|