@uipath/apollo-wind 0.9.1 → 0.10.0-pr219.61d64eb

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.
Files changed (158) hide show
  1. package/dist/components/custom/canvas.cjs +44 -0
  2. package/dist/components/custom/canvas.d.ts +14 -0
  3. package/dist/components/custom/canvas.js +10 -0
  4. package/dist/components/custom/chat-composer.cjs +105 -0
  5. package/dist/components/custom/chat-composer.d.ts +15 -0
  6. package/dist/components/custom/chat-composer.js +71 -0
  7. package/dist/components/custom/chat-first-experience.cjs +87 -0
  8. package/dist/components/custom/chat-first-experience.d.ts +24 -0
  9. package/dist/components/custom/chat-first-experience.js +53 -0
  10. package/dist/components/custom/chat-prompt-suggestions.cjs +48 -0
  11. package/dist/components/custom/chat-prompt-suggestions.d.ts +18 -0
  12. package/dist/components/custom/chat-prompt-suggestions.js +14 -0
  13. package/dist/components/custom/chat-steps-view.cjs +307 -0
  14. package/dist/components/custom/chat-steps-view.d.ts +38 -0
  15. package/dist/components/custom/chat-steps-view.js +273 -0
  16. package/dist/components/custom/flow-node.cjs +76 -0
  17. package/dist/components/custom/flow-node.d.ts +20 -0
  18. package/dist/components/custom/flow-node.js +42 -0
  19. package/dist/components/custom/flow-properties-bar.cjs +101 -0
  20. package/dist/components/custom/flow-properties-bar.d.ts +21 -0
  21. package/dist/components/custom/flow-properties-bar.js +67 -0
  22. package/dist/components/custom/flow-properties-expanded.cjs +324 -0
  23. package/dist/components/custom/flow-properties-expanded.d.ts +19 -0
  24. package/dist/components/custom/flow-properties-expanded.js +290 -0
  25. package/dist/components/custom/flow-properties-simple.cjs +357 -0
  26. package/dist/components/custom/flow-properties-simple.d.ts +62 -0
  27. package/dist/components/custom/flow-properties-simple.js +323 -0
  28. package/dist/components/custom/flow-properties.cjs +56 -0
  29. package/dist/components/custom/flow-properties.d.ts +28 -0
  30. package/dist/components/custom/flow-properties.js +22 -0
  31. package/dist/components/custom/global-header.cjs +415 -0
  32. package/dist/components/custom/global-header.d.ts +38 -0
  33. package/dist/components/custom/global-header.js +381 -0
  34. package/dist/components/custom/grid-maestro.cjs +62 -0
  35. package/dist/components/custom/grid-maestro.d.ts +19 -0
  36. package/dist/components/custom/grid-maestro.js +22 -0
  37. package/dist/components/custom/panel-delegate.cjs +280 -0
  38. package/dist/components/custom/panel-delegate.d.ts +34 -0
  39. package/dist/components/custom/panel-delegate.js +246 -0
  40. package/dist/components/custom/panel-flow.cjs +260 -0
  41. package/dist/components/custom/panel-flow.d.ts +38 -0
  42. package/dist/components/custom/panel-flow.js +223 -0
  43. package/dist/components/custom/panel-maestro.cjs +73 -0
  44. package/dist/components/custom/panel-maestro.d.ts +30 -0
  45. package/dist/components/custom/panel-maestro.js +39 -0
  46. package/dist/components/custom/toolbar-canvas.cjs +121 -0
  47. package/dist/components/custom/toolbar-canvas.d.ts +15 -0
  48. package/dist/components/custom/toolbar-canvas.js +87 -0
  49. package/dist/components/custom/toolbar-view.cjs +119 -0
  50. package/dist/components/custom/toolbar-view.d.ts +14 -0
  51. package/dist/components/custom/toolbar-view.js +85 -0
  52. package/dist/components/custom/viewport-guard.cjs +92 -0
  53. package/dist/components/custom/viewport-guard.d.ts +23 -0
  54. package/dist/components/custom/viewport-guard.js +55 -0
  55. package/dist/components/ui/button.cjs +3 -3
  56. package/dist/components/ui/button.js +3 -3
  57. package/dist/components/ui/chart.cjs +218 -0
  58. package/dist/components/ui/chart.d.ts +40 -0
  59. package/dist/components/ui/chart.js +169 -0
  60. package/dist/components/ui/data-table.cjs +14 -2
  61. package/dist/components/ui/data-table.d.ts +4 -1
  62. package/dist/components/ui/data-table.js +15 -3
  63. package/dist/components/ui/empty-state.cjs +17 -6
  64. package/dist/components/ui/empty-state.d.ts +7 -0
  65. package/dist/components/ui/empty-state.js +17 -6
  66. package/dist/components/ui/file-upload.cjs +82 -42
  67. package/dist/components/ui/file-upload.d.ts +3 -1
  68. package/dist/components/ui/file-upload.js +82 -42
  69. package/dist/components/ui/index.cjs +289 -149
  70. package/dist/components/ui/index.d.ts +2 -3
  71. package/dist/components/ui/index.js +2 -3
  72. package/dist/components/ui/tree-view.cjs +1101 -0
  73. package/dist/components/ui/tree-view.d.ts +95 -0
  74. package/dist/components/ui/tree-view.js +1067 -0
  75. package/dist/foundation/Future/colors.cjs +92 -0
  76. package/dist/foundation/Future/colors.d.ts +132 -0
  77. package/dist/foundation/Future/colors.js +43 -0
  78. package/dist/foundation/Future/radius.cjs +46 -0
  79. package/dist/foundation/Future/radius.d.ts +33 -0
  80. package/dist/foundation/Future/radius.js +12 -0
  81. package/dist/foundation/Future/responsive.cjs +49 -0
  82. package/dist/foundation/Future/responsive.d.ts +40 -0
  83. package/dist/foundation/Future/responsive.js +12 -0
  84. package/dist/foundation/Future/shadows.cjs +48 -0
  85. package/dist/foundation/Future/shadows.d.ts +29 -0
  86. package/dist/foundation/Future/shadows.js +11 -0
  87. package/dist/foundation/Future/spacing.cjs +71 -0
  88. package/dist/foundation/Future/spacing.d.ts +80 -0
  89. package/dist/foundation/Future/spacing.js +31 -0
  90. package/dist/foundation/Future/strokes.cjs +59 -0
  91. package/dist/foundation/Future/strokes.d.ts +49 -0
  92. package/dist/foundation/Future/strokes.js +19 -0
  93. package/dist/foundation/Future/types.cjs +18 -0
  94. package/dist/foundation/Future/types.d.ts +18 -0
  95. package/dist/foundation/Future/types.js +0 -0
  96. package/dist/foundation/Future/typography.cjs +79 -0
  97. package/dist/foundation/Future/typography.d.ts +86 -0
  98. package/dist/foundation/Future/typography.js +33 -0
  99. package/dist/index.cjs +125 -219
  100. package/dist/index.d.ts +2 -3
  101. package/dist/index.js +2 -4
  102. package/dist/src/foundation/Future/themes.css +371 -0
  103. package/dist/styles.css +1704 -582
  104. package/dist/tailwind.css +4 -0
  105. package/dist/templates/Admin/settings-admin.d.ts +5 -0
  106. package/dist/templates/Admin/template-admin.d.ts +105 -0
  107. package/dist/templates/Delegate/template-delegate.d.ts +26 -0
  108. package/dist/templates/EmptyErrors/error-components.d.ts +3 -0
  109. package/dist/templates/Experiments/ideas-AnimatedGradientText.d.ts +23 -0
  110. package/dist/templates/Flow/template-flow.d.ts +52 -0
  111. package/dist/templates/Maestro/template-maestro.d.ts +52 -0
  112. package/dist/templates/{vscode-example.d.ts → VisualStudio/shell.d.ts} +1 -1
  113. package/package.json +10 -1
  114. package/dist/components/ui/menubar.cjs +0 -210
  115. package/dist/components/ui/menubar.d.ts +0 -28
  116. package/dist/components/ui/menubar.js +0 -131
  117. package/dist/components/ui/navigation-menu.cjs +0 -122
  118. package/dist/components/ui/navigation-menu.d.ts +0 -12
  119. package/dist/components/ui/navigation-menu.js +0 -64
  120. package/dist/examples/admin-layout-example.cjs +0 -490
  121. package/dist/examples/admin-layout-example.d.ts +0 -92
  122. package/dist/examples/admin-layout-example.js +0 -411
  123. package/dist/examples/app-shell-example.cjs +0 -452
  124. package/dist/examples/app-shell-example.d.ts +0 -52
  125. package/dist/examples/app-shell-example.js +0 -418
  126. package/dist/examples/dashboard-example.cjs +0 -590
  127. package/dist/examples/dashboard-example.d.ts +0 -11
  128. package/dist/examples/dashboard-example.js +0 -556
  129. package/dist/examples/data-management-example.cjs +0 -584
  130. package/dist/examples/data-management-example.d.ts +0 -1
  131. package/dist/examples/data-management-example.js +0 -550
  132. package/dist/examples/flow-editor-layout-example.cjs +0 -309
  133. package/dist/examples/flow-editor-layout-example.d.ts +0 -22
  134. package/dist/examples/flow-editor-layout-example.js +0 -269
  135. package/dist/examples/flow-start-example.cjs +0 -467
  136. package/dist/examples/flow-start-example.d.ts +0 -30
  137. package/dist/examples/flow-start-example.js +0 -433
  138. package/dist/examples/form-builder-example.cjs +0 -674
  139. package/dist/examples/form-builder-example.js +0 -640
  140. package/dist/examples/new-project-example.cjs +0 -550
  141. package/dist/examples/new-project-example.d.ts +0 -30
  142. package/dist/examples/new-project-example.js +0 -516
  143. package/dist/examples/settings-example.cjs +0 -864
  144. package/dist/examples/settings-example.d.ts +0 -1
  145. package/dist/examples/settings-example.js +0 -830
  146. package/dist/examples/vscode-example.cjs +0 -340
  147. package/dist/examples/vscode-example.d.ts +0 -80
  148. package/dist/examples/vscode-example.js +0 -270
  149. package/dist/templates/admin-layout-example.d.ts +0 -92
  150. package/dist/templates/app-shell-example.d.ts +0 -52
  151. package/dist/templates/dashboard-example.d.ts +0 -11
  152. package/dist/templates/data-management-example.d.ts +0 -1
  153. package/dist/templates/flow-editor-layout-example.d.ts +0 -22
  154. package/dist/templates/flow-start-example.d.ts +0 -30
  155. package/dist/templates/form-builder-example.d.ts +0 -1
  156. package/dist/templates/new-project-example.d.ts +0 -30
  157. package/dist/templates/settings-example.d.ts +0 -1
  158. /package/dist/{examples → templates/Forms}/form-builder-example.d.ts +0 -0
@@ -0,0 +1,1067 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
+ import { Button } from "./button.js";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
6
+ import { Box, ChevronRight, Folder, Info, MoreHorizontal, Search, X } from "lucide-react";
7
+ import { AnimatePresence, motion } from "framer-motion";
8
+ import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "./context-menu.js";
9
+ import { HoverCard, HoverCardContent, HoverCardTrigger } from "./hover-card.js";
10
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./dropdown-menu.js";
11
+ import { Badge } from "./badge.js";
12
+ import { cn } from "../../lib/index.js";
13
+ import { Input } from "./input.js";
14
+ import { Checkbox } from "./checkbox.js";
15
+ const buildItemMap = (items)=>{
16
+ const map = new Map();
17
+ const processItem = (item)=>{
18
+ map.set(item.id, item);
19
+ item.children?.forEach(processItem);
20
+ };
21
+ items.forEach(processItem);
22
+ return map;
23
+ };
24
+ const getCheckState = (item, itemMap)=>{
25
+ const originalItem = itemMap.get(item.id);
26
+ if (!originalItem) return "unchecked";
27
+ if (!originalItem.children || 0 === originalItem.children.length) return originalItem.checked ? "checked" : "unchecked";
28
+ let checkedCount = 0;
29
+ let indeterminateCount = 0;
30
+ originalItem.children.forEach((child)=>{
31
+ const childState = getCheckState(child, itemMap);
32
+ if ("checked" === childState) checkedCount++;
33
+ if ("indeterminate" === childState) indeterminateCount++;
34
+ });
35
+ const totalChildren = originalItem.children.length;
36
+ if (checkedCount === totalChildren) return "checked";
37
+ if (checkedCount > 0 || indeterminateCount > 0) return "indeterminate";
38
+ return "unchecked";
39
+ };
40
+ const defaultIconMap = {
41
+ file: /*#__PURE__*/ jsx(Box, {
42
+ className: "h-4 w-4 text-red-600"
43
+ }),
44
+ folder: /*#__PURE__*/ jsx(Folder, {
45
+ className: "h-4 w-4 text-primary/80"
46
+ })
47
+ };
48
+ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expandedIds, onToggleExpand, selectionMode, getIcon, onAction, onAccessChange, allItems, showAccessRights, showSelectionCheckboxes, itemMap, iconMap = defaultIconMap, menuItems, getSelectedItems }) {
49
+ const isOpen = expandedIds.has(item.id);
50
+ const isSelected = selectedIds.has(item.id);
51
+ const isDisabled = true === item.disabled;
52
+ const itemRef = useRef(null);
53
+ const [selectionStyle, setSelectionStyle] = useState("");
54
+ const getVisibleItems = useCallback((items)=>{
55
+ let visibleItems = [];
56
+ items.forEach((item)=>{
57
+ visibleItems.push(item);
58
+ if (item.children && expandedIds.has(item.id)) visibleItems = [
59
+ ...visibleItems,
60
+ ...getVisibleItems(item.children)
61
+ ];
62
+ });
63
+ return visibleItems;
64
+ }, [
65
+ expandedIds
66
+ ]);
67
+ useEffect(()=>{
68
+ if (!isSelected) return void setSelectionStyle("");
69
+ const visibleItems = getVisibleItems(allItems);
70
+ const currentIndex = visibleItems.findIndex((i)=>i.id === item.id);
71
+ const prevItem = visibleItems[currentIndex - 1];
72
+ const nextItem = visibleItems[currentIndex + 1];
73
+ const isPrevSelected = prevItem && selectedIds.has(prevItem.id);
74
+ const isNextSelected = nextItem && selectedIds.has(nextItem.id);
75
+ const roundTop = !isPrevSelected;
76
+ const roundBottom = !isNextSelected;
77
+ setSelectionStyle(`${roundTop ? "rounded-t-md" : ""} ${roundBottom ? "rounded-b-md" : ""}`);
78
+ }, [
79
+ isSelected,
80
+ selectedIds,
81
+ expandedIds,
82
+ item.id,
83
+ getVisibleItems,
84
+ allItems
85
+ ]);
86
+ const handleClick = (e)=>{
87
+ e.stopPropagation();
88
+ e.preventDefault();
89
+ if (isDisabled || "none" === selectionMode) return;
90
+ let newSelection = new Set(selectedIds);
91
+ if (!itemRef.current) return;
92
+ if ("single" === selectionMode) {
93
+ newSelection = new Set([
94
+ item.id
95
+ ]);
96
+ lastSelectedId.current = item.id;
97
+ onSelect(newSelection);
98
+ if (item.children && isSelected) onToggleExpand(item.id, !isOpen);
99
+ return;
100
+ }
101
+ if (e.shiftKey && null !== lastSelectedId.current) {
102
+ const items = Array.from(document.querySelectorAll("[data-tree-item]"));
103
+ const lastIndex = items.findIndex((el)=>el.getAttribute("data-id") === lastSelectedId.current);
104
+ const currentIndex = items.findIndex((el)=>el === itemRef.current);
105
+ const [start, end] = [
106
+ Math.min(lastIndex, currentIndex),
107
+ Math.max(lastIndex, currentIndex)
108
+ ];
109
+ items.slice(start, end + 1).forEach((el)=>{
110
+ const id = el.getAttribute("data-id");
111
+ const isDisabledEl = "true" === el.getAttribute("data-disabled");
112
+ const parentFolderClosed = el.closest('[data-folder-closed="true"]');
113
+ const isClosedFolder = "true" === el.getAttribute("data-folder-closed");
114
+ if (id && !isDisabledEl && (isClosedFolder || !parentFolderClosed)) newSelection.add(id);
115
+ });
116
+ } else if (e.ctrlKey || e.metaKey) if (newSelection.has(item.id)) newSelection.delete(item.id);
117
+ else newSelection.add(item.id);
118
+ else {
119
+ newSelection = new Set([
120
+ item.id
121
+ ]);
122
+ if (item.children && isSelected) onToggleExpand(item.id, !isOpen);
123
+ }
124
+ lastSelectedId.current = item.id;
125
+ onSelect(newSelection);
126
+ };
127
+ const handleAccessClick = (e)=>{
128
+ e.stopPropagation();
129
+ if (onAccessChange) {
130
+ const currentState = getCheckState(item, itemMap);
131
+ const newChecked = "checked" !== currentState;
132
+ onAccessChange(item, newChecked);
133
+ }
134
+ };
135
+ const renderIcon = ()=>{
136
+ if (getIcon) return getIcon(item, depth);
137
+ return iconMap[item.type] || iconMap.folder || defaultIconMap.folder;
138
+ };
139
+ const getItemPath = (item, items)=>{
140
+ const path = [
141
+ item.name
142
+ ];
143
+ const findParent = (currentItem, allItems)=>{
144
+ for (const potentialParent of allItems){
145
+ if (potentialParent.children?.some((child)=>child.id === currentItem.id)) {
146
+ path.unshift(potentialParent.name);
147
+ findParent(potentialParent, allItems);
148
+ break;
149
+ }
150
+ if (potentialParent.children) findParent(currentItem, potentialParent.children);
151
+ }
152
+ };
153
+ findParent(item, items);
154
+ return path.join(" → ");
155
+ };
156
+ const getSelectedChildrenCount = (item)=>{
157
+ let count = 0;
158
+ if (!item.children) return 0;
159
+ item.children.forEach((child)=>{
160
+ if (selectedIds.has(child.id)) count++;
161
+ if (child.children) count += getSelectedChildrenCount(child);
162
+ });
163
+ return count;
164
+ };
165
+ const selectedCount = item.children && !isOpen && getSelectedChildrenCount(item) || null;
166
+ return /*#__PURE__*/ jsxs(ContextMenu, {
167
+ children: [
168
+ /*#__PURE__*/ jsx(ContextMenuTrigger, {
169
+ children: /*#__PURE__*/ jsxs("div", {
170
+ children: [
171
+ /*#__PURE__*/ jsx("div", {
172
+ ref: itemRef,
173
+ "data-tree-item": true,
174
+ "data-id": item.id,
175
+ "data-depth": depth,
176
+ "data-folder-closed": item.children && !isOpen,
177
+ "data-disabled": isDisabled,
178
+ className: `select-none rounded-md px-1 ${isDisabled ? "cursor-not-allowed opacity-50 text-muted-foreground" : `cursor-pointer ${isSelected && "none" !== selectionMode ? `bg-accent ${selectionStyle}` : "text-foreground hover:bg-muted/50"}`}`,
179
+ style: {
180
+ paddingLeft: `${20 * depth}px`
181
+ },
182
+ onClick: handleClick,
183
+ children: /*#__PURE__*/ jsx("div", {
184
+ className: "flex items-center h-8 min-w-0",
185
+ children: item.children ? /*#__PURE__*/ jsxs("div", {
186
+ className: "flex items-center gap-2 flex-1 min-w-0 group",
187
+ children: [
188
+ /*#__PURE__*/ jsx(Collapsible, {
189
+ open: isOpen,
190
+ onOpenChange: (open)=>onToggleExpand(item.id, open),
191
+ children: /*#__PURE__*/ jsx(CollapsibleTrigger, {
192
+ asChild: true,
193
+ onClick: (e)=>e.stopPropagation(),
194
+ children: /*#__PURE__*/ jsx(Button, {
195
+ variant: "ghost",
196
+ size: "icon",
197
+ className: "h-6 w-6",
198
+ children: /*#__PURE__*/ jsx(motion.div, {
199
+ initial: false,
200
+ animate: {
201
+ rotate: isOpen ? 90 : 0
202
+ },
203
+ transition: {
204
+ duration: 0.1
205
+ },
206
+ children: /*#__PURE__*/ jsx(ChevronRight, {
207
+ className: "h-4 w-4"
208
+ })
209
+ })
210
+ })
211
+ })
212
+ }),
213
+ showAccessRights && /*#__PURE__*/ jsxs("div", {
214
+ className: "relative flex items-center justify-center w-4 h-4 cursor-pointer hover:opacity-80",
215
+ onClick: handleAccessClick,
216
+ children: [
217
+ "checked" === getCheckState(item, itemMap) && /*#__PURE__*/ jsx("div", {
218
+ className: "w-4 h-4 border rounded bg-primary border-primary flex items-center justify-center",
219
+ children: /*#__PURE__*/ jsx("svg", {
220
+ className: "h-3 w-3 text-primary-foreground",
221
+ fill: "none",
222
+ viewBox: "0 0 24 24",
223
+ stroke: "currentColor",
224
+ children: /*#__PURE__*/ jsx("path", {
225
+ strokeLinecap: "round",
226
+ strokeLinejoin: "round",
227
+ strokeWidth: 2,
228
+ d: "M5 13l4 4L19 7"
229
+ })
230
+ })
231
+ }),
232
+ "unchecked" === getCheckState(item, itemMap) && /*#__PURE__*/ jsx("div", {
233
+ className: "w-4 h-4 border rounded border-input"
234
+ }),
235
+ "indeterminate" === getCheckState(item, itemMap) && /*#__PURE__*/ jsx("div", {
236
+ className: "w-4 h-4 border rounded bg-primary border-primary flex items-center justify-center",
237
+ children: /*#__PURE__*/ jsx("div", {
238
+ className: "h-0.5 w-2 bg-primary-foreground"
239
+ })
240
+ })
241
+ ]
242
+ }),
243
+ renderIcon(),
244
+ /*#__PURE__*/ jsx("span", {
245
+ className: "flex-1 min-w-0 truncate",
246
+ children: item.name
247
+ }),
248
+ item.badge && /*#__PURE__*/ jsx("span", {
249
+ className: "shrink-0 ml-1",
250
+ children: item.badge
251
+ }),
252
+ item.meta && /*#__PURE__*/ jsx("span", {
253
+ className: "text-xs text-muted-foreground shrink-0 ml-1 truncate max-w-[6rem]",
254
+ children: item.meta
255
+ }),
256
+ null !== selectedCount && selectedCount > 0 && /*#__PURE__*/ jsxs(Badge, {
257
+ variant: "secondary",
258
+ className: "shrink-0 mr-1 bg-blue-100 hover:bg-blue-100",
259
+ children: [
260
+ selectedCount,
261
+ " selected"
262
+ ]
263
+ }),
264
+ (item.actions?.length ?? 0) > 0 ? /*#__PURE__*/ jsxs(DropdownMenu, {
265
+ children: [
266
+ /*#__PURE__*/ jsx(DropdownMenuTrigger, {
267
+ asChild: true,
268
+ children: /*#__PURE__*/ jsx(Button, {
269
+ variant: "ghost",
270
+ size: "icon",
271
+ className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
272
+ onClick: (e)=>e.stopPropagation(),
273
+ children: /*#__PURE__*/ jsx(MoreHorizontal, {
274
+ className: "h-4 w-4 text-muted-foreground"
275
+ })
276
+ })
277
+ }),
278
+ /*#__PURE__*/ jsxs(DropdownMenuContent, {
279
+ align: "end",
280
+ className: "w-48",
281
+ children: [
282
+ item.actions?.map((action)=>/*#__PURE__*/ jsxs(DropdownMenuItem, {
283
+ disabled: isDisabled,
284
+ onClick: (e)=>{
285
+ e.stopPropagation();
286
+ action.onClick(item);
287
+ },
288
+ children: [
289
+ action.icon,
290
+ action.label ?? action.id
291
+ ]
292
+ }, action.id)),
293
+ /*#__PURE__*/ jsxs(DropdownMenuSub, {
294
+ children: [
295
+ /*#__PURE__*/ jsx(DropdownMenuSubTrigger, {
296
+ children: "View details"
297
+ }),
298
+ /*#__PURE__*/ jsx(DropdownMenuSubContent, {
299
+ className: "w-64 p-3",
300
+ children: /*#__PURE__*/ jsxs("div", {
301
+ className: "space-y-2 text-sm",
302
+ children: [
303
+ /*#__PURE__*/ jsx("h4", {
304
+ className: "font-semibold",
305
+ children: item.name
306
+ }),
307
+ /*#__PURE__*/ jsxs("div", {
308
+ className: "text-muted-foreground space-y-1",
309
+ children: [
310
+ /*#__PURE__*/ jsxs("div", {
311
+ children: [
312
+ /*#__PURE__*/ jsx("span", {
313
+ className: "font-medium",
314
+ children: "Type:"
315
+ }),
316
+ " ",
317
+ item.type.charAt(0).toUpperCase() + item.type.slice(1).replace("_", " ")
318
+ ]
319
+ }),
320
+ /*#__PURE__*/ jsxs("div", {
321
+ children: [
322
+ /*#__PURE__*/ jsx("span", {
323
+ className: "font-medium",
324
+ children: "ID:"
325
+ }),
326
+ " ",
327
+ item.id
328
+ ]
329
+ }),
330
+ /*#__PURE__*/ jsxs("div", {
331
+ children: [
332
+ /*#__PURE__*/ jsx("span", {
333
+ className: "font-medium",
334
+ children: "Location:"
335
+ }),
336
+ " ",
337
+ getItemPath(item, allItems)
338
+ ]
339
+ }),
340
+ /*#__PURE__*/ jsxs("div", {
341
+ children: [
342
+ /*#__PURE__*/ jsx("span", {
343
+ className: "font-medium",
344
+ children: "Items:"
345
+ }),
346
+ " ",
347
+ item.children?.length ?? 0,
348
+ " direct items"
349
+ ]
350
+ })
351
+ ]
352
+ })
353
+ ]
354
+ })
355
+ })
356
+ ]
357
+ })
358
+ ]
359
+ })
360
+ ]
361
+ }) : /*#__PURE__*/ jsxs(HoverCard, {
362
+ children: [
363
+ /*#__PURE__*/ jsx(HoverCardTrigger, {
364
+ asChild: true,
365
+ children: /*#__PURE__*/ jsx(Button, {
366
+ variant: "ghost",
367
+ size: "icon",
368
+ className: "h-6 w-6 shrink-0 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
369
+ onClick: (e)=>e.stopPropagation(),
370
+ children: /*#__PURE__*/ jsx(Info, {
371
+ className: "h-4 w-4 text-muted-foreground"
372
+ })
373
+ })
374
+ }),
375
+ /*#__PURE__*/ jsx(HoverCardContent, {
376
+ className: "w-80",
377
+ children: /*#__PURE__*/ jsxs("div", {
378
+ className: "space-y-2",
379
+ children: [
380
+ /*#__PURE__*/ jsx("h4", {
381
+ className: "text-sm font-semibold",
382
+ children: item.name
383
+ }),
384
+ /*#__PURE__*/ jsxs("div", {
385
+ className: "text-sm text-muted-foreground space-y-1",
386
+ children: [
387
+ /*#__PURE__*/ jsxs("div", {
388
+ children: [
389
+ /*#__PURE__*/ jsx("span", {
390
+ className: "font-medium",
391
+ children: "Type:"
392
+ }),
393
+ " ",
394
+ item.type.charAt(0).toUpperCase() + item.type.slice(1).replace("_", " ")
395
+ ]
396
+ }),
397
+ /*#__PURE__*/ jsxs("div", {
398
+ children: [
399
+ /*#__PURE__*/ jsx("span", {
400
+ className: "font-medium",
401
+ children: "ID:"
402
+ }),
403
+ " ",
404
+ item.id
405
+ ]
406
+ }),
407
+ /*#__PURE__*/ jsxs("div", {
408
+ children: [
409
+ /*#__PURE__*/ jsx("span", {
410
+ className: "font-medium",
411
+ children: "Location:"
412
+ }),
413
+ " ",
414
+ getItemPath(item, allItems)
415
+ ]
416
+ }),
417
+ /*#__PURE__*/ jsxs("div", {
418
+ children: [
419
+ /*#__PURE__*/ jsx("span", {
420
+ className: "font-medium",
421
+ children: "Items:"
422
+ }),
423
+ " ",
424
+ item.children?.length ?? 0,
425
+ " direct items"
426
+ ]
427
+ })
428
+ ]
429
+ })
430
+ ]
431
+ })
432
+ })
433
+ ]
434
+ })
435
+ ]
436
+ }) : /*#__PURE__*/ jsxs("div", {
437
+ className: "flex items-center gap-2 flex-1 min-w-0 pl-8 group",
438
+ children: [
439
+ showSelectionCheckboxes && !item.children && !isDisabled && /*#__PURE__*/ jsx(Checkbox, {
440
+ checked: isSelected,
441
+ onCheckedChange: (checked)=>{
442
+ if ("none" === selectionMode) return;
443
+ const newSelection = "single" === selectionMode ? new Set(checked ? [
444
+ item.id
445
+ ] : []) : new Set(selectedIds);
446
+ if ("multiple" === selectionMode) if (checked) newSelection.add(item.id);
447
+ else newSelection.delete(item.id);
448
+ lastSelectedId.current = item.id;
449
+ onSelect(newSelection);
450
+ },
451
+ onClick: (e)=>e.stopPropagation(),
452
+ "aria-label": `Select ${item.name}`
453
+ }),
454
+ showAccessRights && /*#__PURE__*/ jsx("div", {
455
+ className: "relative flex items-center justify-center w-4 h-4 cursor-pointer hover:opacity-80",
456
+ onClick: handleAccessClick,
457
+ children: item.checked ? /*#__PURE__*/ jsx("div", {
458
+ className: "w-4 h-4 border rounded bg-primary border-primary flex items-center justify-center",
459
+ children: /*#__PURE__*/ jsx("svg", {
460
+ className: "h-3 w-3 text-primary-foreground",
461
+ fill: "none",
462
+ viewBox: "0 0 24 24",
463
+ stroke: "currentColor",
464
+ children: /*#__PURE__*/ jsx("path", {
465
+ strokeLinecap: "round",
466
+ strokeLinejoin: "round",
467
+ strokeWidth: 2,
468
+ d: "M5 13l4 4L19 7"
469
+ })
470
+ })
471
+ }) : /*#__PURE__*/ jsx("div", {
472
+ className: "w-4 h-4 border rounded border-input"
473
+ })
474
+ }),
475
+ renderIcon(),
476
+ /*#__PURE__*/ jsx("span", {
477
+ className: "flex-1 min-w-0 truncate",
478
+ children: item.name
479
+ }),
480
+ item.badge && /*#__PURE__*/ jsx("span", {
481
+ className: "shrink-0 ml-1",
482
+ children: item.badge
483
+ }),
484
+ item.meta && /*#__PURE__*/ jsx("span", {
485
+ className: "text-xs text-muted-foreground shrink-0 ml-1 truncate max-w-[6rem]",
486
+ children: item.meta
487
+ }),
488
+ (item.actions?.length ?? 0) > 0 ? /*#__PURE__*/ jsxs(DropdownMenu, {
489
+ children: [
490
+ /*#__PURE__*/ jsx(DropdownMenuTrigger, {
491
+ asChild: true,
492
+ children: /*#__PURE__*/ jsx(Button, {
493
+ variant: "ghost",
494
+ size: "icon",
495
+ className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
496
+ onClick: (e)=>e.stopPropagation(),
497
+ children: /*#__PURE__*/ jsx(MoreHorizontal, {
498
+ className: "h-4 w-4 text-muted-foreground"
499
+ })
500
+ })
501
+ }),
502
+ /*#__PURE__*/ jsxs(DropdownMenuContent, {
503
+ align: "end",
504
+ className: "w-48",
505
+ children: [
506
+ item.actions?.map((action)=>/*#__PURE__*/ jsxs(DropdownMenuItem, {
507
+ disabled: isDisabled,
508
+ onClick: (e)=>{
509
+ e.stopPropagation();
510
+ action.onClick(item);
511
+ },
512
+ children: [
513
+ action.icon,
514
+ action.label ?? action.id
515
+ ]
516
+ }, action.id)),
517
+ /*#__PURE__*/ jsxs(DropdownMenuSub, {
518
+ children: [
519
+ /*#__PURE__*/ jsx(DropdownMenuSubTrigger, {
520
+ children: "View details"
521
+ }),
522
+ /*#__PURE__*/ jsx(DropdownMenuSubContent, {
523
+ className: "w-64 p-3",
524
+ children: /*#__PURE__*/ jsxs("div", {
525
+ className: "space-y-2 text-sm",
526
+ children: [
527
+ /*#__PURE__*/ jsx("h4", {
528
+ className: "font-semibold",
529
+ children: item.name
530
+ }),
531
+ /*#__PURE__*/ jsxs("div", {
532
+ className: "text-muted-foreground space-y-1",
533
+ children: [
534
+ /*#__PURE__*/ jsxs("div", {
535
+ children: [
536
+ /*#__PURE__*/ jsx("span", {
537
+ className: "font-medium",
538
+ children: "Type:"
539
+ }),
540
+ " ",
541
+ item.type.charAt(0).toUpperCase() + item.type.slice(1).replace("_", " ")
542
+ ]
543
+ }),
544
+ /*#__PURE__*/ jsxs("div", {
545
+ children: [
546
+ /*#__PURE__*/ jsx("span", {
547
+ className: "font-medium",
548
+ children: "ID:"
549
+ }),
550
+ " ",
551
+ item.id
552
+ ]
553
+ }),
554
+ /*#__PURE__*/ jsxs("div", {
555
+ children: [
556
+ /*#__PURE__*/ jsx("span", {
557
+ className: "font-medium",
558
+ children: "Location:"
559
+ }),
560
+ " ",
561
+ getItemPath(item, allItems)
562
+ ]
563
+ })
564
+ ]
565
+ })
566
+ ]
567
+ })
568
+ })
569
+ ]
570
+ })
571
+ ]
572
+ })
573
+ ]
574
+ }) : /*#__PURE__*/ jsxs(HoverCard, {
575
+ children: [
576
+ /*#__PURE__*/ jsx(HoverCardTrigger, {
577
+ asChild: true,
578
+ children: /*#__PURE__*/ jsx(Button, {
579
+ variant: "ghost",
580
+ size: "icon",
581
+ className: "h-6 w-6 shrink-0 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
582
+ onClick: (e)=>e.stopPropagation(),
583
+ children: /*#__PURE__*/ jsx(Info, {
584
+ className: "h-4 w-4 text-muted-foreground"
585
+ })
586
+ })
587
+ }),
588
+ /*#__PURE__*/ jsx(HoverCardContent, {
589
+ className: "w-80",
590
+ children: /*#__PURE__*/ jsxs("div", {
591
+ className: "space-y-2",
592
+ children: [
593
+ /*#__PURE__*/ jsx("h4", {
594
+ className: "text-sm font-semibold",
595
+ children: item.name
596
+ }),
597
+ /*#__PURE__*/ jsxs("div", {
598
+ className: "text-sm text-muted-foreground space-y-1",
599
+ children: [
600
+ /*#__PURE__*/ jsxs("div", {
601
+ children: [
602
+ /*#__PURE__*/ jsx("span", {
603
+ className: "font-medium",
604
+ children: "Type:"
605
+ }),
606
+ " ",
607
+ item.type.charAt(0).toUpperCase() + item.type.slice(1).replace("_", " ")
608
+ ]
609
+ }),
610
+ /*#__PURE__*/ jsxs("div", {
611
+ children: [
612
+ /*#__PURE__*/ jsx("span", {
613
+ className: "font-medium",
614
+ children: "ID:"
615
+ }),
616
+ " ",
617
+ item.id
618
+ ]
619
+ }),
620
+ /*#__PURE__*/ jsxs("div", {
621
+ children: [
622
+ /*#__PURE__*/ jsx("span", {
623
+ className: "font-medium",
624
+ children: "Location:"
625
+ }),
626
+ " ",
627
+ getItemPath(item, allItems)
628
+ ]
629
+ })
630
+ ]
631
+ })
632
+ ]
633
+ })
634
+ })
635
+ ]
636
+ })
637
+ ]
638
+ })
639
+ })
640
+ }),
641
+ item.children && /*#__PURE__*/ jsx(Collapsible, {
642
+ open: isOpen,
643
+ onOpenChange: (open)=>onToggleExpand(item.id, open),
644
+ children: /*#__PURE__*/ jsx(AnimatePresence, {
645
+ initial: false,
646
+ children: isOpen && /*#__PURE__*/ jsx(CollapsibleContent, {
647
+ forceMount: true,
648
+ asChild: true,
649
+ children: /*#__PURE__*/ jsx(motion.div, {
650
+ initial: {
651
+ height: 0,
652
+ opacity: 0
653
+ },
654
+ animate: {
655
+ height: "auto",
656
+ opacity: 1
657
+ },
658
+ exit: {
659
+ height: 0,
660
+ opacity: 0
661
+ },
662
+ transition: {
663
+ duration: 0.05
664
+ },
665
+ children: item.children?.map((child)=>/*#__PURE__*/ jsx(TreeItem, {
666
+ item: child,
667
+ depth: depth + 1,
668
+ selectedIds: selectedIds,
669
+ lastSelectedId: lastSelectedId,
670
+ onSelect: onSelect,
671
+ expandedIds: expandedIds,
672
+ onToggleExpand: onToggleExpand,
673
+ selectionMode: selectionMode,
674
+ getIcon: getIcon,
675
+ onAction: onAction,
676
+ onAccessChange: onAccessChange,
677
+ allItems: allItems,
678
+ showAccessRights: showAccessRights,
679
+ showSelectionCheckboxes: showSelectionCheckboxes,
680
+ itemMap: itemMap,
681
+ iconMap: iconMap,
682
+ menuItems: menuItems,
683
+ getSelectedItems: getSelectedItems
684
+ }, child.id))
685
+ })
686
+ })
687
+ })
688
+ })
689
+ ]
690
+ })
691
+ }),
692
+ /*#__PURE__*/ jsx(ContextMenuContent, {
693
+ className: "w-64",
694
+ children: menuItems?.map((menuItem)=>/*#__PURE__*/ jsxs(ContextMenuItem, {
695
+ onClick: ()=>{
696
+ const items = selectedIds.has(item.id) ? getSelectedItems() : [
697
+ item
698
+ ];
699
+ menuItem.action(items);
700
+ },
701
+ children: [
702
+ menuItem.icon && /*#__PURE__*/ jsx("span", {
703
+ className: "mr-2 h-4 w-4",
704
+ children: menuItem.icon
705
+ }),
706
+ menuItem.label
707
+ ]
708
+ }, menuItem.id))
709
+ })
710
+ ]
711
+ });
712
+ }
713
+ function TreeView({ className, containerClassName, checkboxLabels = {
714
+ check: "Check",
715
+ uncheck: "Uncheck"
716
+ }, data, iconMap, searchPlaceholder = "Search...", selectionText = "selected", showExpandAll = true, showCheckboxes = false, showSelectionCheckboxes = false, selectionMode = "multiple", title, getIcon, onSelectionChange, onAction, onCheckChange, menuItems }) {
717
+ const [currentMousePos, setCurrentMousePos] = useState(0);
718
+ const [dragStart, setDragStart] = useState(null);
719
+ const [dragStartPosition, setDragStartPosition] = useState(null);
720
+ const [expandedIds, setExpandedIds] = useState(new Set());
721
+ const [isDragging, setIsDragging] = useState(false);
722
+ const [selectedIds, setSelectedIds] = useState(new Set());
723
+ const [searchQuery, setSearchQuery] = useState("");
724
+ const dragRef = useRef(null);
725
+ const lastSelectedId = useRef(null);
726
+ const treeRef = useRef(null);
727
+ const DRAG_THRESHOLD = 10;
728
+ const itemMap = useMemo(()=>buildItemMap(data), [
729
+ data
730
+ ]);
731
+ const { filteredData, searchExpandedIds } = useMemo(()=>{
732
+ if (!searchQuery.trim()) return {
733
+ filteredData: data,
734
+ searchExpandedIds: new Set()
735
+ };
736
+ const searchLower = searchQuery.toLowerCase();
737
+ const newExpandedIds = new Set();
738
+ const itemMatches = (item)=>{
739
+ const nameMatches = item.name.toLowerCase().includes(searchLower);
740
+ if (nameMatches) return true;
741
+ if (item.children) return item.children.some((child)=>itemMatches(child));
742
+ return false;
743
+ };
744
+ const filterTree = (items)=>items.map((item)=>{
745
+ if (!item.children) return itemMatches(item) ? item : null;
746
+ const filteredChildren = filterTree(item.children);
747
+ if (filteredChildren.length > 0 || itemMatches(item)) {
748
+ if (item.children) newExpandedIds.add(item.id);
749
+ return {
750
+ ...item,
751
+ children: filteredChildren
752
+ };
753
+ }
754
+ return null;
755
+ }).filter((item)=>null !== item);
756
+ return {
757
+ filteredData: filterTree(data),
758
+ searchExpandedIds: newExpandedIds
759
+ };
760
+ }, [
761
+ data,
762
+ searchQuery
763
+ ]);
764
+ useEffect(()=>{
765
+ if (searchQuery.trim()) setExpandedIds((prev)=>new Set([
766
+ ...prev,
767
+ ...searchExpandedIds
768
+ ]));
769
+ }, [
770
+ searchExpandedIds,
771
+ searchQuery
772
+ ]);
773
+ useEffect(()=>{
774
+ const handleClickAway = (e)=>{
775
+ const target = e.target;
776
+ const clickedInside = treeRef.current && treeRef.current.contains(target) || dragRef.current && dragRef.current.contains(target) || target.closest('[role="menu"]') || target.closest("[data-radix-popper-content-wrapper]");
777
+ if (!clickedInside) {
778
+ setSelectedIds(new Set());
779
+ lastSelectedId.current = null;
780
+ }
781
+ };
782
+ document.addEventListener("mousedown", handleClickAway);
783
+ return ()=>document.removeEventListener("mousedown", handleClickAway);
784
+ }, []);
785
+ const getAllFolderIds = (items)=>{
786
+ let ids = [];
787
+ items.forEach((item)=>{
788
+ if (item.children) {
789
+ ids.push(item.id);
790
+ ids = [
791
+ ...ids,
792
+ ...getAllFolderIds(item.children)
793
+ ];
794
+ }
795
+ });
796
+ return ids;
797
+ };
798
+ const handleExpandAll = ()=>{
799
+ setExpandedIds(new Set(getAllFolderIds(data)));
800
+ };
801
+ const handleCollapseAll = ()=>{
802
+ setExpandedIds(new Set());
803
+ };
804
+ const handleToggleExpand = (id, isOpen)=>{
805
+ const newExpandedIds = new Set(expandedIds);
806
+ if (isOpen) newExpandedIds.add(id);
807
+ else newExpandedIds.delete(id);
808
+ setExpandedIds(newExpandedIds);
809
+ };
810
+ const getSelectedItems = useCallback(()=>{
811
+ const items = [];
812
+ const processItem = (item)=>{
813
+ if (selectedIds.has(item.id)) items.push(item);
814
+ item.children?.forEach(processItem);
815
+ };
816
+ data.forEach(processItem);
817
+ return items;
818
+ }, [
819
+ selectedIds,
820
+ data
821
+ ]);
822
+ const getEffectiveSelectedItems = useCallback(()=>{
823
+ const selectedItems = getSelectedItems();
824
+ const selectedIdsSet = new Set(selectedItems.map((item)=>item.id));
825
+ return selectedItems.filter((item)=>{
826
+ if (!item.children) return true;
827
+ const hasSelectedChildren = item.children.some((child)=>selectedIdsSet.has(child.id));
828
+ return !hasSelectedChildren;
829
+ });
830
+ }, [
831
+ getSelectedItems
832
+ ]);
833
+ const handleMouseDown = useCallback((e)=>{
834
+ if (0 !== e.button || e.target.closest("button")) return;
835
+ setDragStartPosition({
836
+ x: e.clientX,
837
+ y: e.clientY
838
+ });
839
+ }, []);
840
+ const handleMouseMove = useCallback((e)=>{
841
+ if ("none" === selectionMode) return;
842
+ if (!(1 & e.buttons)) {
843
+ setIsDragging(false);
844
+ setDragStart(null);
845
+ setDragStartPosition(null);
846
+ return;
847
+ }
848
+ if (!dragStartPosition) return;
849
+ const deltaX = e.clientX - dragStartPosition.x;
850
+ const deltaY = e.clientY - dragStartPosition.y;
851
+ const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
852
+ if (!isDragging) {
853
+ if (distance > DRAG_THRESHOLD) {
854
+ setIsDragging(true);
855
+ setDragStart(dragStartPosition.y);
856
+ if (!e.shiftKey && !e.ctrlKey) {
857
+ setSelectedIds(new Set());
858
+ lastSelectedId.current = null;
859
+ }
860
+ }
861
+ return;
862
+ }
863
+ if (!dragRef.current) return;
864
+ const items = Array.from(dragRef.current.querySelectorAll("[data-tree-item]"));
865
+ const startY = dragStart;
866
+ const currentY = e.clientY;
867
+ const [selectionStart, selectionEnd] = [
868
+ Math.min(startY || 0, currentY),
869
+ Math.max(startY || 0, currentY)
870
+ ];
871
+ const newSelection = new Set(e.shiftKey || e.ctrlKey ? Array.from(selectedIds) : []);
872
+ items.forEach((item)=>{
873
+ const rect = item.getBoundingClientRect();
874
+ const itemTop = rect.top;
875
+ const itemBottom = rect.top + rect.height;
876
+ if (itemBottom >= selectionStart && itemTop <= selectionEnd) {
877
+ const id = item.getAttribute("data-id");
878
+ const isDisabledEl = "true" === item.getAttribute("data-disabled");
879
+ const isClosedFolder = "true" === item.getAttribute("data-folder-closed");
880
+ const parentFolderClosed = item.closest('[data-folder-closed="true"]');
881
+ if (id && !isDisabledEl && (isClosedFolder || !parentFolderClosed)) newSelection.add(id);
882
+ }
883
+ });
884
+ setSelectedIds(newSelection);
885
+ setCurrentMousePos(e.clientY);
886
+ }, [
887
+ isDragging,
888
+ dragStart,
889
+ selectedIds,
890
+ dragStartPosition,
891
+ selectionMode
892
+ ]);
893
+ const handleMouseUp = useCallback(()=>{
894
+ setIsDragging(false);
895
+ setDragStart(null);
896
+ setDragStartPosition(null);
897
+ }, []);
898
+ useEffect(()=>{
899
+ if (isDragging) {
900
+ document.addEventListener("mouseup", handleMouseUp);
901
+ document.addEventListener("mouseleave", handleMouseUp);
902
+ }
903
+ return ()=>{
904
+ document.removeEventListener("mouseup", handleMouseUp);
905
+ document.removeEventListener("mouseleave", handleMouseUp);
906
+ };
907
+ }, [
908
+ isDragging,
909
+ handleMouseUp
910
+ ]);
911
+ useEffect(()=>{
912
+ if (onSelectionChange) onSelectionChange(getSelectedItems());
913
+ }, [
914
+ selectedIds,
915
+ onSelectionChange,
916
+ getSelectedItems
917
+ ]);
918
+ return /*#__PURE__*/ jsx("div", {
919
+ className: cn("flex gap-4 min-w-0", containerClassName ? "w-full" : ""),
920
+ children: /*#__PURE__*/ jsxs("div", {
921
+ ref: treeRef,
922
+ className: cn("bg-background rounded-xl border space-y-4 relative shadow-lg flex flex-col min-w-0 overflow-hidden", containerClassName ?? "p-6 max-w-2xl w-[600px]"),
923
+ children: [
924
+ title && /*#__PURE__*/ jsx("div", {
925
+ className: "text-sm font-medium text-foreground shrink-0",
926
+ children: title
927
+ }),
928
+ /*#__PURE__*/ jsxs("div", {
929
+ className: "relative w-full shrink-0",
930
+ children: [
931
+ /*#__PURE__*/ jsx(Search, {
932
+ className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"
933
+ }),
934
+ /*#__PURE__*/ jsx(Input, {
935
+ placeholder: searchPlaceholder,
936
+ value: searchQuery,
937
+ onChange: (e)=>setSearchQuery(e.target.value),
938
+ className: "h-10 w-full pl-9"
939
+ })
940
+ ]
941
+ }),
942
+ /*#__PURE__*/ jsxs("div", {
943
+ className: "flex items-center justify-between gap-2 shrink-0",
944
+ children: [
945
+ /*#__PURE__*/ jsx("div", {
946
+ className: "flex gap-2",
947
+ children: showExpandAll && /*#__PURE__*/ jsxs(Fragment, {
948
+ children: [
949
+ /*#__PURE__*/ jsx(Button, {
950
+ variant: "ghost",
951
+ size: "sm",
952
+ className: "h-6 px-1.5 text-xs",
953
+ onClick: handleExpandAll,
954
+ children: "Expand"
955
+ }),
956
+ /*#__PURE__*/ jsx(Button, {
957
+ variant: "ghost",
958
+ size: "sm",
959
+ className: "h-6 px-1.5 text-xs",
960
+ onClick: handleCollapseAll,
961
+ children: "Collapse"
962
+ })
963
+ ]
964
+ })
965
+ }),
966
+ "none" !== selectionMode && selectedIds.size > 0 ? /*#__PURE__*/ jsxs("div", {
967
+ className: "flex items-center gap-2",
968
+ children: [
969
+ /*#__PURE__*/ jsxs("span", {
970
+ className: "text-xs text-muted-foreground",
971
+ children: [
972
+ selectedIds.size,
973
+ " ",
974
+ selectionText
975
+ ]
976
+ }),
977
+ /*#__PURE__*/ jsxs(Button, {
978
+ variant: "ghost",
979
+ size: "sm",
980
+ className: "h-6 px-1.5 text-xs",
981
+ onClick: ()=>{
982
+ setSelectedIds(new Set());
983
+ lastSelectedId.current = null;
984
+ },
985
+ children: [
986
+ /*#__PURE__*/ jsx(X, {
987
+ className: "h-3 w-3 mr-1"
988
+ }),
989
+ "Clear"
990
+ ]
991
+ }),
992
+ showCheckboxes && /*#__PURE__*/ jsxs("div", {
993
+ className: "flex gap-2",
994
+ children: [
995
+ /*#__PURE__*/ jsx(Button, {
996
+ variant: "ghost",
997
+ size: "sm",
998
+ className: "h-8 px-2 text-green-600 hover:text-green-700 hover:bg-green-50",
999
+ onClick: ()=>{
1000
+ const effectiveItems = getEffectiveSelectedItems();
1001
+ const processItem = (item)=>{
1002
+ onCheckChange?.(item, true);
1003
+ item.children?.forEach(processItem);
1004
+ };
1005
+ effectiveItems.forEach(processItem);
1006
+ },
1007
+ children: checkboxLabels.check
1008
+ }),
1009
+ /*#__PURE__*/ jsx(Button, {
1010
+ variant: "ghost",
1011
+ size: "sm",
1012
+ className: "h-8 px-2 text-red-600 hover:text-red-700 hover:bg-red-50",
1013
+ onClick: ()=>{
1014
+ const effectiveItems = getEffectiveSelectedItems();
1015
+ const processItem = (item)=>{
1016
+ onCheckChange?.(item, false);
1017
+ item.children?.forEach(processItem);
1018
+ };
1019
+ effectiveItems.forEach(processItem);
1020
+ },
1021
+ children: checkboxLabels.uncheck
1022
+ })
1023
+ ]
1024
+ })
1025
+ ]
1026
+ }) : null
1027
+ ]
1028
+ }),
1029
+ /*#__PURE__*/ jsxs("div", {
1030
+ ref: dragRef,
1031
+ className: cn("rounded-lg relative select-none min-w-0 overflow-x-hidden", className),
1032
+ onMouseDown: handleMouseDown,
1033
+ onMouseMove: handleMouseMove,
1034
+ children: [
1035
+ isDragging && /*#__PURE__*/ jsx("div", {
1036
+ className: "absolute inset-0 bg-blue-500/0 pointer-events-none",
1037
+ style: {
1038
+ top: Math.min(dragStart || 0, null === dragStart ? 0 : currentMousePos),
1039
+ height: Math.abs((dragStart || 0) - (null === dragStart ? 0 : currentMousePos))
1040
+ }
1041
+ }),
1042
+ filteredData.map((item)=>/*#__PURE__*/ jsx(TreeItem, {
1043
+ item: item,
1044
+ selectedIds: selectedIds,
1045
+ lastSelectedId: lastSelectedId,
1046
+ onSelect: setSelectedIds,
1047
+ expandedIds: expandedIds,
1048
+ onToggleExpand: handleToggleExpand,
1049
+ selectionMode: selectionMode,
1050
+ getIcon: getIcon,
1051
+ onAction: onAction,
1052
+ onAccessChange: onCheckChange,
1053
+ allItems: data,
1054
+ showAccessRights: showCheckboxes,
1055
+ showSelectionCheckboxes: showSelectionCheckboxes,
1056
+ itemMap: itemMap,
1057
+ iconMap: iconMap,
1058
+ menuItems: menuItems,
1059
+ getSelectedItems: getSelectedItems
1060
+ }, item.id))
1061
+ ]
1062
+ })
1063
+ ]
1064
+ })
1065
+ });
1066
+ }
1067
+ export { TreeView as default };