@vuer-ai/vuer-uikit 0.0.75 → 0.0.77
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/{chunk-P27TWGME.cjs → chunk-33ZAFHOY.cjs} +2 -2
- package/dist/{chunk-IZFHHQ6S.mjs → chunk-3HERIMKO.mjs} +2 -2
- package/dist/chunk-3LM4LVYM.mjs +187 -0
- package/dist/chunk-6E4NTY34.cjs +494 -0
- package/dist/{chunk-VNYP2IVJ.cjs → chunk-7644AY3P.cjs} +2 -2
- package/dist/chunk-AHNVEAOM.cjs +855 -0
- package/dist/{chunk-5432JOTN.mjs → chunk-AOAM6HV2.mjs} +2 -2
- package/dist/chunk-BWBBQCG2.mjs +217 -0
- package/dist/{chunk-P5T6EVSQ.mjs → chunk-CSSMBHBD.mjs} +1 -1
- package/dist/chunk-CW6FHIAT.cjs +624 -0
- package/dist/chunk-D4W2G6CY.cjs +494 -0
- package/dist/{chunk-NS2P4CPA.mjs → chunk-D5YKZOUG.mjs} +4 -4
- package/dist/{chunk-2274XZ2C.cjs → chunk-E6D3BSYY.cjs} +6 -6
- package/dist/chunk-HOJOWLJT.mjs +142 -0
- package/dist/chunk-HTAFERCZ.mjs +1 -0
- package/dist/chunk-HTHCG2AN.cjs +125 -0
- package/dist/chunk-HVVT3D2T.mjs +1 -0
- package/dist/chunk-IZJYFVS7.mjs +15 -0
- package/dist/chunk-KFPS5CCR.cjs +2 -0
- package/dist/chunk-KQXLV6YW.mjs +489 -0
- package/dist/chunk-LBENVTO2.mjs +853 -0
- package/dist/chunk-MMT74K7A.mjs +247 -0
- package/dist/chunk-NEOSSUNE.mjs +599 -0
- package/dist/chunk-OEM5OJDP.mjs +489 -0
- package/dist/chunk-RM7E3WGH.cjs +71 -0
- package/dist/chunk-SYXRPCBO.cjs +220 -0
- package/dist/chunk-TE5JNR5C.mjs +117 -0
- package/dist/chunk-UHDBWDHS.cjs +190 -0
- package/dist/{chunk-Z5P6VCGR.cjs → chunk-V2OROE7H.cjs} +2 -2
- package/dist/chunk-VOTZLQ6J.cjs +2 -0
- package/dist/chunk-W4CDQ2RJ.mjs +69 -0
- package/dist/chunk-XKIB3LSS.cjs +167 -0
- package/dist/chunk-YPQYI63K.cjs +249 -0
- package/dist/chunk-ZO3X2NDT.cjs +21 -0
- package/dist/highlight-cursor/enhanced-components.cjs +8 -8
- package/dist/highlight-cursor/enhanced-components.mjs +3 -3
- package/dist/highlight-cursor/index.cjs +12 -12
- package/dist/highlight-cursor/index.mjs +3 -3
- package/dist/index.cjs +442 -417
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +43 -38
- package/dist/ui/UIKitBadge.cjs +5 -5
- package/dist/ui/UIKitBadge.mjs +1 -1
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/index.cjs +362 -337
- package/dist/ui/index.d.cts +6 -2
- package/dist/ui/index.d.ts +6 -2
- package/dist/ui/index.mjs +42 -37
- package/dist/ui/inputs/index.cjs +5 -5
- package/dist/ui/inputs/index.mjs +1 -1
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/layouts/index.cjs +6 -6
- package/dist/ui/layouts/index.mjs +2 -2
- package/dist/ui/pagination.cjs +9 -9
- package/dist/ui/pagination.mjs +2 -2
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/sidebar.cjs +26 -26
- package/dist/ui/sidebar.mjs +2 -2
- package/dist/ui/{tree-view.cjs → simple-tree-view.cjs} +3 -3
- package/dist/ui/{tree-view.d.cts → simple-tree-view.d.cts} +1 -1
- package/dist/ui/{tree-view.d.ts → simple-tree-view.d.ts} +1 -1
- package/dist/ui/{tree-view.mjs → simple-tree-view.mjs} +1 -1
- package/dist/ui/tabs.cjs +6 -6
- package/dist/ui/tabs.mjs +2 -2
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/timeline.cjs +4 -4
- package/dist/ui/timeline.d.cts +1 -1
- package/dist/ui/timeline.d.ts +1 -1
- package/dist/ui/timeline.mjs +3 -3
- package/dist/ui/tree-view/TreeSearchBar.cjs +22 -0
- package/dist/ui/tree-view/TreeSearchBar.d.cts +16 -0
- package/dist/ui/tree-view/TreeSearchBar.d.ts +16 -0
- package/dist/ui/tree-view/TreeSearchBar.mjs +13 -0
- package/dist/ui/tree-view/TreeView.cjs +24 -0
- package/dist/ui/tree-view/TreeView.d.cts +48 -0
- package/dist/ui/tree-view/TreeView.d.ts +48 -0
- package/dist/ui/tree-view/TreeView.mjs +11 -0
- package/dist/ui/tree-view/hooks.cjs +14 -0
- package/dist/ui/tree-view/hooks.d.cts +38 -0
- package/dist/ui/tree-view/hooks.d.ts +38 -0
- package/dist/ui/tree-view/hooks.mjs +1 -0
- package/dist/ui/tree-view/index.cjs +42 -0
- package/dist/ui/tree-view/index.d.cts +6 -0
- package/dist/ui/tree-view/index.d.ts +6 -0
- package/dist/ui/tree-view/index.mjs +17 -0
- package/dist/ui/tree-view/types.cjs +4 -0
- package/dist/ui/tree-view/types.d.cts +24 -0
- package/dist/ui/tree-view/types.d.ts +24 -0
- package/dist/ui/tree-view/types.mjs +1 -0
- package/dist/ui/tree-view-legacy.cjs +37 -0
- package/dist/ui/tree-view-legacy.d.cts +108 -0
- package/dist/ui/tree-view-legacy.d.ts +108 -0
- package/dist/ui/{tree-view-v2.mjs → tree-view-legacy.mjs} +2 -2
- package/dist/ui/waterfall/TimelineEvent.d.cts +1 -1
- package/dist/ui/waterfall/TimelineEvent.d.ts +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.d.cts +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.d.ts +1 -1
- package/dist/ui/waterfall/Wedges.d.cts +1 -1
- package/dist/ui/waterfall/Wedges.d.ts +1 -1
- package/dist/ui/waterfall/hooks/useTimelineState.d.cts +1 -2
- package/dist/ui/waterfall/hooks/useTimelineState.d.ts +1 -2
- package/dist/ui/waterfall/hooks/useViewport.d.cts +1 -2
- package/dist/ui/waterfall/hooks/useViewport.d.ts +1 -2
- package/dist/ui/waterfall/index.cjs +6 -6
- package/dist/ui/waterfall/index.d.cts +1 -1
- package/dist/ui/waterfall/index.d.ts +1 -1
- package/dist/ui/waterfall/index.mjs +5 -5
- package/dist/ui/waterfall/types.d.cts +1 -2
- package/dist/ui/waterfall/types.d.ts +1 -2
- package/package.json +1 -1
- package/dist/chunk-FD5AAGON.cjs +0 -487
- package/dist/chunk-ILGNKXK2.mjs +0 -485
- package/dist/ui/tree-view-v2.cjs +0 -25
- package/dist/ui/tree-view-v2.d.cts +0 -43
- package/dist/ui/tree-view-v2.d.ts +0 -43
- /package/dist/{chunk-SUABRIFA.mjs → chunk-2SWBXWLK.mjs} +0 -0
- /package/dist/{chunk-XMUP5MIM.mjs → chunk-G3EIVAVR.mjs} +0 -0
- /package/dist/{chunk-OX2U5RAG.cjs → chunk-G5NT42YF.cjs} +0 -0
- /package/dist/{chunk-J5DLIKNB.cjs → chunk-X2A7TKER.cjs} +0 -0
package/dist/chunk-ILGNKXK2.mjs
DELETED
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './chunk-PCSY5IJ2.mjs';
|
|
2
|
-
import { SyncScroll } from './chunk-BEJIZ56L.mjs';
|
|
3
|
-
import { InputRoot, InputSlot } from './chunk-JXALL32A.mjs';
|
|
4
|
-
import { cn } from './chunk-HMN4IKTG.mjs';
|
|
5
|
-
import { Search, CaseSensitive, Regex, ChevronDown } from 'lucide-react';
|
|
6
|
-
import { useState, useMemo, useEffect } from 'react';
|
|
7
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
function TreeView({
|
|
10
|
-
data,
|
|
11
|
-
getIcon,
|
|
12
|
-
onVisibleDataChange,
|
|
13
|
-
onItemHover,
|
|
14
|
-
className,
|
|
15
|
-
hoveredId,
|
|
16
|
-
isSelectable = false,
|
|
17
|
-
selectedItemId,
|
|
18
|
-
onSelectChange,
|
|
19
|
-
isSearchable = true,
|
|
20
|
-
alwaysShowExpand = false,
|
|
21
|
-
useSyncScroll = false
|
|
22
|
-
}) {
|
|
23
|
-
const [expandedItems, setExpandedItems] = useState(() => {
|
|
24
|
-
const initial = /* @__PURE__ */ new Set();
|
|
25
|
-
data.forEach((item) => {
|
|
26
|
-
if (item.isCollapsible) initial.add(item.id);
|
|
27
|
-
});
|
|
28
|
-
return initial;
|
|
29
|
-
});
|
|
30
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
31
|
-
const [isCaseSensitive, setIsCaseSensitive] = useState(false);
|
|
32
|
-
const [isRegex, setIsRegex] = useState(false);
|
|
33
|
-
const [isRegexValid, setIsRegexValid] = useState(true);
|
|
34
|
-
const toggleItem = (id) => {
|
|
35
|
-
setExpandedItems((prev) => {
|
|
36
|
-
const newSet = new Set(prev);
|
|
37
|
-
if (newSet.has(id)) {
|
|
38
|
-
newSet.delete(id);
|
|
39
|
-
} else {
|
|
40
|
-
newSet.add(id);
|
|
41
|
-
}
|
|
42
|
-
return newSet;
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const handleItemSelect = (id) => {
|
|
46
|
-
if (isSelectable && onSelectChange) {
|
|
47
|
-
onSelectChange(selectedItemId === id ? null : id);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const hasDescendants = (itemId) => {
|
|
51
|
-
return (childrenMap.get(itemId) || []).length > 0;
|
|
52
|
-
};
|
|
53
|
-
const childrenMap = useMemo(() => {
|
|
54
|
-
const map = /* @__PURE__ */ new Map();
|
|
55
|
-
data.forEach((item) => {
|
|
56
|
-
if (!map.has(item.parentId)) {
|
|
57
|
-
map.set(item.parentId, []);
|
|
58
|
-
}
|
|
59
|
-
map.get(item.parentId).push(item);
|
|
60
|
-
});
|
|
61
|
-
return map;
|
|
62
|
-
}, [data]);
|
|
63
|
-
const dataWithMeta = useMemo(() => {
|
|
64
|
-
const dataMap = new Map(data.map((item) => [item.id, item]));
|
|
65
|
-
const getAncestors = (item) => {
|
|
66
|
-
const ancestors = [];
|
|
67
|
-
let current = item.parentId;
|
|
68
|
-
while (current) {
|
|
69
|
-
const parent = dataMap.get(current);
|
|
70
|
-
if (parent) {
|
|
71
|
-
ancestors.unshift(parent);
|
|
72
|
-
current = parent.parentId;
|
|
73
|
-
} else {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return ancestors;
|
|
78
|
-
};
|
|
79
|
-
const sortedData = [];
|
|
80
|
-
const visited = /* @__PURE__ */ new Set();
|
|
81
|
-
const traverseNode = (nodeId, depth = 0) => {
|
|
82
|
-
const children = childrenMap.get(nodeId) || [];
|
|
83
|
-
children.forEach((child) => {
|
|
84
|
-
if (!visited.has(child.id)) {
|
|
85
|
-
visited.add(child.id);
|
|
86
|
-
sortedData.push(child);
|
|
87
|
-
traverseNode(child.id, depth + 1);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
traverseNode(null);
|
|
92
|
-
return sortedData.map((item) => {
|
|
93
|
-
const siblings = childrenMap.get(item.parentId) || [];
|
|
94
|
-
const isLast = siblings.length > 0 && siblings[siblings.length - 1].id === item.id;
|
|
95
|
-
const ancestors = getAncestors(item);
|
|
96
|
-
const indent = ancestors.length;
|
|
97
|
-
return { ...item, indent, isLast, ancestors };
|
|
98
|
-
});
|
|
99
|
-
}, [data, childrenMap]);
|
|
100
|
-
const visibleData = useMemo(() => {
|
|
101
|
-
const dataMap = new Map(data.map((item) => [item.id, item]));
|
|
102
|
-
if (!searchQuery) {
|
|
103
|
-
const isVisible = (item) => {
|
|
104
|
-
return item.ancestors.every((ancestor) => expandedItems.has(ancestor.id));
|
|
105
|
-
};
|
|
106
|
-
return dataWithMeta.filter(isVisible);
|
|
107
|
-
}
|
|
108
|
-
const matchingAndAncestorIds = /* @__PURE__ */ new Set();
|
|
109
|
-
let regex = null;
|
|
110
|
-
if (isRegex) {
|
|
111
|
-
try {
|
|
112
|
-
regex = new RegExp(searchQuery, isCaseSensitive ? "" : "i");
|
|
113
|
-
if (!isRegexValid) setIsRegexValid(true);
|
|
114
|
-
} catch {
|
|
115
|
-
if (isRegexValid) setIsRegexValid(false);
|
|
116
|
-
return [];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
data.forEach((item) => {
|
|
120
|
-
let labelMatches = false;
|
|
121
|
-
if (regex) {
|
|
122
|
-
labelMatches = regex.test(item.label);
|
|
123
|
-
} else {
|
|
124
|
-
const source = isCaseSensitive ? item.label : item.label.toLowerCase();
|
|
125
|
-
const query = isCaseSensitive ? searchQuery : searchQuery.toLowerCase();
|
|
126
|
-
labelMatches = source.includes(query);
|
|
127
|
-
}
|
|
128
|
-
if (labelMatches) {
|
|
129
|
-
matchingAndAncestorIds.add(item.id);
|
|
130
|
-
let current = item.parentId;
|
|
131
|
-
while (current) {
|
|
132
|
-
const parent = dataMap.get(current);
|
|
133
|
-
if (parent) {
|
|
134
|
-
matchingAndAncestorIds.add(parent.id);
|
|
135
|
-
current = parent.parentId;
|
|
136
|
-
} else {
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return dataWithMeta.filter((item) => matchingAndAncestorIds.has(item.id));
|
|
143
|
-
}, [searchQuery, dataWithMeta, expandedItems, isCaseSensitive, isRegex, isRegexValid, data]);
|
|
144
|
-
const searchResultsCount = useMemo(() => {
|
|
145
|
-
if (!searchQuery || !isRegexValid) return 0;
|
|
146
|
-
let count = 0;
|
|
147
|
-
let regex = null;
|
|
148
|
-
if (isRegex) {
|
|
149
|
-
try {
|
|
150
|
-
regex = new RegExp(searchQuery, isCaseSensitive ? "" : "i");
|
|
151
|
-
} catch {
|
|
152
|
-
return 0;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
data.forEach((item) => {
|
|
156
|
-
let labelMatches = false;
|
|
157
|
-
if (regex) {
|
|
158
|
-
labelMatches = regex.test(item.label);
|
|
159
|
-
} else {
|
|
160
|
-
const source = isCaseSensitive ? item.label : item.label.toLowerCase();
|
|
161
|
-
const query = isCaseSensitive ? searchQuery : searchQuery.toLowerCase();
|
|
162
|
-
labelMatches = source.includes(query);
|
|
163
|
-
}
|
|
164
|
-
if (labelMatches) {
|
|
165
|
-
count++;
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
return count;
|
|
169
|
-
}, [searchQuery, data, isCaseSensitive, isRegex, isRegexValid]);
|
|
170
|
-
useEffect(() => {
|
|
171
|
-
onVisibleDataChange?.(visibleData);
|
|
172
|
-
}, [visibleData, onVisibleDataChange]);
|
|
173
|
-
const renderLabel = (label) => {
|
|
174
|
-
if (!searchQuery || !isRegexValid) {
|
|
175
|
-
return label;
|
|
176
|
-
}
|
|
177
|
-
let regex;
|
|
178
|
-
try {
|
|
179
|
-
regex = new RegExp(`(${searchQuery})`, isCaseSensitive ? "g" : "gi");
|
|
180
|
-
} catch {
|
|
181
|
-
return label;
|
|
182
|
-
}
|
|
183
|
-
const parts = label.split(regex);
|
|
184
|
-
return /* @__PURE__ */ jsx(Fragment, { children: parts.map(
|
|
185
|
-
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("span", { className: "rounded-uk-xs bg-accent-warning", children: part }, i) : part
|
|
186
|
-
) });
|
|
187
|
-
};
|
|
188
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col", className), children: [
|
|
189
|
-
isSearchable && /* @__PURE__ */ jsxs("div", { className: "shrink-0", children: [
|
|
190
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 py-1", children: /* @__PURE__ */ jsxs(
|
|
191
|
-
InputRoot,
|
|
192
|
-
{
|
|
193
|
-
type: "text",
|
|
194
|
-
placeholder: "Search...",
|
|
195
|
-
size: "md",
|
|
196
|
-
className: "flex-1",
|
|
197
|
-
inputClassName: cn(
|
|
198
|
-
!isRegexValid && "text-red-500"
|
|
199
|
-
),
|
|
200
|
-
value: searchQuery,
|
|
201
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
202
|
-
children: [
|
|
203
|
-
/* @__PURE__ */ jsx(InputSlot, { side: "left", children: /* @__PURE__ */ jsx(Search, { className: "text-text-secondary size-4 stroke-1" }) }),
|
|
204
|
-
/* @__PURE__ */ jsx(InputSlot, { side: "right", children: /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 200, children: [
|
|
205
|
-
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
206
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
207
|
-
"button",
|
|
208
|
-
{
|
|
209
|
-
onClick: () => setIsCaseSensitive((prev) => !prev),
|
|
210
|
-
className: cn("rounded-uk-sm p-1 mr-1", isCaseSensitive && "bg-shadow-secondary"),
|
|
211
|
-
children: /* @__PURE__ */ jsx(CaseSensitive, { className: "size-4" })
|
|
212
|
-
}
|
|
213
|
-
) }),
|
|
214
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Case Sensitive" }) })
|
|
215
|
-
] }),
|
|
216
|
-
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
217
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
218
|
-
"button",
|
|
219
|
-
{
|
|
220
|
-
onClick: () => setIsRegex((prev) => !prev),
|
|
221
|
-
className: cn("rounded-uk-sm p-1", isRegex && "bg-shadow-secondary"),
|
|
222
|
-
children: /* @__PURE__ */ jsx(Regex, { className: "size-4" })
|
|
223
|
-
}
|
|
224
|
-
) }),
|
|
225
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Use Regular Expression" }) })
|
|
226
|
-
] })
|
|
227
|
-
] }) })
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
) }),
|
|
231
|
-
searchQuery && isRegexValid && /* @__PURE__ */ jsx("div", { className: "flex justify-end px-2 pb-1", children: /* @__PURE__ */ jsxs("span", { className: "text-uk-xs text-text-secondary", children: [
|
|
232
|
-
searchResultsCount,
|
|
233
|
-
" result",
|
|
234
|
-
searchResultsCount !== 1 ? "s" : ""
|
|
235
|
-
] }) })
|
|
236
|
-
] }),
|
|
237
|
-
useSyncScroll ? /* @__PURE__ */ jsx(SyncScroll, { className: "scrollbar-track-transparent flex-1", children: visibleData.map((item) => /* @__PURE__ */ jsxs(
|
|
238
|
-
"div",
|
|
239
|
-
{
|
|
240
|
-
className: cn(
|
|
241
|
-
"group relative flex h-[32px] items-center",
|
|
242
|
-
isSelectable && "rounded-uk-md",
|
|
243
|
-
!item.disable && "cursor-pointer",
|
|
244
|
-
hoveredId === item.id && !item.disable && "bg-bg-secondary",
|
|
245
|
-
isSelectable && selectedItemId === item.id && "bg-brand-primary text-text-withbg"
|
|
246
|
-
),
|
|
247
|
-
onMouseEnter: () => onItemHover?.(item.id),
|
|
248
|
-
onMouseLeave: () => onItemHover?.(null),
|
|
249
|
-
onClick: () => !item.disable && handleItemSelect(item.id),
|
|
250
|
-
children: [
|
|
251
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute top-0 left-[-0.28rem] z-0 flex h-full items-center", children: [
|
|
252
|
-
item.ancestors.map((ancestor, index) => {
|
|
253
|
-
const parentIsLast = dataWithMeta.find((d) => d.id === ancestor.id)?.isLast;
|
|
254
|
-
return /* @__PURE__ */ jsx(
|
|
255
|
-
"div",
|
|
256
|
-
{
|
|
257
|
-
className: cn(
|
|
258
|
-
"h-full w-[1.25rem]",
|
|
259
|
-
parentIsLast ? "" : "border-l",
|
|
260
|
-
"border-line-primary"
|
|
261
|
-
)
|
|
262
|
-
},
|
|
263
|
-
index
|
|
264
|
-
);
|
|
265
|
-
}),
|
|
266
|
-
item.indent > 0 && /* @__PURE__ */ jsxs("div", { className: "relative h-full w-[1.24rem]", children: [
|
|
267
|
-
/* @__PURE__ */ jsx(
|
|
268
|
-
"div",
|
|
269
|
-
{
|
|
270
|
-
className: cn(
|
|
271
|
-
"absolute top-0 left-0 h-1/2 w-1/2 border-b border-l",
|
|
272
|
-
item.isLast ? "rounded-bl-md" : "",
|
|
273
|
-
"border-line-primary"
|
|
274
|
-
)
|
|
275
|
-
}
|
|
276
|
-
),
|
|
277
|
-
!item.isLast && /* @__PURE__ */ jsx("div", { className: "border-line-primary absolute top-1/2 left-0 h-1/2 w-1/2 border-l" })
|
|
278
|
-
] })
|
|
279
|
-
] }),
|
|
280
|
-
/* @__PURE__ */ jsxs(
|
|
281
|
-
"div",
|
|
282
|
-
{
|
|
283
|
-
className: "text-uk-md z-10 flex w-full items-center justify-between gap-2 px-2 whitespace-nowrap",
|
|
284
|
-
style: { paddingLeft: `${item.indent * 1.25 + 0.5}rem` },
|
|
285
|
-
children: [
|
|
286
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
287
|
-
alwaysShowExpand && hasDescendants(item.id) && !expandedItems.has(item.id) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
288
|
-
/* @__PURE__ */ jsx(
|
|
289
|
-
"button",
|
|
290
|
-
{
|
|
291
|
-
onClick: (e) => {
|
|
292
|
-
e.stopPropagation();
|
|
293
|
-
toggleItem(item.id);
|
|
294
|
-
},
|
|
295
|
-
className: "flex size-4 cursor-pointer items-center justify-center",
|
|
296
|
-
children: /* @__PURE__ */ jsx(
|
|
297
|
-
ChevronDown,
|
|
298
|
-
{
|
|
299
|
-
className: cn(
|
|
300
|
-
"size-4 -rotate-90 transition-transform",
|
|
301
|
-
item.disable && "text-icon-tertiary"
|
|
302
|
-
)
|
|
303
|
-
}
|
|
304
|
-
)
|
|
305
|
-
}
|
|
306
|
-
),
|
|
307
|
-
/* @__PURE__ */ jsx(
|
|
308
|
-
"div",
|
|
309
|
-
{
|
|
310
|
-
className: cn(
|
|
311
|
-
"flex size-4 items-center justify-center",
|
|
312
|
-
item.disable && "text-icon-tertiary"
|
|
313
|
-
),
|
|
314
|
-
children: getIcon(item)
|
|
315
|
-
}
|
|
316
|
-
)
|
|
317
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex size-4 items-center justify-center", children: [
|
|
318
|
-
item.isCollapsible && /* @__PURE__ */ jsx(
|
|
319
|
-
"button",
|
|
320
|
-
{
|
|
321
|
-
onClick: (e) => {
|
|
322
|
-
e.stopPropagation();
|
|
323
|
-
toggleItem(item.id);
|
|
324
|
-
},
|
|
325
|
-
className: "absolute z-20 flex cursor-pointer items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
|
|
326
|
-
children: /* @__PURE__ */ jsx(
|
|
327
|
-
ChevronDown,
|
|
328
|
-
{
|
|
329
|
-
className: cn(
|
|
330
|
-
"size-4 transition-transform",
|
|
331
|
-
!expandedItems.has(item.id) && "-rotate-90",
|
|
332
|
-
item.disable && "text-icon-tertiary"
|
|
333
|
-
)
|
|
334
|
-
}
|
|
335
|
-
)
|
|
336
|
-
}
|
|
337
|
-
),
|
|
338
|
-
/* @__PURE__ */ jsx(
|
|
339
|
-
"div",
|
|
340
|
-
{
|
|
341
|
-
className: cn(
|
|
342
|
-
"cursor-pointer transition-opacity",
|
|
343
|
-
item.isCollapsible && "group-hover:opacity-0",
|
|
344
|
-
item.disable && "text-icon-tertiary"
|
|
345
|
-
),
|
|
346
|
-
children: getIcon(item)
|
|
347
|
-
}
|
|
348
|
-
)
|
|
349
|
-
] }),
|
|
350
|
-
/* @__PURE__ */ jsx("span", { className: cn("truncate", item.disable && "text-text-tertiary"), children: renderLabel(item.label) })
|
|
351
|
-
] }),
|
|
352
|
-
item.actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", onClick: (e) => e.stopPropagation(), children: item.actions })
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
)
|
|
356
|
-
]
|
|
357
|
-
},
|
|
358
|
-
item.id
|
|
359
|
-
)) }) : /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: visibleData.map((item) => /* @__PURE__ */ jsxs(
|
|
360
|
-
"div",
|
|
361
|
-
{
|
|
362
|
-
className: cn(
|
|
363
|
-
"group relative flex h-[32px] items-center",
|
|
364
|
-
isSelectable && "rounded-uk-md",
|
|
365
|
-
!item.disable && "cursor-pointer",
|
|
366
|
-
hoveredId === item.id && !item.disable && "bg-bg-secondary",
|
|
367
|
-
isSelectable && selectedItemId === item.id && "bg-brand-primary text-text-withbg"
|
|
368
|
-
),
|
|
369
|
-
onMouseEnter: () => onItemHover?.(item.id),
|
|
370
|
-
onMouseLeave: () => onItemHover?.(null),
|
|
371
|
-
onClick: () => !item.disable && handleItemSelect(item.id),
|
|
372
|
-
children: [
|
|
373
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute top-0 left-[-0.28rem] z-0 flex h-full items-center", children: [
|
|
374
|
-
item.ancestors.map((ancestor, index) => {
|
|
375
|
-
const parentIsLast = dataWithMeta.find((d) => d.id === ancestor.id)?.isLast;
|
|
376
|
-
return /* @__PURE__ */ jsx(
|
|
377
|
-
"div",
|
|
378
|
-
{
|
|
379
|
-
className: cn(
|
|
380
|
-
"h-full w-[1.25rem]",
|
|
381
|
-
parentIsLast ? "" : "border-l",
|
|
382
|
-
"border-line-primary"
|
|
383
|
-
)
|
|
384
|
-
},
|
|
385
|
-
index
|
|
386
|
-
);
|
|
387
|
-
}),
|
|
388
|
-
item.indent > 0 && /* @__PURE__ */ jsxs("div", { className: "relative h-full w-[1.24rem]", children: [
|
|
389
|
-
/* @__PURE__ */ jsx(
|
|
390
|
-
"div",
|
|
391
|
-
{
|
|
392
|
-
className: cn(
|
|
393
|
-
"absolute top-0 left-0 h-1/2 w-1/2 border-b border-l",
|
|
394
|
-
item.isLast ? "rounded-bl-md" : "",
|
|
395
|
-
"border-line-primary"
|
|
396
|
-
)
|
|
397
|
-
}
|
|
398
|
-
),
|
|
399
|
-
!item.isLast && /* @__PURE__ */ jsx("div", { className: "border-line-primary absolute top-1/2 left-0 h-1/2 w-1/2 border-l" })
|
|
400
|
-
] })
|
|
401
|
-
] }),
|
|
402
|
-
/* @__PURE__ */ jsxs(
|
|
403
|
-
"div",
|
|
404
|
-
{
|
|
405
|
-
className: "text-uk-md z-10 flex w-full items-center justify-between gap-2 px-2 whitespace-nowrap",
|
|
406
|
-
style: { paddingLeft: `${item.indent * 1.25 + 0.5}rem` },
|
|
407
|
-
children: [
|
|
408
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
409
|
-
alwaysShowExpand && hasDescendants(item.id) && !expandedItems.has(item.id) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
410
|
-
/* @__PURE__ */ jsx(
|
|
411
|
-
"button",
|
|
412
|
-
{
|
|
413
|
-
onClick: (e) => {
|
|
414
|
-
e.stopPropagation();
|
|
415
|
-
toggleItem(item.id);
|
|
416
|
-
},
|
|
417
|
-
className: "flex size-4 cursor-pointer items-center justify-center",
|
|
418
|
-
children: /* @__PURE__ */ jsx(
|
|
419
|
-
ChevronDown,
|
|
420
|
-
{
|
|
421
|
-
className: cn(
|
|
422
|
-
"size-4 -rotate-90 transition-transform",
|
|
423
|
-
item.disable && "text-icon-tertiary"
|
|
424
|
-
)
|
|
425
|
-
}
|
|
426
|
-
)
|
|
427
|
-
}
|
|
428
|
-
),
|
|
429
|
-
/* @__PURE__ */ jsx(
|
|
430
|
-
"div",
|
|
431
|
-
{
|
|
432
|
-
className: cn(
|
|
433
|
-
"flex size-4 items-center justify-center",
|
|
434
|
-
item.disable && "text-icon-tertiary"
|
|
435
|
-
),
|
|
436
|
-
children: getIcon(item)
|
|
437
|
-
}
|
|
438
|
-
)
|
|
439
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex size-4 items-center justify-center", children: [
|
|
440
|
-
item.isCollapsible && /* @__PURE__ */ jsx(
|
|
441
|
-
"button",
|
|
442
|
-
{
|
|
443
|
-
onClick: (e) => {
|
|
444
|
-
e.stopPropagation();
|
|
445
|
-
toggleItem(item.id);
|
|
446
|
-
},
|
|
447
|
-
className: "absolute z-20 flex cursor-pointer items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
|
|
448
|
-
children: /* @__PURE__ */ jsx(
|
|
449
|
-
ChevronDown,
|
|
450
|
-
{
|
|
451
|
-
className: cn(
|
|
452
|
-
"size-4 transition-transform",
|
|
453
|
-
!expandedItems.has(item.id) && "-rotate-90",
|
|
454
|
-
item.disable && "text-icon-tertiary"
|
|
455
|
-
)
|
|
456
|
-
}
|
|
457
|
-
)
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
/* @__PURE__ */ jsx(
|
|
461
|
-
"div",
|
|
462
|
-
{
|
|
463
|
-
className: cn(
|
|
464
|
-
"cursor-pointer transition-opacity",
|
|
465
|
-
item.isCollapsible && "group-hover:opacity-0",
|
|
466
|
-
item.disable && "text-icon-tertiary"
|
|
467
|
-
),
|
|
468
|
-
children: getIcon(item)
|
|
469
|
-
}
|
|
470
|
-
)
|
|
471
|
-
] }),
|
|
472
|
-
/* @__PURE__ */ jsx("span", { className: cn("truncate", item.disable && "text-text-tertiary"), children: renderLabel(item.label) })
|
|
473
|
-
] }),
|
|
474
|
-
item.actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", onClick: (e) => e.stopPropagation(), children: item.actions })
|
|
475
|
-
]
|
|
476
|
-
}
|
|
477
|
-
)
|
|
478
|
-
]
|
|
479
|
-
},
|
|
480
|
-
item.id
|
|
481
|
-
)) })
|
|
482
|
-
] });
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
export { TreeView };
|
package/dist/ui/tree-view-v2.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkFD5AAGON_cjs = require('../chunk-FD5AAGON.cjs');
|
|
4
|
-
require('../chunk-LCCNBVKZ.cjs');
|
|
5
|
-
require('../chunk-JMCH2AFN.cjs');
|
|
6
|
-
require('../chunk-VBBJSIY7.cjs');
|
|
7
|
-
require('../chunk-G4FJGNY5.cjs');
|
|
8
|
-
require('../chunk-YQCSEMRB.cjs');
|
|
9
|
-
require('../chunk-QN4N4I3Z.cjs');
|
|
10
|
-
require('../chunk-Q7E73DVJ.cjs');
|
|
11
|
-
require('../chunk-JR4TVE43.cjs');
|
|
12
|
-
require('../chunk-VXZURKMQ.cjs');
|
|
13
|
-
require('../chunk-Q4XH2Z5M.cjs');
|
|
14
|
-
require('../chunk-6BOWMGFG.cjs');
|
|
15
|
-
require('../chunk-YZIR6LIY.cjs');
|
|
16
|
-
require('../chunk-RPTRTGC2.cjs');
|
|
17
|
-
require('../chunk-LBWMTA5T.cjs');
|
|
18
|
-
require('../chunk-OHIB3TEN.cjs');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(exports, "TreeViewV2", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () { return chunkFD5AAGON_cjs.TreeView; }
|
|
25
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Minimal tree node shape used by `TreeViewV2`.
|
|
6
|
-
*/
|
|
7
|
-
type TreeDataItem = {
|
|
8
|
-
id: string;
|
|
9
|
-
parentId: string | null;
|
|
10
|
-
label: string;
|
|
11
|
-
isCollapsible?: boolean;
|
|
12
|
-
actions?: ReactNode;
|
|
13
|
-
disable?: boolean;
|
|
14
|
-
[key: string]: unknown;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Props for the virtualized filterable tree view.
|
|
18
|
-
*/
|
|
19
|
-
type TreeViewProps<T extends TreeDataItem> = {
|
|
20
|
-
data: T[];
|
|
21
|
-
getIcon: (item: T) => ReactNode;
|
|
22
|
-
onVisibleDataChange?: (data: (T & {
|
|
23
|
-
indent: number;
|
|
24
|
-
isLast: boolean;
|
|
25
|
-
ancestors: T[];
|
|
26
|
-
})[]) => void;
|
|
27
|
-
onItemHover?: (id: string | null) => void;
|
|
28
|
-
className?: string;
|
|
29
|
-
hoveredId?: string | null;
|
|
30
|
-
isSelectable?: boolean;
|
|
31
|
-
selectedItemId?: string | null;
|
|
32
|
-
onSelectChange?: (id: string | null) => void;
|
|
33
|
-
isSearchable?: boolean;
|
|
34
|
-
alwaysShowExpand?: boolean;
|
|
35
|
-
useSyncScroll?: boolean;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Filterable and highlightable tree view with keyboardless interactions.
|
|
39
|
-
* Supports search (plain or regex), hover highlights, and collapsible nodes.
|
|
40
|
-
*/
|
|
41
|
-
declare function TreeView<T extends TreeDataItem>({ data, getIcon, onVisibleDataChange, onItemHover, className, hoveredId, isSelectable, selectedItemId, onSelectChange, isSearchable, alwaysShowExpand, useSyncScroll, }: TreeViewProps<T>): react_jsx_runtime.JSX.Element;
|
|
42
|
-
|
|
43
|
-
export { type TreeDataItem as TreeDataItemV2, TreeView as TreeViewV2 };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Minimal tree node shape used by `TreeViewV2`.
|
|
6
|
-
*/
|
|
7
|
-
type TreeDataItem = {
|
|
8
|
-
id: string;
|
|
9
|
-
parentId: string | null;
|
|
10
|
-
label: string;
|
|
11
|
-
isCollapsible?: boolean;
|
|
12
|
-
actions?: ReactNode;
|
|
13
|
-
disable?: boolean;
|
|
14
|
-
[key: string]: unknown;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Props for the virtualized filterable tree view.
|
|
18
|
-
*/
|
|
19
|
-
type TreeViewProps<T extends TreeDataItem> = {
|
|
20
|
-
data: T[];
|
|
21
|
-
getIcon: (item: T) => ReactNode;
|
|
22
|
-
onVisibleDataChange?: (data: (T & {
|
|
23
|
-
indent: number;
|
|
24
|
-
isLast: boolean;
|
|
25
|
-
ancestors: T[];
|
|
26
|
-
})[]) => void;
|
|
27
|
-
onItemHover?: (id: string | null) => void;
|
|
28
|
-
className?: string;
|
|
29
|
-
hoveredId?: string | null;
|
|
30
|
-
isSelectable?: boolean;
|
|
31
|
-
selectedItemId?: string | null;
|
|
32
|
-
onSelectChange?: (id: string | null) => void;
|
|
33
|
-
isSearchable?: boolean;
|
|
34
|
-
alwaysShowExpand?: boolean;
|
|
35
|
-
useSyncScroll?: boolean;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Filterable and highlightable tree view with keyboardless interactions.
|
|
39
|
-
* Supports search (plain or regex), hover highlights, and collapsible nodes.
|
|
40
|
-
*/
|
|
41
|
-
declare function TreeView<T extends TreeDataItem>({ data, getIcon, onVisibleDataChange, onItemHover, className, hoveredId, isSelectable, selectedItemId, onSelectChange, isSearchable, alwaysShowExpand, useSyncScroll, }: TreeViewProps<T>): react_jsx_runtime.JSX.Element;
|
|
42
|
-
|
|
43
|
-
export { type TreeDataItem as TreeDataItemV2, TreeView as TreeViewV2 };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|