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