@elliemae/ds-treeview 2.3.0-alpha.9 → 2.3.0-next.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/cjs/TreeView.js +30 -0
  2. package/cjs/TreeViewContext.js +98 -0
  3. package/cjs/config/cssClassesConstants.js +13 -0
  4. package/cjs/config/useTreeview.js +127 -0
  5. package/cjs/hoc/DnDTreeContext.js +18 -0
  6. package/cjs/hoc/SortableItemContext.js +21 -0
  7. package/cjs/hoc/WithConditionalDnDContext.js +138 -0
  8. package/cjs/hoc/WithDnDSortableItemContext.js +70 -0
  9. package/cjs/index.js +26 -0
  10. package/cjs/parts/CheckboxSelectable.js +86 -0
  11. package/cjs/parts/ChildrenCountDisplayer.js +30 -0
  12. package/cjs/parts/DnDHandle.js +46 -0
  13. package/cjs/parts/DropIndicator.js +75 -0
  14. package/cjs/parts/ExpandCaret.js +94 -0
  15. package/cjs/parts/Icon.js +37 -0
  16. package/cjs/parts/NestingSpace.js +47 -0
  17. package/cjs/parts/RadioSelectable.js +59 -0
  18. package/cjs/parts/TreeItem.js +185 -0
  19. package/cjs/parts/TreeItemText.js +108 -0
  20. package/cjs/parts/TreeList.js +139 -0
  21. package/cjs/plugins/dnd/TreeDndPlugin.js +7 -0
  22. package/cjs/plugins/dnd/index.js +9 -0
  23. package/cjs/plugins/index.js +21 -0
  24. package/cjs/plugins/roving/TreeRovingPlugin.js +7 -0
  25. package/cjs/plugins/roving/index.js +9 -0
  26. package/cjs/plugins/searchable/SearchableTreePlugin.js +7 -0
  27. package/cjs/plugins/searchable/index.js +9 -0
  28. package/cjs/plugins/selectable/SelectablePluginTree.js +7 -0
  29. package/cjs/plugins/selectable/index.js +9 -0
  30. package/cjs/plugins/toolbar/TreeToolbarPlugin.js +7 -0
  31. package/cjs/plugins/toolbar/index.js +9 -0
  32. package/cjs/plugins/tree/TreeDataPlugin.js +7 -0
  33. package/cjs/plugins/tree/index.js +9 -0
  34. package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +7 -0
  35. package/cjs/plugins/virtualization/index.js +9 -0
  36. package/cjs/react-desc-prop-types.js +56 -0
  37. package/cjs/related-components/TreeViewSearchBar.js +48 -0
  38. package/cjs/sharedTypes.js +2 -0
  39. package/cjs/utils/array-helpers.js +24 -0
  40. package/cjs/utils/group-expands-helpers.js +111 -0
  41. package/cjs/utils/keyboard-helpers.js +175 -0
  42. package/cjs/utils/object-helpers.js +69 -0
  43. package/cjs/utils/refs-helpers.js +31 -0
  44. package/cjs/utils/selectable-helper.js +80 -0
  45. package/cjs/utils/string-helpers.js +7 -0
  46. package/cjs/utils/tree-helpers.js +220 -0
  47. package/cjs/utils/useInstanceRefActions.js +87 -0
  48. package/cjs/utils/useTree.js +108 -0
  49. package/esm/TreeView.js +21 -0
  50. package/{dist/esm → esm}/TreeViewContext.js +29 -24
  51. package/esm/config/cssClassesConstants.js +6 -0
  52. package/esm/config/useTreeview.js +119 -0
  53. package/esm/hoc/DnDTreeContext.js +14 -0
  54. package/esm/hoc/SortableItemContext.js +17 -0
  55. package/esm/hoc/WithConditionalDnDContext.js +128 -0
  56. package/esm/hoc/WithDnDSortableItemContext.js +61 -0
  57. package/esm/index.js +9 -0
  58. package/esm/parts/CheckboxSelectable.js +78 -0
  59. package/esm/parts/ChildrenCountDisplayer.js +22 -0
  60. package/esm/parts/DnDHandle.js +38 -0
  61. package/esm/parts/DropIndicator.js +68 -0
  62. package/esm/parts/ExpandCaret.js +85 -0
  63. package/esm/parts/Icon.js +29 -0
  64. package/esm/parts/NestingSpace.js +39 -0
  65. package/esm/parts/RadioSelectable.js +53 -0
  66. package/esm/parts/TreeItem.js +173 -0
  67. package/esm/parts/TreeItemText.js +99 -0
  68. package/esm/parts/TreeList.js +127 -0
  69. package/esm/plugins/dnd/TreeDndPlugin.js +3 -0
  70. package/esm/plugins/dnd/index.js +1 -0
  71. package/esm/plugins/index.js +7 -0
  72. package/esm/plugins/roving/TreeRovingPlugin.js +3 -0
  73. package/esm/plugins/roving/index.js +1 -0
  74. package/esm/plugins/searchable/SearchableTreePlugin.js +3 -0
  75. package/esm/plugins/searchable/index.js +1 -0
  76. package/esm/plugins/selectable/SelectablePluginTree.js +3 -0
  77. package/esm/plugins/selectable/index.js +1 -0
  78. package/esm/plugins/toolbar/TreeToolbarPlugin.js +3 -0
  79. package/esm/plugins/toolbar/index.js +1 -0
  80. package/esm/plugins/tree/TreeDataPlugin.js +3 -0
  81. package/esm/plugins/tree/index.js +1 -0
  82. package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +3 -0
  83. package/esm/plugins/virtualization/index.js +1 -0
  84. package/esm/react-desc-prop-types.js +52 -0
  85. package/esm/related-components/TreeViewSearchBar.js +40 -0
  86. package/esm/sharedTypes.js +1 -0
  87. package/{dist/esm → esm}/utils/array-helpers.js +6 -6
  88. package/esm/utils/group-expands-helpers.js +99 -0
  89. package/{dist/esm → esm}/utils/keyboard-helpers.js +71 -43
  90. package/esm/utils/object-helpers.js +64 -0
  91. package/esm/utils/refs-helpers.js +27 -0
  92. package/esm/utils/selectable-helper.js +70 -0
  93. package/esm/utils/string-helpers.js +3 -0
  94. package/esm/utils/tree-helpers.js +205 -0
  95. package/{dist/esm → esm}/utils/useInstanceRefActions.js +35 -21
  96. package/esm/utils/useTree.js +99 -0
  97. package/package.json +121 -124
  98. package/{dist/types → types}/TreeView.d.ts +0 -0
  99. package/{dist/types → types}/TreeViewContext.d.ts +0 -0
  100. package/{dist/types → types}/config/cssClassesConstants.d.ts +0 -0
  101. package/{dist/types → types}/config/useTreeview.d.ts +0 -0
  102. package/{dist/types → types}/hoc/DnDTreeContext.d.ts +0 -0
  103. package/{dist/types → types}/hoc/SortableItemContext.d.ts +0 -0
  104. package/{dist/types → types}/hoc/WithConditionalDnDContext.d.ts +0 -0
  105. package/{dist/types → types}/hoc/WithDnDSortableItemContext.d.ts +0 -0
  106. package/{dist/types → types}/index.d.ts +0 -0
  107. package/{dist/types → types}/parts/CheckboxSelectable.d.ts +0 -0
  108. package/{dist/types → types}/parts/ChildrenCountDisplayer.d.ts +0 -0
  109. package/{dist/types → types}/parts/DnDHandle.d.ts +0 -0
  110. package/{dist/types → types}/parts/DropIndicator.d.ts +0 -0
  111. package/{dist/types → types}/parts/ExpandCaret.d.ts +0 -0
  112. package/{dist/types → types}/parts/Icon.d.ts +0 -0
  113. package/{dist/types → types}/parts/NestingSpace.d.ts +0 -0
  114. package/{dist/types → types}/parts/RadioSelectable.d.ts +0 -0
  115. package/{dist/types → types}/parts/TreeItem.d.ts +0 -0
  116. package/{dist/types → types}/parts/TreeItemText.d.ts +0 -0
  117. package/{dist/types → types}/parts/TreeList.d.ts +0 -0
  118. package/{dist/types → types}/plugins/dnd/TreeDndPlugin.d.ts +0 -0
  119. package/{dist/types → types}/plugins/dnd/index.d.ts +0 -0
  120. package/{dist/types → types}/plugins/index.d.ts +0 -0
  121. package/{dist/types → types}/plugins/roving/TreeRovingPlugin.d.ts +0 -0
  122. package/{dist/types → types}/plugins/roving/index.d.ts +0 -0
  123. package/{dist/types → types}/plugins/searchable/SearchableTreePlugin.d.ts +0 -0
  124. package/{dist/types → types}/plugins/searchable/index.d.ts +0 -0
  125. package/{dist/types → types}/plugins/selectable/SelectablePluginTree.d.ts +0 -0
  126. package/{dist/types → types}/plugins/selectable/index.d.ts +0 -0
  127. package/{dist/types → types}/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -0
  128. package/{dist/types → types}/plugins/toolbar/index.d.ts +0 -0
  129. package/{dist/types → types}/plugins/tree/TreeDataPlugin.d.ts +0 -0
  130. package/{dist/types → types}/plugins/tree/index.d.ts +0 -0
  131. package/{dist/types → types}/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -0
  132. package/{dist/types → types}/plugins/virtualization/index.d.ts +0 -0
  133. package/{dist/types → types}/react-desc-prop-types.d.ts +0 -0
  134. package/{dist/types → types}/related-components/TreeViewSearchBar.d.ts +0 -0
  135. package/{dist/types → types}/sharedTypes.d.ts +0 -0
  136. package/{dist/types → types}/utils/array-helpers.d.ts +0 -0
  137. package/{dist/types → types}/utils/group-expands-helpers.d.ts +0 -0
  138. package/{dist/types → types}/utils/keyboard-helpers.d.ts +0 -0
  139. package/{dist/types → types}/utils/object-helpers.d.ts +0 -0
  140. package/{dist/types → types}/utils/refs-helpers.d.ts +0 -0
  141. package/{dist/types → types}/utils/selectable-helper.d.ts +0 -0
  142. package/{dist/types → types}/utils/string-helpers.d.ts +0 -0
  143. package/{dist/types → types}/utils/tree-helpers.d.ts +0 -0
  144. package/{dist/types → types}/utils/useInstanceRefActions.d.ts +0 -0
  145. package/{dist/types → types}/utils/useTree.d.ts +0 -0
  146. package/dist/cjs/TreeView.js +0 -50
  147. package/dist/cjs/TreeView.js.map +0 -7
  148. package/dist/cjs/TreeViewContext.js +0 -116
  149. package/dist/cjs/TreeViewContext.js.map +0 -7
  150. package/dist/cjs/config/cssClassesConstants.js +0 -41
  151. package/dist/cjs/config/cssClassesConstants.js.map +0 -7
  152. package/dist/cjs/config/useTreeview.js +0 -151
  153. package/dist/cjs/config/useTreeview.js.map +0 -7
  154. package/dist/cjs/hoc/DnDTreeContext.js +0 -45
  155. package/dist/cjs/hoc/DnDTreeContext.js.map +0 -7
  156. package/dist/cjs/hoc/SortableItemContext.js +0 -46
  157. package/dist/cjs/hoc/SortableItemContext.js.map +0 -7
  158. package/dist/cjs/hoc/WithConditionalDnDContext.js +0 -128
  159. package/dist/cjs/hoc/WithConditionalDnDContext.js.map +0 -7
  160. package/dist/cjs/hoc/WithDnDSortableItemContext.js +0 -69
  161. package/dist/cjs/hoc/WithDnDSortableItemContext.js.map +0 -7
  162. package/dist/cjs/index.js +0 -37
  163. package/dist/cjs/index.js.map +0 -7
  164. package/dist/cjs/parts/CheckboxSelectable.js +0 -97
  165. package/dist/cjs/parts/CheckboxSelectable.js.map +0 -7
  166. package/dist/cjs/parts/ChildrenCountDisplayer.js +0 -47
  167. package/dist/cjs/parts/ChildrenCountDisplayer.js.map +0 -7
  168. package/dist/cjs/parts/DnDHandle.js +0 -57
  169. package/dist/cjs/parts/DnDHandle.js.map +0 -7
  170. package/dist/cjs/parts/DropIndicator.js +0 -80
  171. package/dist/cjs/parts/DropIndicator.js.map +0 -7
  172. package/dist/cjs/parts/ExpandCaret.js +0 -96
  173. package/dist/cjs/parts/ExpandCaret.js.map +0 -7
  174. package/dist/cjs/parts/Icon.js +0 -52
  175. package/dist/cjs/parts/Icon.js.map +0 -7
  176. package/dist/cjs/parts/NestingSpace.js +0 -55
  177. package/dist/cjs/parts/NestingSpace.js.map +0 -7
  178. package/dist/cjs/parts/RadioSelectable.js +0 -74
  179. package/dist/cjs/parts/RadioSelectable.js.map +0 -7
  180. package/dist/cjs/parts/TreeItem.js +0 -166
  181. package/dist/cjs/parts/TreeItem.js.map +0 -7
  182. package/dist/cjs/parts/TreeItemText.js +0 -101
  183. package/dist/cjs/parts/TreeItemText.js.map +0 -7
  184. package/dist/cjs/parts/TreeList.js +0 -123
  185. package/dist/cjs/parts/TreeList.js.map +0 -7
  186. package/dist/cjs/plugins/dnd/TreeDndPlugin.js +0 -35
  187. package/dist/cjs/plugins/dnd/TreeDndPlugin.js.map +0 -7
  188. package/dist/cjs/plugins/dnd/index.js +0 -28
  189. package/dist/cjs/plugins/dnd/index.js.map +0 -7
  190. package/dist/cjs/plugins/index.js +0 -34
  191. package/dist/cjs/plugins/index.js.map +0 -7
  192. package/dist/cjs/plugins/roving/TreeRovingPlugin.js +0 -35
  193. package/dist/cjs/plugins/roving/TreeRovingPlugin.js.map +0 -7
  194. package/dist/cjs/plugins/roving/index.js +0 -28
  195. package/dist/cjs/plugins/roving/index.js.map +0 -7
  196. package/dist/cjs/plugins/searchable/SearchableTreePlugin.js +0 -35
  197. package/dist/cjs/plugins/searchable/SearchableTreePlugin.js.map +0 -7
  198. package/dist/cjs/plugins/searchable/index.js +0 -28
  199. package/dist/cjs/plugins/searchable/index.js.map +0 -7
  200. package/dist/cjs/plugins/selectable/SelectablePluginTree.js +0 -35
  201. package/dist/cjs/plugins/selectable/SelectablePluginTree.js.map +0 -7
  202. package/dist/cjs/plugins/selectable/index.js +0 -28
  203. package/dist/cjs/plugins/selectable/index.js.map +0 -7
  204. package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js +0 -35
  205. package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +0 -7
  206. package/dist/cjs/plugins/toolbar/index.js +0 -28
  207. package/dist/cjs/plugins/toolbar/index.js.map +0 -7
  208. package/dist/cjs/plugins/tree/TreeDataPlugin.js +0 -35
  209. package/dist/cjs/plugins/tree/TreeDataPlugin.js.map +0 -7
  210. package/dist/cjs/plugins/tree/index.js +0 -28
  211. package/dist/cjs/plugins/tree/index.js.map +0 -7
  212. package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +0 -35
  213. package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -7
  214. package/dist/cjs/plugins/virtualization/index.js +0 -28
  215. package/dist/cjs/plugins/virtualization/index.js.map +0 -7
  216. package/dist/cjs/react-desc-prop-types.js +0 -85
  217. package/dist/cjs/react-desc-prop-types.js.map +0 -7
  218. package/dist/cjs/related-components/TreeViewSearchBar.js +0 -50
  219. package/dist/cjs/related-components/TreeViewSearchBar.js.map +0 -7
  220. package/dist/cjs/sharedTypes.js +0 -27
  221. package/dist/cjs/sharedTypes.js.map +0 -7
  222. package/dist/cjs/utils/array-helpers.js +0 -48
  223. package/dist/cjs/utils/array-helpers.js.map +0 -7
  224. package/dist/cjs/utils/group-expands-helpers.js +0 -138
  225. package/dist/cjs/utils/group-expands-helpers.js.map +0 -7
  226. package/dist/cjs/utils/keyboard-helpers.js +0 -170
  227. package/dist/cjs/utils/keyboard-helpers.js.map +0 -7
  228. package/dist/cjs/utils/object-helpers.js +0 -76
  229. package/dist/cjs/utils/object-helpers.js.map +0 -7
  230. package/dist/cjs/utils/refs-helpers.js +0 -52
  231. package/dist/cjs/utils/refs-helpers.js.map +0 -7
  232. package/dist/cjs/utils/selectable-helper.js +0 -88
  233. package/dist/cjs/utils/selectable-helper.js.map +0 -7
  234. package/dist/cjs/utils/string-helpers.js +0 -35
  235. package/dist/cjs/utils/string-helpers.js.map +0 -7
  236. package/dist/cjs/utils/tree-helpers.js +0 -184
  237. package/dist/cjs/utils/tree-helpers.js.map +0 -7
  238. package/dist/cjs/utils/useInstanceRefActions.js +0 -98
  239. package/dist/cjs/utils/useInstanceRefActions.js.map +0 -7
  240. package/dist/cjs/utils/useTree.js +0 -106
  241. package/dist/cjs/utils/useTree.js.map +0 -7
  242. package/dist/esm/TreeView.js +0 -21
  243. package/dist/esm/TreeView.js.map +0 -7
  244. package/dist/esm/TreeViewContext.js.map +0 -7
  245. package/dist/esm/config/cssClassesConstants.js +0 -12
  246. package/dist/esm/config/cssClassesConstants.js.map +0 -7
  247. package/dist/esm/config/useTreeview.js +0 -122
  248. package/dist/esm/config/useTreeview.js.map +0 -7
  249. package/dist/esm/hoc/DnDTreeContext.js +0 -16
  250. package/dist/esm/hoc/DnDTreeContext.js.map +0 -7
  251. package/dist/esm/hoc/SortableItemContext.js +0 -17
  252. package/dist/esm/hoc/SortableItemContext.js.map +0 -7
  253. package/dist/esm/hoc/WithConditionalDnDContext.js +0 -99
  254. package/dist/esm/hoc/WithConditionalDnDContext.js.map +0 -7
  255. package/dist/esm/hoc/WithDnDSortableItemContext.js +0 -40
  256. package/dist/esm/hoc/WithDnDSortableItemContext.js.map +0 -7
  257. package/dist/esm/index.js +0 -8
  258. package/dist/esm/index.js.map +0 -7
  259. package/dist/esm/parts/CheckboxSelectable.js +0 -68
  260. package/dist/esm/parts/CheckboxSelectable.js.map +0 -7
  261. package/dist/esm/parts/ChildrenCountDisplayer.js +0 -18
  262. package/dist/esm/parts/ChildrenCountDisplayer.js.map +0 -7
  263. package/dist/esm/parts/DnDHandle.js +0 -28
  264. package/dist/esm/parts/DnDHandle.js.map +0 -7
  265. package/dist/esm/parts/DropIndicator.js +0 -51
  266. package/dist/esm/parts/DropIndicator.js.map +0 -7
  267. package/dist/esm/parts/ExpandCaret.js +0 -67
  268. package/dist/esm/parts/ExpandCaret.js.map +0 -7
  269. package/dist/esm/parts/Icon.js +0 -23
  270. package/dist/esm/parts/Icon.js.map +0 -7
  271. package/dist/esm/parts/NestingSpace.js +0 -26
  272. package/dist/esm/parts/NestingSpace.js.map +0 -7
  273. package/dist/esm/parts/RadioSelectable.js +0 -45
  274. package/dist/esm/parts/RadioSelectable.js.map +0 -7
  275. package/dist/esm/parts/TreeItem.js +0 -137
  276. package/dist/esm/parts/TreeItem.js.map +0 -7
  277. package/dist/esm/parts/TreeItemText.js +0 -72
  278. package/dist/esm/parts/TreeItemText.js.map +0 -7
  279. package/dist/esm/parts/TreeList.js +0 -94
  280. package/dist/esm/parts/TreeList.js.map +0 -7
  281. package/dist/esm/plugins/dnd/TreeDndPlugin.js +0 -6
  282. package/dist/esm/plugins/dnd/TreeDndPlugin.js.map +0 -7
  283. package/dist/esm/plugins/dnd/index.js +0 -3
  284. package/dist/esm/plugins/dnd/index.js.map +0 -7
  285. package/dist/esm/plugins/index.js +0 -9
  286. package/dist/esm/plugins/index.js.map +0 -7
  287. package/dist/esm/plugins/roving/TreeRovingPlugin.js +0 -6
  288. package/dist/esm/plugins/roving/TreeRovingPlugin.js.map +0 -7
  289. package/dist/esm/plugins/roving/index.js +0 -3
  290. package/dist/esm/plugins/roving/index.js.map +0 -7
  291. package/dist/esm/plugins/searchable/SearchableTreePlugin.js +0 -6
  292. package/dist/esm/plugins/searchable/SearchableTreePlugin.js.map +0 -7
  293. package/dist/esm/plugins/searchable/index.js +0 -3
  294. package/dist/esm/plugins/searchable/index.js.map +0 -7
  295. package/dist/esm/plugins/selectable/SelectablePluginTree.js +0 -6
  296. package/dist/esm/plugins/selectable/SelectablePluginTree.js.map +0 -7
  297. package/dist/esm/plugins/selectable/index.js +0 -3
  298. package/dist/esm/plugins/selectable/index.js.map +0 -7
  299. package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js +0 -6
  300. package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js.map +0 -7
  301. package/dist/esm/plugins/toolbar/index.js +0 -3
  302. package/dist/esm/plugins/toolbar/index.js.map +0 -7
  303. package/dist/esm/plugins/tree/TreeDataPlugin.js +0 -6
  304. package/dist/esm/plugins/tree/TreeDataPlugin.js.map +0 -7
  305. package/dist/esm/plugins/tree/index.js +0 -3
  306. package/dist/esm/plugins/tree/index.js.map +0 -7
  307. package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js +0 -6
  308. package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -7
  309. package/dist/esm/plugins/virtualization/index.js +0 -3
  310. package/dist/esm/plugins/virtualization/index.js.map +0 -7
  311. package/dist/esm/react-desc-prop-types.js +0 -56
  312. package/dist/esm/react-desc-prop-types.js.map +0 -7
  313. package/dist/esm/related-components/TreeViewSearchBar.js +0 -21
  314. package/dist/esm/related-components/TreeViewSearchBar.js.map +0 -7
  315. package/dist/esm/sharedTypes.js +0 -2
  316. package/dist/esm/sharedTypes.js.map +0 -7
  317. package/dist/esm/utils/array-helpers.js.map +0 -7
  318. package/dist/esm/utils/group-expands-helpers.js +0 -109
  319. package/dist/esm/utils/group-expands-helpers.js.map +0 -7
  320. package/dist/esm/utils/keyboard-helpers.js.map +0 -7
  321. package/dist/esm/utils/object-helpers.js +0 -47
  322. package/dist/esm/utils/object-helpers.js.map +0 -7
  323. package/dist/esm/utils/refs-helpers.js +0 -23
  324. package/dist/esm/utils/refs-helpers.js.map +0 -7
  325. package/dist/esm/utils/selectable-helper.js +0 -59
  326. package/dist/esm/utils/selectable-helper.js.map +0 -7
  327. package/dist/esm/utils/string-helpers.js +0 -6
  328. package/dist/esm/utils/string-helpers.js.map +0 -7
  329. package/dist/esm/utils/tree-helpers.js +0 -155
  330. package/dist/esm/utils/tree-helpers.js.map +0 -7
  331. package/dist/esm/utils/useInstanceRefActions.js.map +0 -7
  332. package/dist/esm/utils/useTree.js +0 -77
  333. package/dist/esm/utils/useTree.js.map +0 -7
@@ -0,0 +1,22 @@
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 };
@@ -0,0 +1,38 @@
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 };
@@ -0,0 +1,68 @@
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 };
@@ -0,0 +1,85 @@
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 };
@@ -0,0 +1,29 @@
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 };
@@ -0,0 +1,39 @@
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 };
@@ -0,0 +1,53 @@
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 };
@@ -0,0 +1,173 @@
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, useCallback } from 'react';
9
+ import { aggregatedClasses } from '@elliemae/ds-classnames';
10
+ import RadioSelectable from './RadioSelectable.js';
11
+ import CheckboxSelectable from './CheckboxSelectable.js';
12
+ import TreeViewContext from '../TreeViewContext.js';
13
+ import { setMultipleRefs } from '../utils/refs-helpers.js';
14
+ import { useOnItemKeyDown } from '../utils/keyboard-helpers.js';
15
+ import { NestingSpace } from './NestingSpace.js';
16
+ import { Icon } from './Icon.js';
17
+ import { ExpandCaret } from './ExpandCaret.js';
18
+ import { TreeItemText } from './TreeItemText.js';
19
+ import { treeItemBlockName, DSTreeViewPrefix } from '../config/cssClassesConstants.js';
20
+ import { DnDHandle } from './DnDHandle.js';
21
+ import { withDnDSortableItemContext } from '../hoc/WithDnDSortableItemContext.js';
22
+ import { SortableItemContext, DropIndicatorPosition } from '../hoc/SortableItemContext.js';
23
+ import DropIndicator from './DropIndicator.js';
24
+ import { jsxs } from 'react/jsx-runtime';
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+ const TreeListItem = aggregatedClasses('li', {
30
+ 'data-testid': treeItemBlockName,
31
+ role: 'treeitem' // temp fix untill we move to styled components
32
+
33
+ })(treeItemBlockName);
34
+ const TreeListItemAddonsWrapper = aggregatedClasses('div')(treeItemBlockName, 'addons' // temp fix untill we move to styled components
35
+ );
36
+ const TreeItem = props => {
37
+ const {
38
+ item,
39
+ itemIndex,
40
+ itemWrapperStyle = {},
41
+ virtualItemRef,
42
+ spaceForNestingLevel = 1.5,
43
+ isDragOverlay = false
44
+ } = props;
45
+ const {
46
+ id,
47
+ node
48
+ } = item;
49
+ const {
50
+ nodeItemRef
51
+ } = node.model;
52
+ const {
53
+ draggableProps
54
+ } = useContext(SortableItemContext);
55
+ const onItemKeyDown = useOnItemKeyDown(item, draggableProps);
56
+ const ctx = useContext(TreeViewContext);
57
+ const {
58
+ props: {
59
+ disableIcons,
60
+ rightAddons,
61
+ onItemClick,
62
+ onItemFocus,
63
+ rowSize,
64
+ labelOverflow
65
+ },
66
+ withRadioChecks,
67
+ withCheckboxChecks,
68
+ withDragAndDrop,
69
+ selectedItem,
70
+ selectedCheckboxes,
71
+ hoverItem,
72
+ virtualListHelpers: {
73
+ scrollToIndex
74
+ },
75
+ setHoverItem,
76
+ setSelectedItem,
77
+ setFocusedItem
78
+ } = ctx; // Sortable Items needs to update
79
+ // - the virtual list ref (for react-virtual requirement)
80
+ // - nodeItemRef which is a prop avaiable in the TreeModel nodes
81
+ // - the drag and drop node reference
82
+
83
+ const setItemRefs = ref => {
84
+ setMultipleRefs(virtualItemRef, !isDragOverlay && nodeItemRef, !isDragOverlay && draggableProps && draggableProps.setNodeRef)(ref);
85
+ };
86
+
87
+ const dropIndicatorPosition = draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;
88
+ const isDropIndicatorPositionInside = dropIndicatorPosition === DropIndicatorPosition.Inside;
89
+ const isDragging = draggableProps && draggableProps.isDragging;
90
+ const isDropValid = draggableProps && draggableProps.isDropValid;
91
+ const dropPreviewClassName = useMemo(() => {
92
+ if (isDropIndicatorPositionInside) {
93
+ const className = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName).concat(isDropValid ? '--valid' : '--invalid', "-drop-in");
94
+ return className;
95
+ }
96
+
97
+ return '';
98
+ }, [isDropIndicatorPositionInside, isDropValid]);
99
+ const dragOverlayClassName = useMemo(() => isDragOverlay ? 'drag-overlay' : '', [isDragOverlay]);
100
+ const selectedClassName = useMemo(() => (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) === item.id && !isDragOverlay ? 'selected' : '', [isDragOverlay, item.id, selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id]);
101
+ const hoverClassName = useMemo(() => !isDragOverlay && ((hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id) === item.id || isDragging) ? 'hover' : '', [isDragOverlay, hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id, item.id, isDragging]);
102
+ const fixedHeightClassname = useMemo(() => {
103
+ if (labelOverflow === 'truncate') {
104
+ if (rowSize === 'compact') return "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "--fixed-height-compact");
105
+ return "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "--fixed-height");
106
+ }
107
+
108
+ return '';
109
+ }, [labelOverflow, rowSize]);
110
+ const finalClassName = useMemo(() => "".concat(dropPreviewClassName, " ").concat(fixedHeightClassname, " ").concat(selectedClassName, " ").concat(hoverClassName, " ").concat(dragOverlayClassName), [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname, dragOverlayClassName]);
111
+ const handleItemClick = useCallback(e => {
112
+ onItemClick(item, e);
113
+ setFocusedItem(item);
114
+ setSelectedItem(item);
115
+ const itemVirtualIndex = typeof item.virtualIndex === 'number' ? item.virtualIndex : -1;
116
+ onItemFocus({
117
+ itemIndex: itemVirtualIndex,
118
+ scrollToItem: function () {
119
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
120
+ align: 'start'
121
+ };
122
+ return scrollToIndex(itemVirtualIndex, opts);
123
+ },
124
+ item
125
+ });
126
+ }, [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem]);
127
+ return /*#__PURE__*/jsxs(TreeListItem, {
128
+ tabIndex: 0,
129
+ onMouseLeave: () => {
130
+ if ((hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id) === item.id) {
131
+ setHoverItem(null);
132
+ }
133
+ },
134
+ onMouseEnter: () => {
135
+ setHoverItem(item);
136
+ },
137
+ onClick: handleItemClick,
138
+ onBlur: () => setFocusedItem(null),
139
+ ref: setItemRefs,
140
+ style: _objectSpread({}, itemWrapperStyle),
141
+ className: finalClassName,
142
+ "aria-expanded": !!item.isExpanded,
143
+ "aria-selected": !!selectedCheckboxes[item.id],
144
+ "data-id": item.id,
145
+ "data-index": item.virtualIndex,
146
+ onKeyDown: onItemKeyDown,
147
+ children: [/*#__PURE__*/_jsx(TreeListItemAddonsWrapper, {}, void 0, withDragAndDrop ? /*#__PURE__*/_jsx(DnDHandle, {
148
+ id: id,
149
+ isDragOverlay: isDragOverlay
150
+ }) : null, withRadioChecks && !isDragOverlay ? /*#__PURE__*/_jsx(RadioSelectable, {
151
+ item: item,
152
+ itemIndex: itemIndex
153
+ }) : null, withCheckboxChecks && !isDragOverlay ? /*#__PURE__*/_jsx(CheckboxSelectable, {
154
+ item: item,
155
+ itemIndex: itemIndex
156
+ }) : null, !isDragOverlay && /*#__PURE__*/_jsx(NestingSpace, {
157
+ item: item,
158
+ spaceForNestingLevel: spaceForNestingLevel
159
+ }), !isDragOverlay && /*#__PURE__*/_jsx(ExpandCaret, {
160
+ item: item
161
+ }), !disableIcons ? /*#__PURE__*/_jsx(Icon, {
162
+ item: item
163
+ }) : null), /*#__PURE__*/_jsx(TreeItemText, {
164
+ item: item
165
+ }), rightAddons && /*#__PURE__*/_jsx(TreeListItemAddonsWrapper, {}, void 0, typeof rightAddons === 'function' ? rightAddons(item) : rightAddons), /*#__PURE__*/_jsx(DropIndicator, {
166
+ dropIndicatorPosition: dropIndicatorPosition,
167
+ isDropValid: isDropValid
168
+ })]
169
+ });
170
+ };
171
+ var TreeItem$1 = withDnDSortableItemContext(TreeItem);
172
+
173
+ export { TreeItem, TreeListItem, TreeListItemAddonsWrapper, TreeItem$1 as default };
@@ -0,0 +1,99 @@
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import { useContext, useMemo } from 'react';
3
+ import Highlighter from 'react-highlight-words';
4
+ import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
5
+ import { aggregatedClasses } from '@elliemae/ds-classnames';
6
+ import { ChildrenCountDisplayer } from './ChildrenCountDisplayer.js';
7
+ import { treeItemBlockName, DSTreeViewPrefix } from '../config/cssClassesConstants.js';
8
+ import TreeViewContext from '../TreeViewContext.js';
9
+ import { jsxs, Fragment } from 'react/jsx-runtime';
10
+
11
+ const ItemContent = aggregatedClasses('div')("".concat(treeItemBlockName, "-content"));
12
+ const ItemValue = aggregatedClasses('span')(treeItemBlockName, 'value'); // const wrapperClassName = `${DSTreeViewPrefix}-${treeItemBlockName}-content`;
13
+
14
+ const classNameModifierWrapAll = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "__value--wrap-all");
15
+ const classNameModifierTruncate = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "__value--truncate"); // eslint-disable-next-line react/prop-types
16
+
17
+ const CustomHighlight = _ref => {
18
+ let {
19
+ children
20
+ } = _ref;
21
+ return /*#__PURE__*/_jsx("mark", {
22
+ className: "tree-text-highlight",
23
+ "data-testid": "tree-text-highlight"
24
+ }, void 0, children);
25
+ };
26
+
27
+ function TreeItemText(props) {
28
+ var _ChildrenCountDisplay, _ChildrenCountDisplay2, _ChildrenCountDisplay3, _ChildrenCountDisplay4;
29
+
30
+ const {
31
+ item
32
+ } = props;
33
+ const ctx = useContext(TreeViewContext);
34
+ const {
35
+ props: {
36
+ searchQuery,
37
+ showChildrenAmount,
38
+ labelOverflow,
39
+ nameKey
40
+ }
41
+ } = ctx;
42
+ const Text = useMemo(() => {
43
+ const itemLabelText = item[nameKey];
44
+
45
+ if (searchQuery) {
46
+ if (labelOverflow === 'truncate') {
47
+ return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
48
+ value: /*#__PURE__*/jsxs(Fragment, {
49
+ children: [/*#__PURE__*/_jsx(Highlighter, {
50
+ autoEscape: true,
51
+ highlightTag: CustomHighlight,
52
+ searchWords: [searchQuery],
53
+ textToHighlight: itemLabelText
54
+ }), showChildrenAmount ? _ChildrenCountDisplay || (_ChildrenCountDisplay = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
55
+ item: item
56
+ })) : null]
57
+ })
58
+ });
59
+ }
60
+
61
+ return /*#__PURE__*/jsxs(Fragment, {
62
+ children: [/*#__PURE__*/_jsx(Highlighter, {
63
+ autoEscape: true,
64
+ highlightTag: CustomHighlight,
65
+ searchWords: [searchQuery],
66
+ textToHighlight: itemLabelText
67
+ }), showChildrenAmount ? _ChildrenCountDisplay2 || (_ChildrenCountDisplay2 = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
68
+ item: item
69
+ })) : null]
70
+ });
71
+ }
72
+
73
+ if (labelOverflow === 'truncate') {
74
+ return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
75
+ value: /*#__PURE__*/jsxs(Fragment, {
76
+ children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay3 || (_ChildrenCountDisplay3 = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
77
+ item: item
78
+ })) : null]
79
+ })
80
+ });
81
+ }
82
+
83
+ return /*#__PURE__*/jsxs(Fragment, {
84
+ children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay4 || (_ChildrenCountDisplay4 = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
85
+ item: item
86
+ })) : null]
87
+ });
88
+ }, [item, searchQuery, nameKey, showChildrenAmount, labelOverflow]);
89
+ let className = '';
90
+ if (labelOverflow === 'wrap-all') className += "".concat(classNameModifierWrapAll, " ");
91
+ if (labelOverflow === 'truncate') className += "".concat(classNameModifierTruncate, " ");
92
+ return /*#__PURE__*/_jsx(ItemContent, {
93
+ "data-testid": "".concat(treeItemBlockName, "-content")
94
+ }, void 0, /*#__PURE__*/_jsx(ItemValue, {
95
+ className: className
96
+ }, void 0, Text));
97
+ }
98
+
99
+ export { TreeItemText };