@elliemae/ds-treeview 2.3.0-alpha.1 → 2.3.0-alpha.6

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 (266) hide show
  1. package/{cjs → dist/cjs}/TreeView.js +1 -3
  2. package/dist/cjs/TreeView.js.map +7 -0
  3. package/{cjs → dist/cjs}/TreeViewContext.js +2 -8
  4. package/dist/cjs/TreeViewContext.js.map +7 -0
  5. package/{cjs → dist/cjs}/config/cssClassesConstants.js +0 -0
  6. package/{cjs → dist/cjs}/config/cssClassesConstants.js.map +0 -0
  7. package/{cjs → dist/cjs}/config/useTreeview.js +14 -28
  8. package/dist/cjs/config/useTreeview.js.map +7 -0
  9. package/dist/cjs/hoc/DnDTreeContext.js +45 -0
  10. package/dist/cjs/hoc/DnDTreeContext.js.map +7 -0
  11. package/dist/cjs/hoc/SortableItemContext.js +46 -0
  12. package/dist/cjs/hoc/SortableItemContext.js.map +7 -0
  13. package/dist/cjs/hoc/WithConditionalDnDContext.js +128 -0
  14. package/dist/cjs/hoc/WithConditionalDnDContext.js.map +7 -0
  15. package/dist/cjs/hoc/WithDnDSortableItemContext.js +69 -0
  16. package/dist/cjs/hoc/WithDnDSortableItemContext.js.map +7 -0
  17. package/{cjs → dist/cjs}/index.js +0 -0
  18. package/{cjs → dist/cjs}/index.js.map +0 -0
  19. package/{cjs → dist/cjs}/parts/CheckboxSelectable.js +0 -0
  20. package/{cjs → dist/cjs}/parts/CheckboxSelectable.js.map +0 -0
  21. package/{cjs → dist/cjs}/parts/ChildrenCountDisplayer.js +0 -0
  22. package/{cjs → dist/cjs}/parts/ChildrenCountDisplayer.js.map +0 -0
  23. package/dist/cjs/parts/DnDHandle.js +57 -0
  24. package/dist/cjs/parts/DnDHandle.js.map +7 -0
  25. package/dist/cjs/parts/DropIndicator.js +80 -0
  26. package/dist/cjs/parts/DropIndicator.js.map +7 -0
  27. package/{cjs → dist/cjs}/parts/ExpandCaret.js +0 -0
  28. package/{cjs → dist/cjs}/parts/ExpandCaret.js.map +0 -0
  29. package/{cjs → dist/cjs}/parts/Icon.js +0 -0
  30. package/{cjs → dist/cjs}/parts/Icon.js.map +0 -0
  31. package/{cjs → dist/cjs}/parts/NestingSpace.js +0 -0
  32. package/{cjs → dist/cjs}/parts/NestingSpace.js.map +0 -0
  33. package/{cjs → dist/cjs}/parts/RadioSelectable.js +0 -0
  34. package/{cjs → dist/cjs}/parts/RadioSelectable.js.map +0 -0
  35. package/{cjs → dist/cjs}/parts/TreeItem.js +37 -62
  36. package/dist/cjs/parts/TreeItem.js.map +7 -0
  37. package/{cjs → dist/cjs}/parts/TreeItemText.js +0 -0
  38. package/{cjs → dist/cjs}/parts/TreeItemText.js.map +0 -0
  39. package/{cjs → dist/cjs}/parts/TreeList.js +13 -18
  40. package/dist/cjs/parts/TreeList.js.map +7 -0
  41. package/dist/cjs/plugins/dnd/TreeDndPlugin.js +35 -0
  42. package/dist/cjs/plugins/dnd/TreeDndPlugin.js.map +7 -0
  43. package/{cjs → dist/cjs}/plugins/dnd/index.js +0 -0
  44. package/{cjs → dist/cjs}/plugins/dnd/index.js.map +0 -0
  45. package/{cjs → dist/cjs}/plugins/index.js +0 -0
  46. package/{cjs → dist/cjs}/plugins/index.js.map +0 -0
  47. package/{cjs → dist/cjs}/plugins/roving/TreeRovingPlugin.js +0 -0
  48. package/{cjs → dist/cjs}/plugins/roving/TreeRovingPlugin.js.map +0 -0
  49. package/{cjs → dist/cjs}/plugins/roving/index.js +0 -0
  50. package/{cjs → dist/cjs}/plugins/roving/index.js.map +0 -0
  51. package/{cjs → dist/cjs}/plugins/searchable/SearchableTreePlugin.js +0 -0
  52. package/{cjs → dist/cjs}/plugins/searchable/SearchableTreePlugin.js.map +0 -0
  53. package/{cjs → dist/cjs}/plugins/searchable/index.js +0 -0
  54. package/{cjs → dist/cjs}/plugins/searchable/index.js.map +0 -0
  55. package/{cjs → dist/cjs}/plugins/selectable/SelectablePluginTree.js +0 -0
  56. package/{cjs → dist/cjs}/plugins/selectable/SelectablePluginTree.js.map +0 -0
  57. package/{cjs → dist/cjs}/plugins/selectable/index.js +0 -0
  58. package/{cjs → dist/cjs}/plugins/selectable/index.js.map +0 -0
  59. package/{cjs → dist/cjs}/plugins/toolbar/TreeToolbarPlugin.js +0 -0
  60. package/{cjs → dist/cjs}/plugins/toolbar/TreeToolbarPlugin.js.map +0 -0
  61. package/{cjs → dist/cjs}/plugins/toolbar/index.js +0 -0
  62. package/{cjs → dist/cjs}/plugins/toolbar/index.js.map +0 -0
  63. package/{cjs → dist/cjs}/plugins/tree/TreeDataPlugin.js +0 -0
  64. package/{cjs → dist/cjs}/plugins/tree/TreeDataPlugin.js.map +0 -0
  65. package/{cjs → dist/cjs}/plugins/tree/index.js +0 -0
  66. package/{cjs → dist/cjs}/plugins/tree/index.js.map +0 -0
  67. package/{cjs → dist/cjs}/plugins/virtualization/TreeVirtualizationPlugin.js +0 -0
  68. package/{cjs → dist/cjs}/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -0
  69. package/{cjs → dist/cjs}/plugins/virtualization/index.js +0 -0
  70. package/{cjs → dist/cjs}/plugins/virtualization/index.js.map +0 -0
  71. package/{cjs → dist/cjs}/react-desc-prop-types.js +1 -0
  72. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  73. package/{cjs → dist/cjs}/related-components/TreeViewSearchBar.js +0 -0
  74. package/{cjs → dist/cjs}/related-components/TreeViewSearchBar.js.map +0 -0
  75. package/{cjs → dist/cjs}/sharedTypes.js +0 -0
  76. package/dist/cjs/sharedTypes.js.map +7 -0
  77. package/{cjs → dist/cjs}/utils/array-helpers.js +0 -0
  78. package/{cjs → dist/cjs}/utils/array-helpers.js.map +0 -0
  79. package/{cjs → dist/cjs}/utils/group-expands-helpers.js +0 -0
  80. package/{cjs → dist/cjs}/utils/group-expands-helpers.js.map +0 -0
  81. package/{cjs → dist/cjs}/utils/keyboard-helpers.js +7 -7
  82. package/dist/cjs/utils/keyboard-helpers.js.map +7 -0
  83. package/{cjs → dist/cjs}/utils/object-helpers.js +0 -0
  84. package/{cjs → dist/cjs}/utils/object-helpers.js.map +0 -0
  85. package/{cjs → dist/cjs}/utils/refs-helpers.js +0 -0
  86. package/{cjs → dist/cjs}/utils/refs-helpers.js.map +1 -1
  87. package/{cjs → dist/cjs}/utils/selectable-helper.js +0 -0
  88. package/{cjs → dist/cjs}/utils/selectable-helper.js.map +0 -0
  89. package/{cjs → dist/cjs}/utils/string-helpers.js +0 -0
  90. package/{cjs → dist/cjs}/utils/string-helpers.js.map +0 -0
  91. package/{cjs → dist/cjs}/utils/tree-helpers.js +21 -1
  92. package/{cjs → dist/cjs}/utils/tree-helpers.js.map +2 -2
  93. package/{cjs → dist/cjs}/utils/useInstanceRefActions.js +0 -0
  94. package/{cjs → dist/cjs}/utils/useInstanceRefActions.js.map +0 -0
  95. package/{cjs → dist/cjs}/utils/useTree.js +3 -1
  96. package/dist/cjs/utils/useTree.js.map +7 -0
  97. package/{esm → dist/esm}/TreeView.js +1 -3
  98. package/dist/esm/TreeView.js.map +7 -0
  99. package/{esm → dist/esm}/TreeViewContext.js +2 -8
  100. package/dist/esm/TreeViewContext.js.map +7 -0
  101. package/{esm → dist/esm}/config/cssClassesConstants.js +0 -0
  102. package/{esm → dist/esm}/config/cssClassesConstants.js.map +0 -0
  103. package/{esm → dist/esm}/config/useTreeview.js +15 -29
  104. package/dist/esm/config/useTreeview.js.map +7 -0
  105. package/dist/esm/hoc/DnDTreeContext.js +16 -0
  106. package/dist/esm/hoc/DnDTreeContext.js.map +7 -0
  107. package/dist/esm/hoc/SortableItemContext.js +17 -0
  108. package/dist/esm/hoc/SortableItemContext.js.map +7 -0
  109. package/dist/esm/hoc/WithConditionalDnDContext.js +99 -0
  110. package/dist/esm/hoc/WithConditionalDnDContext.js.map +7 -0
  111. package/dist/esm/hoc/WithDnDSortableItemContext.js +40 -0
  112. package/dist/esm/hoc/WithDnDSortableItemContext.js.map +7 -0
  113. package/{esm → dist/esm}/index.js +0 -0
  114. package/{esm → dist/esm}/index.js.map +0 -0
  115. package/{esm → dist/esm}/parts/CheckboxSelectable.js +0 -0
  116. package/{esm → dist/esm}/parts/CheckboxSelectable.js.map +0 -0
  117. package/{esm → dist/esm}/parts/ChildrenCountDisplayer.js +0 -0
  118. package/{esm → dist/esm}/parts/ChildrenCountDisplayer.js.map +0 -0
  119. package/dist/esm/parts/DnDHandle.js +28 -0
  120. package/dist/esm/parts/DnDHandle.js.map +7 -0
  121. package/dist/esm/parts/DropIndicator.js +51 -0
  122. package/dist/esm/parts/DropIndicator.js.map +7 -0
  123. package/{esm → dist/esm}/parts/ExpandCaret.js +0 -0
  124. package/{esm → dist/esm}/parts/ExpandCaret.js.map +0 -0
  125. package/{esm → dist/esm}/parts/Icon.js +0 -0
  126. package/{esm → dist/esm}/parts/Icon.js.map +0 -0
  127. package/{esm → dist/esm}/parts/NestingSpace.js +0 -0
  128. package/{esm → dist/esm}/parts/NestingSpace.js.map +0 -0
  129. package/{esm → dist/esm}/parts/RadioSelectable.js +0 -0
  130. package/{esm → dist/esm}/parts/RadioSelectable.js.map +0 -0
  131. package/{esm → dist/esm}/parts/TreeItem.js +37 -62
  132. package/dist/esm/parts/TreeItem.js.map +7 -0
  133. package/{esm → dist/esm}/parts/TreeItemText.js +0 -0
  134. package/{esm → dist/esm}/parts/TreeItemText.js.map +0 -0
  135. package/{esm → dist/esm}/parts/TreeList.js +12 -17
  136. package/dist/esm/parts/TreeList.js.map +7 -0
  137. package/dist/esm/plugins/dnd/TreeDndPlugin.js +6 -0
  138. package/dist/esm/plugins/dnd/TreeDndPlugin.js.map +7 -0
  139. package/{esm → dist/esm}/plugins/dnd/index.js +0 -0
  140. package/{esm → dist/esm}/plugins/dnd/index.js.map +0 -0
  141. package/{esm → dist/esm}/plugins/index.js +0 -0
  142. package/{esm → dist/esm}/plugins/index.js.map +0 -0
  143. package/{esm → dist/esm}/plugins/roving/TreeRovingPlugin.js +0 -0
  144. package/{esm → dist/esm}/plugins/roving/TreeRovingPlugin.js.map +0 -0
  145. package/{esm → dist/esm}/plugins/roving/index.js +0 -0
  146. package/{esm → dist/esm}/plugins/roving/index.js.map +0 -0
  147. package/{esm → dist/esm}/plugins/searchable/SearchableTreePlugin.js +0 -0
  148. package/{esm → dist/esm}/plugins/searchable/SearchableTreePlugin.js.map +0 -0
  149. package/{esm → dist/esm}/plugins/searchable/index.js +0 -0
  150. package/{esm → dist/esm}/plugins/searchable/index.js.map +0 -0
  151. package/{esm → dist/esm}/plugins/selectable/SelectablePluginTree.js +0 -0
  152. package/{esm → dist/esm}/plugins/selectable/SelectablePluginTree.js.map +0 -0
  153. package/{esm → dist/esm}/plugins/selectable/index.js +0 -0
  154. package/{esm → dist/esm}/plugins/selectable/index.js.map +0 -0
  155. package/{esm → dist/esm}/plugins/toolbar/TreeToolbarPlugin.js +0 -0
  156. package/{esm → dist/esm}/plugins/toolbar/TreeToolbarPlugin.js.map +0 -0
  157. package/{esm → dist/esm}/plugins/toolbar/index.js +0 -0
  158. package/{esm → dist/esm}/plugins/toolbar/index.js.map +0 -0
  159. package/{esm → dist/esm}/plugins/tree/TreeDataPlugin.js +0 -0
  160. package/{esm → dist/esm}/plugins/tree/TreeDataPlugin.js.map +0 -0
  161. package/{esm → dist/esm}/plugins/tree/index.js +0 -0
  162. package/{esm → dist/esm}/plugins/tree/index.js.map +0 -0
  163. package/{esm → dist/esm}/plugins/virtualization/TreeVirtualizationPlugin.js +0 -0
  164. package/{esm → dist/esm}/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -0
  165. package/{esm → dist/esm}/plugins/virtualization/index.js +0 -0
  166. package/{esm → dist/esm}/plugins/virtualization/index.js.map +0 -0
  167. package/{esm → dist/esm}/react-desc-prop-types.js +1 -0
  168. package/dist/esm/react-desc-prop-types.js.map +7 -0
  169. package/{esm → dist/esm}/related-components/TreeViewSearchBar.js +0 -0
  170. package/{esm → dist/esm}/related-components/TreeViewSearchBar.js.map +0 -0
  171. package/{esm → dist/esm}/sharedTypes.js +0 -0
  172. package/{esm → dist/esm}/sharedTypes.js.map +0 -0
  173. package/{esm → dist/esm}/utils/array-helpers.js +0 -0
  174. package/{esm → dist/esm}/utils/array-helpers.js.map +0 -0
  175. package/{esm → dist/esm}/utils/group-expands-helpers.js +0 -0
  176. package/{esm → dist/esm}/utils/group-expands-helpers.js.map +0 -0
  177. package/{esm → dist/esm}/utils/keyboard-helpers.js +7 -7
  178. package/dist/esm/utils/keyboard-helpers.js.map +7 -0
  179. package/{esm → dist/esm}/utils/object-helpers.js +0 -0
  180. package/{esm → dist/esm}/utils/object-helpers.js.map +0 -0
  181. package/{esm → dist/esm}/utils/refs-helpers.js +0 -0
  182. package/{esm → dist/esm}/utils/refs-helpers.js.map +1 -1
  183. package/{esm → dist/esm}/utils/selectable-helper.js +0 -0
  184. package/{esm → dist/esm}/utils/selectable-helper.js.map +0 -0
  185. package/{esm → dist/esm}/utils/string-helpers.js +0 -0
  186. package/{esm → dist/esm}/utils/string-helpers.js.map +0 -0
  187. package/{esm → dist/esm}/utils/tree-helpers.js +21 -1
  188. package/{esm → dist/esm}/utils/tree-helpers.js.map +2 -2
  189. package/{esm → dist/esm}/utils/useInstanceRefActions.js +0 -0
  190. package/{esm → dist/esm}/utils/useInstanceRefActions.js.map +0 -0
  191. package/{esm → dist/esm}/utils/useTree.js +4 -2
  192. package/dist/esm/utils/useTree.js.map +7 -0
  193. package/package.json +136 -117
  194. package/cjs/TreeView.js.map +0 -7
  195. package/cjs/TreeViewContext.js.map +0 -7
  196. package/cjs/config/useTreeview.js.map +0 -7
  197. package/cjs/parts/TreeItem.js.map +0 -7
  198. package/cjs/parts/TreeList.js.map +0 -7
  199. package/cjs/plugins/dnd/TreeDndPlugin.js +0 -59
  200. package/cjs/plugins/dnd/TreeDndPlugin.js.map +0 -7
  201. package/cjs/react-desc-prop-types.js.map +0 -7
  202. package/cjs/sharedTypes.js.map +0 -7
  203. package/cjs/utils/dnd-helpers.js +0 -146
  204. package/cjs/utils/dnd-helpers.js.map +0 -7
  205. package/cjs/utils/keyboard-helpers.js.map +0 -7
  206. package/cjs/utils/useDnDHelpers.js +0 -199
  207. package/cjs/utils/useDnDHelpers.js.map +0 -7
  208. package/cjs/utils/useTree.js.map +0 -7
  209. package/esm/TreeView.js.map +0 -7
  210. package/esm/TreeViewContext.js.map +0 -7
  211. package/esm/config/useTreeview.js.map +0 -7
  212. package/esm/parts/TreeItem.js.map +0 -7
  213. package/esm/parts/TreeList.js.map +0 -7
  214. package/esm/plugins/dnd/TreeDndPlugin.js +0 -30
  215. package/esm/plugins/dnd/TreeDndPlugin.js.map +0 -7
  216. package/esm/react-desc-prop-types.js.map +0 -7
  217. package/esm/utils/dnd-helpers.js +0 -117
  218. package/esm/utils/dnd-helpers.js.map +0 -7
  219. package/esm/utils/keyboard-helpers.js.map +0 -7
  220. package/esm/utils/useDnDHelpers.js +0 -170
  221. package/esm/utils/useDnDHelpers.js.map +0 -7
  222. package/esm/utils/useTree.js.map +0 -7
  223. package/types/TreeView.d.ts +0 -13
  224. package/types/TreeViewContext.d.ts +0 -17
  225. package/types/config/cssClassesConstants.d.ts +0 -4
  226. package/types/config/useTreeview.d.ts +0 -7
  227. package/types/index.d.ts +0 -3
  228. package/types/parts/CheckboxSelectable.d.ts +0 -8
  229. package/types/parts/ChildrenCountDisplayer.d.ts +0 -7
  230. package/types/parts/ExpandCaret.d.ts +0 -7
  231. package/types/parts/Icon.d.ts +0 -7
  232. package/types/parts/NestingSpace.d.ts +0 -8
  233. package/types/parts/RadioSelectable.d.ts +0 -8
  234. package/types/parts/TreeItem.d.ts +0 -24
  235. package/types/parts/TreeItemText.d.ts +0 -7
  236. package/types/parts/TreeList.d.ts +0 -24
  237. package/types/plugins/dnd/TreeDndPlugin.d.ts +0 -3
  238. package/types/plugins/dnd/index.d.ts +0 -1
  239. package/types/plugins/index.d.ts +0 -7
  240. package/types/plugins/roving/TreeRovingPlugin.d.ts +0 -1
  241. package/types/plugins/roving/index.d.ts +0 -1
  242. package/types/plugins/searchable/SearchableTreePlugin.d.ts +0 -1
  243. package/types/plugins/searchable/index.d.ts +0 -1
  244. package/types/plugins/selectable/SelectablePluginTree.d.ts +0 -1
  245. package/types/plugins/selectable/index.d.ts +0 -1
  246. package/types/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -1
  247. package/types/plugins/toolbar/index.d.ts +0 -1
  248. package/types/plugins/tree/TreeDataPlugin.d.ts +0 -1
  249. package/types/plugins/tree/index.d.ts +0 -1
  250. package/types/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -1
  251. package/types/plugins/virtualization/index.d.ts +0 -1
  252. package/types/react-desc-prop-types.d.ts +0 -196
  253. package/types/related-components/TreeViewSearchBar.d.ts +0 -16
  254. package/types/sharedTypes.d.ts +0 -54
  255. package/types/utils/array-helpers.d.ts +0 -2
  256. package/types/utils/dnd-helpers.d.ts +0 -39
  257. package/types/utils/group-expands-helpers.d.ts +0 -14
  258. package/types/utils/keyboard-helpers.d.ts +0 -5
  259. package/types/utils/object-helpers.d.ts +0 -6
  260. package/types/utils/refs-helpers.d.ts +0 -4
  261. package/types/utils/selectable-helper.d.ts +0 -7
  262. package/types/utils/string-helpers.d.ts +0 -1
  263. package/types/utils/tree-helpers.d.ts +0 -25
  264. package/types/utils/useDnDHelpers.d.ts +0 -26
  265. package/types/utils/useInstanceRefActions.d.ts +0 -3
  266. package/types/utils/useTree.d.ts +0 -13
@@ -0,0 +1,80 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var DropIndicator_exports = {};
29
+ __export(DropIndicator_exports, {
30
+ default: () => DropIndicator_default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react = __toESM(require("react"));
34
+ var import_styled_components = __toESM(require("styled-components"));
35
+ var import_SortableItemContext = require("../hoc/SortableItemContext");
36
+ const getPositionStyles = ({ dropIndicatorPosition }) => `
37
+ top: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "0" : "unset"};
38
+ bottom: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "0" : "unset"};
39
+ left: -2px;
40
+ `;
41
+ const getCircleStyles = ({ dropIndicatorPosition }) => ({
42
+ position: "absolute",
43
+ zIndex: 20,
44
+ top: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "unset" : "-2px",
45
+ bottom: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "unset" : "-2px",
46
+ left: "0px",
47
+ opacity: 1
48
+ });
49
+ const StyledIndicator = import_styled_components.default.div`
50
+ position: absolute;
51
+ ${getPositionStyles}
52
+ box-sizing: border-box;
53
+ width: ${(props) => props.vertical ? "2px" : "100%"};
54
+ height: ${(props) => props.vertical ? "100%" : "2px"};
55
+ background-color: ${({ isDropValid, theme }) => isDropValid ? theme.colors.brand[600] : theme.colors.danger[900]};
56
+ z-index: 20;
57
+ `;
58
+ const CircleIndicator = (style, isDropValid) => /* @__PURE__ */ import_react.default.createElement("svg", {
59
+ height: "6",
60
+ width: "6",
61
+ style
62
+ }, /* @__PURE__ */ import_react.default.createElement("circle", {
63
+ cx: "3",
64
+ cy: "3",
65
+ r: "3",
66
+ strokeWidth: "0",
67
+ fill: isDropValid ? "#1E79C2" : "#C64252"
68
+ }));
69
+ const DropIndicator = ({ dropIndicatorPosition, isLast, isDropValid }) => {
70
+ if (![import_SortableItemContext.DropIndicatorPosition.After, import_SortableItemContext.DropIndicatorPosition.Before].includes(dropIndicatorPosition))
71
+ return null;
72
+ const safeDropIndicatorPosition = isLast ? import_SortableItemContext.DropIndicatorPosition.Before : dropIndicatorPosition;
73
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid), /* @__PURE__ */ import_react.default.createElement(StyledIndicator, {
74
+ dropIndicatorPosition: safeDropIndicatorPosition,
75
+ isDropValid
76
+ }));
77
+ };
78
+ var DropIndicator_default = DropIndicator;
79
+ module.exports = __toCommonJS(DropIndicator_exports);
80
+ //# sourceMappingURL=DropIndicator.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/parts/DropIndicator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport styled from 'styled-components';\nimport { DropIndicatorPosition } from '../hoc/SortableItemContext';\n\ninterface DropIndicatorProps {\n vertical?: boolean;\n dropIndicatorPosition: DropIndicatorPosition | false;\n isLast?: boolean;\n isDropValid?: boolean;\n}\n\nconst getPositionStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => `\n top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n left: -2px;\n `;\n\nconst getCircleStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => ({\n position: 'absolute',\n zIndex: 20,\n top: dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n left: '0px',\n opacity: 1,\n});\n\nconst StyledIndicator = styled.div<DropIndicatorProps>`\n position: absolute;\n ${getPositionStyles}\n box-sizing: border-box;\n width: ${(props) => (props.vertical ? '2px' : '100%')};\n height: ${(props) => (props.vertical ? '100%' : '2px')};\n background-color: ${({ isDropValid, theme }) => (isDropValid ? theme.colors.brand[600] : theme.colors.danger[900])};\n z-index: 20;\n`;\n\nconst CircleIndicator = (style: Record<string, unknown>, isDropValid: boolean | null | undefined) => (\n <svg height=\"6\" width=\"6\" style={style}>\n <circle cx=\"3\" cy=\"3\" r=\"3\" strokeWidth=\"0\" fill={isDropValid ? '#1E79C2' : '#C64252'} />\n </svg>\n);\n\nconst DropIndicator: React.ComponentType<DropIndicatorProps> = ({ dropIndicatorPosition, isLast, isDropValid }) => {\n if (\n ![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(\n dropIndicatorPosition as DropIndicatorPosition,\n )\n )\n return null;\n\n const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;\n\n return (\n <>\n {CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid)}\n <StyledIndicator dropIndicatorPosition={safeDropIndicatorPosition} isDropValid={isDropValid} />\n </>\n );\n};\n\nexport default DropIndicator;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADA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File without changes
File without changes
File without changes
File without changes
@@ -27,16 +27,14 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
27
27
  })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
28
  var TreeItem_exports = {};
29
29
  __export(TreeItem_exports, {
30
- DragAndDropTreeItem: () => DragAndDropTreeItem,
31
30
  TreeItem: () => TreeItem,
32
31
  TreeListItem: () => TreeListItem,
33
- TreeListItemAddonsWrapper: () => TreeListItemAddonsWrapper
32
+ TreeListItemAddonsWrapper: () => TreeListItemAddonsWrapper,
33
+ default: () => TreeItem_default
34
34
  });
35
35
  var React = __toESM(require("react"));
36
36
  var import_react = __toESM(require("react"));
37
- var import_react_sortable_hoc = require("@elliemae/react-sortable-hoc");
38
37
  var import_ds_classnames = require("@elliemae/ds-classnames");
39
- var import_ds_icons = require("@elliemae/ds-icons");
40
38
  var import_RadioSelectable = __toESM(require("./RadioSelectable"));
41
39
  var import_CheckboxSelectable = __toESM(require("./CheckboxSelectable"));
42
40
  var import_TreeViewContext = __toESM(require("../TreeViewContext"));
@@ -47,23 +45,15 @@ var import_Icon = require("./Icon");
47
45
  var import_ExpandCaret = require("./ExpandCaret");
48
46
  var import_TreeItemText = require("./TreeItemText");
49
47
  var import_cssClassesConstants = require("../config/cssClassesConstants");
48
+ var import_DnDHandle = require("./DnDHandle");
49
+ var import_WithDnDSortableItemContext = require("../hoc/WithDnDSortableItemContext");
50
+ var import_SortableItemContext = require("../hoc/SortableItemContext");
51
+ var import_DropIndicator = __toESM(require("./DropIndicator"));
50
52
  const TreeListItem = (0, import_ds_classnames.aggregatedClasses)("li", {
51
53
  "data-testid": import_cssClassesConstants.treeItemBlockName,
52
54
  role: "treeitem"
53
55
  })(import_cssClassesConstants.treeItemBlockName);
54
56
  const TreeListItemAddonsWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(import_cssClassesConstants.treeItemBlockName, "addons");
55
- const DnDHandle = (0, import_react_sortable_hoc.SortableHandle)(({ id }) => /* @__PURE__ */ import_react.default.createElement(import_ds_icons.GripperVertical, {
56
- "data-testid": "drag-handle",
57
- key: `${id}-drag-handle`,
58
- className: "drag-handle",
59
- size: "s",
60
- onMouseDown: (e) => {
61
- if (e) {
62
- e.preventDefault();
63
- }
64
- },
65
- tabIndex: "0"
66
- }));
67
57
  const TreeItem = (props) => {
68
58
  const {
69
59
  item,
@@ -71,47 +61,43 @@ const TreeItem = (props) => {
71
61
  itemWrapperStyle = {},
72
62
  virtualItemRef,
73
63
  spaceForNestingLevel = 1.5,
74
- onMouseDragOverItem
64
+ isDragOverlay = false
75
65
  } = props;
76
66
  const { id, node } = item;
77
67
  const { nodeItemRef } = node.model;
78
- const openFolderOnHoverTimeout = (0, import_react.useRef)(null);
79
- const [isDraggingOverThis, setIsDraggingOverThis] = (0, import_react.useState)(false);
80
- const onItemKeyDown = (0, import_keyboard_helpers.useOnItemKeyDown)(item);
68
+ const { draggableProps } = (0, import_react.useContext)(import_SortableItemContext.SortableItemContext);
69
+ const onItemKeyDown = (0, import_keyboard_helpers.useOnItemKeyDown)(item, draggableProps);
81
70
  const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
82
71
  const {
83
72
  props: { disableIcons, rightAddons, onItemClick, onItemFocus, rowSize, labelOverflow },
84
- relativeMouseCord,
85
73
  withRadioChecks,
86
74
  withCheckboxChecks,
87
75
  withDragAndDrop,
88
76
  selectedItem,
89
77
  selectedCheckboxes,
90
78
  hoverItem,
91
- isDragging,
92
79
  virtualListHelpers: { scrollToIndex },
93
80
  setHoverItem,
94
81
  setSelectedItem,
95
82
  setFocusedItem
96
83
  } = ctx;
97
84
  const setItemRefs = (ref) => {
98
- (0, import_refs_helpers.setMultipleRefs)(virtualItemRef, nodeItemRef)(ref);
85
+ (0, import_refs_helpers.setMultipleRefs)(virtualItemRef, !isDragOverlay && nodeItemRef, !isDragOverlay && draggableProps && draggableProps.setNodeRef)(ref);
99
86
  };
87
+ const dropIndicatorPosition = draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;
88
+ const isDropIndicatorPositionInside = dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Inside;
89
+ const isDragging = draggableProps && draggableProps.isDragging;
90
+ const isDropValid = draggableProps && draggableProps.isDropValid;
100
91
  const dropPreviewClassName = (0, import_react.useMemo)(() => {
101
- if (!withDragAndDrop || !relativeMouseCord || !isDraggingOverThis)
102
- return "";
103
- const { isBefore, isAfter, isValid } = relativeMouseCord;
104
- let className = `${import_cssClassesConstants.DSTreeViewPrefix}-${import_cssClassesConstants.treeItemBlockName}${isValid ? "--valid" : "--invalid"}`;
105
- if (isBefore)
106
- className += "-drop-before";
107
- else if (isAfter)
108
- className += "-drop-after";
109
- else
110
- className += "-drop-in";
111
- return className;
112
- }, [withDragAndDrop, relativeMouseCord, isDraggingOverThis]);
113
- const selectedClassName = (0, import_react.useMemo)(() => selectedItem?.id === item.id ? "selected" : "", [item.id, selectedItem?.id]);
114
- const hoverClassName = (0, import_react.useMemo)(() => hoverItem?.id !== item.id || withDragAndDrop && isDragging ? "" : "hover", [hoverItem?.id, item.id, withDragAndDrop, isDragging]);
92
+ if (isDropIndicatorPositionInside) {
93
+ const className = `${import_cssClassesConstants.DSTreeViewPrefix}-${import_cssClassesConstants.treeItemBlockName}${isDropValid ? "--valid" : "--invalid"}-drop-in`;
94
+ return className;
95
+ }
96
+ return "";
97
+ }, [isDropIndicatorPositionInside, isDropValid]);
98
+ const dragOverlayClassName = (0, import_react.useMemo)(() => isDragOverlay ? "drag-overlay" : "", [isDragOverlay]);
99
+ const selectedClassName = (0, import_react.useMemo)(() => selectedItem?.id === item.id && !isDragOverlay ? "selected" : "", [isDragOverlay, item.id, selectedItem?.id]);
100
+ const hoverClassName = (0, import_react.useMemo)(() => !isDragOverlay && (hoverItem?.id === item.id || isDragging) ? "hover" : "", [isDragOverlay, hoverItem?.id, item.id, isDragging]);
115
101
  const fixedHeightClassname = (0, import_react.useMemo)(() => {
116
102
  if (labelOverflow === "truncate") {
117
103
  if (rowSize === "compact")
@@ -120,7 +106,7 @@ const TreeItem = (props) => {
120
106
  }
121
107
  return "";
122
108
  }, [labelOverflow, rowSize]);
123
- const finalClassName = (0, import_react.useMemo)(() => `${dropPreviewClassName} ${fixedHeightClassname} ${selectedClassName} ${hoverClassName}`, [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname]);
109
+ const finalClassName = (0, import_react.useMemo)(() => `${dropPreviewClassName} ${fixedHeightClassname} ${selectedClassName} ${hoverClassName} ${dragOverlayClassName}`, [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname, dragOverlayClassName]);
124
110
  const handleItemClick = (0, import_react.useCallback)((e) => {
125
111
  onItemClick(item, e);
126
112
  setFocusedItem(item);
@@ -134,23 +120,7 @@ const TreeItem = (props) => {
134
120
  }, [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem]);
135
121
  return /* @__PURE__ */ import_react.default.createElement(TreeListItem, {
136
122
  tabIndex: 0,
137
- onMouseMove: (event) => {
138
- if (withDragAndDrop && onMouseDragOverItem) {
139
- onMouseDragOverItem({
140
- event,
141
- item,
142
- itemIndex,
143
- setIsDraggingOverThis,
144
- openFolderOnHoverTimeout
145
- });
146
- }
147
- },
148
123
  onMouseLeave: () => {
149
- if (withDragAndDrop) {
150
- setIsDraggingOverThis(false);
151
- if (openFolderOnHoverTimeout?.current)
152
- clearTimeout(openFolderOnHoverTimeout.current);
153
- }
154
124
  if (hoverItem?.id === item.id) {
155
125
  setHoverItem(null);
156
126
  }
@@ -159,6 +129,7 @@ const TreeItem = (props) => {
159
129
  setHoverItem(item);
160
130
  },
161
131
  onClick: handleItemClick,
132
+ onBlur: () => setFocusedItem(null),
162
133
  ref: setItemRefs,
163
134
  style: { ...itemWrapperStyle },
164
135
  className: finalClassName,
@@ -167,25 +138,29 @@ const TreeItem = (props) => {
167
138
  "data-id": item.id,
168
139
  "data-index": item.virtualIndex,
169
140
  onKeyDown: onItemKeyDown
170
- }, /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, withDragAndDrop ? /* @__PURE__ */ import_react.default.createElement(DnDHandle, {
171
- id
172
- }) : null, withRadioChecks ? /* @__PURE__ */ import_react.default.createElement(import_RadioSelectable.default, {
141
+ }, /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, withDragAndDrop ? /* @__PURE__ */ import_react.default.createElement(import_DnDHandle.DnDHandle, {
142
+ id,
143
+ isDragOverlay
144
+ }) : null, withRadioChecks && !isDragOverlay ? /* @__PURE__ */ import_react.default.createElement(import_RadioSelectable.default, {
173
145
  item,
174
146
  itemIndex
175
- }) : null, withCheckboxChecks ? /* @__PURE__ */ import_react.default.createElement(import_CheckboxSelectable.default, {
147
+ }) : null, withCheckboxChecks && !isDragOverlay ? /* @__PURE__ */ import_react.default.createElement(import_CheckboxSelectable.default, {
176
148
  item,
177
149
  itemIndex
178
- }) : null, /* @__PURE__ */ import_react.default.createElement(import_NestingSpace.NestingSpace, {
150
+ }) : null, !isDragOverlay && /* @__PURE__ */ import_react.default.createElement(import_NestingSpace.NestingSpace, {
179
151
  item,
180
152
  spaceForNestingLevel
181
- }), /* @__PURE__ */ import_react.default.createElement(import_ExpandCaret.ExpandCaret, {
153
+ }), !isDragOverlay && /* @__PURE__ */ import_react.default.createElement(import_ExpandCaret.ExpandCaret, {
182
154
  item
183
155
  }), !disableIcons ? /* @__PURE__ */ import_react.default.createElement(import_Icon.Icon, {
184
156
  item
185
157
  }) : null), /* @__PURE__ */ import_react.default.createElement(import_TreeItemText.TreeItemText, {
186
158
  item
187
- }), rightAddons && /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, typeof rightAddons === "function" ? rightAddons(item) : rightAddons));
159
+ }), rightAddons && /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, typeof rightAddons === "function" ? rightAddons(item) : rightAddons), /* @__PURE__ */ import_react.default.createElement(import_DropIndicator.default, {
160
+ dropIndicatorPosition,
161
+ isDropValid
162
+ }));
188
163
  };
189
- const DragAndDropTreeItem = (0, import_react_sortable_hoc.SortableElement)(TreeItem);
164
+ var TreeItem_default = (0, import_WithDnDSortableItemContext.withDnDSortableItemContext)(TreeItem);
190
165
  module.exports = __toCommonJS(TreeItem_exports);
191
166
  //# sourceMappingURL=TreeItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/parts/TreeItem.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport React, { useContext, useMemo, useCallback } from 'react';\n\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\n\nimport RadioSelectable from './RadioSelectable';\nimport CheckboxSelectable from './CheckboxSelectable';\nimport TreeViewContext from '../TreeViewContext';\nimport { setMultipleRefs } from '../utils/refs-helpers';\nimport { useOnItemKeyDown } from '../utils/keyboard-helpers';\nimport { NestingSpace } from './NestingSpace';\nimport { Icon } from './Icon';\nimport { ExpandCaret } from './ExpandCaret';\nimport { TreeItemText } from './TreeItemText';\nimport { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nimport { DnDHandle } from './DnDHandle';\nimport { withDnDSortableItemContext } from '../hoc/WithDnDSortableItemContext';\nimport { DropIndicatorPosition, SortableItemContext } from '../hoc/SortableItemContext';\nimport DropIndicator from './DropIndicator';\n\nexport const TreeListItem = aggregatedClasses('li', {\n 'data-testid': treeItemBlockName,\n role: 'treeitem',\n // temp fix untill we move to styled components\n})(treeItemBlockName) as unknown as React.ComponentType<React.ComponentProps<'li'>>;\n\nexport const TreeListItemAddonsWrapper = aggregatedClasses('div')(\n treeItemBlockName,\n 'addons',\n // temp fix untill we move to styled components\n) as unknown as React.ComponentType;\n\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n isDragOverlay?: boolean;\n virtualItemRef?: React.RefObject<HTMLLIElement>;\n itemWrapperStyle?: { [key: string]: unknown };\n spaceForNestingLevel?: number;\n}\nexport const TreeItem = (props: PropsT): JSX.Element => {\n const {\n item,\n itemIndex,\n itemWrapperStyle = {},\n virtualItemRef,\n spaceForNestingLevel = 1.5,\n isDragOverlay = false,\n } = props;\n const { id, node } = item;\n const { nodeItemRef } = node.model;\n\n const { draggableProps } = useContext(SortableItemContext);\n\n const onItemKeyDown = useOnItemKeyDown(item, draggableProps);\n\n const ctx = useContext(TreeViewContext);\n const {\n props: { disableIcons, rightAddons, onItemClick, onItemFocus, rowSize, labelOverflow },\n withRadioChecks,\n withCheckboxChecks,\n withDragAndDrop,\n selectedItem,\n selectedCheckboxes,\n hoverItem,\n virtualListHelpers: { scrollToIndex },\n setHoverItem,\n setSelectedItem,\n setFocusedItem,\n } = ctx;\n\n // Sortable Items needs to update\n // - the virtual list ref (for react-virtual requirement)\n // - nodeItemRef which is a prop avaiable in the TreeModel nodes\n // - the drag and drop node reference\n const setItemRefs: React.LegacyRef<HTMLLIElement> | undefined = (ref: HTMLLIElement) => {\n setMultipleRefs(\n virtualItemRef,\n !isDragOverlay && nodeItemRef,\n !isDragOverlay && draggableProps && draggableProps.setNodeRef,\n )(ref);\n };\n\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const isDropIndicatorPositionInside = dropIndicatorPosition === DropIndicatorPosition.Inside;\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n const isDropValid = draggableProps && draggableProps.isDropValid;\n\n const dropPreviewClassName = useMemo(() => {\n if (isDropIndicatorPositionInside) {\n const className = `${DSTreeViewPrefix}-${treeItemBlockName}${isDropValid ? '--valid' : '--invalid'}-drop-in`;\n return className;\n }\n return '';\n }, [isDropIndicatorPositionInside, isDropValid]);\n\n const dragOverlayClassName = useMemo(() => (isDragOverlay ? 'drag-overlay' : ''), [isDragOverlay]);\n\n const selectedClassName = useMemo(\n () => (selectedItem?.id === item.id && !isDragOverlay ? 'selected' : ''),\n [isDragOverlay, item.id, selectedItem?.id],\n );\n const hoverClassName = useMemo(\n () => (!isDragOverlay && (hoverItem?.id === item.id || isDragging) ? 'hover' : ''),\n [isDragOverlay, hoverItem?.id, item.id, isDragging],\n );\n const fixedHeightClassname = useMemo(() => {\n if (labelOverflow === 'truncate') {\n if (rowSize === 'compact') return `${DSTreeViewPrefix}-${treeItemBlockName}--fixed-height-compact`;\n return `${DSTreeViewPrefix}-${treeItemBlockName}--fixed-height`;\n }\n return '';\n }, [labelOverflow, rowSize]);\n\n const finalClassName = useMemo(\n () =>\n `${dropPreviewClassName} ${fixedHeightClassname} ${selectedClassName} ${hoverClassName} ${dragOverlayClassName}`,\n [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname, dragOverlayClassName],\n );\n\n const handleItemClick = useCallback(\n (e: React.MouseEvent<HTMLLIElement>) => {\n onItemClick(item, e);\n setFocusedItem(item);\n setSelectedItem(item);\n const itemVirtualIndex = typeof item.virtualIndex === 'number' ? item.virtualIndex : -1;\n onItemFocus({\n itemIndex: itemVirtualIndex,\n scrollToItem: (opts = { align: 'start' }) => scrollToIndex(itemVirtualIndex, opts),\n item,\n });\n },\n [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem],\n );\n\n return (\n <TreeListItem\n tabIndex={0}\n onMouseLeave={() => {\n if (hoverItem?.id === item.id) {\n setHoverItem(null);\n }\n }}\n onMouseEnter={() => {\n setHoverItem(item);\n }}\n onClick={handleItemClick}\n onBlur={() => setFocusedItem(null)}\n ref={setItemRefs}\n style={{ ...itemWrapperStyle }}\n className={finalClassName}\n aria-expanded={!!item.isExpanded}\n aria-selected={!!selectedCheckboxes[item.id]}\n data-id={item.id}\n data-index={item.virtualIndex}\n onKeyDown={onItemKeyDown}\n >\n <TreeListItemAddonsWrapper>\n {withDragAndDrop ? <DnDHandle id={id} isDragOverlay={isDragOverlay} /> : null}\n {withRadioChecks && !isDragOverlay ? <RadioSelectable item={item} itemIndex={itemIndex} /> : null}\n {withCheckboxChecks && !isDragOverlay ? <CheckboxSelectable item={item} itemIndex={itemIndex} /> : null}\n {!isDragOverlay && <NestingSpace item={item} spaceForNestingLevel={spaceForNestingLevel} />}\n {!isDragOverlay && <ExpandCaret item={item} />}\n {!disableIcons ? <Icon item={item} /> : null}\n </TreeListItemAddonsWrapper>\n <TreeItemText item={item} />\n {rightAddons && (\n <TreeListItemAddonsWrapper>\n {typeof rightAddons === 'function' ? rightAddons(item) : rightAddons}\n </TreeListItemAddonsWrapper>\n )}\n <DropIndicator dropIndicatorPosition={dropIndicatorPosition} isDropValid={isDropValid} />\n </TreeListItem>\n );\n};\n\nexport default withDnDSortableItemContext(TreeItem);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwD;AAExD,2BAAkC;AAElC,6BAA4B;AAC5B,gCAA+B;AAC/B,6BAA4B;AAC5B,0BAAgC;AAChC,8BAAiC;AACjC,0BAA6B;AAC7B,kBAAqB;AACrB,yBAA4B;AAC5B,0BAA6B;AAC7B,iCAAoD;AAEpD,uBAA0B;AAC1B,wCAA2C;AAC3C,iCAA2D;AAC3D,2BAA0B;AAEnB,MAAM,eAAe,4CAAkB,MAAM;AAAA,EAClD,eAAe;AAAA,EACf,MAAM;AAAA,GAEL;AAEI,MAAM,4BAA4B,4CAAkB,OACzD,8CACA;AAYK,MAAM,WAAW,CAAC,UAA+B;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,MACd;AACJ,QAAM,EAAE,IAAI,SAAS;AACrB,QAAM,EAAE,gBAAgB,KAAK;AAE7B,QAAM,EAAE,mBAAmB,6BAAW;AAEtC,QAAM,gBAAgB,8CAAiB,MAAM;AAE7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;AAAA,MACb,eACC,mDAAC,2BAAD,MACG,OAAO,gBAAgB,aAAa,YAAY,QAAQ,cAG7D,mDAAC,8BAAD;AAAA,IAAe;AAAA,IAA8C;AAAA;AAAA;AAKnE,IAAO,mBAAQ,kEAA2B;",
6
+ "names": []
7
+ }
File without changes
File without changes
@@ -27,7 +27,6 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
27
27
  })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
28
  var TreeList_exports = {};
29
29
  __export(TreeList_exports, {
30
- DragAndDropTreeList: () => DragAndDropTreeList,
31
30
  TreeList: () => TreeList,
32
31
  TreeListNoItems: () => TreeListNoItems,
33
32
  TreeListWrapper: () => TreeListWrapper,
@@ -35,12 +34,13 @@ __export(TreeList_exports, {
35
34
  });
36
35
  var React = __toESM(require("react"));
37
36
  var import_react = __toESM(require("react"));
38
- var import_react_sortable_hoc = require("@elliemae/react-sortable-hoc");
39
37
  var import_ds_classnames = require("@elliemae/ds-classnames");
40
38
  var import_ds_circular_progress_indicator = require("@elliemae/ds-circular-progress-indicator");
41
39
  var import_TreeViewContext = __toESM(require("../TreeViewContext"));
42
40
  var import_cssClassesConstants = require("../config/cssClassesConstants");
43
- var import_TreeItem = require("./TreeItem");
41
+ var import_TreeItem = __toESM(require("./TreeItem"));
42
+ var import_WithConditionalDnDContext = require("../hoc/WithConditionalDnDContext");
43
+ var import_DnDTreeContext = require("../hoc/DnDTreeContext");
44
44
  const treeListNoItemsBn = `${import_cssClassesConstants.treeListBlockName}-no-items`;
45
45
  const TreeListNoItems = (0, import_ds_classnames.aggregatedClasses)("div", {
46
46
  "data-testid": treeListNoItemsBn
@@ -53,18 +53,17 @@ const TreeListWrapper = (0, import_ds_classnames.aggregatedClasses)("ul", {
53
53
  }));
54
54
  const compactRowClass = `${import_cssClassesConstants.DSTreeViewPrefix}-tv-row-size-compact`;
55
55
  const normaRowClass = `${import_cssClassesConstants.DSTreeViewPrefix}-tv-row-size-normal`;
56
- const TreeList = (props) => {
57
- const { onMouseDragOverItem } = props;
56
+ const TreeListComp = () => {
58
57
  const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
59
58
  const {
60
59
  virtualListRef,
61
60
  virtualListHelpers,
62
- visibleItems,
63
- withDragAndDrop,
61
+ visibleItems: flattenedVisibleItems,
64
62
  props: { width, height, rowSize, noItemsPlaceholder, isLoading }
65
63
  } = ctx;
66
64
  const { totalSize, virtualItems } = virtualListHelpers;
67
65
  const className = `${rowSize === "compact" ? `${compactRowClass}` : `${normaRowClass}`}`;
66
+ const { visibleItems } = (0, import_react.useContext)(import_DnDTreeContext.DnDTreeContext);
68
67
  return /* @__PURE__ */ import_react.default.createElement(TreeListWrapper, {
69
68
  ref: virtualListRef,
70
69
  className,
@@ -95,15 +94,16 @@ const TreeList = (props) => {
95
94
  }
96
95
  }, virtualItems.map((virtualItem) => {
97
96
  const { index, measureRef, start } = virtualItem;
98
- const item = visibleItems[index];
97
+ const item = (visibleItems || flattenedVisibleItems)[index];
98
+ if (!item)
99
+ return null;
99
100
  item.virtualIndex = index;
100
101
  const { id } = item;
101
102
  const style = {
102
103
  position: "absolute",
103
- top: 0,
104
+ top: `${start}px`,
104
105
  left: 0,
105
- width: "100%",
106
- transform: `translateY(${start}px)`
106
+ width: "100%"
107
107
  };
108
108
  const listItemProps = {
109
109
  key: `DS-TreeView-List-Item-${id}`,
@@ -113,16 +113,11 @@ const TreeList = (props) => {
113
113
  item,
114
114
  itemWrapperStyle: style
115
115
  };
116
- if (withDragAndDrop)
117
- return /* @__PURE__ */ import_react.default.createElement(import_TreeItem.DragAndDropTreeItem, {
118
- ...listItemProps,
119
- onMouseDragOverItem
120
- });
121
- return /* @__PURE__ */ import_react.default.createElement(import_TreeItem.TreeItem, {
116
+ return /* @__PURE__ */ import_react.default.createElement(import_TreeItem.default, {
122
117
  ...listItemProps
123
118
  });
124
119
  })) : null);
125
120
  };
126
- const DragAndDropTreeList = (0, import_react_sortable_hoc.SortableContainer)(TreeList);
121
+ const TreeList = (0, import_WithConditionalDnDContext.withConditionalDnDRowContext)(TreeListComp);
127
122
  module.exports = __toCommonJS(TreeList_exports);
128
123
  //# sourceMappingURL=TreeList.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/parts/TreeList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useContext } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';\n\nimport TreeViewContext from '../TreeViewContext';\nimport { DSTreeViewPrefix, treeListBlockName } from '../config/cssClassesConstants';\nimport TreeItem from './TreeItem';\n\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nimport { withConditionalDnDRowContext } from '../hoc/WithConditionalDnDContext';\nimport { DnDTreeContext } from '../hoc/DnDTreeContext';\n\nexport const treeListNoItemsBn = `${treeListBlockName}-no-items`;\nexport const TreeListNoItems = aggregatedClasses('div', {\n 'data-testid': treeListNoItemsBn,\n})(treeListNoItemsBn) as unknown as React.ComponentType<React.ComponentProps<'div'>>;\n\n// React.ComponentProps<'ul'> uses LegacyRef typings that existed pre-hook era\n// we omit the LegacyRef typings in favor of hook-era typings\ninterface UlProps extends Omit<React.ComponentProps<'ul'>, 'ref'> {\n ref: React.MutableRefObject<HTMLUListElement | undefined> | undefined;\n}\nexport const TreeListWrapper = aggregatedClasses('ul', {\n 'data-testid': treeListBlockName,\n role: 'tree',\n})(treeListBlockName, null, ({ rowSize }: { rowSize: 'normal' | 'compact' }) => ({\n [`rowsize-${rowSize}`]: rowSize,\n})) as unknown as React.ComponentType<UlProps>;\n\nconst compactRowClass = `${DSTreeViewPrefix}-tv-row-size-compact`;\nconst normaRowClass = `${DSTreeViewPrefix}-tv-row-size-normal`;\n\ninterface PropsT {\n onMouseDragOverItem?: (opts: {\n event: React.MouseEvent<HTMLLIElement>;\n item: DSTreeviewT.Item;\n itemIndex: number;\n setIsDraggingOverThis: React.Dispatch<React.SetStateAction<boolean>>;\n openFolderOnHoverTimeout: React.MutableRefObject<NodeJS.Timeout | null>;\n }) => void;\n}\n\nconst TreeListComp: React.ComponentType<PropsT> = () => {\n const ctx = useContext(TreeViewContext);\n const {\n virtualListRef,\n virtualListHelpers,\n visibleItems: flattenedVisibleItems,\n props: { width, height, rowSize, noItemsPlaceholder, isLoading },\n } = ctx;\n const { totalSize, virtualItems } = virtualListHelpers;\n const className = `${rowSize === 'compact' ? `${compactRowClass}` : `${normaRowClass}`}`;\n\n const { visibleItems } = useContext(DnDTreeContext);\n\n return (\n <TreeListWrapper\n ref={virtualListRef}\n className={className}\n style={{\n height: `${typeof height === 'number' ? `${height}px` : height}`,\n width: `${typeof width === 'number' ? `${width}px` : width}`,\n overflow: 'auto',\n }}\n >\n {isLoading ? (\n <div\n style={{\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <DSCircularProgressIndicator size=\"xl\" loading={isLoading} showLabel waiting={false} showTooltip={false} />\n </div>\n ) : null}\n {!isLoading && virtualItems.length === 0 ? <TreeListNoItems>{noItemsPlaceholder}</TreeListNoItems> : null}\n {!isLoading && virtualItems.length !== 0 ? (\n <div\n style={{\n height: `${totalSize}px`,\n width: '100%',\n position: 'relative',\n }}\n >\n {virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const item = (visibleItems || flattenedVisibleItems)[index];\n if (!item) return null;\n item.virtualIndex = index;\n const { id } = item;\n\n const style = {\n position: 'absolute',\n top: `${start}px`,\n left: 0,\n width: '100%',\n };\n\n const listItemProps = {\n key: `DS-TreeView-List-Item-${id}`,\n virtualItemRef: measureRef,\n index, // this is consumed by the DnD HOC\n itemIndex: index,\n item,\n itemWrapperStyle: style,\n };\n\n return <TreeItem {...listItemProps} />;\n })}\n </div>\n ) : null}\n </TreeListWrapper>\n );\n};\n\nexport const TreeList = withConditionalDn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6B,MAAK;AAAA,IAAK,SAAS;AAAA,IAAW,WAAS;AAAA,IAAC,SAAS;AAAA,IAAO,aAAa;AAAA,QAElG,MACH,CAAC,aAAa,aAAa,WAAW,IAAI,mDAAC,iBAAD,MAAkB,sBAAwC,MACpG,CAAC,aAAa,aAAa,WAAW,IACrC,mDAAC,OAAD;AAAA,IACE,OAAO;AAAA,MACL,QAAQ,GAAG;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA;AAAA,KAGX,aAAa,IAAI,CAAC,gBAAgB;AACjC,UAAM,EAAE,OAAO,YAAY,UAAU;AACrC,UAAM,OAAQ,iBAAgB,uBAAuB;AACrD,QAAI,CAAC;AAAM,aAAO;AAClB,SAAK,eAAe;AACpB,UAAM,EAAE,OAAO;AAEf,UAAM,QAAQ;AAAA,MACZ,UAAU;AAAA,MACV,KAAK,GAAG;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA;AAGT,UAAM,gBAAgB;AAAA,MACpB,KAAK,yBAAyB;AAAA,MAC9B,gBAAgB;AAAA,MAChB;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA,kBAAkB;AAAA;AAGpB,WAAO,mDAAC,yBAAD;AAAA,SAAc;AAAA;AAAA,QAGvB;AAAA;AAKH,MAAM,WAAW,mEAA6B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var TreeDndPlugin_exports = {};
29
+ __export(TreeDndPlugin_exports, {
30
+ TreeDndPlugin: () => TreeDndPlugin
31
+ });
32
+ var React = __toESM(require("react"));
33
+ const TreeDndPlugin = "tree-dnd";
34
+ module.exports = __toCommonJS(TreeDndPlugin_exports);
35
+ //# sourceMappingURL=TreeDndPlugin.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/plugins/dnd/TreeDndPlugin.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export const TreeDndPlugin = 'tree-dnd';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,gBAAgB;",
6
+ "names": []
7
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -59,6 +59,7 @@ const TreeViewPropTypes = {
59
59
  isMultiSelect: import_react_desc.PropTypes.bool.description("whether the tree view is multi select or not").defaultValue(false),
60
60
  isSingleSelect: import_react_desc.PropTypes.bool.description("wheter the tree view is single select or not").defaultValue(false),
61
61
  isLoading: import_react_desc.PropTypes.bool.description("wheter the tree should show the loading state or not").defaultValue(false),
62
+ getIsDropValid: import_react_desc.PropTypes.func.description("Function that returns true if the drop is valid and false if it's not").defaultValue("() => true"),
62
63
  restrictDragAndDrop: import_react_desc.PropTypes.bool.description("whether to restrict DnD functionality or not").defaultValue(false),
63
64
  showChildrenAmount: import_react_desc.PropTypes.bool.description("whether to show the amount of children or not").defaultValue(false),
64
65
  sortable: import_react_desc.PropTypes.bool.description("whether the sortable functionality is active or not").defaultValue(false),
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport { PropTypes } from 'react-desc';\nimport TreeModel from 'tree-model';\nimport { useVirtual } from 'react-virtual';\nexport declare namespace DSTreeviewT {\n export type StringOrNum = string | number;\n export type SelectionState = boolean | 'mixed';\n export type SelectionItems = Record<StringOrNum, SelectionState>;\n export type ScrollToFunc = ReturnType<typeof useVirtual>['scrollToIndex'];\n export type ScrollToItemOptions = Parameters<ReturnType<typeof useVirtual>['scrollToIndex']>[1];\n export type ScrollToItemFunc = (options: ScrollToItemOptions) => void;\n export type ExpandedItems = Record<StringOrNum, true>; // { [id]:true } -> e.g. {1:true; 2:true} // false are not listed\n export interface SimpleItem {\n [key: string]: unknown;\n name: string;\n children?: SimpleItem[];\n id: StringOrNum;\n }\n\n export interface Item extends SimpleItem {\n children: Item[];\n treeDepth?: number;\n virtualIndex?: number;\n isChecked?: boolean | 'mixed';\n isGroup?: boolean;\n isExpanded?: boolean;\n childrenMatchesSearchQuery?: boolean;\n matchesSearchQuery?: boolean;\n nodeItemRef?: React.RefObject<HTMLLIElement>;\n model: TreeModel.Node<Item>['model'];\n node: TreeModel.Node<Item> & { parent?: TreeModel.Node<Item> };\n nodePath: TreeModel.Node<Item>[];\n }\n\n export interface DndItem {\n uid: string;\n depth: number;\n realIndex: number;\n childrenCount: number;\n parentId: string | null;\n original: SimpleItem;\n }\n\n export interface Actions {\n toggleExpandAll: (isExpand: boolean) => Promise<DSTreeviewT.Item[]>;\n scrollTo: DSTreeviewT.ScrollToFunc;\n setSelectedItemByVirtualIndex: (index: number) => void;\n setFocusedItemByVirtualIndex: (\n index: number,\n scrollOpts: DSTreeviewT.ScrollToItemOptions & { withScroll?: boolean },\n ) => void;\n }\n export interface InstanceRef {\n actions: Actions;\n }\n\n export interface DefaultProps {\n plugins: string[];\n selection: SelectionItems;\n instanceRef: React.MutableRefObject<InstanceRef>;\n isItemDisabled: (item: Item) => boolean;\n disableIcons: boolean;\n fluid: boolean;\n isMultiSelect: boolean;\n isSingleSelect: boolean;\n getIsDropValid: (\n active: DndItem,\n over: DndItem,\n dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside',\n ) => boolean;\n restrictDragAndDrop: boolean;\n showChildrenAmount: boolean;\n sortable: boolean;\n isLoading: boolean;\n highlightOnlyQuery: boolean;\n onItemClick: (item: Item, e: React.MouseEvent<HTMLLIElement>) => void;\n onItemFocus: (meta: { scrollToItem: ScrollToItemFunc; itemIndex: number; item: Item }) => void;\n onVisibleItemsChange: (newVisibleItems: Item[]) => void;\n onOrderChange: (newData: SimpleItem[], oldData: SimpleItem[], draggedItem: DndItem) => void;\n onSelectionChange: (\n selection: SelectionItems,\n item: Item,\n meta: { scrollToItem: ScrollToItemFunc; itemIndex: number },\n ) => void;\n onExpandChange: (expandedHashmap: ExpandedItems, itemToggled: Item | null | undefined) => void;\n onInstanceRefInitialized: (instanceRef: React.MutableRefObject<InstanceRef>) => void;\n rowSize: 'normal' | 'compact';\n labelOverflow: 'wrap' | 'wrap-all' | 'truncate';\n noItemsPlaceholder: string;\n nameKey: string;\n width: StringOrNum;\n height: StringOrNum;\n groupIcon: JSX.Element | null;\n itemIcon: JSX.Element | null;\n searchQuery: string;\n }\n export interface PropsOptional {\n expanded: ExpandedItems;\n rightAddons: ((item: Item) => React.ReactNode | React.ReactNode[]) | JSX.Element;\n }\n export interface PropsRequired {\n data: Item[];\n }\n export interface Props extends DefaultProps, PropsOptional, PropsRequired {}\n}\n\nexport const TreeViewPropTypes = {\n data: PropTypes.arrayOf(\n PropTypes.shape({\n children: PropTypes.arrayOf(PropTypes.object),\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n isGroup: PropTypes.oneOfType([PropTypes.oneOf([undefined, null]), PropTypes.bool]),\n name: PropTypes.string,\n node: PropTypes.object,\n }),\n ).description('data to populate tree view').isRequired,\n plugins: PropTypes.arrayOf(PropTypes.string).description('list of enabled plugins').defaultValue([]),\n selection: PropTypes.object.description('pre selected items').defaultValue({}),\n expanded: PropTypes.object.description('control what items are expanded').defaultValue(undefined),\n instanceRef: PropTypes.shape({\n current: PropTypes.oneOfType([\n PropTypes.oneOf([null, undefined]),\n PropTypes.shape({\n actions: PropTypes.shape({\n toggleExpandAll: PropTypes.func,\n scrollTo: PropTypes.func,\n }).description('').isRequired,\n }),\n ]),\n }).description('instance ref'),\n isItemDisabled: PropTypes.func\n .description('Function that receives an item, and returns whether that item should be disabled')\n .defaultValue('() => false'),\n disableIcons: PropTypes.bool.description('disable icons').defaultValue(false),\n fluid: PropTypes.bool.description('whether is fluid or not').defaultValue(false),\n isMultiSelect: PropTypes.bool.description('whether the tree view is multi select or not').defaultValue(false),\n isSingleSelect: PropTypes.bool.description('wheter the tree view is single select or not').defaultValue(false),\n isLoading: PropTypes.bool.description('wheter the tree should show the loading state or not').defaultValue(false),\n getIsDropValid: PropTypes.func\n .description(\"Function that returns true if the drop is valid and false if it's not\")\n .defaultValue('() => true'),\n restrictDragAndDrop: PropTypes.bool.description('whether to restrict DnD functionality or not').defaultValue(false),\n showChildrenAmount: PropTypes.bool.description('whether to show the amount of children or not').defaultValue(false),\n sortable: PropTypes.bool.description('whether the sortable functionality is active or not').defaultValue(false),\n onItemClick: PropTypes.func.description('function executed when clicking on an item').defaultValue('() => {}'),\n onItemFocus: PropTypes.func.description('function executed when focusing on an item').defaultValue('() => {}'),\n onVisibleItemsChange: PropTypes.func\n .description('function executed when the visible items change')\n .defaultValue('() => {}'),\n onOrderChange: PropTypes.func.description('function executed when the items order changes').defaultValue('() => {}'),\n onSelectionChange: PropTypes.func\n .description('function executed when the selection changes')\n .defaultValue('() => {}'),\n onExpandChange: PropTypes.func.description('function executed when expanding an item').defaultValue('() => {}'),\n onInstanceRefInitialized: PropTypes.func\n .description('function executed when instanceRef has terminated instanciation')\n .defaultValue('() => {}'),\n rowSize: PropTypes.oneOf(['normal', 'compact']).description('size of the row').defaultValue('normal'),\n labelOverflow: PropTypes.oneOf(['wrap', 'wrap-all', 'truncate'])\n .description('label truncation preference')\n .defaultValue('wrap'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('components width').defaultValue('100%'),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('components height')\n .defaultValue('100%'),\n groupIcon: PropTypes.node.description('icon for groups'),\n itemIcon: PropTypes.node.description('icon for items'),\n searchQuery: PropTypes.string.description('search query value'),\n noItemsPlaceholder: PropTypes.string\n .description('message to be shown when there are no items in the treeview to be displayed')\n .defaultValue('No items found'),\n name: PropTypes.string.description('property key to identifier for items labels').defaultValue('name'),\n highlightOnlyQuery: PropTypes.bool.description('whether to highlight results or not').defaultValue(false),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,wBAA0B;AAyGnB,MAAM,oBAAoB;AAAA,EAC/B,MAAM,4BAAU,QACd,4BAAU,MAAM;AAAA,IACd,UAAU,4BAAU,QAAQ,4BAAU;AAAA,IACtC,IAAI,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU;AAAA,IACrD,SAAS,4BAAU,UAAU,CAAC,4BAAU,MAAM,CAAC,QAAW,QAAQ,4BAAU;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