@elliemae/ds-treeview 2.3.0-next.0 → 3.0.0-alpha.0

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 (333) hide show
  1. package/dist/cjs/TreeView.js +50 -0
  2. package/dist/cjs/TreeView.js.map +7 -0
  3. package/dist/cjs/TreeViewContext.js +116 -0
  4. package/dist/cjs/TreeViewContext.js.map +7 -0
  5. package/dist/cjs/config/cssClassesConstants.js +41 -0
  6. package/dist/cjs/config/cssClassesConstants.js.map +7 -0
  7. package/dist/cjs/config/useTreeview.js +151 -0
  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/dist/cjs/index.js +37 -0
  18. package/dist/cjs/index.js.map +7 -0
  19. package/dist/cjs/parts/CheckboxSelectable.js +97 -0
  20. package/dist/cjs/parts/CheckboxSelectable.js.map +7 -0
  21. package/dist/cjs/parts/ChildrenCountDisplayer.js +47 -0
  22. package/dist/cjs/parts/ChildrenCountDisplayer.js.map +7 -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/dist/cjs/parts/ExpandCaret.js +96 -0
  28. package/dist/cjs/parts/ExpandCaret.js.map +7 -0
  29. package/dist/cjs/parts/Icon.js +52 -0
  30. package/dist/cjs/parts/Icon.js.map +7 -0
  31. package/dist/cjs/parts/NestingSpace.js +55 -0
  32. package/dist/cjs/parts/NestingSpace.js.map +7 -0
  33. package/dist/cjs/parts/RadioSelectable.js +74 -0
  34. package/dist/cjs/parts/RadioSelectable.js.map +7 -0
  35. package/dist/cjs/parts/TreeItem.js +166 -0
  36. package/dist/cjs/parts/TreeItem.js.map +7 -0
  37. package/dist/cjs/parts/TreeItemText.js +101 -0
  38. package/dist/cjs/parts/TreeItemText.js.map +7 -0
  39. package/dist/cjs/parts/TreeList.js +123 -0
  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/dist/cjs/plugins/dnd/index.js +28 -0
  44. package/dist/cjs/plugins/dnd/index.js.map +7 -0
  45. package/dist/cjs/plugins/index.js +34 -0
  46. package/dist/cjs/plugins/index.js.map +7 -0
  47. package/dist/cjs/plugins/roving/TreeRovingPlugin.js +35 -0
  48. package/dist/cjs/plugins/roving/TreeRovingPlugin.js.map +7 -0
  49. package/dist/cjs/plugins/roving/index.js +28 -0
  50. package/dist/cjs/plugins/roving/index.js.map +7 -0
  51. package/dist/cjs/plugins/searchable/SearchableTreePlugin.js +35 -0
  52. package/dist/cjs/plugins/searchable/SearchableTreePlugin.js.map +7 -0
  53. package/dist/cjs/plugins/searchable/index.js +28 -0
  54. package/dist/cjs/plugins/searchable/index.js.map +7 -0
  55. package/dist/cjs/plugins/selectable/SelectablePluginTree.js +35 -0
  56. package/dist/cjs/plugins/selectable/SelectablePluginTree.js.map +7 -0
  57. package/dist/cjs/plugins/selectable/index.js +28 -0
  58. package/dist/cjs/plugins/selectable/index.js.map +7 -0
  59. package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js +35 -0
  60. package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
  61. package/dist/cjs/plugins/toolbar/index.js +28 -0
  62. package/dist/cjs/plugins/toolbar/index.js.map +7 -0
  63. package/dist/cjs/plugins/tree/TreeDataPlugin.js +35 -0
  64. package/dist/cjs/plugins/tree/TreeDataPlugin.js.map +7 -0
  65. package/dist/cjs/plugins/tree/index.js +28 -0
  66. package/dist/cjs/plugins/tree/index.js.map +7 -0
  67. package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +35 -0
  68. package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
  69. package/dist/cjs/plugins/virtualization/index.js +28 -0
  70. package/dist/cjs/plugins/virtualization/index.js.map +7 -0
  71. package/dist/cjs/react-desc-prop-types.js +85 -0
  72. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  73. package/dist/cjs/related-components/TreeViewSearchBar.js +50 -0
  74. package/dist/cjs/related-components/TreeViewSearchBar.js.map +7 -0
  75. package/dist/cjs/sharedTypes.js +27 -0
  76. package/dist/cjs/sharedTypes.js.map +7 -0
  77. package/dist/cjs/utils/array-helpers.js +48 -0
  78. package/dist/cjs/utils/array-helpers.js.map +7 -0
  79. package/dist/cjs/utils/group-expands-helpers.js +138 -0
  80. package/dist/cjs/utils/group-expands-helpers.js.map +7 -0
  81. package/dist/cjs/utils/keyboard-helpers.js +170 -0
  82. package/dist/cjs/utils/keyboard-helpers.js.map +7 -0
  83. package/dist/cjs/utils/object-helpers.js +76 -0
  84. package/dist/cjs/utils/object-helpers.js.map +7 -0
  85. package/dist/cjs/utils/refs-helpers.js +52 -0
  86. package/dist/cjs/utils/refs-helpers.js.map +7 -0
  87. package/dist/cjs/utils/selectable-helper.js +88 -0
  88. package/dist/cjs/utils/selectable-helper.js.map +7 -0
  89. package/dist/cjs/utils/string-helpers.js +35 -0
  90. package/dist/cjs/utils/string-helpers.js.map +7 -0
  91. package/dist/cjs/utils/tree-helpers.js +184 -0
  92. package/dist/cjs/utils/tree-helpers.js.map +7 -0
  93. package/dist/cjs/utils/useInstanceRefActions.js +98 -0
  94. package/dist/cjs/utils/useInstanceRefActions.js.map +7 -0
  95. package/dist/cjs/utils/useTree.js +106 -0
  96. package/dist/cjs/utils/useTree.js.map +7 -0
  97. package/dist/esm/TreeView.js +21 -0
  98. package/dist/esm/TreeView.js.map +7 -0
  99. package/{esm → dist/esm}/TreeViewContext.js +24 -29
  100. package/dist/esm/TreeViewContext.js.map +7 -0
  101. package/dist/esm/config/cssClassesConstants.js +12 -0
  102. package/dist/esm/config/cssClassesConstants.js.map +7 -0
  103. package/dist/esm/config/useTreeview.js +122 -0
  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/dist/esm/index.js +8 -0
  114. package/dist/esm/index.js.map +7 -0
  115. package/dist/esm/parts/CheckboxSelectable.js +68 -0
  116. package/dist/esm/parts/CheckboxSelectable.js.map +7 -0
  117. package/dist/esm/parts/ChildrenCountDisplayer.js +18 -0
  118. package/dist/esm/parts/ChildrenCountDisplayer.js.map +7 -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/dist/esm/parts/ExpandCaret.js +67 -0
  124. package/dist/esm/parts/ExpandCaret.js.map +7 -0
  125. package/dist/esm/parts/Icon.js +23 -0
  126. package/dist/esm/parts/Icon.js.map +7 -0
  127. package/dist/esm/parts/NestingSpace.js +26 -0
  128. package/dist/esm/parts/NestingSpace.js.map +7 -0
  129. package/dist/esm/parts/RadioSelectable.js +45 -0
  130. package/dist/esm/parts/RadioSelectable.js.map +7 -0
  131. package/dist/esm/parts/TreeItem.js +137 -0
  132. package/dist/esm/parts/TreeItem.js.map +7 -0
  133. package/dist/esm/parts/TreeItemText.js +72 -0
  134. package/dist/esm/parts/TreeItemText.js.map +7 -0
  135. package/dist/esm/parts/TreeList.js +94 -0
  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/dist/esm/plugins/dnd/index.js +3 -0
  140. package/dist/esm/plugins/dnd/index.js.map +7 -0
  141. package/dist/esm/plugins/index.js +9 -0
  142. package/dist/esm/plugins/index.js.map +7 -0
  143. package/dist/esm/plugins/roving/TreeRovingPlugin.js +6 -0
  144. package/dist/esm/plugins/roving/TreeRovingPlugin.js.map +7 -0
  145. package/dist/esm/plugins/roving/index.js +3 -0
  146. package/dist/esm/plugins/roving/index.js.map +7 -0
  147. package/dist/esm/plugins/searchable/SearchableTreePlugin.js +6 -0
  148. package/dist/esm/plugins/searchable/SearchableTreePlugin.js.map +7 -0
  149. package/dist/esm/plugins/searchable/index.js +3 -0
  150. package/dist/esm/plugins/searchable/index.js.map +7 -0
  151. package/dist/esm/plugins/selectable/SelectablePluginTree.js +6 -0
  152. package/dist/esm/plugins/selectable/SelectablePluginTree.js.map +7 -0
  153. package/dist/esm/plugins/selectable/index.js +3 -0
  154. package/dist/esm/plugins/selectable/index.js.map +7 -0
  155. package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js +6 -0
  156. package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
  157. package/dist/esm/plugins/toolbar/index.js +3 -0
  158. package/dist/esm/plugins/toolbar/index.js.map +7 -0
  159. package/dist/esm/plugins/tree/TreeDataPlugin.js +6 -0
  160. package/dist/esm/plugins/tree/TreeDataPlugin.js.map +7 -0
  161. package/dist/esm/plugins/tree/index.js +3 -0
  162. package/dist/esm/plugins/tree/index.js.map +7 -0
  163. package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js +6 -0
  164. package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
  165. package/dist/esm/plugins/virtualization/index.js +3 -0
  166. package/dist/esm/plugins/virtualization/index.js.map +7 -0
  167. package/dist/esm/react-desc-prop-types.js +56 -0
  168. package/dist/esm/react-desc-prop-types.js.map +7 -0
  169. package/dist/esm/related-components/TreeViewSearchBar.js +21 -0
  170. package/dist/esm/related-components/TreeViewSearchBar.js.map +7 -0
  171. package/dist/esm/sharedTypes.js +2 -0
  172. package/dist/esm/sharedTypes.js.map +7 -0
  173. package/{esm → dist/esm}/utils/array-helpers.js +6 -6
  174. package/dist/esm/utils/array-helpers.js.map +7 -0
  175. package/dist/esm/utils/group-expands-helpers.js +109 -0
  176. package/dist/esm/utils/group-expands-helpers.js.map +7 -0
  177. package/{esm → dist/esm}/utils/keyboard-helpers.js +43 -71
  178. package/dist/esm/utils/keyboard-helpers.js.map +7 -0
  179. package/dist/esm/utils/object-helpers.js +47 -0
  180. package/dist/esm/utils/object-helpers.js.map +7 -0
  181. package/dist/esm/utils/refs-helpers.js +23 -0
  182. package/dist/esm/utils/refs-helpers.js.map +7 -0
  183. package/dist/esm/utils/selectable-helper.js +59 -0
  184. package/dist/esm/utils/selectable-helper.js.map +7 -0
  185. package/dist/esm/utils/string-helpers.js +6 -0
  186. package/dist/esm/utils/string-helpers.js.map +7 -0
  187. package/dist/esm/utils/tree-helpers.js +155 -0
  188. package/dist/esm/utils/tree-helpers.js.map +7 -0
  189. package/{esm → dist/esm}/utils/useInstanceRefActions.js +21 -35
  190. package/dist/esm/utils/useInstanceRefActions.js.map +7 -0
  191. package/dist/esm/utils/useTree.js +77 -0
  192. package/dist/esm/utils/useTree.js.map +7 -0
  193. package/{types → dist/types}/TreeView.d.ts +0 -0
  194. package/{types → dist/types}/TreeViewContext.d.ts +0 -0
  195. package/{types → dist/types}/config/cssClassesConstants.d.ts +0 -0
  196. package/{types → dist/types}/config/useTreeview.d.ts +0 -0
  197. package/{types → dist/types}/hoc/DnDTreeContext.d.ts +0 -0
  198. package/{types → dist/types}/hoc/SortableItemContext.d.ts +0 -0
  199. package/{types → dist/types}/hoc/WithConditionalDnDContext.d.ts +0 -0
  200. package/{types → dist/types}/hoc/WithDnDSortableItemContext.d.ts +0 -0
  201. package/{types → dist/types}/index.d.ts +0 -0
  202. package/{types → dist/types}/parts/CheckboxSelectable.d.ts +0 -0
  203. package/{types → dist/types}/parts/ChildrenCountDisplayer.d.ts +0 -0
  204. package/{types → dist/types}/parts/DnDHandle.d.ts +0 -0
  205. package/{types → dist/types}/parts/DropIndicator.d.ts +0 -0
  206. package/{types → dist/types}/parts/ExpandCaret.d.ts +0 -0
  207. package/{types → dist/types}/parts/Icon.d.ts +0 -0
  208. package/{types → dist/types}/parts/NestingSpace.d.ts +0 -0
  209. package/{types → dist/types}/parts/RadioSelectable.d.ts +0 -0
  210. package/{types → dist/types}/parts/TreeItem.d.ts +0 -0
  211. package/{types → dist/types}/parts/TreeItemText.d.ts +0 -0
  212. package/{types → dist/types}/parts/TreeList.d.ts +0 -0
  213. package/{types → dist/types}/plugins/dnd/TreeDndPlugin.d.ts +0 -0
  214. package/{types → dist/types}/plugins/dnd/index.d.ts +0 -0
  215. package/{types → dist/types}/plugins/index.d.ts +0 -0
  216. package/{types → dist/types}/plugins/roving/TreeRovingPlugin.d.ts +0 -0
  217. package/{types → dist/types}/plugins/roving/index.d.ts +0 -0
  218. package/{types → dist/types}/plugins/searchable/SearchableTreePlugin.d.ts +0 -0
  219. package/{types → dist/types}/plugins/searchable/index.d.ts +0 -0
  220. package/{types → dist/types}/plugins/selectable/SelectablePluginTree.d.ts +0 -0
  221. package/{types → dist/types}/plugins/selectable/index.d.ts +0 -0
  222. package/{types → dist/types}/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -0
  223. package/{types → dist/types}/plugins/toolbar/index.d.ts +0 -0
  224. package/{types → dist/types}/plugins/tree/TreeDataPlugin.d.ts +0 -0
  225. package/{types → dist/types}/plugins/tree/index.d.ts +0 -0
  226. package/{types → dist/types}/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -0
  227. package/{types → dist/types}/plugins/virtualization/index.d.ts +0 -0
  228. package/{types → dist/types}/react-desc-prop-types.d.ts +0 -0
  229. package/{types → dist/types}/related-components/TreeViewSearchBar.d.ts +0 -0
  230. package/{types → dist/types}/sharedTypes.d.ts +0 -0
  231. package/{types → dist/types}/utils/array-helpers.d.ts +0 -0
  232. package/{types → dist/types}/utils/group-expands-helpers.d.ts +0 -0
  233. package/{types → dist/types}/utils/keyboard-helpers.d.ts +0 -0
  234. package/{types → dist/types}/utils/object-helpers.d.ts +0 -0
  235. package/{types → dist/types}/utils/refs-helpers.d.ts +0 -0
  236. package/{types → dist/types}/utils/selectable-helper.d.ts +0 -0
  237. package/{types → dist/types}/utils/string-helpers.d.ts +0 -0
  238. package/{types → dist/types}/utils/tree-helpers.d.ts +0 -0
  239. package/{types → dist/types}/utils/useInstanceRefActions.d.ts +0 -0
  240. package/{types → dist/types}/utils/useTree.d.ts +0 -0
  241. package/package.json +129 -120
  242. package/cjs/TreeView.js +0 -30
  243. package/cjs/TreeViewContext.js +0 -98
  244. package/cjs/config/cssClassesConstants.js +0 -13
  245. package/cjs/config/useTreeview.js +0 -127
  246. package/cjs/hoc/DnDTreeContext.js +0 -18
  247. package/cjs/hoc/SortableItemContext.js +0 -21
  248. package/cjs/hoc/WithConditionalDnDContext.js +0 -138
  249. package/cjs/hoc/WithDnDSortableItemContext.js +0 -70
  250. package/cjs/index.js +0 -26
  251. package/cjs/parts/CheckboxSelectable.js +0 -86
  252. package/cjs/parts/ChildrenCountDisplayer.js +0 -30
  253. package/cjs/parts/DnDHandle.js +0 -46
  254. package/cjs/parts/DropIndicator.js +0 -75
  255. package/cjs/parts/ExpandCaret.js +0 -94
  256. package/cjs/parts/Icon.js +0 -37
  257. package/cjs/parts/NestingSpace.js +0 -47
  258. package/cjs/parts/RadioSelectable.js +0 -59
  259. package/cjs/parts/TreeItem.js +0 -185
  260. package/cjs/parts/TreeItemText.js +0 -108
  261. package/cjs/parts/TreeList.js +0 -139
  262. package/cjs/plugins/dnd/TreeDndPlugin.js +0 -7
  263. package/cjs/plugins/dnd/index.js +0 -9
  264. package/cjs/plugins/index.js +0 -21
  265. package/cjs/plugins/roving/TreeRovingPlugin.js +0 -7
  266. package/cjs/plugins/roving/index.js +0 -9
  267. package/cjs/plugins/searchable/SearchableTreePlugin.js +0 -7
  268. package/cjs/plugins/searchable/index.js +0 -9
  269. package/cjs/plugins/selectable/SelectablePluginTree.js +0 -7
  270. package/cjs/plugins/selectable/index.js +0 -9
  271. package/cjs/plugins/toolbar/TreeToolbarPlugin.js +0 -7
  272. package/cjs/plugins/toolbar/index.js +0 -9
  273. package/cjs/plugins/tree/TreeDataPlugin.js +0 -7
  274. package/cjs/plugins/tree/index.js +0 -9
  275. package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +0 -7
  276. package/cjs/plugins/virtualization/index.js +0 -9
  277. package/cjs/react-desc-prop-types.js +0 -56
  278. package/cjs/related-components/TreeViewSearchBar.js +0 -48
  279. package/cjs/sharedTypes.js +0 -2
  280. package/cjs/utils/array-helpers.js +0 -24
  281. package/cjs/utils/group-expands-helpers.js +0 -111
  282. package/cjs/utils/keyboard-helpers.js +0 -175
  283. package/cjs/utils/object-helpers.js +0 -69
  284. package/cjs/utils/refs-helpers.js +0 -31
  285. package/cjs/utils/selectable-helper.js +0 -80
  286. package/cjs/utils/string-helpers.js +0 -7
  287. package/cjs/utils/tree-helpers.js +0 -220
  288. package/cjs/utils/useInstanceRefActions.js +0 -87
  289. package/cjs/utils/useTree.js +0 -108
  290. package/esm/TreeView.js +0 -21
  291. package/esm/config/cssClassesConstants.js +0 -6
  292. package/esm/config/useTreeview.js +0 -119
  293. package/esm/hoc/DnDTreeContext.js +0 -14
  294. package/esm/hoc/SortableItemContext.js +0 -17
  295. package/esm/hoc/WithConditionalDnDContext.js +0 -128
  296. package/esm/hoc/WithDnDSortableItemContext.js +0 -61
  297. package/esm/index.js +0 -9
  298. package/esm/parts/CheckboxSelectable.js +0 -78
  299. package/esm/parts/ChildrenCountDisplayer.js +0 -22
  300. package/esm/parts/DnDHandle.js +0 -38
  301. package/esm/parts/DropIndicator.js +0 -68
  302. package/esm/parts/ExpandCaret.js +0 -85
  303. package/esm/parts/Icon.js +0 -29
  304. package/esm/parts/NestingSpace.js +0 -39
  305. package/esm/parts/RadioSelectable.js +0 -53
  306. package/esm/parts/TreeItem.js +0 -173
  307. package/esm/parts/TreeItemText.js +0 -99
  308. package/esm/parts/TreeList.js +0 -127
  309. package/esm/plugins/dnd/TreeDndPlugin.js +0 -3
  310. package/esm/plugins/dnd/index.js +0 -1
  311. package/esm/plugins/index.js +0 -7
  312. package/esm/plugins/roving/TreeRovingPlugin.js +0 -3
  313. package/esm/plugins/roving/index.js +0 -1
  314. package/esm/plugins/searchable/SearchableTreePlugin.js +0 -3
  315. package/esm/plugins/searchable/index.js +0 -1
  316. package/esm/plugins/selectable/SelectablePluginTree.js +0 -3
  317. package/esm/plugins/selectable/index.js +0 -1
  318. package/esm/plugins/toolbar/TreeToolbarPlugin.js +0 -3
  319. package/esm/plugins/toolbar/index.js +0 -1
  320. package/esm/plugins/tree/TreeDataPlugin.js +0 -3
  321. package/esm/plugins/tree/index.js +0 -1
  322. package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +0 -3
  323. package/esm/plugins/virtualization/index.js +0 -1
  324. package/esm/react-desc-prop-types.js +0 -52
  325. package/esm/related-components/TreeViewSearchBar.js +0 -40
  326. package/esm/sharedTypes.js +0 -1
  327. package/esm/utils/group-expands-helpers.js +0 -99
  328. package/esm/utils/object-helpers.js +0 -64
  329. package/esm/utils/refs-helpers.js +0 -27
  330. package/esm/utils/selectable-helper.js +0 -70
  331. package/esm/utils/string-helpers.js +0 -3
  332. package/esm/utils/tree-helpers.js +0 -205
  333. package/esm/utils/useTree.js +0 -99
@@ -0,0 +1,122 @@
1
+ import * as React from "react";
2
+ import { useState, useRef, useEffect, useMemo, useCallback } from "react";
3
+ import { useVirtual } from "react-virtual";
4
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
5
+ import { v4 as uuidv4 } from "uuid";
6
+ import { TreeViewPropTypes } from "../react-desc-prop-types";
7
+ import { defaultProps } from "../TreeViewContext";
8
+ import { TreeDndPlugin } from "../plugins/dnd";
9
+ import { useTree } from "../utils/useTree";
10
+ import { useNotifyExpandedChange, toggleItemExpand } from "../utils/group-expands-helpers";
11
+ import { useInstanceRefActions } from "../utils/useInstanceRefActions";
12
+ import { useGlobalToggleAllExpandShortcut } from "../utils/keyboard-helpers";
13
+ const useTreeview = (props) => {
14
+ const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
15
+ useValidateTypescriptPropTypes(propsWithDefault, TreeViewPropTypes);
16
+ const defaultActions = {
17
+ actions: {
18
+ toggleExpandAll: () => {
19
+ },
20
+ scrollTo: () => {
21
+ },
22
+ setSelectedItemByVirtualIndex: () => {
23
+ },
24
+ setFocusedItemByVirtualIndex: () => {
25
+ }
26
+ }
27
+ };
28
+ const treeRef = useRef(defaultActions);
29
+ const {
30
+ data,
31
+ plugins,
32
+ onOrderChange,
33
+ isMultiSelect,
34
+ isSingleSelect,
35
+ instanceRef,
36
+ selection,
37
+ onInstanceRefInitialized
38
+ } = propsWithDefault;
39
+ const [uniqueTreeViewUUID] = useState(uuidv4());
40
+ const [hoverItem, setHoverItem] = useState(null);
41
+ const [latestToggledItem, setLatestToggledItem] = useState(null);
42
+ const [selectedItem, setSelectedItem] = useState(null);
43
+ const [focusedItem, setFocusedItem] = useState(null);
44
+ const [selectedCheckboxes, setSelectedCheckboxes] = useState({
45
+ ...selection
46
+ });
47
+ const [expandedGroups, setExpandedGroups] = useState({});
48
+ const { visibleItems, flattenedItems, tree, treeRoot, triggerTreeRerender, updateUserExpandedState } = useTree(data, propsWithDefault, {
49
+ setExpandedGroups
50
+ });
51
+ const virtualListRef = useRef();
52
+ const virtualListHelpers = useVirtual({
53
+ size: visibleItems.length,
54
+ parentRef: virtualListRef,
55
+ overscan: 15
56
+ });
57
+ const withDragAndDrop = !!(plugins?.includes(TreeDndPlugin) && onOrderChange);
58
+ const withRadioChecks = isSingleSelect && !isMultiSelect;
59
+ const withCheckboxChecks = !isSingleSelect && isMultiSelect;
60
+ const handleExpandGroup = useCallback(toggleItemExpand, []);
61
+ const ctx = useMemo(() => ({
62
+ props: propsWithDefault,
63
+ virtualListHelpers,
64
+ virtualListRef,
65
+ tree,
66
+ treeRoot,
67
+ visibleItems,
68
+ flattenedItems,
69
+ triggerTreeRerender,
70
+ withRadioChecks,
71
+ withCheckboxChecks,
72
+ withDragAndDrop,
73
+ uniqueTreeViewUUID,
74
+ selectedCheckboxes,
75
+ setSelectedCheckboxes,
76
+ selectedItem,
77
+ setSelectedItem,
78
+ expandedGroups,
79
+ setExpandedGroups,
80
+ latestToggledItem,
81
+ setLatestToggledItem,
82
+ focusedItem,
83
+ setFocusedItem,
84
+ hoverItem,
85
+ setHoverItem,
86
+ handleExpandGroup,
87
+ updateUserExpandedState
88
+ }), [
89
+ propsWithDefault,
90
+ virtualListHelpers,
91
+ tree,
92
+ treeRoot,
93
+ visibleItems,
94
+ flattenedItems,
95
+ triggerTreeRerender,
96
+ withRadioChecks,
97
+ withCheckboxChecks,
98
+ withDragAndDrop,
99
+ uniqueTreeViewUUID,
100
+ selectedCheckboxes,
101
+ selectedItem,
102
+ expandedGroups,
103
+ latestToggledItem,
104
+ focusedItem,
105
+ hoverItem,
106
+ handleExpandGroup,
107
+ updateUserExpandedState
108
+ ]);
109
+ if (instanceRef)
110
+ instanceRef.current = treeRef.current;
111
+ useInstanceRefActions(treeRef.current, ctx);
112
+ useGlobalToggleAllExpandShortcut(treeRoot, triggerTreeRerender, setLatestToggledItem, updateUserExpandedState);
113
+ useNotifyExpandedChange(propsWithDefault, ctx);
114
+ useEffect(() => {
115
+ setTimeout(() => onInstanceRefInitialized(treeRef), 100);
116
+ }, []);
117
+ return useMemo(() => ({ ctx }), [ctx]);
118
+ };
119
+ export {
120
+ useTreeview
121
+ };
122
+ //# sourceMappingURL=useTreeview.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useTreeview.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport { useState, useRef, useEffect, useMemo, useCallback } from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { TreeViewPropTypes } from '../react-desc-prop-types';\nimport { defaultProps } from '../TreeViewContext';\nimport { TreeDndPlugin } from '../plugins/dnd';\nimport { useTree } from '../utils/useTree';\nimport { useNotifyExpandedChange, toggleItemExpand } from '../utils/group-expands-helpers';\nimport { useInstanceRefActions } from '../utils/useInstanceRefActions';\nimport { useGlobalToggleAllExpandShortcut } from '../utils/keyboard-helpers';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nimport type { DSTreeviewInternalsT } from '../sharedTypes';\n\ntype UseTreeviewT = (props: DSTreeviewT.Props) => { ctx: DSTreeviewInternalsT.CTX };\n\nexport const useTreeview: UseTreeviewT = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSTreeviewT.Props>(props, defaultProps);\n useValidateTypescriptPropTypes<DSTreeviewT.Props>(propsWithDefault, TreeViewPropTypes);\n const defaultActions = {\n actions: {\n toggleExpandAll: () => {},\n scrollTo: () => {},\n setSelectedItemByVirtualIndex: () => {},\n setFocusedItemByVirtualIndex: () => {},\n },\n } as unknown as DSTreeviewT.InstanceRef;\n const treeRef = useRef(defaultActions);\n const {\n data,\n plugins,\n onOrderChange,\n isMultiSelect,\n isSingleSelect,\n instanceRef,\n selection,\n onInstanceRefInitialized,\n } = propsWithDefault;\n const [uniqueTreeViewUUID] = useState(uuidv4());\n const [hoverItem, setHoverItem] = useState<DSTreeviewT.Item | null>(null);\n const [latestToggledItem, setLatestToggledItem] = useState<DSTreeviewT.Item | null>(null);\n const [selectedItem, setSelectedItem] = useState<DSTreeviewT.Item | null>(null);\n const [focusedItem, setFocusedItem] = useState<DSTreeviewT.Item | null>(null);\n const [selectedCheckboxes, setSelectedCheckboxes] = useState({\n ...selection,\n });\n const [expandedGroups, setExpandedGroups] = useState<DSTreeviewT.ExpandedItems>({});\n const { visibleItems, flattenedItems, tree, treeRoot, triggerTreeRerender, updateUserExpandedState } = useTree(\n data,\n propsWithDefault,\n {\n setExpandedGroups,\n },\n );\n\n const virtualListRef = useRef<HTMLUListElement>();\n // estimateSize should not be really required given what was stated on\n // https://github.com/tannerlinsley/react-virtual/issues/23\n\n const virtualListHelpers = useVirtual({\n size: visibleItems.length,\n parentRef: virtualListRef,\n overscan: 15,\n });\n\n const withDragAndDrop = !!(plugins?.includes(TreeDndPlugin) && onOrderChange);\n const withRadioChecks = isSingleSelect && !isMultiSelect;\n const withCheckboxChecks = !isSingleSelect && isMultiSelect;\n\n const handleExpandGroup = useCallback(toggleItemExpand, []);\n\n const ctx: DSTreeviewInternalsT.CTX = useMemo(\n () => ({\n props: propsWithDefault,\n virtualListHelpers,\n virtualListRef,\n tree,\n treeRoot,\n visibleItems,\n flattenedItems,\n triggerTreeRerender,\n withRadioChecks,\n withCheckboxChecks,\n withDragAndDrop,\n uniqueTreeViewUUID,\n selectedCheckboxes,\n setSelectedCheckboxes,\n selectedItem,\n setSelectedItem,\n expandedGroups,\n setExpandedGroups,\n latestToggledItem,\n setLatestToggledItem,\n focusedItem,\n setFocusedItem,\n hoverItem,\n setHoverItem,\n handleExpandGroup,\n updateUserExpandedState,\n }),\n [\n propsWithDefault,\n virtualListHelpers,\n tree,\n treeRoot,\n visibleItems,\n flattenedItems,\n triggerTreeRerender,\n withRadioChecks,\n withCheckboxChecks,\n withDragAndDrop,\n uniqueTreeViewUUID,\n selectedCheckboxes,\n selectedItem,\n expandedGroups,\n latestToggledItem,\n focusedItem,\n hoverItem,\n handleExpandGroup,\n updateUserExpandedState,\n ],\n );\n // this hooks can't use the context because the context provider doesn't wrap this\n // as such we manually pass the second parameter as fit\n if (instanceRef) instanceRef.current = treeRef.current;\n useInstanceRefActions(treeRef.current, ctx);\n useGlobalToggleAllExpandShortcut(treeRoot, triggerTreeRerender, setLatestToggledItem, updateUserExpandedState);\n useNotifyExpandedChange(propsWithDefault, ctx);\n\n // this is an horrible hack.\n // this is required because there is no \"on rendered\" react-way to check if every children has finished rendering\n // this should be working for now, in the future we may want to review this for a better solution\n useEffect(() => {\n setTimeout(() => onInstanceRefInitialized(treeRef), 100);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => ({ ctx }), [ctx]);\n};\n"],
5
+ "mappings": "AAAA;ACEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,MAAM,cAA4B,CAAC,UAAU;AAClD,QAAM,mBAAmB,6BAAgD,OAAO;AAChF,iCAAkD,kBAAkB;AACpE,QAAM,iBAAiB;AAAA,IACrB,SAAS;AAAA,MACP,iBAAiB,MAAM;AAAA;AAAA,MACvB,UAAU,MAAM;AAAA;AAAA,MAChB,+BAA+B,MAAM;AAAA;AAAA,MACrC,8BAA8B,MAAM;AAAA;AAAA;AAAA;AAGxC,QAAM,UAAU,OAAO;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AACJ,QAAM,CAAC,sBAAsB,SAAS;AACtC,QAAM,CAAC,WAAW,gBAAgB,SAAkC;AACpE,QAAM,CAAC,mBAAmB,wBAAwB,SAAkC;AACpF,QAAM,CAAC,cAAc,mBAAmB,SAAkC;AAC1E,QAAM,CAAC,aAAa,kBAAkB,SAAkC;AACxE,QAAM,CAAC,oBAAoB,yBAAyB,SAAS;AAAA,OACxD;AAAA;AAEL,QAAM,CAAC,gBAAgB,qBAAqB,SAAoC;AAChF,QAAM,EAAE,cAAc,gBAAgB,MAAM,UAAU,qBAAqB,4BAA4B,QACrG,MACA,kBACA;AAAA,IACE;AAAA;AAIJ,QAAM,iBAAiB;AAIvB,QAAM,qBAAqB,WAAW;AAAA,IACpC,MAAM,aAAa;AAAA,IACnB,WAAW;AAAA,IACX,UAAU;AAAA;AAGZ,QAAM,kBAAkB,CAAC,CAAE,UAAS,SAAS,kBAAkB;AAC/D,QAAM,kBAAkB,kBAAkB,CAAC;AAC3C,QAAM,qBAAqB,CAAC,kBAAkB;AAE9C,QAAM,oBAAoB,YAAY,kBAAkB;AAExD,QAAM,MAAgC,QACpC,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKJ,MAAI;AAAa,gBAAY,UAAU,QAAQ;AAC/C,wBAAsB,QAAQ,SAAS;AACvC,mCAAiC,UAAU,qBAAqB,sBAAsB;AACtF,0BAAwB,kBAAkB;AAK1C,YAAU,MAAM;AACd,eAAW,MAAM,yBAAyB,UAAU;AAAA,KAEnD;AAEH,SAAO,QAAQ,MAAO,GAAE,QAAQ,CAAC;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ import { DropIndicatorPosition } from "./SortableItemContext";
4
+ const DnDTreeContext = createContext({
5
+ depth: void 0,
6
+ activeIndex: void 0,
7
+ visibleItems: void 0,
8
+ dropIndicatorPosition: DropIndicatorPosition.None,
9
+ lastActiveId: void 0,
10
+ setLastActiveId: void 0,
11
+ isDropValid: false
12
+ });
13
+ export {
14
+ DnDTreeContext
15
+ };
16
+ //# sourceMappingURL=DnDTreeContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hoc/DnDTreeContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport { DSTreeviewT } from '../react-desc-prop-types';\nimport { DropIndicatorPosition } from './SortableItemContext';\n\ntype DnDTreeContextType = {\n depth: number | undefined;\n activeIndex: number | undefined;\n visibleItems: DSTreeviewT.Item[] | undefined;\n dropIndicatorPosition: DropIndicatorPosition;\n lastActiveId: string | undefined;\n setLastActiveId: React.Dispatch<React.SetStateAction<string>> | undefined;\n isDropValid: boolean;\n};\n\nexport const DnDTreeContext = createContext<DnDTreeContextType>({\n depth: undefined,\n activeIndex: undefined,\n visibleItems: undefined,\n dropIndicatorPosition: DropIndicatorPosition.None,\n lastActiveId: undefined,\n setLastActiveId: undefined,\n isDropValid: false,\n});\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AAYO,MAAM,iBAAiB,cAAkC;AAAA,EAC9D,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,uBAAuB,sBAAsB;AAAA,EAC7C,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,aAAa;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ var DropIndicatorPosition = /* @__PURE__ */ ((DropIndicatorPosition2) => {
4
+ DropIndicatorPosition2[DropIndicatorPosition2["None"] = 0] = "None";
5
+ DropIndicatorPosition2[DropIndicatorPosition2["Before"] = 1] = "Before";
6
+ DropIndicatorPosition2[DropIndicatorPosition2["After"] = 2] = "After";
7
+ DropIndicatorPosition2[DropIndicatorPosition2["Inside"] = 3] = "Inside";
8
+ return DropIndicatorPosition2;
9
+ })(DropIndicatorPosition || {});
10
+ const SortableItemContext = createContext({
11
+ draggableProps: false
12
+ });
13
+ export {
14
+ DropIndicatorPosition,
15
+ SortableItemContext
16
+ };
17
+ //# sourceMappingURL=SortableItemContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hoc/SortableItemContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useSortable } from '@dnd-kit/sortable';\nimport { createContext } from 'react';\n\nexport enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n\nexport type SortableItemContextType = {\n draggableProps:\n | false\n | (ReturnType<typeof useSortable> & {\n dropIndicatorPosition: DropIndicatorPosition;\n shouldShowDropIndicatorPosition: boolean;\n lastActiveId?: string;\n setLastActiveId?: React.Dispatch<React.SetStateAction<string>>;\n isDropValid: boolean;\n });\n};\n\n/** Context for cross component communication */\nexport const SortableItemContext = createContext<SortableItemContextType>({\n draggableProps: false,\n});\n"],
5
+ "mappings": "AAAA;ACCA;AAEO,IAAK,wBAAL,kBAAK,2BAAL;AACL,0DAAO,KAAP;AACA,4DAAS,KAAT;AACA,2DAAQ,KAAR;AACA,4DAAS,KAAT;AAJU;AAAA;AAoBL,MAAM,sBAAsB,cAAuC;AAAA,EACxE,gBAAgB;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,99 @@
1
+ import * as React from "react";
2
+ import React2, { useCallback, useContext, useMemo } from "react";
3
+ import { DndContext, DragOverlay } from "@dnd-kit/core";
4
+ import { SortableContext } from "@dnd-kit/sortable";
5
+ import { useTreeDndkitConfig } from "@elliemae/ds-drag-and-drop";
6
+ import TreeViewContext from "../TreeViewContext";
7
+ import { TreeItem } from "../parts/TreeItem";
8
+ import { DnDTreeContext } from "./DnDTreeContext";
9
+ const ensure = (argument, message = "This should never happen") => {
10
+ if (argument === void 0 || argument === null) {
11
+ throw new TypeError(message);
12
+ }
13
+ return argument;
14
+ };
15
+ const withConditionalDnDRowContext = (Component) => (props) => {
16
+ const [lastActiveId, setLastActiveId] = React2.useState("");
17
+ const {
18
+ props: { data, onOrderChange, getIsDropValid },
19
+ flattenedItems,
20
+ visibleItems: flattenedVisibleTree,
21
+ withDragAndDrop
22
+ } = useContext(TreeViewContext);
23
+ const flattenedVisibleTreeForDnD = useMemo(() => flattenedVisibleTree.map((item, index) => ({
24
+ uid: item.id.toString(),
25
+ depth: (item.treeDepth ?? 1) - 1,
26
+ realIndex: index,
27
+ childrenCount: item.children?.length ?? 0,
28
+ parentId: item.node.parent?.model?.id?.toString() ?? null,
29
+ original: item
30
+ })), [flattenedVisibleTree]);
31
+ const onReorder = useCallback((tree, indexes) => {
32
+ const nodes = {};
33
+ tree.forEach((item) => {
34
+ const originalItem = item.original;
35
+ originalItem.children = [];
36
+ nodes[item.uid] = item.original;
37
+ });
38
+ const newUserTree = [];
39
+ tree.forEach((item) => {
40
+ if (item.parentId !== null && item.parentId !== void 0 && item.parentId !== "__ds_tree_root") {
41
+ const parentNode = nodes[item.parentId];
42
+ parentNode.children?.push(item.original);
43
+ } else if (item.uid !== "__ds_tree_root")
44
+ newUserTree.push(item.original);
45
+ });
46
+ onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);
47
+ }, [onOrderChange, data, flattenedItems]);
48
+ const {
49
+ dndContextProps,
50
+ sortableContextProps,
51
+ activeId,
52
+ activeIndex,
53
+ depth,
54
+ dropIndicatorPosition,
55
+ visibleItems,
56
+ isDropValid
57
+ } = useTreeDndkitConfig({
58
+ flattenedItems,
59
+ visibleItems: flattenedVisibleTreeForDnD,
60
+ isHorizontalDnD: false,
61
+ isExpandable: true,
62
+ onReorder,
63
+ getIsDropValid,
64
+ maxDragAndDropLevel: Infinity
65
+ });
66
+ if (lastActiveId !== activeId && activeId)
67
+ setLastActiveId(activeId);
68
+ if (withDragAndDrop)
69
+ return /* @__PURE__ */ React2.createElement(DndContext, {
70
+ ...dndContextProps
71
+ }, /* @__PURE__ */ React2.createElement(SortableContext, {
72
+ ...sortableContextProps
73
+ }, /* @__PURE__ */ React2.createElement(DnDTreeContext.Provider, {
74
+ value: {
75
+ activeIndex,
76
+ depth,
77
+ visibleItems: visibleItems.map((item) => item.original),
78
+ dropIndicatorPosition,
79
+ lastActiveId,
80
+ setLastActiveId,
81
+ isDropValid
82
+ }
83
+ }, /* @__PURE__ */ React2.createElement(Component, {
84
+ ...props
85
+ }))), /* @__PURE__ */ React2.createElement(DragOverlay, {
86
+ style: { width: "auto" }
87
+ }, activeId ? /* @__PURE__ */ React2.createElement(TreeItem, {
88
+ itemIndex: activeIndex,
89
+ item: ensure(flattenedVisibleTree.find((item) => item.id.toString() === activeId)),
90
+ isDragOverlay: true
91
+ }) : null));
92
+ return /* @__PURE__ */ React2.createElement(Component, {
93
+ ...props
94
+ });
95
+ };
96
+ export {
97
+ withConditionalDnDRowContext
98
+ };
99
+ //# sourceMappingURL=WithConditionalDnDContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hoc/WithConditionalDnDContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useContext, useMemo } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { SortableContext } from '@dnd-kit/sortable';\nimport { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { DSTreeviewT } from '../react-desc-prop-types';\nimport TreeViewContext from '../TreeViewContext';\nimport { TreeItem } from '../parts/TreeItem';\nimport { DnDTreeContext } from './DnDTreeContext';\n\ntype FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;\n\nconst ensure = <T,>(argument: T | undefined | null, message = 'This should never happen'): T => {\n if (argument === undefined || argument === null) {\n throw new TypeError(message);\n }\n\n return argument;\n};\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const [lastActiveId, setLastActiveId] = React.useState('');\n\n const {\n props: { data, onOrderChange, getIsDropValid },\n flattenedItems,\n visibleItems: flattenedVisibleTree,\n withDragAndDrop,\n } = useContext(TreeViewContext);\n\n const flattenedVisibleTreeForDnD = useMemo(\n () =>\n flattenedVisibleTree.map((item, index) => ({\n uid: item.id.toString(),\n depth: (item.treeDepth ?? 1) - 1,\n realIndex: index,\n childrenCount: item.children?.length ?? 0,\n parentId: item.node.parent?.model?.id?.toString() ?? null,\n original: item,\n })),\n [flattenedVisibleTree],\n );\n\n const onReorder = useCallback(\n (tree: DSTreeviewT.DndItem[], indexes: { targetIndex: number; fromIndex: number }) => {\n // Pull the row's original data into an object\n const nodes: Record<DSTreeviewT.StringOrNum, DSTreeviewT.SimpleItem> = {};\n tree.forEach((item) => {\n const originalItem = item.original;\n originalItem.children = [];\n nodes[item.uid] = item.original;\n });\n\n const newUserTree: DSTreeviewT.SimpleItem[] = [];\n tree.forEach((item) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (item.parentId !== null && item.parentId !== undefined && item.parentId !== '__ds_tree_root') {\n const parentNode = nodes[item.parentId];\n parentNode.children?.push(item.original);\n } else if (item.uid !== '__ds_tree_root') newUserTree.push(item.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);\n },\n [onOrderChange, data, flattenedItems],\n );\n\n const {\n dndContextProps,\n sortableContextProps,\n activeId,\n activeIndex,\n depth,\n dropIndicatorPosition,\n visibleItems,\n isDropValid,\n } = useTreeDndkitConfig({\n flattenedItems,\n visibleItems: flattenedVisibleTreeForDnD,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n getIsDropValid,\n maxDragAndDropLevel: Infinity,\n });\n\n if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);\n\n if (withDragAndDrop)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider\n value={{\n activeIndex,\n depth,\n visibleItems: visibleItems.map((item) => item.original) as DSTreeviewT.Item[],\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n }}\n >\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n <DragOverlay style={{ width: 'auto' }}>\n {activeId ? (\n <TreeItem\n itemIndex={activeIndex}\n item={ensure(flattenedVisibleTree.find((item) => item.id.toString() === activeId))}\n isDragOverlay\n />\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA;AACA;AACA;AAIA,MAAM,SAAS,CAAK,UAAgC,UAAU,+BAAkC;AAC9F,MAAI,aAAa,UAAa,aAAa,MAAM;AAC/C,UAAM,IAAI,UAAU;AAAA;AAGtB,SAAO;AAAA;AAIF,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM,CAAC,cAAc,mBAAmB,OAAM,SAAS;AAEvD,QAAM;AAAA,IACJ,OAAO,EAAE,MAAM,eAAe;AAAA,IAC9B;AAAA,IACA,cAAc;AAAA,IACd;AAAA,MACE,WAAW;AAEf,QAAM,6BAA6B,QACjC,MACE,qBAAqB,IAAI,CAAC,MAAM,UAAW;AAAA,IACzC,KAAK,KAAK,GAAG;AAAA,IACb,OAAQ,MAAK,aAAa,KAAK;AAAA,IAC/B,WAAW;AAAA,IACX,eAAe,KAAK,UAAU,UAAU;AAAA,IACxC,UAAU,KAAK,KAAK,QAAQ,OAAO,IAAI,cAAc;AAAA,IACrD,UAAU;AAAA,OAEd,CAAC;AAGH,QAAM,YAAY,YAChB,CAAC,MAA6B,YAAwD;AAEpF,UAAM,QAAiE;AACvE,SAAK,QAAQ,CAAC,SAAS;AACrB,YAAM,eAAe,KAAK;AAC1B,mBAAa,WAAW;AACxB,YAAM,KAAK,OAAO,KAAK;AAAA;AAGzB,UAAM,cAAwC;AAC9C,SAAK,QAAQ,CAAC,SAAS;AAGrB,UAAI,KAAK,aAAa,QAAQ,KAAK,aAAa,UAAa,KAAK,aAAa,kBAAkB;AAC/F,cAAM,aAAa,MAAM,KAAK;AAC9B,mBAAW,UAAU,KAAK,KAAK;AAAA,iBACtB,KAAK,QAAQ;AAAkB,oBAAY,KAAK,KAAK;AAAA;AAGlE,kBAAc,aAAa,MAAM,eAAe,QAAQ;AAAA,KAE1D,CAAC,eAAe,MAAM;AAGxB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,oBAAoB;AAAA,IACtB;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA;AAGvB,MAAI,iBAAiB,YAAY;AAAU,oBAAgB;AAE3D,MAAI;AACF,WACE,qCAAC,YAAD;AAAA,SAAgB;AAAA,OACd,qCAAC,iBAAD;AAAA,SAAqB;AAAA,OACnB,qCAAC,eAAe,UAAhB;AAAA,MACE,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,cAAc,aAAa,IAAI,CAAC,SAAS,KAAK;AAAA,QAC9C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,OAGF,qCAAC,WAAD;AAAA,SAAe;AAAA,UAGnB,qCAAC,aAAD;AAAA,MAAa,OAAO,EAAE,OAAO;AAAA,OAC1B,WACC,qCAAC,UAAD;AAAA,MACE,WAAW;AAAA,MACX,MAAM,OAAO,qBAAqB,KAAK,CAAC,SAAS,KAAK,GAAG,eAAe;AAAA,MACxE,eAAa;AAAA,SAEb;AAIZ,SAAO,qCAAC,WAAD;AAAA,OAAe;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ import React2, { useContext, useMemo } from "react";
3
+ import { useSortable } from "@dnd-kit/sortable";
4
+ import { SortableItemContext } from "./SortableItemContext";
5
+ import TreeViewContext from "../TreeViewContext";
6
+ import { DnDTreeContext } from "./DnDTreeContext";
7
+ const withDnDSortableItemContext = (Component) => (props) => {
8
+ const { withDragAndDrop } = useContext(TreeViewContext);
9
+ const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = useContext(DnDTreeContext);
10
+ const id = props.item.id.toString();
11
+ const draggableOptions = useMemo(() => ({
12
+ id
13
+ }), [id]);
14
+ const useSortableHelpers = useSortable(draggableOptions);
15
+ const draggableProps = useMemo(() => {
16
+ if (!withDragAndDrop)
17
+ return false;
18
+ const { index, overIndex } = useSortableHelpers;
19
+ return {
20
+ ...useSortableHelpers,
21
+ shouldShowDropIndicatorPosition: overIndex === index,
22
+ dropIndicatorPosition,
23
+ lastActiveId,
24
+ setLastActiveId,
25
+ isDropValid
26
+ };
27
+ }, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]);
28
+ const ctx = useMemo(() => ({
29
+ draggableProps
30
+ }), [draggableProps]);
31
+ return /* @__PURE__ */ React2.createElement(SortableItemContext.Provider, {
32
+ value: ctx
33
+ }, /* @__PURE__ */ React2.createElement(Component, {
34
+ ...props
35
+ }));
36
+ };
37
+ export {
38
+ withDnDSortableItemContext
39
+ };
40
+ //# sourceMappingURL=WithDnDSortableItemContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hoc/WithDnDSortableItemContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { SortableItemContext, SortableItemContextType } from './SortableItemContext';\nimport TreeViewContext from '../TreeViewContext';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport { DSTreeviewT } from '../react-desc-prop-types';\n\ntype FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;\n\nexport const withDnDSortableItemContext: FunctionalHOC = (Component) => (props: any) => {\n const { withDragAndDrop } = useContext(TreeViewContext);\n const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = useContext(DnDTreeContext);\n\n const id = (props as { item: DSTreeviewT.Item }).item.id.toString();\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id,\n }),\n [id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!withDragAndDrop) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n };\n }, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n"],
5
+ "mappings": "AAAA;ACGA;AACA;AACA;AACA;AACA;AAKO,MAAM,6BAA4C,CAAC,cAAc,CAAC,UAAe;AACtF,QAAM,EAAE,oBAAoB,WAAW;AACvC,QAAM,EAAE,uBAAuB,cAAc,iBAAiB,gBAAgB,WAAW;AAEzF,QAAM,KAAM,MAAqC,KAAK,GAAG;AAGzD,QAAM,mBAAmB,QACvB,MAAO;AAAA,IACL;AAAA,MAEF,CAAC;AAGH,QAAM,qBAAqB,YAAY;AAGvC,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC;AAAiB,aAAO;AAE7B,UAAM,EAAE,OAAO,cAAc;AAE7B,WAAO;AAAA,SACF;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,KAED,CAAC,iBAAiB,oBAAoB,uBAAuB,cAAc,iBAAiB;AAK/F,QAAM,MAA+B,QACnC,MAAO;AAAA,IACL;AAAA,MAEF,CAAC;AAGH,SACE,qCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KACnC,qCAAC,WAAD;AAAA,OAAe;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export * from "./TreeView";
3
+ export * from "./plugins";
4
+ import { TreeViewSearchBar } from "./related-components/TreeViewSearchBar";
5
+ export {
6
+ TreeViewSearchBar
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './TreeView';\nexport * from './plugins';\n\nexport { TreeViewSearchBar } from './related-components/TreeViewSearchBar';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,68 @@
1
+ import * as React from "react";
2
+ import React2, { useContext, useCallback, useMemo } from "react";
3
+ import { DSCheckbox } from "@elliemae/ds-form";
4
+ import styled from "styled-components";
5
+ import TreeViewContext from "../TreeViewContext";
6
+ import { toggleCheckboxItem } from "../utils/selectable-helper";
7
+ import { filterObject } from "../utils/object-helpers";
8
+ const StyledCheckboxWrapper = styled.span`
9
+ padding-top: 3px;
10
+ `;
11
+ function CheckboxSelectable(props) {
12
+ const { item, itemIndex } = props;
13
+ const { id } = item;
14
+ const ctx = useContext(TreeViewContext);
15
+ const {
16
+ props: { onSelectionChange, isItemDisabled },
17
+ virtualListHelpers: { scrollToIndex },
18
+ triggerTreeRerender,
19
+ selectedCheckboxes,
20
+ setSelectedCheckboxes
21
+ } = ctx;
22
+ const onCheckboxChange = useCallback(() => {
23
+ const newSelections = toggleCheckboxItem(item);
24
+ const newSelectionHasmap = filterObject({ ...selectedCheckboxes, ...newSelections }, (value) => value !== false);
25
+ setSelectedCheckboxes(newSelectionHasmap);
26
+ triggerTreeRerender();
27
+ const indexAndScrollTo = {
28
+ scrollToItem: () => {
29
+ if (typeof item.virtualIndex === "number")
30
+ scrollToIndex(item.virtualIndex);
31
+ },
32
+ itemIndex
33
+ };
34
+ if (onSelectionChange)
35
+ onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
36
+ }, [
37
+ item,
38
+ triggerTreeRerender,
39
+ onSelectionChange,
40
+ itemIndex,
41
+ scrollToIndex,
42
+ selectedCheckboxes,
43
+ setSelectedCheckboxes
44
+ ]);
45
+ const isChecked = useMemo(() => {
46
+ if (selectedCheckboxes[id] === "mixed") {
47
+ return "mixed";
48
+ }
49
+ if (selectedCheckboxes[id] === true) {
50
+ return true;
51
+ }
52
+ return false;
53
+ }, [selectedCheckboxes, id]);
54
+ const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
55
+ return /* @__PURE__ */ React2.createElement(StyledCheckboxWrapper, null, /* @__PURE__ */ React2.createElement(DSCheckbox, {
56
+ checked: isChecked,
57
+ disabled: isDisabled,
58
+ className: "em-ds-tree-item-checkbox",
59
+ "data-testid": "tree-item-checkbox",
60
+ onChange: onCheckboxChange,
61
+ tabIndex: "0"
62
+ }));
63
+ }
64
+ var CheckboxSelectable_default = CheckboxSelectable;
65
+ export {
66
+ CheckboxSelectable_default as default
67
+ };
68
+ //# sourceMappingURL=CheckboxSelectable.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/CheckboxSelectable.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useMemo } from 'react';\nimport { DSCheckbox } from '@elliemae/ds-form';\nimport styled from 'styled-components';\nimport TreeViewContext from '../TreeViewContext';\nimport { toggleCheckboxItem } from '../utils/selectable-helper';\nimport { filterObject } from '../utils/object-helpers';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nconst StyledCheckboxWrapper = styled.span`\n padding-top: 3px;\n`;\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n}\nfunction CheckboxSelectable(props: PropsT): JSX.Element | null {\n const { item, itemIndex } = props;\n const { id } = item;\n\n const ctx = useContext(TreeViewContext);\n const {\n props: { onSelectionChange, isItemDisabled },\n virtualListHelpers: { scrollToIndex },\n triggerTreeRerender,\n selectedCheckboxes,\n setSelectedCheckboxes,\n } = ctx;\n\n const onCheckboxChange = useCallback(() => {\n const newSelections = toggleCheckboxItem(item);\n const newSelectionHasmap = filterObject<DSTreeviewT.SelectionState>(\n { ...selectedCheckboxes, ...newSelections },\n (value) => value !== false,\n );\n setSelectedCheckboxes(newSelectionHasmap);\n triggerTreeRerender();\n\n const indexAndScrollTo = {\n scrollToItem: () => {\n if (typeof item.virtualIndex === 'number') scrollToIndex(item.virtualIndex);\n },\n itemIndex,\n };\n if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);\n }, [\n item,\n triggerTreeRerender,\n onSelectionChange,\n itemIndex,\n scrollToIndex,\n selectedCheckboxes,\n setSelectedCheckboxes,\n ]);\n const isChecked = useMemo(() => {\n if (selectedCheckboxes[id] === 'mixed') {\n return 'mixed' as const;\n }\n if (selectedCheckboxes[id] === true) {\n return true;\n }\n return false;\n }, [selectedCheckboxes, id]);\n\n const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);\n\n return (\n <StyledCheckboxWrapper>\n <DSCheckbox\n checked={isChecked}\n disabled={isDisabled}\n className=\"em-ds-tree-item-checkbox\"\n data-testid=\"tree-item-checkbox\"\n onChange={onCheckboxChange}\n tabIndex=\"0\"\n />\n </StyledCheckboxWrapper>\n );\n}\n\nexport default CheckboxSelectable;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,wBAAwB,OAAO;AAAA;AAAA;AAOrC,4BAA4B,OAAmC;AAC7D,QAAM,EAAE,MAAM,cAAc;AAC5B,QAAM,EAAE,OAAO;AAEf,QAAM,MAAM,WAAW;AACvB,QAAM;AAAA,IACJ,OAAO,EAAE,mBAAmB;AAAA,IAC5B,oBAAoB,EAAE;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,QAAM,mBAAmB,YAAY,MAAM;AACzC,UAAM,gBAAgB,mBAAmB;AACzC,UAAM,qBAAqB,aACzB,KAAK,uBAAuB,iBAC5B,CAAC,UAAU,UAAU;AAEvB,0BAAsB;AACtB;AAEA,UAAM,mBAAmB;AAAA,MACvB,cAAc,MAAM;AAClB,YAAI,OAAO,KAAK,iBAAiB;AAAU,wBAAc,KAAK;AAAA;AAAA,MAEhE;AAAA;AAEF,QAAI;AAAmB,wBAAkB,oBAAoB,MAAM;AAAA,KAClE;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAEF,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI,mBAAmB,QAAQ,SAAS;AACtC,aAAO;AAAA;AAET,QAAI,mBAAmB,QAAQ,MAAM;AACnC,aAAO;AAAA;AAET,WAAO;AAAA,KACN,CAAC,oBAAoB;AAExB,QAAM,aAAa,QAAQ,MAAM,eAAe,OAAO,CAAC,MAAM;AAE9D,SACE,qCAAC,uBAAD,MACE,qCAAC,YAAD;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,UAAU;AAAA,IACV,UAAS;AAAA;AAAA;AAMjB,IAAO,6BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { DSTreeViewPrefix, treeItemBlockName } from "../config/cssClassesConstants";
4
+ const className = `${DSTreeViewPrefix}-${treeItemBlockName}-children-count-displayer`;
5
+ const ChildrenCountDisplayer = (props) => {
6
+ const { item } = props;
7
+ const { isGroup, children } = item;
8
+ if (!isGroup)
9
+ return null;
10
+ return /* @__PURE__ */ React2.createElement("span", {
11
+ "data-testid": "tree-item-children-count-displayer",
12
+ className
13
+ }, ` | ${children.length} Items`);
14
+ };
15
+ export {
16
+ ChildrenCountDisplayer
17
+ };
18
+ //# sourceMappingURL=ChildrenCountDisplayer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/ChildrenCountDisplayer.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\n\nconst className = `${DSTreeViewPrefix}-${treeItemBlockName}-children-count-displayer`;\n\ninterface PropsT {\n item: DSTreeviewT.Item;\n}\n\nexport const ChildrenCountDisplayer = (props: PropsT): JSX.Element | null => {\n const { item } = props;\n const { isGroup, children } = item;\n\n if (!isGroup) return null;\n // return ` | ${children.length} Items`;\n return (\n <span data-testid=\"tree-item-children-count-displayer\" className={className}>{` | ${children.length} Items`}</span>\n );\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAGA,MAAM,YAAY,GAAG,oBAAoB;AAMlC,MAAM,yBAAyB,CAAC,UAAsC;AAC3E,QAAM,EAAE,SAAS;AACjB,QAAM,EAAE,SAAS,aAAa;AAE9B,MAAI,CAAC;AAAS,WAAO;AAErB,SACE,qCAAC,QAAD;AAAA,IAAM,eAAY;AAAA,IAAqC;AAAA,KAAuB,MAAM,SAAS;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,28 @@
1
+ import * as React from "react";
2
+ import React2, { useContext } from "react";
3
+ import { GripperVertical } from "@elliemae/ds-icons";
4
+ import { SortableItemContext } from "../hoc/SortableItemContext";
5
+ const DnDHandle = ({ id, isDragOverlay }) => {
6
+ const { draggableProps } = useContext(SortableItemContext);
7
+ const isDragging = draggableProps && draggableProps.isDragging;
8
+ return /* @__PURE__ */ React2.createElement(GripperVertical, {
9
+ role: "button",
10
+ ...draggableProps && {
11
+ ...draggableProps.listeners,
12
+ ...draggableProps.attributes
13
+ },
14
+ "data-testid": "drag-handle",
15
+ "data-isactive": draggableProps && !!draggableProps.active,
16
+ "data-isdragoverlay": isDragOverlay,
17
+ id: `${id}-drag-handle`,
18
+ key: `${id}-drag-handle`,
19
+ className: `drag-handle ${isDragging ? "" : "focuseable"}`,
20
+ color: ["brand-primary", "800"],
21
+ size: "s",
22
+ tabIndex: 0
23
+ });
24
+ };
25
+ export {
26
+ DnDHandle
27
+ };
28
+ //# sourceMappingURL=DnDHandle.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DnDHandle.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { SortableItemContext } from '../hoc/SortableItemContext';\nimport { DSTreeviewT } from '../react-desc-prop-types';\n\nexport const DnDHandle = ({ id, isDragOverlay }: { id: DSTreeviewT.StringOrNum; isDragOverlay: boolean }) => {\n const { draggableProps } = useContext(SortableItemContext);\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n return (\n <GripperVertical\n role=\"button\"\n {...(draggableProps && {\n ...draggableProps.listeners,\n ...draggableProps.attributes,\n })}\n data-testid=\"drag-handle\"\n data-isactive={draggableProps && !!draggableProps.active}\n data-isdragoverlay={isDragOverlay}\n id={`${id}-drag-handle`}\n key={`${id}-drag-handle`}\n className={`drag-handle ${isDragging ? '' : 'focuseable'}`}\n color={['brand-primary', '800']}\n size=\"s\"\n tabIndex={0}\n />\n );\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAGO,MAAM,YAAY,CAAC,EAAE,IAAI,oBAA6E;AAC3G,QAAM,EAAE,mBAAmB,WAAW;AAEtC,QAAM,aAAa,kBAAkB,eAAe;AAEpD,SACE,qCAAC,iBAAD;AAAA,IACE,MAAK;AAAA,OACA,kBAAkB;AAAA,SAClB,eAAe;AAAA,SACf,eAAe;AAAA;AAAA,IAEpB,eAAY;AAAA,IACZ,iBAAe,kBAAkB,CAAC,CAAC,eAAe;AAAA,IAClD,sBAAoB;AAAA,IACpB,IAAI,GAAG;AAAA,IACP,KAAK,GAAG;AAAA,IACR,WAAW,eAAe,aAAa,KAAK;AAAA,IAC5C,OAAO,CAAC,iBAAiB;AAAA,IACzB,MAAK;AAAA,IACL,UAAU;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import styled from "styled-components";
4
+ import { DropIndicatorPosition } from "../hoc/SortableItemContext";
5
+ const getPositionStyles = ({ dropIndicatorPosition }) => `
6
+ top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? "0" : "unset"};
7
+ bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? "0" : "unset"};
8
+ left: -2px;
9
+ `;
10
+ const getCircleStyles = ({ dropIndicatorPosition }) => ({
11
+ position: "absolute",
12
+ zIndex: 20,
13
+ top: dropIndicatorPosition === DropIndicatorPosition.After ? "unset" : "-2px",
14
+ bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? "unset" : "-2px",
15
+ left: "0px",
16
+ opacity: 1
17
+ });
18
+ const StyledIndicator = styled.div`
19
+ position: absolute;
20
+ ${getPositionStyles}
21
+ box-sizing: border-box;
22
+ width: ${(props) => props.vertical ? "2px" : "100%"};
23
+ height: ${(props) => props.vertical ? "100%" : "2px"};
24
+ background-color: ${({ isDropValid, theme }) => isDropValid ? theme.colors.brand[600] : theme.colors.danger[900]};
25
+ z-index: 20;
26
+ `;
27
+ const CircleIndicator = (style, isDropValid) => /* @__PURE__ */ React2.createElement("svg", {
28
+ height: "6",
29
+ width: "6",
30
+ style
31
+ }, /* @__PURE__ */ React2.createElement("circle", {
32
+ cx: "3",
33
+ cy: "3",
34
+ r: "3",
35
+ strokeWidth: "0",
36
+ fill: isDropValid ? "#1E79C2" : "#C64252"
37
+ }));
38
+ const DropIndicator = ({ dropIndicatorPosition, isLast, isDropValid }) => {
39
+ if (![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition))
40
+ return null;
41
+ const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;
42
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid), /* @__PURE__ */ React2.createElement(StyledIndicator, {
43
+ dropIndicatorPosition: safeDropIndicatorPosition,
44
+ isDropValid
45
+ }));
46
+ };
47
+ var DropIndicator_default = DropIndicator;
48
+ export {
49
+ DropIndicator_default as default
50
+ };
51
+ //# sourceMappingURL=DropIndicator.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropIndicator.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AASA,MAAM,oBAAoB,CAAC,EAAE,4BAAgD;AAAA,aAChE,0BAA0B,sBAAsB,SAAS,MAAM;AAAA,gBAC5D,0BAA0B,sBAAsB,QAAQ,MAAM;AAAA;AAAA;AAI9E,MAAM,kBAAkB,CAAC,EAAE,4BAAiD;AAAA,EAC1E,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,KAAK,0BAA0B,sBAAsB,QAAQ,UAAU;AAAA,EACvE,QAAQ,0BAA0B,sBAAsB,SAAS,UAAU;AAAA,EAC3E,MAAM;AAAA,EACN,SAAS;AAAA;AAGX,MAAM,kBAAkB,OAAO;AAAA;AAAA,IAE3B;AAAA;AAAA,WAEO,CAAC,UAAW,MAAM,WAAW,QAAQ;AAAA,YACpC,CAAC,UAAW,MAAM,WAAW,SAAS;AAAA,sBAC5B,CAAC,EAAE,aAAa,YAAa,cAAc,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,OAAO;AAAA;AAAA;AAI/G,MAAM,kBAAkB,CAAC,OAAgC,gBACvD,qCAAC,OAAD;AAAA,EAAK,QAAO;AAAA,EAAI,OAAM;AAAA,EAAI;AAAA,GACxB,qCAAC,UAAD;AAAA,EAAQ,IAAG;AAAA,EAAI,IAAG;AAAA,EAAI,GAAE;AAAA,EAAI,aAAY;AAAA,EAAI,MAAM,cAAc,YAAY;AAAA;AAIhF,MAAM,gBAAyD,CAAC,EAAE,uBAAuB,QAAQ,kBAAkB;AACjH,MACE,CAAC,CAAC,sBAAsB,OAAO,sBAAsB,QAAQ,SAC3D;AAGF,WAAO;AAET,QAAM,4BAA4B,SAAS,sBAAsB,SAAS;AAE1E,SACE,4DACG,gBAAgB,gBAAgB,EAAE,uBAAuB,8BAA8B,cACxF,qCAAC,iBAAD;AAAA,IAAiB,uBAAuB;AAAA,IAA2B;AAAA;AAAA;AAKzE,IAAO,wBAAQ;",
6
+ "names": []
7
+ }