@vuer-ai/vuer-uikit 0.0.98 → 0.0.100
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/SyncScroll/SyncScroll.cjs +9 -9
- package/dist/SyncScroll/SyncScroll.mjs +2 -2
- package/dist/SyncScroll/index.cjs +9 -9
- package/dist/SyncScroll/index.mjs +2 -2
- package/dist/chunk-AIYM5PFP.cjs +66 -0
- package/dist/chunk-OWEYAVGT.mjs +62 -0
- package/dist/{chunk-7GWDO25E.cjs → chunk-XBTBTLID.cjs} +2 -2
- package/dist/{chunk-TTYSYGVE.mjs → chunk-XGXWOY3U.mjs} +2 -2
- package/dist/dial/DialPanel.cjs +23 -22
- package/dist/dial/DialPanel.mjs +22 -21
- package/dist/dial/index.cjs +39 -38
- package/dist/dial/index.mjs +22 -21
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +26 -25
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +22 -21
- package/dist/dial/wrapped-inputs/DialInputs.cjs +33 -32
- package/dist/dial/wrapped-inputs/DialInputs.mjs +22 -21
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +23 -22
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +22 -21
- package/dist/dial/wrapped-inputs/index.cjs +38 -37
- package/dist/dial/wrapped-inputs/index.mjs +22 -21
- package/dist/highlight-cursor/cursor-provider.cjs +3 -3
- package/dist/highlight-cursor/cursor-provider.mjs +2 -2
- package/dist/highlight-cursor/enhanced-components.cjs +1 -1
- package/dist/highlight-cursor/enhanced-components.mjs +1 -1
- package/dist/highlight-cursor/index.cjs +3 -3
- package/dist/highlight-cursor/index.mjs +2 -2
- package/dist/index.cjs +151 -138
- package/dist/index.css +7 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +22 -21
- package/dist/ui/DialBadge.cjs +28 -0
- package/dist/ui/DialBadge.d.cts +33 -0
- package/dist/ui/DialBadge.d.ts +33 -0
- package/dist/ui/DialBadge.mjs +11 -0
- 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 +77 -64
- package/dist/ui/index.d.cts +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.mjs +18 -17
- package/dist/ui/inputs/index.cjs +15 -15
- package/dist/ui/inputs/index.mjs +3 -3
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/inputs/number-inputs/index.cjs +10 -10
- package/dist/ui/inputs/number-inputs/index.mjs +2 -2
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/tree-view-legacy.cjs +8 -8
- package/dist/ui/tree-view-legacy.mjs +4 -4
- package/dist/ui/waterfall/index.cjs +6 -6
- package/dist/ui/waterfall/index.mjs +5 -5
- package/package.json +2 -7
- package/src/ui/DialBadge.tsx +97 -0
- package/src/ui/index.ts +1 -0
- package/cli/dial-cli.js +0 -833
- package/dist/chunk-4KWGGESI.cjs +0 -494
- package/dist/chunk-A5LCX2UQ.cjs +0 -208
- package/dist/chunk-BEJIZ56L.mjs +0 -300
- package/dist/chunk-C7VGRU3O.mjs +0 -283
- package/dist/chunk-O66RESRR.cjs +0 -285
- package/dist/chunk-VA3PEYFM.mjs +0 -489
- package/dist/chunk-VBBJSIY7.cjs +0 -308
- package/dist/chunk-WWGF6TBZ.mjs +0 -206
- package/dist/chunk-ZGN4UEJR.cjs +0 -679
- package/dist/chunk-ZQLRMOUW.mjs +0 -661
- package/src/cli/dial-cli.ts +0 -1133
- package/dist/{chunk-XMUP5MIM.mjs → chunk-G3EIVAVR.mjs} +0 -0
- package/dist/{chunk-7IS37C3P.cjs → chunk-K4I4YU6N.cjs} +1 -1
- package/dist/{chunk-OX2U5RAG.cjs → chunk-KFPS5CCR.cjs} +0 -0
- package/dist/{chunk-2OZK5DY5.mjs → chunk-KXKEZ3MH.mjs} +1 -1
- package/dist/{chunk-LJMNHTTG.cjs → chunk-OEI7NCF6.cjs} +4 -4
- package/dist/{chunk-W4JCKCW7.mjs → chunk-QHPFLC2O.mjs} +4 -4
package/dist/chunk-VA3PEYFM.mjs
DELETED
|
@@ -1,489 +0,0 @@
|
|
|
1
|
-
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './chunk-ZNPI2TYG.mjs';
|
|
2
|
-
import { SyncScroll } from './chunk-BEJIZ56L.mjs';
|
|
3
|
-
import { InputRoot, InputSlot } from './chunk-4XUJBMDE.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
|
-
// External search state props
|
|
23
|
-
searchQuery: externalSearchQuery,
|
|
24
|
-
onSearchQueryChange: externalOnSearchQueryChange,
|
|
25
|
-
isCaseSensitive: externalIsCaseSensitive,
|
|
26
|
-
onIsCaseSensitiveChange: externalOnIsCaseSensitiveChange,
|
|
27
|
-
isRegex: externalIsRegex,
|
|
28
|
-
onIsRegexChange: externalOnIsRegexChange
|
|
29
|
-
}) {
|
|
30
|
-
const [expandedItems, setExpandedItems] = useState(() => {
|
|
31
|
-
const initial = /* @__PURE__ */ new Set();
|
|
32
|
-
data.forEach((item) => {
|
|
33
|
-
if (item.isCollapsible) initial.add(item.id);
|
|
34
|
-
});
|
|
35
|
-
return initial;
|
|
36
|
-
});
|
|
37
|
-
const [internalSearchQuery, setInternalSearchQuery] = useState("");
|
|
38
|
-
const [internalIsCaseSensitive, setInternalIsCaseSensitive] = useState(false);
|
|
39
|
-
const [internalIsRegex, setInternalIsRegex] = useState(false);
|
|
40
|
-
const [isRegexValid, setIsRegexValid] = useState(true);
|
|
41
|
-
const searchQuery = externalSearchQuery ?? internalSearchQuery;
|
|
42
|
-
const setSearchQuery = externalOnSearchQueryChange ?? setInternalSearchQuery;
|
|
43
|
-
const isCaseSensitive = externalIsCaseSensitive ?? internalIsCaseSensitive;
|
|
44
|
-
const isRegex = externalIsRegex ?? internalIsRegex;
|
|
45
|
-
const setIsCaseSensitive = (value) => {
|
|
46
|
-
if (externalOnIsCaseSensitiveChange) {
|
|
47
|
-
externalOnIsCaseSensitiveChange(value);
|
|
48
|
-
} else {
|
|
49
|
-
setInternalIsCaseSensitive(value);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const setIsRegex = (value) => {
|
|
53
|
-
if (externalOnIsRegexChange) {
|
|
54
|
-
externalOnIsRegexChange(value);
|
|
55
|
-
} else {
|
|
56
|
-
setInternalIsRegex(value);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const toggleItem = (id) => {
|
|
60
|
-
setExpandedItems((prev) => {
|
|
61
|
-
const newSet = new Set(prev);
|
|
62
|
-
if (newSet.has(id)) {
|
|
63
|
-
newSet.delete(id);
|
|
64
|
-
} else {
|
|
65
|
-
newSet.add(id);
|
|
66
|
-
}
|
|
67
|
-
return newSet;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
const handleItemSelect = (id) => {
|
|
71
|
-
if (isSelectable && onSelectChange) {
|
|
72
|
-
onSelectChange(selectedItemId === id ? null : id);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const hasDescendants = (itemId) => {
|
|
76
|
-
return (childrenMap.get(itemId) || []).length > 0;
|
|
77
|
-
};
|
|
78
|
-
const childrenMap = useMemo(() => {
|
|
79
|
-
const map = /* @__PURE__ */ new Map();
|
|
80
|
-
data.forEach((item) => {
|
|
81
|
-
if (!map.has(item.parentId)) {
|
|
82
|
-
map.set(item.parentId, []);
|
|
83
|
-
}
|
|
84
|
-
map.get(item.parentId).push(item);
|
|
85
|
-
});
|
|
86
|
-
return map;
|
|
87
|
-
}, [data]);
|
|
88
|
-
const dataWithMeta = useMemo(() => {
|
|
89
|
-
const dataMap = new Map(data.map((item) => [item.id, item]));
|
|
90
|
-
const getAncestors = (item) => {
|
|
91
|
-
const ancestors = [];
|
|
92
|
-
let current = item.parentId;
|
|
93
|
-
while (current) {
|
|
94
|
-
const parent = dataMap.get(current);
|
|
95
|
-
if (parent) {
|
|
96
|
-
ancestors.unshift(parent);
|
|
97
|
-
current = parent.parentId;
|
|
98
|
-
} else {
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return ancestors;
|
|
103
|
-
};
|
|
104
|
-
const sortedData = [];
|
|
105
|
-
const visited = /* @__PURE__ */ new Set();
|
|
106
|
-
const traverseNode = (nodeId, depth = 0) => {
|
|
107
|
-
const children = childrenMap.get(nodeId) || [];
|
|
108
|
-
children.forEach((child) => {
|
|
109
|
-
if (!visited.has(child.id)) {
|
|
110
|
-
visited.add(child.id);
|
|
111
|
-
sortedData.push(child);
|
|
112
|
-
traverseNode(child.id, depth + 1);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
traverseNode(null);
|
|
117
|
-
return sortedData.map((item) => {
|
|
118
|
-
const siblings = childrenMap.get(item.parentId) || [];
|
|
119
|
-
const isLast = siblings.length > 0 && siblings[siblings.length - 1].id === item.id;
|
|
120
|
-
const ancestors = getAncestors(item);
|
|
121
|
-
const indent = ancestors.length;
|
|
122
|
-
return { ...item, indent, isLast, ancestors };
|
|
123
|
-
});
|
|
124
|
-
}, [data, childrenMap]);
|
|
125
|
-
const visibleData = useMemo(() => {
|
|
126
|
-
const dataMap = new Map(data.map((item) => [item.id, item]));
|
|
127
|
-
if (!searchQuery) {
|
|
128
|
-
const isVisible = (item) => {
|
|
129
|
-
return item.ancestors.every((ancestor) => expandedItems.has(ancestor.id));
|
|
130
|
-
};
|
|
131
|
-
return dataWithMeta.filter(isVisible);
|
|
132
|
-
}
|
|
133
|
-
const matchingAndAncestorIds = /* @__PURE__ */ new Set();
|
|
134
|
-
let regex = null;
|
|
135
|
-
if (isRegex) {
|
|
136
|
-
try {
|
|
137
|
-
regex = new RegExp(searchQuery, isCaseSensitive ? "" : "i");
|
|
138
|
-
if (!isRegexValid) setIsRegexValid(true);
|
|
139
|
-
} catch {
|
|
140
|
-
if (isRegexValid) setIsRegexValid(false);
|
|
141
|
-
return [];
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
data.forEach((item) => {
|
|
145
|
-
let labelMatches = false;
|
|
146
|
-
if (regex) {
|
|
147
|
-
labelMatches = regex.test(item.label);
|
|
148
|
-
} else {
|
|
149
|
-
const source = isCaseSensitive ? item.label : item.label.toLowerCase();
|
|
150
|
-
const query = isCaseSensitive ? searchQuery : searchQuery.toLowerCase();
|
|
151
|
-
labelMatches = source.includes(query);
|
|
152
|
-
}
|
|
153
|
-
if (labelMatches) {
|
|
154
|
-
matchingAndAncestorIds.add(item.id);
|
|
155
|
-
let current = item.parentId;
|
|
156
|
-
while (current) {
|
|
157
|
-
const parent = dataMap.get(current);
|
|
158
|
-
if (parent) {
|
|
159
|
-
matchingAndAncestorIds.add(parent.id);
|
|
160
|
-
current = parent.parentId;
|
|
161
|
-
} else {
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
return dataWithMeta.filter((item) => matchingAndAncestorIds.has(item.id));
|
|
168
|
-
}, [searchQuery, dataWithMeta, expandedItems, isCaseSensitive, isRegex, isRegexValid, data]);
|
|
169
|
-
const searchResultsCount = useMemo(() => {
|
|
170
|
-
if (!searchQuery || !isRegexValid) return 0;
|
|
171
|
-
let count = 0;
|
|
172
|
-
let regex = null;
|
|
173
|
-
if (isRegex) {
|
|
174
|
-
try {
|
|
175
|
-
regex = new RegExp(searchQuery, isCaseSensitive ? "" : "i");
|
|
176
|
-
} catch {
|
|
177
|
-
return 0;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
data.forEach((item) => {
|
|
181
|
-
let labelMatches = false;
|
|
182
|
-
if (regex) {
|
|
183
|
-
labelMatches = regex.test(item.label);
|
|
184
|
-
} else {
|
|
185
|
-
const source = isCaseSensitive ? item.label : item.label.toLowerCase();
|
|
186
|
-
const query = isCaseSensitive ? searchQuery : searchQuery.toLowerCase();
|
|
187
|
-
labelMatches = source.includes(query);
|
|
188
|
-
}
|
|
189
|
-
if (labelMatches) {
|
|
190
|
-
count++;
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
return count;
|
|
194
|
-
}, [searchQuery, data, isCaseSensitive, isRegex, isRegexValid]);
|
|
195
|
-
useEffect(() => {
|
|
196
|
-
onVisibleDataChange?.(visibleData);
|
|
197
|
-
}, [visibleData, onVisibleDataChange]);
|
|
198
|
-
const renderLabel = (label) => {
|
|
199
|
-
if (!searchQuery || !isRegexValid) {
|
|
200
|
-
return label;
|
|
201
|
-
}
|
|
202
|
-
let regex;
|
|
203
|
-
try {
|
|
204
|
-
regex = new RegExp(`(${searchQuery})`, isCaseSensitive ? "g" : "gi");
|
|
205
|
-
} catch {
|
|
206
|
-
return label;
|
|
207
|
-
}
|
|
208
|
-
const parts = label.split(regex);
|
|
209
|
-
return /* @__PURE__ */ jsx(Fragment, { children: parts.map(
|
|
210
|
-
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("span", { className: "rounded-uk-xs bg-accent-warning", children: part }, i) : part
|
|
211
|
-
) });
|
|
212
|
-
};
|
|
213
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col", className), children: [
|
|
214
|
-
isSearchable && /* @__PURE__ */ jsx(
|
|
215
|
-
TreeSearchBar,
|
|
216
|
-
{
|
|
217
|
-
searchQuery,
|
|
218
|
-
setSearchQuery,
|
|
219
|
-
isCaseSensitive,
|
|
220
|
-
setIsCaseSensitive,
|
|
221
|
-
isRegex,
|
|
222
|
-
setIsRegex,
|
|
223
|
-
isRegexValid,
|
|
224
|
-
searchResultsCount
|
|
225
|
-
}
|
|
226
|
-
),
|
|
227
|
-
/* @__PURE__ */ jsx(
|
|
228
|
-
TreeEntries,
|
|
229
|
-
{
|
|
230
|
-
visibleData,
|
|
231
|
-
hoveredId,
|
|
232
|
-
onItemHover,
|
|
233
|
-
isSelectable,
|
|
234
|
-
selectedItemId,
|
|
235
|
-
handleItemSelect,
|
|
236
|
-
expandedItems,
|
|
237
|
-
toggleItem,
|
|
238
|
-
alwaysShowExpand,
|
|
239
|
-
hasDescendants,
|
|
240
|
-
getIcon,
|
|
241
|
-
renderLabel,
|
|
242
|
-
dataWithMeta,
|
|
243
|
-
useSyncScroll
|
|
244
|
-
}
|
|
245
|
-
)
|
|
246
|
-
] });
|
|
247
|
-
}
|
|
248
|
-
function TreeSearchBar({
|
|
249
|
-
searchQuery,
|
|
250
|
-
setSearchQuery,
|
|
251
|
-
isCaseSensitive,
|
|
252
|
-
setIsCaseSensitive,
|
|
253
|
-
isRegex,
|
|
254
|
-
setIsRegex,
|
|
255
|
-
isRegexValid,
|
|
256
|
-
searchResultsCount
|
|
257
|
-
}) {
|
|
258
|
-
return /* @__PURE__ */ jsxs("div", { className: "shrink-0", children: [
|
|
259
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 py-1", children: /* @__PURE__ */ jsxs(
|
|
260
|
-
InputRoot,
|
|
261
|
-
{
|
|
262
|
-
type: "text",
|
|
263
|
-
placeholder: "Search...",
|
|
264
|
-
size: "md",
|
|
265
|
-
className: "flex-1",
|
|
266
|
-
inputClassName: cn(!isRegexValid && "text-red-500"),
|
|
267
|
-
value: searchQuery,
|
|
268
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
269
|
-
children: [
|
|
270
|
-
/* @__PURE__ */ jsx(InputSlot, { side: "left", children: /* @__PURE__ */ jsx(Search, { className: "text-text-secondary size-4 stroke-1" }) }),
|
|
271
|
-
/* @__PURE__ */ jsx(InputSlot, { side: "right", children: /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 200, children: [
|
|
272
|
-
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
273
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
274
|
-
"button",
|
|
275
|
-
{
|
|
276
|
-
onClick: () => setIsCaseSensitive((prev) => !prev),
|
|
277
|
-
className: cn(
|
|
278
|
-
"rounded-uk-sm mr-1 p-1",
|
|
279
|
-
isCaseSensitive ? "bg-shadow-secondary" : ""
|
|
280
|
-
),
|
|
281
|
-
children: /* @__PURE__ */ jsx(CaseSensitive, { className: "size-4" })
|
|
282
|
-
}
|
|
283
|
-
) }),
|
|
284
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Case Sensitive" }) })
|
|
285
|
-
] }),
|
|
286
|
-
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
287
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
288
|
-
"button",
|
|
289
|
-
{
|
|
290
|
-
onClick: () => setIsRegex((prev) => !prev),
|
|
291
|
-
className: cn("rounded-uk-sm p-1", isRegex && "bg-shadow-secondary"),
|
|
292
|
-
children: /* @__PURE__ */ jsx(Regex, { className: "size-4" })
|
|
293
|
-
}
|
|
294
|
-
) }),
|
|
295
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Use Regular Expression" }) })
|
|
296
|
-
] })
|
|
297
|
-
] }) })
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
) }),
|
|
301
|
-
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: [
|
|
302
|
-
searchResultsCount,
|
|
303
|
-
" result",
|
|
304
|
-
searchResultsCount !== 1 ? "s" : ""
|
|
305
|
-
] }) })
|
|
306
|
-
] });
|
|
307
|
-
}
|
|
308
|
-
function TreeEntryItem({
|
|
309
|
-
item,
|
|
310
|
-
hoveredId,
|
|
311
|
-
onItemHover,
|
|
312
|
-
isSelectable,
|
|
313
|
-
selectedItemId,
|
|
314
|
-
handleItemSelect,
|
|
315
|
-
expandedItems,
|
|
316
|
-
toggleItem,
|
|
317
|
-
alwaysShowExpand,
|
|
318
|
-
hasDescendants,
|
|
319
|
-
getIcon,
|
|
320
|
-
renderLabel,
|
|
321
|
-
dataWithMeta
|
|
322
|
-
}) {
|
|
323
|
-
return /* @__PURE__ */ jsxs(
|
|
324
|
-
"div",
|
|
325
|
-
{
|
|
326
|
-
className: cn(
|
|
327
|
-
"group relative flex h-[32px] items-center",
|
|
328
|
-
isSelectable && "rounded-uk-md",
|
|
329
|
-
!item.disable && "cursor-pointer",
|
|
330
|
-
hoveredId === item.id && !item.disable && "bg-bg-secondary",
|
|
331
|
-
isSelectable && selectedItemId === item.id && "bg-brand-primary text-text-withbg"
|
|
332
|
-
),
|
|
333
|
-
onMouseEnter: () => onItemHover?.(item.id),
|
|
334
|
-
onMouseLeave: () => onItemHover?.(null),
|
|
335
|
-
onClick: () => !item.disable && handleItemSelect(item.id),
|
|
336
|
-
children: [
|
|
337
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute top-0 left-[-0.28rem] z-0 flex h-full items-center", children: [
|
|
338
|
-
item.ancestors.map((ancestor, index) => {
|
|
339
|
-
const parentIsLast = dataWithMeta.find((d) => d.id === ancestor.id)?.isLast;
|
|
340
|
-
return /* @__PURE__ */ jsx(
|
|
341
|
-
"div",
|
|
342
|
-
{
|
|
343
|
-
className: cn(
|
|
344
|
-
"h-full w-[1.25rem]",
|
|
345
|
-
parentIsLast ? "" : "border-l",
|
|
346
|
-
"border-line-primary"
|
|
347
|
-
)
|
|
348
|
-
},
|
|
349
|
-
index
|
|
350
|
-
);
|
|
351
|
-
}),
|
|
352
|
-
item.indent > 0 && /* @__PURE__ */ jsxs("div", { className: "relative h-full w-[1.24rem]", children: [
|
|
353
|
-
/* @__PURE__ */ jsx(
|
|
354
|
-
"div",
|
|
355
|
-
{
|
|
356
|
-
className: cn(
|
|
357
|
-
"absolute top-0 left-0 h-1/2 w-1/2 border-b border-l",
|
|
358
|
-
item.isLast ? "rounded-bl-md" : "",
|
|
359
|
-
"border-line-primary"
|
|
360
|
-
)
|
|
361
|
-
}
|
|
362
|
-
),
|
|
363
|
-
!item.isLast && /* @__PURE__ */ jsx("div", { className: "border-line-primary absolute top-1/2 left-0 h-1/2 w-1/2 border-l" })
|
|
364
|
-
] })
|
|
365
|
-
] }),
|
|
366
|
-
/* @__PURE__ */ jsxs(
|
|
367
|
-
"div",
|
|
368
|
-
{
|
|
369
|
-
className: "text-uk-md z-10 flex w-full items-center justify-between gap-2 px-2 whitespace-nowrap",
|
|
370
|
-
style: { paddingLeft: `${item.indent * 1.25 + 0.5}rem` },
|
|
371
|
-
children: [
|
|
372
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
373
|
-
alwaysShowExpand && hasDescendants(item.id) && !expandedItems.has(item.id) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
374
|
-
/* @__PURE__ */ jsx(
|
|
375
|
-
"button",
|
|
376
|
-
{
|
|
377
|
-
onClick: (e) => {
|
|
378
|
-
e.stopPropagation();
|
|
379
|
-
toggleItem(item.id);
|
|
380
|
-
},
|
|
381
|
-
className: "flex size-4 cursor-pointer items-center justify-center",
|
|
382
|
-
children: /* @__PURE__ */ jsx(
|
|
383
|
-
ChevronDown,
|
|
384
|
-
{
|
|
385
|
-
className: cn(
|
|
386
|
-
"size-4 -rotate-90 transition-transform",
|
|
387
|
-
item.disable && "text-icon-tertiary"
|
|
388
|
-
)
|
|
389
|
-
}
|
|
390
|
-
)
|
|
391
|
-
}
|
|
392
|
-
),
|
|
393
|
-
/* @__PURE__ */ jsx(
|
|
394
|
-
"div",
|
|
395
|
-
{
|
|
396
|
-
className: cn(
|
|
397
|
-
"flex size-4 items-center justify-center",
|
|
398
|
-
item.disable && "text-icon-tertiary"
|
|
399
|
-
),
|
|
400
|
-
children: getIcon(item)
|
|
401
|
-
}
|
|
402
|
-
)
|
|
403
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex size-4 items-center justify-center", children: [
|
|
404
|
-
item.isCollapsible && /* @__PURE__ */ jsx(
|
|
405
|
-
"button",
|
|
406
|
-
{
|
|
407
|
-
onClick: (e) => {
|
|
408
|
-
e.stopPropagation();
|
|
409
|
-
toggleItem(item.id);
|
|
410
|
-
},
|
|
411
|
-
className: "absolute z-20 flex cursor-pointer items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
|
|
412
|
-
children: /* @__PURE__ */ jsx(
|
|
413
|
-
ChevronDown,
|
|
414
|
-
{
|
|
415
|
-
className: cn(
|
|
416
|
-
"size-4 transition-transform",
|
|
417
|
-
!expandedItems.has(item.id) && "-rotate-90",
|
|
418
|
-
item.disable && "text-icon-tertiary"
|
|
419
|
-
)
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
}
|
|
423
|
-
),
|
|
424
|
-
/* @__PURE__ */ jsx(
|
|
425
|
-
"div",
|
|
426
|
-
{
|
|
427
|
-
className: cn(
|
|
428
|
-
"cursor-pointer transition-opacity",
|
|
429
|
-
item.isCollapsible && "group-hover:opacity-0",
|
|
430
|
-
item.disable && "text-icon-tertiary"
|
|
431
|
-
),
|
|
432
|
-
children: getIcon(item)
|
|
433
|
-
}
|
|
434
|
-
)
|
|
435
|
-
] }),
|
|
436
|
-
/* @__PURE__ */ jsx("span", { className: cn("truncate", item.disable && "text-text-tertiary"), children: renderLabel(item.label) })
|
|
437
|
-
] }),
|
|
438
|
-
item.actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", onClick: (e) => e.stopPropagation(), children: item.actions })
|
|
439
|
-
]
|
|
440
|
-
}
|
|
441
|
-
)
|
|
442
|
-
]
|
|
443
|
-
},
|
|
444
|
-
item.id
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
function TreeEntries({
|
|
448
|
-
visibleData,
|
|
449
|
-
hoveredId,
|
|
450
|
-
onItemHover,
|
|
451
|
-
isSelectable,
|
|
452
|
-
selectedItemId,
|
|
453
|
-
handleItemSelect,
|
|
454
|
-
expandedItems,
|
|
455
|
-
toggleItem,
|
|
456
|
-
alwaysShowExpand,
|
|
457
|
-
hasDescendants,
|
|
458
|
-
getIcon,
|
|
459
|
-
renderLabel,
|
|
460
|
-
dataWithMeta,
|
|
461
|
-
useSyncScroll = false,
|
|
462
|
-
className
|
|
463
|
-
}) {
|
|
464
|
-
const content = visibleData.map((item) => /* @__PURE__ */ jsx(
|
|
465
|
-
TreeEntryItem,
|
|
466
|
-
{
|
|
467
|
-
item,
|
|
468
|
-
hoveredId,
|
|
469
|
-
onItemHover,
|
|
470
|
-
isSelectable,
|
|
471
|
-
selectedItemId,
|
|
472
|
-
handleItemSelect,
|
|
473
|
-
expandedItems,
|
|
474
|
-
toggleItem,
|
|
475
|
-
alwaysShowExpand,
|
|
476
|
-
hasDescendants,
|
|
477
|
-
getIcon,
|
|
478
|
-
renderLabel,
|
|
479
|
-
dataWithMeta
|
|
480
|
-
},
|
|
481
|
-
item.id
|
|
482
|
-
));
|
|
483
|
-
if (useSyncScroll) {
|
|
484
|
-
return /* @__PURE__ */ jsx(SyncScroll, { className: cn("scrollbar-track-transparent flex-1", className), children: content });
|
|
485
|
-
}
|
|
486
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-y-auto", className), children: content });
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
export { TreeEntries, TreeEntryItem, TreeSearchBar, TreeView };
|