@elliemae/ds-treeview 2.3.1 → 3.0.0-alpha.3

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 +163 -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 +134 -0
  14. package/dist/cjs/hoc/WithConditionalDnDContext.js.map +7 -0
  15. package/dist/cjs/hoc/WithDnDSortableItemContext.js +83 -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 +111 -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 +71 -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 +180 -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 +135 -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 +102 -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 +123 -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 +136 -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 +107 -0
  110. package/dist/esm/hoc/WithConditionalDnDContext.js.map +7 -0
  111. package/dist/esm/hoc/WithDnDSortableItemContext.js +56 -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 +84 -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 +44 -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 +153 -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 +108 -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 +75 -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 +96 -0
  192. package/dist/esm/utils/useTree.js.map +7 -0
  193. package/package.json +133 -123
  194. package/cjs/TreeView.js +0 -30
  195. package/cjs/TreeViewContext.js +0 -98
  196. package/cjs/config/cssClassesConstants.js +0 -13
  197. package/cjs/config/useTreeview.js +0 -127
  198. package/cjs/hoc/DnDTreeContext.js +0 -18
  199. package/cjs/hoc/SortableItemContext.js +0 -21
  200. package/cjs/hoc/WithConditionalDnDContext.js +0 -138
  201. package/cjs/hoc/WithDnDSortableItemContext.js +0 -70
  202. package/cjs/index.js +0 -26
  203. package/cjs/parts/CheckboxSelectable.js +0 -86
  204. package/cjs/parts/ChildrenCountDisplayer.js +0 -30
  205. package/cjs/parts/DnDHandle.js +0 -46
  206. package/cjs/parts/DropIndicator.js +0 -75
  207. package/cjs/parts/ExpandCaret.js +0 -94
  208. package/cjs/parts/Icon.js +0 -37
  209. package/cjs/parts/NestingSpace.js +0 -47
  210. package/cjs/parts/RadioSelectable.js +0 -59
  211. package/cjs/parts/TreeItem.js +0 -185
  212. package/cjs/parts/TreeItemText.js +0 -108
  213. package/cjs/parts/TreeList.js +0 -139
  214. package/cjs/plugins/dnd/TreeDndPlugin.js +0 -7
  215. package/cjs/plugins/dnd/index.js +0 -9
  216. package/cjs/plugins/index.js +0 -21
  217. package/cjs/plugins/roving/TreeRovingPlugin.js +0 -7
  218. package/cjs/plugins/roving/index.js +0 -9
  219. package/cjs/plugins/searchable/SearchableTreePlugin.js +0 -7
  220. package/cjs/plugins/searchable/index.js +0 -9
  221. package/cjs/plugins/selectable/SelectablePluginTree.js +0 -7
  222. package/cjs/plugins/selectable/index.js +0 -9
  223. package/cjs/plugins/toolbar/TreeToolbarPlugin.js +0 -7
  224. package/cjs/plugins/toolbar/index.js +0 -9
  225. package/cjs/plugins/tree/TreeDataPlugin.js +0 -7
  226. package/cjs/plugins/tree/index.js +0 -9
  227. package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +0 -7
  228. package/cjs/plugins/virtualization/index.js +0 -9
  229. package/cjs/react-desc-prop-types.js +0 -56
  230. package/cjs/related-components/TreeViewSearchBar.js +0 -48
  231. package/cjs/sharedTypes.js +0 -2
  232. package/cjs/utils/array-helpers.js +0 -24
  233. package/cjs/utils/group-expands-helpers.js +0 -111
  234. package/cjs/utils/keyboard-helpers.js +0 -175
  235. package/cjs/utils/object-helpers.js +0 -69
  236. package/cjs/utils/refs-helpers.js +0 -31
  237. package/cjs/utils/selectable-helper.js +0 -80
  238. package/cjs/utils/string-helpers.js +0 -7
  239. package/cjs/utils/tree-helpers.js +0 -220
  240. package/cjs/utils/useInstanceRefActions.js +0 -87
  241. package/cjs/utils/useTree.js +0 -108
  242. package/esm/TreeView.js +0 -21
  243. package/esm/config/cssClassesConstants.js +0 -6
  244. package/esm/config/useTreeview.js +0 -119
  245. package/esm/hoc/DnDTreeContext.js +0 -14
  246. package/esm/hoc/SortableItemContext.js +0 -17
  247. package/esm/hoc/WithConditionalDnDContext.js +0 -128
  248. package/esm/hoc/WithDnDSortableItemContext.js +0 -61
  249. package/esm/index.js +0 -9
  250. package/esm/parts/CheckboxSelectable.js +0 -78
  251. package/esm/parts/ChildrenCountDisplayer.js +0 -22
  252. package/esm/parts/DnDHandle.js +0 -38
  253. package/esm/parts/DropIndicator.js +0 -68
  254. package/esm/parts/ExpandCaret.js +0 -85
  255. package/esm/parts/Icon.js +0 -29
  256. package/esm/parts/NestingSpace.js +0 -39
  257. package/esm/parts/RadioSelectable.js +0 -53
  258. package/esm/parts/TreeItem.js +0 -173
  259. package/esm/parts/TreeItemText.js +0 -99
  260. package/esm/parts/TreeList.js +0 -127
  261. package/esm/plugins/dnd/TreeDndPlugin.js +0 -3
  262. package/esm/plugins/dnd/index.js +0 -1
  263. package/esm/plugins/index.js +0 -7
  264. package/esm/plugins/roving/TreeRovingPlugin.js +0 -3
  265. package/esm/plugins/roving/index.js +0 -1
  266. package/esm/plugins/searchable/SearchableTreePlugin.js +0 -3
  267. package/esm/plugins/searchable/index.js +0 -1
  268. package/esm/plugins/selectable/SelectablePluginTree.js +0 -3
  269. package/esm/plugins/selectable/index.js +0 -1
  270. package/esm/plugins/toolbar/TreeToolbarPlugin.js +0 -3
  271. package/esm/plugins/toolbar/index.js +0 -1
  272. package/esm/plugins/tree/TreeDataPlugin.js +0 -3
  273. package/esm/plugins/tree/index.js +0 -1
  274. package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +0 -3
  275. package/esm/plugins/virtualization/index.js +0 -1
  276. package/esm/react-desc-prop-types.js +0 -52
  277. package/esm/related-components/TreeViewSearchBar.js +0 -40
  278. package/esm/sharedTypes.js +0 -1
  279. package/esm/utils/group-expands-helpers.js +0 -99
  280. package/esm/utils/object-helpers.js +0 -64
  281. package/esm/utils/refs-helpers.js +0 -27
  282. package/esm/utils/selectable-helper.js +0 -70
  283. package/esm/utils/string-helpers.js +0 -3
  284. package/esm/utils/tree-helpers.js +0 -205
  285. package/esm/utils/useTree.js +0 -99
  286. package/types/TreeView.d.ts +0 -13
  287. package/types/TreeViewContext.d.ts +0 -17
  288. package/types/config/cssClassesConstants.d.ts +0 -4
  289. package/types/config/useTreeview.d.ts +0 -7
  290. package/types/hoc/DnDTreeContext.d.ts +0 -14
  291. package/types/hoc/SortableItemContext.d.ts +0 -19
  292. package/types/hoc/WithConditionalDnDContext.d.ts +0 -4
  293. package/types/hoc/WithDnDSortableItemContext.d.ts +0 -4
  294. package/types/index.d.ts +0 -3
  295. package/types/parts/CheckboxSelectable.d.ts +0 -8
  296. package/types/parts/ChildrenCountDisplayer.d.ts +0 -7
  297. package/types/parts/DnDHandle.d.ts +0 -6
  298. package/types/parts/DropIndicator.d.ts +0 -10
  299. package/types/parts/ExpandCaret.d.ts +0 -7
  300. package/types/parts/Icon.d.ts +0 -7
  301. package/types/parts/NestingSpace.d.ts +0 -8
  302. package/types/parts/RadioSelectable.d.ts +0 -8
  303. package/types/parts/TreeItem.d.ts +0 -17
  304. package/types/parts/TreeItemText.d.ts +0 -7
  305. package/types/parts/TreeList.d.ts +0 -20
  306. package/types/plugins/dnd/TreeDndPlugin.d.ts +0 -1
  307. package/types/plugins/dnd/index.d.ts +0 -1
  308. package/types/plugins/index.d.ts +0 -7
  309. package/types/plugins/roving/TreeRovingPlugin.d.ts +0 -1
  310. package/types/plugins/roving/index.d.ts +0 -1
  311. package/types/plugins/searchable/SearchableTreePlugin.d.ts +0 -1
  312. package/types/plugins/searchable/index.d.ts +0 -1
  313. package/types/plugins/selectable/SelectablePluginTree.d.ts +0 -1
  314. package/types/plugins/selectable/index.d.ts +0 -1
  315. package/types/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -1
  316. package/types/plugins/toolbar/index.d.ts +0 -1
  317. package/types/plugins/tree/TreeDataPlugin.d.ts +0 -1
  318. package/types/plugins/tree/index.d.ts +0 -1
  319. package/types/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -1
  320. package/types/plugins/virtualization/index.d.ts +0 -1
  321. package/types/react-desc-prop-types.d.ts +0 -210
  322. package/types/related-components/TreeViewSearchBar.d.ts +0 -16
  323. package/types/sharedTypes.d.ts +0 -47
  324. package/types/utils/array-helpers.d.ts +0 -2
  325. package/types/utils/group-expands-helpers.d.ts +0 -14
  326. package/types/utils/keyboard-helpers.d.ts +0 -6
  327. package/types/utils/object-helpers.d.ts +0 -6
  328. package/types/utils/refs-helpers.d.ts +0 -4
  329. package/types/utils/selectable-helper.d.ts +0 -7
  330. package/types/utils/string-helpers.d.ts +0 -1
  331. package/types/utils/tree-helpers.d.ts +0 -28
  332. package/types/utils/useInstanceRefActions.d.ts +0 -3
  333. package/types/utils/useTree.d.ts +0 -14
@@ -1,17 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- let DropIndicatorPosition;
4
-
5
- (function (DropIndicatorPosition) {
6
- DropIndicatorPosition[DropIndicatorPosition["None"] = 0] = "None";
7
- DropIndicatorPosition[DropIndicatorPosition["Before"] = 1] = "Before";
8
- DropIndicatorPosition[DropIndicatorPosition["After"] = 2] = "After";
9
- DropIndicatorPosition[DropIndicatorPosition["Inside"] = 3] = "Inside";
10
- })(DropIndicatorPosition || (DropIndicatorPosition = {}));
11
-
12
- /** Context for cross component communication */
13
- const SortableItemContext = /*#__PURE__*/createContext({
14
- draggableProps: false
15
- });
16
-
17
- export { DropIndicatorPosition, SortableItemContext };
@@ -1,128 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.filter.js';
3
- import _jsx from '@babel/runtime/helpers/esm/jsx';
4
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
5
- import 'core-js/modules/web.dom-collections.iterator.js';
6
- import 'core-js/modules/esnext.async-iterator.map.js';
7
- import 'core-js/modules/esnext.iterator.map.js';
8
- import 'core-js/modules/esnext.async-iterator.for-each.js';
9
- import 'core-js/modules/esnext.iterator.constructor.js';
10
- import 'core-js/modules/esnext.iterator.for-each.js';
11
- import 'core-js/modules/esnext.async-iterator.find.js';
12
- import 'core-js/modules/esnext.iterator.find.js';
13
- import React, { useContext, useMemo, useCallback } from 'react';
14
- import { DndContext, DragOverlay } from '@dnd-kit/core';
15
- import { SortableContext } from '@dnd-kit/sortable';
16
- import { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';
17
- import TreeViewContext from '../TreeViewContext.js';
18
- import { TreeItem } from '../parts/TreeItem.js';
19
- import { DnDTreeContext } from './DnDTreeContext.js';
20
- import { jsxs, jsx } from 'react/jsx-runtime';
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
-
26
- const ensure = function (argument) {
27
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'This should never happen';
28
-
29
- if (argument === undefined || argument === null) {
30
- throw new TypeError(message);
31
- }
32
-
33
- return argument;
34
- }; // only wraps in "DnDContext" and "DnDTreeContext" if any Drag and Drop functionality is requested
35
-
36
-
37
- const withConditionalDnDRowContext = Component => props => {
38
- const [lastActiveId, setLastActiveId] = React.useState('');
39
- const {
40
- props: {
41
- data,
42
- onOrderChange,
43
- getIsDropValid
44
- },
45
- flattenedItems,
46
- visibleItems: flattenedVisibleTree,
47
- withDragAndDrop
48
- } = useContext(TreeViewContext);
49
- const flattenedVisibleTreeForDnD = useMemo(() => flattenedVisibleTree.map((item, index) => {
50
- var _item$treeDepth, _item$children$length, _item$children, _item$node$parent$mod, _item$node$parent, _item$node$parent$mod2, _item$node$parent$mod3;
51
-
52
- return {
53
- uid: item.id.toString(),
54
- depth: ((_item$treeDepth = item.treeDepth) !== null && _item$treeDepth !== void 0 ? _item$treeDepth : 1) - 1,
55
- realIndex: index,
56
- childrenCount: (_item$children$length = (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) !== null && _item$children$length !== void 0 ? _item$children$length : 0,
57
- parentId: (_item$node$parent$mod = (_item$node$parent = item.node.parent) === null || _item$node$parent === void 0 ? void 0 : (_item$node$parent$mod2 = _item$node$parent.model) === null || _item$node$parent$mod2 === void 0 ? void 0 : (_item$node$parent$mod3 = _item$node$parent$mod2.id) === null || _item$node$parent$mod3 === void 0 ? void 0 : _item$node$parent$mod3.toString()) !== null && _item$node$parent$mod !== void 0 ? _item$node$parent$mod : null,
58
- original: item
59
- };
60
- }), [flattenedVisibleTree]);
61
- const onReorder = useCallback((tree, indexes) => {
62
- // Pull the row's original data into an object
63
- const nodes = {};
64
- tree.forEach(item => {
65
- const originalItem = item.original;
66
- originalItem.children = [];
67
- nodes[item.uid] = item.original;
68
- });
69
- const newUserTree = [];
70
- tree.forEach(item => {
71
- // If row has parent, insert it to it's subrows
72
- // otherwise append it to the new user data
73
- if (item.parentId !== null && item.parentId !== undefined && item.parentId !== '__ds_tree_root') {
74
- var _parentNode$children;
75
-
76
- const parentNode = nodes[item.parentId];
77
- (_parentNode$children = parentNode.children) === null || _parentNode$children === void 0 ? void 0 : _parentNode$children.push(item.original);
78
- } else if (item.uid !== '__ds_tree_root') newUserTree.push(item.original);
79
- }); // Tell the user that the order has change, he can chose to commit it or not
80
-
81
- onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);
82
- }, [onOrderChange, data, flattenedItems]);
83
- const {
84
- dndContextProps,
85
- sortableContextProps,
86
- activeId,
87
- activeIndex,
88
- depth,
89
- dropIndicatorPosition,
90
- visibleItems,
91
- isDropValid
92
- } = useTreeDndkitConfig({
93
- flattenedItems,
94
- visibleItems: flattenedVisibleTreeForDnD,
95
- isHorizontalDnD: false,
96
- isExpandable: true,
97
- onReorder,
98
- getIsDropValid,
99
- maxDragAndDropLevel: Infinity
100
- });
101
- if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);
102
- if (withDragAndDrop) return /*#__PURE__*/jsxs(DndContext, _objectSpread(_objectSpread({}, dndContextProps), {}, {
103
- children: [/*#__PURE__*/jsx(SortableContext, _objectSpread(_objectSpread({}, sortableContextProps), {}, {
104
- children: /*#__PURE__*/_jsx(DnDTreeContext.Provider, {
105
- value: {
106
- activeIndex,
107
- depth,
108
- visibleItems: visibleItems.map(item => item.original),
109
- dropIndicatorPosition,
110
- lastActiveId,
111
- setLastActiveId,
112
- isDropValid
113
- }
114
- }, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props)))
115
- })), /*#__PURE__*/_jsx(DragOverlay, {
116
- style: {
117
- width: 'auto'
118
- }
119
- }, void 0, activeId ? /*#__PURE__*/_jsx(TreeItem, {
120
- itemIndex: activeIndex,
121
- item: ensure(flattenedVisibleTree.find(item => item.id.toString() === activeId)),
122
- isDragOverlay: true
123
- }) : null)]
124
- }));
125
- return /*#__PURE__*/jsx(Component, _objectSpread({}, props));
126
- };
127
-
128
- export { withConditionalDnDRowContext };
@@ -1,61 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _jsx from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import { useContext, useMemo } from 'react';
9
- import { useSortable } from '@dnd-kit/sortable';
10
- import { SortableItemContext } from './SortableItemContext.js';
11
- import TreeViewContext from '../TreeViewContext.js';
12
- import { DnDTreeContext } from './DnDTreeContext.js';
13
- import { jsx } from 'react/jsx-runtime';
14
-
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
-
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
- const withDnDSortableItemContext = Component => props => {
19
- const {
20
- withDragAndDrop
21
- } = useContext(TreeViewContext);
22
- const {
23
- dropIndicatorPosition,
24
- lastActiveId,
25
- setLastActiveId,
26
- isDropValid
27
- } = useContext(DnDTreeContext);
28
- const id = props.item.id.toString(); // onMount generate unique options, so everyting is only ran once
29
-
30
- const draggableOptions = useMemo(() => ({
31
- id
32
- }), [id]);
33
- const useSortableHelpers = useSortable(draggableOptions); // calculate all the "useSortable" values as per required
34
-
35
- const draggableProps = useMemo(() => {
36
- if (!withDragAndDrop) return false;
37
- const {
38
- index,
39
- overIndex
40
- } = useSortableHelpers;
41
- return _objectSpread(_objectSpread({}, useSortableHelpers), {}, {
42
- shouldShowDropIndicatorPosition: overIndex === index,
43
- dropIndicatorPosition,
44
- lastActiveId,
45
- setLastActiveId,
46
- isDropValid
47
- });
48
- }, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]); // we use a context so we can easly access information wherever without bubbling down
49
- // this context is all Memoized so as long as component is not re-mounted,
50
- // the context won't trigger un-required renders per-se...
51
-
52
- const ctx = useMemo(() => ({
53
- draggableProps
54
- }), [draggableProps]); // we always add the context, if draggableProps===false we don't have the DnD enabled.
55
-
56
- return /*#__PURE__*/_jsx(SortableItemContext.Provider, {
57
- value: ctx
58
- }, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props)));
59
- };
60
-
61
- export { withDnDSortableItemContext };
package/esm/index.js DELETED
@@ -1,9 +0,0 @@
1
- export { TreeView, TreeViewWithSchema } from './TreeView.js';
2
- export { TreeDndPlugin } from './plugins/dnd/TreeDndPlugin.js';
3
- export { TreeRovingPlugin } from './plugins/roving/TreeRovingPlugin.js';
4
- export { SelectablePluginTree } from './plugins/selectable/SelectablePluginTree.js';
5
- export { TreeToolbarPlugin } from './plugins/toolbar/TreeToolbarPlugin.js';
6
- export { TreePluginList } from './plugins/tree/TreeDataPlugin.js';
7
- export { TreeVirtualizationPlugin } from './plugins/virtualization/TreeVirtualizationPlugin.js';
8
- export { SearchableTreePlugin } from './plugins/searchable/SearchableTreePlugin.js';
9
- export { TreeViewSearchBar } from './related-components/TreeViewSearchBar.js';
@@ -1,78 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _jsx from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import { useContext, useCallback, useMemo } from 'react';
9
- import { DSCheckbox } from '@elliemae/ds-form';
10
- import styled from 'styled-components';
11
- import TreeViewContext from '../TreeViewContext.js';
12
- import { toggleCheckboxItem } from '../utils/selectable-helper.js';
13
- import { filterObject } from '../utils/object-helpers.js';
14
-
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
-
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
- const StyledCheckboxWrapper = /*#__PURE__*/styled.span.withConfig({
19
- componentId: "sc-1tyhs3t-0"
20
- })(["padding-top:3px;"]);
21
-
22
- function CheckboxSelectable(props) {
23
- const {
24
- item,
25
- itemIndex
26
- } = props;
27
- const {
28
- id
29
- } = item;
30
- const ctx = useContext(TreeViewContext);
31
- const {
32
- props: {
33
- onSelectionChange,
34
- isItemDisabled
35
- },
36
- virtualListHelpers: {
37
- scrollToIndex
38
- },
39
- triggerTreeRerender,
40
- selectedCheckboxes,
41
- setSelectedCheckboxes
42
- } = ctx;
43
- const onCheckboxChange = useCallback(() => {
44
- const newSelections = toggleCheckboxItem(item);
45
- const newSelectionHasmap = filterObject(_objectSpread(_objectSpread({}, selectedCheckboxes), newSelections), value => value !== false);
46
- setSelectedCheckboxes(newSelectionHasmap);
47
- triggerTreeRerender();
48
- const indexAndScrollTo = {
49
- scrollToItem: () => {
50
- if (typeof item.virtualIndex === 'number') scrollToIndex(item.virtualIndex);
51
- },
52
- itemIndex
53
- };
54
- if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
55
- }, [item, triggerTreeRerender, onSelectionChange, itemIndex, scrollToIndex, selectedCheckboxes, setSelectedCheckboxes]);
56
- const isChecked = useMemo(() => {
57
- if (selectedCheckboxes[id] === 'mixed') {
58
- return 'mixed';
59
- }
60
-
61
- if (selectedCheckboxes[id] === true) {
62
- return true;
63
- }
64
-
65
- return false;
66
- }, [selectedCheckboxes, id]);
67
- const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
68
- return /*#__PURE__*/_jsx(StyledCheckboxWrapper, {}, void 0, /*#__PURE__*/_jsx(DSCheckbox, {
69
- checked: isChecked,
70
- disabled: isDisabled,
71
- className: "em-ds-tree-item-checkbox",
72
- "data-testid": "tree-item-checkbox",
73
- onChange: onCheckboxChange,
74
- tabIndex: "0"
75
- }));
76
- }
77
-
78
- export { CheckboxSelectable as default };
@@ -1,22 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants.js';
4
-
5
- const className = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "-children-count-displayer");
6
- const ChildrenCountDisplayer = props => {
7
- const {
8
- item
9
- } = props;
10
- const {
11
- isGroup,
12
- children
13
- } = item;
14
- if (!isGroup) return null; // return ` | ${children.length} Items`;
15
-
16
- return /*#__PURE__*/_jsx("span", {
17
- "data-testid": "tree-item-children-count-displayer",
18
- className: className
19
- }, void 0, " | ".concat(children.length, " Items"));
20
- };
21
-
22
- export { ChildrenCountDisplayer };
@@ -1,38 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import { useContext, createElement } from 'react';
8
- import { GripperVertical } from '@elliemae/ds-icons';
9
- import { SortableItemContext } from '../hoc/SortableItemContext.js';
10
-
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
-
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
- const DnDHandle = _ref => {
15
- let {
16
- id,
17
- isDragOverlay
18
- } = _ref;
19
- const {
20
- draggableProps
21
- } = useContext(SortableItemContext);
22
- const isDragging = draggableProps && draggableProps.isDragging;
23
- return /*#__PURE__*/createElement(GripperVertical, _objectSpread(_objectSpread({
24
- role: "button"
25
- }, draggableProps && _objectSpread(_objectSpread({}, draggableProps.listeners), draggableProps.attributes)), {}, {
26
- "data-testid": "drag-handle",
27
- "data-isactive": draggableProps && !!draggableProps.active,
28
- "data-isdragoverlay": isDragOverlay,
29
- id: "".concat(id, "-drag-handle"),
30
- key: "".concat(id, "-drag-handle"),
31
- className: "drag-handle ".concat(isDragging ? '' : 'focuseable'),
32
- color: ['brand-primary', '800'],
33
- size: "s",
34
- tabIndex: 0
35
- }));
36
- };
37
-
38
- export { DnDHandle };
@@ -1,68 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import styled from 'styled-components';
4
- import { DropIndicatorPosition } from '../hoc/SortableItemContext.js';
5
- import { jsxs, Fragment } from 'react/jsx-runtime';
6
-
7
- const getPositionStyles = _ref => {
8
- let {
9
- dropIndicatorPosition
10
- } = _ref;
11
- return "\n top: ".concat(dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset', ";\n bottom: ").concat(dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset', ";\n left: -2px;\n ");
12
- };
13
-
14
- const getCircleStyles = _ref2 => {
15
- let {
16
- dropIndicatorPosition
17
- } = _ref2;
18
- return {
19
- position: 'absolute',
20
- zIndex: 20,
21
- top: dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',
22
- bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',
23
- left: '0px',
24
- opacity: 1
25
- };
26
- };
27
-
28
- const StyledIndicator = /*#__PURE__*/styled.div.withConfig({
29
- componentId: "sc-1812zh0-0"
30
- })(["position:absolute;", " box-sizing:border-box;width:", ";height:", ";background-color:", ";z-index:20;"], getPositionStyles, props => props.vertical ? '2px' : '100%', props => props.vertical ? '100%' : '2px', _ref3 => {
31
- let {
32
- isDropValid,
33
- theme
34
- } = _ref3;
35
- return isDropValid ? theme.colors.brand[600] : theme.colors.danger[900];
36
- });
37
-
38
- const CircleIndicator = (style, isDropValid) => /*#__PURE__*/_jsx("svg", {
39
- height: "6",
40
- width: "6",
41
- style: style
42
- }, void 0, /*#__PURE__*/_jsx("circle", {
43
- cx: "3",
44
- cy: "3",
45
- r: "3",
46
- strokeWidth: "0",
47
- fill: isDropValid ? '#1E79C2' : '#C64252'
48
- }));
49
-
50
- const DropIndicator = _ref4 => {
51
- let {
52
- dropIndicatorPosition,
53
- isLast,
54
- isDropValid
55
- } = _ref4;
56
- if (![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition)) return null;
57
- const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;
58
- return /*#__PURE__*/jsxs(Fragment, {
59
- children: [CircleIndicator(getCircleStyles({
60
- dropIndicatorPosition: safeDropIndicatorPosition
61
- }), isDropValid), /*#__PURE__*/_jsx(StyledIndicator, {
62
- dropIndicatorPosition: safeDropIndicatorPosition,
63
- isDropValid: isDropValid
64
- })]
65
- });
66
- };
67
-
68
- export { DropIndicator as default };
@@ -1,85 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useCallback, useContext } from 'react';
3
- import Button from '@elliemae/ds-button';
4
- import { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';
5
- import { toggleItemExpand } from '../utils/group-expands-helpers.js';
6
- import { focusItem } from '../utils/tree-helpers.js';
7
- import TreeViewContext from '../TreeViewContext.js';
8
-
9
- var _ArrowheadDown, _ArrowheadRight;
10
- const ExpandCaret = props => {
11
- const defaultHandleExpandGroup = useCallback(toggleItemExpand, []);
12
- const {
13
- item
14
- } = props;
15
- const {
16
- id,
17
- isExpanded,
18
- isGroup,
19
- children
20
- } = item;
21
- const isGroupOrHasChildrens = isGroup || Array.isArray(children) && children.length > 0;
22
- const ctx = useContext(TreeViewContext);
23
- const {
24
- props: {
25
- onItemFocus
26
- },
27
- handleExpandGroup = defaultHandleExpandGroup,
28
- triggerTreeRerender,
29
- updateUserExpandedState,
30
- setLatestToggledItem,
31
- setFocusedItem,
32
- virtualListHelpers: {
33
- scrollToIndex
34
- }
35
- } = ctx;
36
- if (isGroupOrHasChildrens) return /*#__PURE__*/_jsx(Button, {
37
- buttonType: "text",
38
- className: "expandable-arrow",
39
- "data-testid": "tree-item-expand-toggle",
40
- icon: isExpanded ? _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx(ArrowheadDown, {
41
- size: "s",
42
- "data-testid": "ic-arrow-head-down"
43
- })) : _ArrowheadRight || (_ArrowheadRight = /*#__PURE__*/_jsx(ArrowheadRight, {
44
- size: "s",
45
- "data-testid": "ic-arrow-head-right"
46
- })),
47
- onMouseDown: e => {
48
- // prevent focusing the caret
49
- if (e) {
50
- e.preventDefault();
51
- }
52
- },
53
- onClick: e => {
54
- e.stopPropagation();
55
- if (e) handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);
56
- setLatestToggledItem(item);
57
- const itemVitualIndex = item.virtualIndex;
58
-
59
- if (typeof itemVitualIndex === 'number') {
60
- onItemFocus({
61
- itemIndex: itemVitualIndex,
62
- scrollToItem: function () {
63
- let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
64
- align: 'start'
65
- };
66
- return scrollToIndex(itemVitualIndex, opts);
67
- },
68
- item
69
- });
70
- }
71
-
72
- setFocusedItem(item);
73
- focusItem(item);
74
- },
75
- size: "s",
76
- tabIndex: -1
77
- }, "".concat(id, "-expand-addon"));
78
- return /*#__PURE__*/_jsx("div", {
79
- style: {
80
- width: '24px'
81
- }
82
- });
83
- };
84
-
85
- export { ExpandCaret };
package/esm/parts/Icon.js DELETED
@@ -1,29 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { cx } from '@elliemae/ds-utilities';
3
- import TreeViewContext from '../TreeViewContext.js';
4
-
5
- const Icon = props => {
6
- const {
7
- item
8
- } = props;
9
- const isGroupOrHasChildrens = item.isGroup || Array.isArray(item.children) && item.children.length > 0;
10
- const ctx = useContext(TreeViewContext);
11
- const {
12
- props: {
13
- groupIcon,
14
- itemIcon
15
- }
16
- } = ctx;
17
- const icon = isGroupOrHasChildrens ? groupIcon : itemIcon;
18
- if (!icon) return null;
19
- return /*#__PURE__*/React.cloneElement(icon, {
20
- 'data-testid': isGroupOrHasChildrens ? 'tree-item-group-icon' : 'tree-item-icon',
21
- // legacy class-name way of handling things,
22
- // this will eventually be deprecated in favor of styled components
23
- // untill then, just eslint-ignore and move on
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
25
- className: cx(icon.props.className, 'tree-item-icon')
26
- });
27
- };
28
-
29
- export { Icon };
@@ -1,39 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
-
4
- const getItemNestingLeftPadding = (level, opts) => {
5
- const {
6
- spaceForNestingLevel = 1.5
7
- } = opts;
8
- const groupLeftPadding = spaceForNestingLevel * (level - 1);
9
- const finalLeftPadding = groupLeftPadding + spaceForNestingLevel - 0.1; // root level left-padding would be negative and would not be applied
10
- // if "root-level" nesting, then defaults to 0 left-padding.
11
-
12
- return finalLeftPadding > 0 ? "".concat(finalLeftPadding, "em") : '0';
13
- };
14
-
15
- const NestingSpace = props => {
16
- const {
17
- item,
18
- spaceForNestingLevel
19
- } = props;
20
- const {
21
- treeDepth
22
- } = item;
23
-
24
- if (treeDepth) {
25
- const itemNestingLeftPadding = getItemNestingLeftPadding(treeDepth - 1, {
26
- spaceForNestingLevel
27
- });
28
- return /*#__PURE__*/_jsx("div", {
29
- "data-testid": "tree-item-nested-space",
30
- style: {
31
- width: itemNestingLeftPadding
32
- }
33
- });
34
- }
35
-
36
- return null;
37
- };
38
-
39
- export { NestingSpace };
@@ -1,53 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext, useCallback, useMemo } from 'react';
3
- import { DSRadio } from '@elliemae/ds-form';
4
- import TreeViewContext from '../TreeViewContext.js';
5
-
6
- function RadioSelectable(props) {
7
- const {
8
- item,
9
- itemIndex
10
- } = props;
11
- const ctx = useContext(TreeViewContext);
12
- const {
13
- props: {
14
- onSelectionChange,
15
- isItemDisabled
16
- },
17
- virtualListHelpers: {
18
- scrollToIndex
19
- },
20
- uniqueTreeViewUUID,
21
- selectedCheckboxes,
22
- setSelectedCheckboxes
23
- } = ctx;
24
- const {
25
- id
26
- } = item;
27
- const onRadioChange = useCallback(() => {
28
- const newSelectionHasmap = {
29
- [id]: true
30
- };
31
- setSelectedCheckboxes(newSelectionHasmap);
32
- const indexAndScrollTo = {
33
- scrollToItem: () => {
34
- if (item.virtualIndex) scrollToIndex(item.virtualIndex);
35
- },
36
- itemIndex
37
- };
38
- if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
39
- }, [id, setSelectedCheckboxes, itemIndex, onSelectionChange, item, scrollToIndex]);
40
- const radioName = useMemo(() => "radios-".concat(uniqueTreeViewUUID), [uniqueTreeViewUUID]);
41
- const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
42
- return /*#__PURE__*/_jsx(DSRadio, {
43
- checked: selectedCheckboxes[id] === true,
44
- name: radioName,
45
- disabled: isDisabled,
46
- className: "em-ds-tree-item-radio",
47
- "data-testid": "tree-item-radio",
48
- onChange: onRadioChange,
49
- tabIndex: 0
50
- });
51
- }
52
-
53
- export { RadioSelectable as default };