@uipath/apollo-wind 0.10.0 → 0.11.0-pr295.af4e744

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