@elliemae/ds-shuttle 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 (220) hide show
  1. package/dist/cjs/AnimationState.js +75 -0
  2. package/dist/cjs/AnimationState.js.map +7 -0
  3. package/dist/cjs/DSShuttle.js +170 -0
  4. package/dist/cjs/DSShuttle.js.map +7 -0
  5. package/dist/cjs/SearchState.js +60 -0
  6. package/dist/cjs/SearchState.js.map +7 -0
  7. package/dist/cjs/Shuttle.actions.js +126 -0
  8. package/dist/cjs/Shuttle.actions.js.map +7 -0
  9. package/dist/cjs/ShuttleContainer.js +82 -0
  10. package/dist/cjs/ShuttleContainer.js.map +7 -0
  11. package/dist/cjs/ShuttleImpl.js +214 -0
  12. package/dist/cjs/ShuttleImpl.js.map +7 -0
  13. package/dist/cjs/ShuttleRenderer.js +144 -0
  14. package/dist/cjs/ShuttleRenderer.js.map +7 -0
  15. package/dist/cjs/ShuttleState.js +84 -0
  16. package/dist/cjs/ShuttleState.js.map +7 -0
  17. package/dist/cjs/animation/animationConfig.js +78 -0
  18. package/dist/cjs/animation/animationConfig.js.map +7 -0
  19. package/dist/cjs/classedComponents.js +72 -0
  20. package/dist/cjs/classedComponents.js.map +7 -0
  21. package/dist/cjs/components/LoadingIndicator.js +52 -0
  22. package/dist/cjs/components/LoadingIndicator.js.map +7 -0
  23. package/dist/cjs/components/OverflowList.js +55 -0
  24. package/dist/cjs/components/OverflowList.js.map +7 -0
  25. package/dist/cjs/components/ShuttleBreadcrumb.js +54 -0
  26. package/dist/cjs/components/ShuttleBreadcrumb.js.map +7 -0
  27. package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +48 -0
  28. package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
  29. package/dist/cjs/components/ShuttleListItem/ActionButtons.js +60 -0
  30. package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +7 -0
  31. package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +83 -0
  32. package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
  33. package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +90 -0
  34. package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
  35. package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +73 -0
  36. package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
  37. package/dist/cjs/components/ShuttleListPanel.js +49 -0
  38. package/dist/cjs/components/ShuttleListPanel.js.map +7 -0
  39. package/dist/cjs/components/ShuttleSearchBox.js +99 -0
  40. package/dist/cjs/components/ShuttleSearchBox.js.map +7 -0
  41. package/dist/cjs/components/ShuttleSource.js +192 -0
  42. package/dist/cjs/components/ShuttleSource.js.map +7 -0
  43. package/dist/cjs/components/ShuttleTarget.js +104 -0
  44. package/dist/cjs/components/ShuttleTarget.js.map +7 -0
  45. package/dist/cjs/components/VirtualizedItem.js +51 -0
  46. package/dist/cjs/components/VirtualizedItem.js.map +7 -0
  47. package/dist/cjs/components/VirtualizedList.js +88 -0
  48. package/dist/cjs/components/VirtualizedList.js.map +7 -0
  49. package/dist/cjs/components/VirtualizedSortableList.js +48 -0
  50. package/dist/cjs/components/VirtualizedSortableList.js.map +7 -0
  51. package/dist/cjs/helper.js +83 -0
  52. package/dist/cjs/helper.js.map +7 -0
  53. package/dist/cjs/index.js +38 -0
  54. package/dist/cjs/index.js.map +7 -0
  55. package/dist/cjs/tests/utils.js +1218 -0
  56. package/dist/cjs/tests/utils.js.map +7 -0
  57. package/dist/cjs/updateShuttleStateFromProps.js +98 -0
  58. package/dist/cjs/updateShuttleStateFromProps.js.map +7 -0
  59. package/dist/cjs/utils.js +41 -0
  60. package/dist/cjs/utils.js.map +7 -0
  61. package/dist/cjs/withProviders.js +45 -0
  62. package/dist/cjs/withProviders.js.map +7 -0
  63. package/{esm → dist/esm}/AnimationState.js +12 -8
  64. package/dist/esm/AnimationState.js.map +7 -0
  65. package/dist/esm/DSShuttle.js +141 -0
  66. package/dist/esm/DSShuttle.js.map +7 -0
  67. package/dist/esm/SearchState.js +31 -0
  68. package/dist/esm/SearchState.js.map +7 -0
  69. package/dist/esm/Shuttle.actions.js +106 -0
  70. package/dist/esm/Shuttle.actions.js.map +7 -0
  71. package/dist/esm/ShuttleContainer.js +64 -0
  72. package/dist/esm/ShuttleContainer.js.map +7 -0
  73. package/dist/esm/ShuttleImpl.js +199 -0
  74. package/dist/esm/ShuttleImpl.js.map +7 -0
  75. package/dist/esm/ShuttleRenderer.js +115 -0
  76. package/dist/esm/ShuttleRenderer.js.map +7 -0
  77. package/dist/esm/ShuttleState.js +55 -0
  78. package/dist/esm/ShuttleState.js.map +7 -0
  79. package/dist/esm/animation/animationConfig.js +49 -0
  80. package/dist/esm/animation/animationConfig.js.map +7 -0
  81. package/dist/esm/classedComponents.js +43 -0
  82. package/dist/esm/classedComponents.js.map +7 -0
  83. package/dist/esm/components/LoadingIndicator.js +23 -0
  84. package/dist/esm/components/LoadingIndicator.js.map +7 -0
  85. package/dist/esm/components/OverflowList.js +26 -0
  86. package/dist/esm/components/OverflowList.js.map +7 -0
  87. package/dist/esm/components/ShuttleBreadcrumb.js +25 -0
  88. package/dist/esm/components/ShuttleBreadcrumb.js.map +7 -0
  89. package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +19 -0
  90. package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
  91. package/dist/esm/components/ShuttleListItem/ActionButtons.js +31 -0
  92. package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +7 -0
  93. package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +54 -0
  94. package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
  95. package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +61 -0
  96. package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
  97. package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +44 -0
  98. package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
  99. package/dist/esm/components/ShuttleListPanel.js +20 -0
  100. package/dist/esm/components/ShuttleListPanel.js.map +7 -0
  101. package/dist/esm/components/ShuttleSearchBox.js +70 -0
  102. package/dist/esm/components/ShuttleSearchBox.js.map +7 -0
  103. package/dist/esm/components/ShuttleSource.js +175 -0
  104. package/dist/esm/components/ShuttleSource.js.map +7 -0
  105. package/dist/esm/components/ShuttleTarget.js +86 -0
  106. package/dist/esm/components/ShuttleTarget.js.map +7 -0
  107. package/dist/esm/components/VirtualizedItem.js +22 -0
  108. package/dist/esm/components/VirtualizedItem.js.map +7 -0
  109. package/dist/esm/components/VirtualizedList.js +59 -0
  110. package/dist/esm/components/VirtualizedList.js.map +7 -0
  111. package/dist/esm/components/VirtualizedSortableList.js +19 -0
  112. package/dist/esm/components/VirtualizedSortableList.js.map +7 -0
  113. package/dist/esm/helper.js +54 -0
  114. package/dist/esm/helper.js.map +7 -0
  115. package/dist/esm/index.js +9 -0
  116. package/dist/esm/index.js.map +7 -0
  117. package/dist/esm/tests/utils.js +1189 -0
  118. package/dist/esm/tests/utils.js.map +7 -0
  119. package/dist/esm/updateShuttleStateFromProps.js +69 -0
  120. package/dist/esm/updateShuttleStateFromProps.js.map +7 -0
  121. package/dist/esm/utils.js +12 -0
  122. package/dist/esm/utils.js.map +7 -0
  123. package/dist/esm/withProviders.js +16 -0
  124. package/dist/esm/withProviders.js.map +7 -0
  125. package/{types → dist/types}/AnimationState.d.ts +3 -2
  126. package/{types → dist/types}/DSShuttle.d.ts +1 -1
  127. package/{types → dist/types}/SearchState.d.ts +3 -2
  128. package/{types → dist/types}/Shuttle.actions.d.ts +0 -0
  129. package/{types → dist/types}/ShuttleContainer.d.ts +0 -0
  130. package/dist/types/ShuttleImpl.d.ts +4 -0
  131. package/{types → dist/types}/ShuttleRenderer.d.ts +1 -0
  132. package/{types → dist/types}/ShuttleState.d.ts +3 -2
  133. package/{types → dist/types}/animation/animationConfig.d.ts +0 -0
  134. package/{types → dist/types}/classedComponents.d.ts +0 -0
  135. package/{types → dist/types}/components/LoadingIndicator.d.ts +1 -0
  136. package/{types → dist/types}/components/OverflowList.d.ts +1 -0
  137. package/{types → dist/types}/components/ShuttleBreadcrumb.d.ts +1 -0
  138. package/{types → dist/types}/components/ShuttleInfiniteScrollIndicator.d.ts +1 -0
  139. package/{types → dist/types}/components/ShuttleListItem/ActionButtons.d.ts +0 -0
  140. package/{types → dist/types}/components/ShuttleListItem/ShuttleListItem.d.ts +1 -0
  141. package/{types → dist/types}/components/ShuttleListItem/ShuttleSourceListItem.d.ts +1 -0
  142. package/{types → dist/types}/components/ShuttleListItem/ShuttleTargetListItem.d.ts +1 -0
  143. package/{types → dist/types}/components/ShuttleListPanel.d.ts +1 -0
  144. package/{types → dist/types}/components/ShuttleSearchBox.d.ts +3 -1
  145. package/{types → dist/types}/components/ShuttleSource.d.ts +1 -0
  146. package/{types → dist/types}/components/ShuttleTarget.d.ts +1 -0
  147. package/{types → dist/types}/components/VirtualizedItem.d.ts +1 -0
  148. package/{types → dist/types}/components/VirtualizedList.d.ts +1 -0
  149. package/{types → dist/types}/components/VirtualizedSortableList.d.ts +1 -0
  150. package/{types → dist/types}/helper.d.ts +0 -0
  151. package/dist/types/index.d.ts +1 -0
  152. package/{types → dist/types}/tests/DSShuttle.events.test.d.ts +0 -0
  153. package/{types → dist/types}/tests/DSShuttle.test.d.ts +0 -0
  154. package/{types → dist/types}/tests/utils.d.ts +0 -0
  155. package/dist/types/updateShuttleStateFromProps.d.ts +3 -0
  156. package/{types → dist/types}/utils.d.ts +0 -0
  157. package/{types → dist/types}/withProviders.d.ts +1 -0
  158. package/package.json +97 -89
  159. package/cjs/AnimationState.js +0 -48
  160. package/cjs/DSShuttle.js +0 -223
  161. package/cjs/SearchState.js +0 -41
  162. package/cjs/Shuttle.actions.js +0 -137
  163. package/cjs/ShuttleContainer.js +0 -87
  164. package/cjs/ShuttleImpl.js +0 -311
  165. package/cjs/ShuttleRenderer.js +0 -139
  166. package/cjs/ShuttleState.js +0 -80
  167. package/cjs/animation/animationConfig.js +0 -81
  168. package/cjs/classedComponents.js +0 -71
  169. package/cjs/components/LoadingIndicator.js +0 -25
  170. package/cjs/components/OverflowList.js +0 -53
  171. package/cjs/components/ShuttleBreadcrumb.js +0 -42
  172. package/cjs/components/ShuttleInfiniteScrollIndicator.js +0 -39
  173. package/cjs/components/ShuttleListItem/ActionButtons.js +0 -55
  174. package/cjs/components/ShuttleListItem/ShuttleListItem.js +0 -85
  175. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +0 -76
  176. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +0 -57
  177. package/cjs/components/ShuttleListPanel.js +0 -31
  178. package/cjs/components/ShuttleSearchBox.js +0 -110
  179. package/cjs/components/ShuttleSource.js +0 -188
  180. package/cjs/components/ShuttleTarget.js +0 -116
  181. package/cjs/components/VirtualizedItem.js +0 -46
  182. package/cjs/components/VirtualizedList.js +0 -93
  183. package/cjs/components/VirtualizedSortableList.js +0 -41
  184. package/cjs/helper.js +0 -117
  185. package/cjs/index.js +0 -12
  186. package/cjs/updateShuttleStateFromProps.js +0 -94
  187. package/cjs/utils.js +0 -43
  188. package/cjs/withProviders.js +0 -29
  189. package/esm/DSShuttle.js +0 -213
  190. package/esm/SearchState.js +0 -35
  191. package/esm/Shuttle.actions.js +0 -123
  192. package/esm/ShuttleContainer.js +0 -80
  193. package/esm/ShuttleImpl.js +0 -304
  194. package/esm/ShuttleRenderer.js +0 -132
  195. package/esm/ShuttleState.js +0 -74
  196. package/esm/animation/animationConfig.js +0 -77
  197. package/esm/classedComponents.js +0 -51
  198. package/esm/components/LoadingIndicator.js +0 -18
  199. package/esm/components/OverflowList.js +0 -46
  200. package/esm/components/ShuttleBreadcrumb.js +0 -35
  201. package/esm/components/ShuttleInfiniteScrollIndicator.js +0 -32
  202. package/esm/components/ShuttleListItem/ActionButtons.js +0 -43
  203. package/esm/components/ShuttleListItem/ShuttleListItem.js +0 -76
  204. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +0 -68
  205. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +0 -49
  206. package/esm/components/ShuttleListPanel.js +0 -24
  207. package/esm/components/ShuttleSearchBox.js +0 -104
  208. package/esm/components/ShuttleSource.js +0 -179
  209. package/esm/components/ShuttleTarget.js +0 -107
  210. package/esm/components/VirtualizedItem.js +0 -40
  211. package/esm/components/VirtualizedList.js +0 -84
  212. package/esm/components/VirtualizedSortableList.js +0 -34
  213. package/esm/helper.js +0 -78
  214. package/esm/index.js +0 -2
  215. package/esm/updateShuttleStateFromProps.js +0 -88
  216. package/esm/utils.js +0 -18
  217. package/esm/withProviders.js +0 -22
  218. package/types/ShuttleImpl.d.ts +0 -3
  219. package/types/index.d.ts +0 -1
  220. package/types/updateShuttleStateFromProps.d.ts +0 -1
@@ -0,0 +1,175 @@
1
+ import * as React from "react";
2
+ import React2, { useCallback, useContext, useMemo } from "react";
3
+ import PropTypes from "prop-types";
4
+ import { ArrowShortRight, Search } from "@elliemae/ds-icons";
5
+ import { DSButton } from "@elliemae/ds-button";
6
+ import { runAll } from "@elliemae/ds-utilities";
7
+ import { ShuttleSearchBox } from "./ShuttleSearchBox";
8
+ import { ShuttleInfiniteScrollIndicator } from "./ShuttleInfiniteScrollIndicator";
9
+ import { ShuttleSourceListItem } from "./ShuttleListItem/ShuttleSourceListItem";
10
+ import {
11
+ ShuttleFooterCounter,
12
+ Overflow,
13
+ ShuttleFooter,
14
+ ShuttleHeader,
15
+ ShuttleHeaderBreadcrumb,
16
+ ShuttleHeaderSearchToggle,
17
+ ShuttleList,
18
+ ShuttleWrapper,
19
+ ShuttleFooterActions,
20
+ EmptyMessage,
21
+ LoadingList
22
+ } from "../classedComponents";
23
+ import { ShuttleListPanel } from "./ShuttleListPanel";
24
+ import { VirtualizedList } from "./VirtualizedList";
25
+ import { getActiveIdFromHierarchy } from "../helper";
26
+ import { AnimationState } from "../AnimationState";
27
+ import { SearchState } from "../SearchState";
28
+ import { VirtualizedSortableList } from "./VirtualizedSortableList";
29
+ import { LoadingIndicator } from "./LoadingIndicator";
30
+ const noop = () => {
31
+ };
32
+ function ShuttleSource({
33
+ items = [],
34
+ checkedItems = [],
35
+ hierarchy = [],
36
+ onMoveItem = noop,
37
+ onCheckItem = noop,
38
+ onMoveCheckedItems = noop,
39
+ onNavigateTo = noop,
40
+ onClearCheckedItems = noop,
41
+ emptyMessage = "No items found",
42
+ composeSourceItemProps = noop,
43
+ loading = false,
44
+ onSearch = noop,
45
+ onSearchClose = noop,
46
+ onSearchOpen = noop,
47
+ sourceSortable = false,
48
+ onSortEnd = noop,
49
+ sourceClearItemsText = "CLEAR ALL",
50
+ searchPlaceholder,
51
+ renderSourceCounter = (amount) => `${amount} items`,
52
+ onGetMoreItems = () => {
53
+ },
54
+ moreItemsLoading = false,
55
+ hasNextPage = false
56
+ }) {
57
+ const {
58
+ state: { isMovingBack = false, isMoving }
59
+ } = useContext(AnimationState.Context);
60
+ const {
61
+ state: { searching, searchTerm },
62
+ setSearchTerm,
63
+ reset: resetSearch,
64
+ toggleSearchBox
65
+ } = useContext(SearchState.Context);
66
+ const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}), [checkedItems]);
67
+ const handleCloseSearch = useCallback(() => {
68
+ setSearchTerm("");
69
+ runAll(resetSearch, onSearchClose)();
70
+ }, [searching]);
71
+ const handleToggleSearch = useCallback(() => {
72
+ toggleSearchBox(!searching);
73
+ if (searching) {
74
+ handleCloseSearch();
75
+ } else {
76
+ onSearchOpen();
77
+ }
78
+ }, [searching]);
79
+ const ComponentList = useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
80
+ const handleSortEnd = ({ oldIndex, newIndex }) => {
81
+ onSortEnd({
82
+ sourceItem: items[oldIndex],
83
+ targetItem: items[newIndex]
84
+ });
85
+ };
86
+ const isEmpty = !items.length;
87
+ const hasContent = !loading && !isEmpty;
88
+ const contentIsEmpty = !loading && isEmpty;
89
+ return /* @__PURE__ */ React2.createElement(ShuttleWrapper, null, /* @__PURE__ */ React2.createElement(ShuttleHeader, null, /* @__PURE__ */ React2.createElement(ShuttleHeaderBreadcrumb, {
90
+ hierarchy,
91
+ onNavigateTo
92
+ }), /* @__PURE__ */ React2.createElement(ShuttleHeaderSearchToggle, {
93
+ buttonType: "text",
94
+ icon: /* @__PURE__ */ React2.createElement(Search, null),
95
+ onClick: handleToggleSearch,
96
+ containerProps: { "data-testid": "shuttle-header-search-toggle" }
97
+ })), /* @__PURE__ */ React2.createElement(ShuttleList, {
98
+ classProps: { showPulse: isMovingBack },
99
+ style: { pointerEvents: isMoving ? "none" : null }
100
+ }, /* @__PURE__ */ React2.createElement(ShuttleSearchBox, {
101
+ key: searching,
102
+ isOpen: searching,
103
+ onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
104
+ onFilter: runAll(setSearchTerm, onSearch),
105
+ placeholder: searchPlaceholder,
106
+ value: searchTerm
107
+ }), hasContent ? /* @__PURE__ */ React2.createElement(Overflow, {
108
+ activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
109
+ classProps: {
110
+ searching,
111
+ empty: isEmpty
112
+ }
113
+ }, /* @__PURE__ */ React2.createElement(ComponentList, {
114
+ key: searchTerm,
115
+ helperClass: "drag-helper",
116
+ itemRenderer: ({ item, ...rest }) => /* @__PURE__ */ React2.createElement(ShuttleSourceListItem, {
117
+ "data-testid": "source-list-item",
118
+ ...rest,
119
+ ...composeSourceItemProps(item, rest),
120
+ isChecked: !!hashedCheckedItems[item.id],
121
+ item,
122
+ onItemCheck: onCheckItem,
123
+ onMoveToTarget: onMoveItem,
124
+ onNavigateOnSourceTo: onNavigateTo,
125
+ showSortHandler: sourceSortable
126
+ }),
127
+ items,
128
+ onSortEnd: handleSortEnd,
129
+ getMoreItems: onGetMoreItems,
130
+ hasNextPage
131
+ })) : null, contentIsEmpty ? /* @__PURE__ */ React2.createElement(LoadingList, {
132
+ "data-testid": "shuttle__loading-list"
133
+ }, /* @__PURE__ */ React2.createElement(EmptyMessage, null, emptyMessage)) : null, loading ? /* @__PURE__ */ React2.createElement(LoadingList, {
134
+ "data-testid": "shuttle__loading-list"
135
+ }, /* @__PURE__ */ React2.createElement(LoadingIndicator, null)) : null, /* @__PURE__ */ React2.createElement(ShuttleListPanel, {
136
+ onClick: onMoveCheckedItems,
137
+ open: checkedItems.length > 1
138
+ }, /* @__PURE__ */ React2.createElement(ArrowShortRight, null)), moreItemsLoading ? /* @__PURE__ */ React2.createElement(ShuttleInfiniteScrollIndicator, {
139
+ isOpen: true
140
+ }) : null), /* @__PURE__ */ React2.createElement(ShuttleFooter, null, /* @__PURE__ */ React2.createElement(ShuttleFooterActions, null, !!checkedItems.length && /* @__PURE__ */ React2.createElement(DSButton, {
141
+ buttonType: "link",
142
+ labelText: sourceClearItemsText,
143
+ onClick: onClearCheckedItems
144
+ })), /* @__PURE__ */ React2.createElement(ShuttleFooterCounter, null, renderSourceCounter(checkedItems.length))));
145
+ }
146
+ ShuttleSource.propTypes = {
147
+ items: PropTypes.arrayOf(PropTypes.shape({})),
148
+ checkedItems: PropTypes.arrayOf(PropTypes.shape({})),
149
+ hierarchy: PropTypes.arrayOf(PropTypes.shape({})),
150
+ onMoveItem: PropTypes.func,
151
+ onCheckItem: PropTypes.func,
152
+ onMoveCheckedItems: PropTypes.func,
153
+ onNavigateTo: PropTypes.func,
154
+ onClearCheckedItems: PropTypes.func,
155
+ emptyMessage: PropTypes.string,
156
+ composeSourceItemProps: PropTypes.func,
157
+ loading: PropTypes.bool,
158
+ onSearch: PropTypes.func,
159
+ onSearchClose: PropTypes.func,
160
+ onSearchOpen: PropTypes.func,
161
+ sourceSortable: PropTypes.bool,
162
+ onSortEnd: PropTypes.func,
163
+ sourceClearItemsText: PropTypes.string,
164
+ searchPlaceholder: PropTypes.string,
165
+ renderSourceCounter: PropTypes.func,
166
+ onGetMoreItems: PropTypes.func,
167
+ moreItemsLoading: PropTypes.bool,
168
+ hasNextPage: PropTypes.bool
169
+ };
170
+ var ShuttleSource_default = ShuttleSource;
171
+ export {
172
+ ShuttleSource,
173
+ ShuttleSource_default as default
174
+ };
175
+ //# sourceMappingURL=ShuttleSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleSource.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable no-shadow */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { ArrowShortRight, Search } from '@elliemae/ds-icons';\nimport { DSButton } from '@elliemae/ds-button';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { ShuttleSearchBox } from './ShuttleSearchBox';\nimport { ShuttleInfiniteScrollIndicator } from './ShuttleInfiniteScrollIndicator';\nimport { ShuttleSourceListItem } from './ShuttleListItem/ShuttleSourceListItem';\nimport {\n ShuttleFooterCounter,\n Overflow,\n ShuttleFooter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleHeaderSearchToggle,\n ShuttleList,\n ShuttleWrapper,\n ShuttleFooterActions,\n EmptyMessage,\n LoadingList,\n} from '../classedComponents';\nimport { ShuttleListPanel } from './ShuttleListPanel';\nimport { VirtualizedList } from './VirtualizedList';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { SearchState } from '../SearchState';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleSource({\n items = [],\n checkedItems = [], // build Map() and memoize it for better performance\n hierarchy = [],\n onMoveItem = noop,\n onCheckItem = noop,\n onMoveCheckedItems = noop,\n onNavigateTo = noop,\n onClearCheckedItems = noop,\n emptyMessage = 'No items found',\n composeSourceItemProps = noop,\n loading = false,\n onSearch = noop,\n onSearchClose = noop,\n onSearchOpen = noop,\n sourceSortable = false,\n onSortEnd = noop,\n sourceClearItemsText = 'CLEAR ALL',\n searchPlaceholder,\n renderSourceCounter = (amount) => `${amount} items`,\n onGetMoreItems = () => {},\n moreItemsLoading = false,\n hasNextPage = false,\n}) {\n const {\n state: { isMovingBack = false, isMoving },\n } = useContext(AnimationState.Context);\n const {\n state: { searching, searchTerm },\n setSearchTerm,\n reset: resetSearch,\n toggleSearchBox,\n } = useContext(SearchState.Context);\n\n const hashedCheckedItems = useMemo(\n () => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}),\n [checkedItems],\n );\n\n const handleCloseSearch = useCallback(() => {\n setSearchTerm('');\n runAll(resetSearch, onSearchClose)();\n }, [searching]);\n\n const handleToggleSearch = useCallback(() => {\n toggleSearchBox(!searching);\n if (searching) {\n handleCloseSearch();\n } else {\n onSearchOpen();\n }\n }, [searching]);\n\n const ComponentList = useMemo(() => (sourceSortable ? VirtualizedSortableList : VirtualizedList), [sourceSortable]);\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n const isEmpty = !items.length;\n const hasContent = !loading && !isEmpty;\n const contentIsEmpty = !loading && isEmpty;\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n <ShuttleHeaderSearchToggle\n buttonType=\"text\"\n icon={<Search />}\n onClick={handleToggleSearch}\n containerProps={{ 'data-testid': 'shuttle-header-search-toggle' }}\n />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMovingBack }} style={{ pointerEvents: isMoving ? 'none' : null }}>\n <ShuttleSearchBox\n key={searching}\n isOpen={searching}\n onClose={runAll(() => toggleSearchBox(false), handleCloseSearch)}\n onFilter={runAll(setSearchTerm, onSearch)}\n placeholder={searchPlaceholder}\n value={searchTerm}\n />\n {hasContent ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n searching,\n empty: isEmpty,\n }}\n >\n <ComponentList\n key={searchTerm}\n helperClass=\"drag-helper\"\n itemRenderer={({ item, ...rest }) => (\n <ShuttleSourceListItem\n data-testid=\"source-list-item\"\n {...rest}\n {...composeSourceItemProps(item, rest)}\n isChecked={!!hashedCheckedItems[item.id]}\n item={item}\n onItemCheck={onCheckItem}\n onMoveToTarget={onMoveItem}\n onNavigateOnSourceTo={onNavigateTo}\n showSortHandler={sourceSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n getMoreItems={onGetMoreItems}\n hasNextPage={hasNextPage}\n />\n </Overflow>\n ) : null}\n {contentIsEmpty ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <EmptyMessage>{emptyMessage}</EmptyMessage>\n </LoadingList>\n ) : null}\n {loading ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <LoadingIndicator />\n </LoadingList>\n ) : null}\n <ShuttleListPanel onClick={onMoveCheckedItems} open={checkedItems.length > 1}>\n <ArrowShortRight />\n </ShuttleListPanel>\n {moreItemsLoading ? <ShuttleInfiniteScrollIndicator isOpen /> : null}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!checkedItems.length && (\n <DSButton buttonType=\"link\" labelText={sourceClearItemsText} onClick={onClearCheckedItems} />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderSourceCounter(checkedItems.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nShuttleSource.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})),\n checkedItems: PropTypes.arrayOf(PropTypes.shape({})),\n hierarchy: PropTypes.arrayOf(PropTypes.shape({})),\n onMoveItem: PropTypes.func,\n onCheckItem: PropTypes.func,\n onMoveCheckedItems: PropTypes.func,\n onNavigateTo: PropTypes.func,\n onClearCheckedItems: PropTypes.func,\n emptyMessage: PropTypes.string,\n composeSourceItemProps: PropTypes.func,\n loading: PropTypes.bool,\n onSearch: PropTypes.func,\n onSearchClose: PropTypes.func,\n onSearchOpen: PropTypes.func,\n sourceSortable: PropTypes.bool,\n onSortEnd: PropTypes.func,\n sourceClearItemsText: PropTypes.string,\n searchPlaceholder: PropTypes.string,\n renderSourceCounter: PropTypes.func,\n onGetMoreItems: PropTypes.func,\n moreItemsLoading: PropTypes.bool,\n hasNextPage: PropTypes.bool,\n};\n\nexport { ShuttleSource };\nexport default ShuttleSource;\n"],
5
+ "mappings": "AAAA;ACEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,OAAO,MAAM;AAAA;AAEnB,uBAAuB;AAAA,EACrB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,eAAe;AAAA,EACf,yBAAyB;AAAA,EACzB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,uBAAuB;AAAA,EACvB;AAAA,EACA,sBAAsB,CAAC,WAAW,GAAG;AAAA,EACrC,iBAAiB,MAAM;AAAA;AAAA,EACvB,mBAAmB;AAAA,EACnB,cAAc;AAAA,GACb;AACD,QAAM;AAAA,IACJ,OAAO,EAAE,eAAe,OAAO;AAAA,MAC7B,WAAW,eAAe;AAC9B,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW;AAAA,IACpB;AAAA,IACA,OAAO;AAAA,IACP;AAAA,MACE,WAAW,YAAY;AAE3B,QAAM,qBAAqB,QACzB,MAAM,aAAa,OAAO,CAA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AA,EAC1B,WAAW,UAAU;AAAA,EACrB,sBAAsB,UAAU;AAAA,EAChC,mBAAmB,UAAU;AAAA,EAC7B,qBAAqB,UAAU;AAAA,EAC/B,gBAAgB,UAAU;AAAA,EAC1B,kBAAkB,UAAU;AAAA,EAC5B,aAAa,UAAU;AAAA;AAIzB,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,86 @@
1
+ import * as React from "react";
2
+ import React2, { useContext } from "react";
3
+ import { DSButton } from "@elliemae/ds-button";
4
+ import {
5
+ EmptyMessage,
6
+ Overflow,
7
+ ShuttleFooter,
8
+ ShuttleFooterActions,
9
+ ShuttleFooterCounter,
10
+ ShuttleHeader,
11
+ ShuttleHeaderBreadcrumb,
12
+ ShuttleList,
13
+ ShuttleWrapper,
14
+ LoadingList
15
+ } from "../classedComponents";
16
+ import { getActiveIdFromHierarchy } from "../helper";
17
+ import { AnimationState } from "../AnimationState";
18
+ import { VirtualizedList } from "./VirtualizedList";
19
+ import { ShuttleTargetListItem } from "./ShuttleListItem/ShuttleTargetListItem";
20
+ import { VirtualizedSortableList } from "./VirtualizedSortableList";
21
+ import { LoadingIndicator } from "./LoadingIndicator";
22
+ const noop = () => {
23
+ };
24
+ function ShuttleTarget({
25
+ items = [],
26
+ hierarchy = [],
27
+ onNavigateTo = noop,
28
+ onMoveItem = noop,
29
+ onClearMovedItems = noop,
30
+ emptyMessage = "No items selected",
31
+ composeTargetItemProps = () => ({}),
32
+ targetSortable = false,
33
+ onSortEnd = noop,
34
+ targetClearItemsText = "CLEAR ALL",
35
+ renderTargetCounter = (amount) => `${amount} items`,
36
+ loading = false
37
+ }) {
38
+ const {
39
+ state: { isMoving = false }
40
+ } = useContext(AnimationState.Context);
41
+ const isEmpty = !items.length;
42
+ const emptyContent = loading ? /* @__PURE__ */ React2.createElement(LoadingIndicator, null) : /* @__PURE__ */ React2.createElement(EmptyMessage, null, emptyMessage);
43
+ const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;
44
+ const handleSortEnd = ({ oldIndex, newIndex }) => {
45
+ onSortEnd({
46
+ sourceItem: items[oldIndex],
47
+ targetItem: items[newIndex]
48
+ });
49
+ };
50
+ return /* @__PURE__ */ React2.createElement(ShuttleWrapper, null, /* @__PURE__ */ React2.createElement(ShuttleHeader, null, /* @__PURE__ */ React2.createElement(ShuttleHeaderBreadcrumb, {
51
+ hierarchy,
52
+ onNavigateTo
53
+ })), /* @__PURE__ */ React2.createElement(ShuttleList, {
54
+ classProps: { showPulse: isMoving }
55
+ }, !loading && !isEmpty ? /* @__PURE__ */ React2.createElement(Overflow, {
56
+ activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
57
+ classProps: {
58
+ empty: !items.length
59
+ }
60
+ }, /* @__PURE__ */ React2.createElement(ComponentList, {
61
+ itemRenderer: ({ item, ...rest }) => /* @__PURE__ */ React2.createElement(ShuttleTargetListItem, {
62
+ "data-testid": "target-list-item",
63
+ ...rest,
64
+ ...composeTargetItemProps(item, rest),
65
+ isRoot: !getActiveIdFromHierarchy(hierarchy).id,
66
+ item,
67
+ onMoveToSource: onMoveItem,
68
+ onNavigateOnTargetTo: onNavigateTo,
69
+ showSortHandler: targetSortable
70
+ }),
71
+ items,
72
+ onSortEnd: handleSortEnd,
73
+ target: true
74
+ })) : /* @__PURE__ */ React2.createElement(LoadingList, null, emptyContent)), /* @__PURE__ */ React2.createElement(ShuttleFooter, null, /* @__PURE__ */ React2.createElement(ShuttleFooterActions, null, !!items.length && /* @__PURE__ */ React2.createElement(DSButton, {
75
+ containerProps: { "data-testid": "shuttle-clear-all-target" },
76
+ buttonType: "link",
77
+ labelText: targetClearItemsText,
78
+ onClick: onClearMovedItems
79
+ })), /* @__PURE__ */ React2.createElement(ShuttleFooterCounter, null, renderTargetCounter(items.length))));
80
+ }
81
+ var ShuttleTarget_default = ShuttleTarget;
82
+ export {
83
+ ShuttleTarget,
84
+ ShuttleTarget_default as default
85
+ };
86
+ //# sourceMappingURL=ShuttleTarget.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleTarget.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSButton } from '@elliemae/ds-button';\n\nimport {\n EmptyMessage,\n Overflow,\n ShuttleFooter,\n ShuttleFooterActions,\n ShuttleFooterCounter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleList,\n ShuttleWrapper,\n LoadingList,\n} from '../classedComponents';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { VirtualizedList } from './VirtualizedList';\nimport { ShuttleTargetListItem } from './ShuttleListItem/ShuttleTargetListItem';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleTarget({\n items = [],\n hierarchy = [],\n onNavigateTo = noop,\n onMoveItem = noop,\n onClearMovedItems = noop,\n emptyMessage = 'No items selected',\n composeTargetItemProps = () => ({}),\n targetSortable = false,\n onSortEnd = noop,\n targetClearItemsText = 'CLEAR ALL',\n renderTargetCounter = (amount) => `${amount} items`,\n loading = false,\n}) {\n const {\n state: { isMoving = false },\n } = useContext(AnimationState.Context);\n const isEmpty = !items.length;\n const emptyContent = loading ? <LoadingIndicator /> : <EmptyMessage>{emptyMessage}</EmptyMessage>;\n\n const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMoving }}>\n {!loading && !isEmpty ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n empty: !items.length,\n }}\n >\n <ComponentList\n itemRenderer={({ item, ...rest }) => (\n <ShuttleTargetListItem\n data-testid=\"target-list-item\"\n {...rest}\n {...composeTargetItemProps(item, rest)}\n isRoot={!getActiveIdFromHierarchy(hierarchy).id}\n item={item}\n onMoveToSource={onMoveItem}\n onNavigateOnTargetTo={onNavigateTo}\n showSortHandler={targetSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n target\n />\n </Overflow>\n ) : (\n <LoadingList>{emptyContent}</LoadingList>\n )}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!items.length && (\n <DSButton\n containerProps={{ 'data-testid': 'shuttle-clear-all-target' }}\n buttonType=\"link\"\n labelText={targetClearItemsText}\n onClick={onClearMovedItems}\n />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderTargetCounter(items.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nexport { ShuttleTarget };\nexport default ShuttleTarget;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,OAAO,MAAM;AAAA;AAEnB,uBAAuB;AAAA,EACrB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,yBAAyB,MAAO;AAAA,EAChC,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,uBAAuB;AAAA,EACvB,sBAAsB,CAAC,WAAW,GAAG;AAAA,EACrC,UAAU;AAAA,GACT;AACD,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW;AAAA,MAClB,WAAW,eAAe;AAC9B,QAAM,UAAU,CAAC,MAAM;AACvB,QAAM,eAAe,UAAU,qCAAC,kBAAD,QAAuB,qCAAC,cAAD,MAAe;AAErE,QAAM,gBAAgB,iBAAiB,0BAA0B;AAEjE,QAAM,gBAAgB,CAAC,EAAE,UAAU,eAAe;AAChD,cAAU;AAAA,MACR,YAAY,MAAM;AAAA,MAClB,YAAY,MAAM;AAAA;AAAA;AAItB,SACE,qCAAC,gBAAD,MACE,qCAAC,eAAD,MACE,qCAAC,yBAAD;AAAA,IAAyB;AAAA,IAAsB;AAAA,OAEjD,qCAAC,aAAD;AAAA,IAAa,YAAY,EAAE,WAAW;AAAA,KACnC,CAAC,WAAW,CAAC,UACZ,qCAAC,UAAD;AAAA,IACE,iBAAiB,yBAAyB,WAAW;AAAA,IACrD,YAAY;AAAA,MACV,OAAO,CAAC,MAAM;AAAA;AAAA,KAGhB,qCAAC,eAAD;AAAA,IACE,cAAc,CAAC,EAAE,SAAS,WACxB,qCAAC,uBAAD;AAAA,MACE,eAAY;AAAA,SACR;AAAA,SACA,uBAAuB,MAAM;AAAA,MACjC,QAAQ,CAAC,yBAAyB,WAAW;AAAA,MAC7C;AAAA,MACA,gBAAgB;AAAA,MAChB,sBAAsB;AAAA,MACtB,iBAAiB;AAAA;AAAA,IAGrB;AAAA,IACA,WAAW;AAAA,IACX,QAAM;AAAA,QAIV,qCAAC,aAAD,MAAc,gBAGlB,qCAAC,eAAD,MACE,qCAAC,sBAAD,MACG,CAAC,CAAC,MAAM,UACP,qCAAC,UAAD;AAAA,IACE,gBAAgB,EAAE,eAAe;AAAA,IACjC,YAAW;AAAA,IACX,WAAW;AAAA,IACX,SAAS;AAAA,OAIf,qCAAC,sBAAD,MAAuB,oBAAoB,MAAM;AAAA;AAOzD,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { memo } from "react";
3
+ import { areEqual } from "react-window";
4
+ const VirtualizedItem = memo(({ data, index, style: virtualizedStyles, showSortHandler = false }) => {
5
+ const { items, itemRenderer, isItemMoving } = data;
6
+ const { item, props: animatedStyles, key } = items[index] || {};
7
+ if (!item)
8
+ return null;
9
+ return itemRenderer({
10
+ index,
11
+ key,
12
+ item,
13
+ showSortHandler,
14
+ style: isItemMoving ? { ...animatedStyles, ...virtualizedStyles } : virtualizedStyles
15
+ });
16
+ }, areEqual);
17
+ var VirtualizedItem_default = VirtualizedItem;
18
+ export {
19
+ VirtualizedItem,
20
+ VirtualizedItem_default as default
21
+ };
22
+ //# sourceMappingURL=VirtualizedItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/VirtualizedItem.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { memo } from 'react';\nimport { areEqual } from 'react-window';\n\nconst VirtualizedItem = memo(\n ({ data, index, style: virtualizedStyles, showSortHandler = false }) => {\n const { items, itemRenderer, isItemMoving } = data;\n const { item, props: animatedStyles, key } = items[index] || {};\n if (!item) return null;\n return itemRenderer({\n index,\n key,\n item,\n showSortHandler,\n style: isItemMoving\n ? { ...animatedStyles, ...virtualizedStyles }\n : virtualizedStyles,\n });\n },\n areEqual,\n);\n\nexport { VirtualizedItem };\nexport default VirtualizedItem;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA,MAAM,kBAAkB,KACtB,CAAC,EAAE,MAAM,OAAO,OAAO,mBAAmB,kBAAkB,YAAY;AACtE,QAAM,EAAE,OAAO,cAAc,iBAAiB;AAC9C,QAAM,EAAE,MAAM,OAAO,gBAAgB,QAAQ,MAAM,UAAU;AAC7D,MAAI,CAAC;AAAM,WAAO;AAClB,SAAO,aAAa;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,eACH,KAAK,mBAAmB,sBACxB;AAAA;AAAA,GAGR;AAIF,IAAO,0BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,59 @@
1
+ import * as React from "react";
2
+ import React2, { useContext, useEffect, useRef } from "react";
3
+ import { useTransition } from "react-spring/web";
4
+ import { FixedSizeList as List } from "react-window";
5
+ import InfiniteLoader from "react-window-infinite-loader";
6
+ import AutoSizer from "react-virtualized-auto-sizer";
7
+ import { animationConfig } from "../animation/animationConfig";
8
+ import { AnimationState } from "../AnimationState";
9
+ import { VirtualizedItem } from "./VirtualizedItem";
10
+ function VirtualizedList({
11
+ items,
12
+ itemRenderer,
13
+ searching,
14
+ target = false,
15
+ innerRef,
16
+ children,
17
+ hasNextPage = true,
18
+ getMoreItems = () => {
19
+ }
20
+ }) {
21
+ const hasMounted = useRef(false);
22
+ const {
23
+ state: { isMoving, isMovingBack },
24
+ reset
25
+ } = useContext(AnimationState.Context);
26
+ useEffect(() => {
27
+ hasMounted.current = true;
28
+ }, []);
29
+ const transitions = useTransition(items, (item) => item.id, {
30
+ ...animationConfig.moveItem(target),
31
+ onDestroyed: () => reset()
32
+ });
33
+ const itemCount = hasNextPage ? items.length + 1 : items.length;
34
+ const isItemLoaded = (index) => !hasNextPage || index < items.length;
35
+ return /* @__PURE__ */ React2.createElement(AutoSizer, null, ({ height, width }) => /* @__PURE__ */ React2.createElement(InfiniteLoader, {
36
+ isItemLoaded,
37
+ itemCount,
38
+ loadMoreItems: getMoreItems
39
+ }, ({ onItemsRendered, ref }) => /* @__PURE__ */ React2.createElement(List, {
40
+ height: searching ? 300 : height,
41
+ width,
42
+ innerRef,
43
+ itemCount: transitions.length,
44
+ itemData: {
45
+ items: transitions,
46
+ itemRenderer,
47
+ isItemMoving: hasMounted.current && (isMoving || isMovingBack)
48
+ },
49
+ itemSize: 35,
50
+ onItemsRendered,
51
+ ref
52
+ }, children || VirtualizedItem)));
53
+ }
54
+ var VirtualizedList_default = VirtualizedList;
55
+ export {
56
+ VirtualizedList,
57
+ VirtualizedList_default as default
58
+ };
59
+ //# sourceMappingURL=VirtualizedList.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/VirtualizedList.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useContext, useEffect, useRef } from 'react';\nimport { useTransition } from 'react-spring/web';\nimport { FixedSizeList as List } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { animationConfig } from '../animation/animationConfig';\nimport { AnimationState } from '../AnimationState';\nimport { VirtualizedItem } from './VirtualizedItem';\n\nfunction VirtualizedList({\n items,\n itemRenderer,\n searching,\n target = false,\n innerRef,\n children,\n hasNextPage = true,\n getMoreItems = () => {},\n}) {\n const hasMounted = useRef(false);\n const {\n state: { isMoving, isMovingBack },\n reset,\n } = useContext(AnimationState.Context);\n\n useEffect(() => {\n hasMounted.current = true;\n }, []);\n\n const transitions = useTransition(items, (item) => item.id, {\n ...animationConfig.moveItem(target),\n onDestroyed: () => reset(),\n });\n\n const itemCount = hasNextPage ? items.length + 1 : items.length;\n\n const isItemLoaded = (index) => !hasNextPage || index < items.length;\n\n return (\n <AutoSizer>\n {({ height, width }) => (\n <InfiniteLoader\n isItemLoaded={isItemLoaded}\n itemCount={itemCount}\n loadMoreItems={getMoreItems}\n >\n {({ onItemsRendered, ref }) => (\n <List\n height={searching ? 300 : height}\n width={width}\n innerRef={innerRef}\n itemCount={transitions.length}\n itemData={{\n items: transitions,\n itemRenderer,\n isItemMoving: hasMounted.current && (isMoving || isMovingBack),\n }}\n itemSize={35}\n onItemsRendered={onItemsRendered}\n ref={ref}\n >\n {children || VirtualizedItem}\n </List>\n )}\n </InfiniteLoader>\n )}\n </AutoSizer>\n );\n}\n\nexport { VirtualizedList };\nexport default VirtualizedList;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,yBAAyB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,eAAe,MAAM;AAAA;AAAA,GACpB;AACD,QAAM,aAAa,OAAO;AAC1B,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU;AAAA,IACnB;AAAA,MACE,WAAW,eAAe;AAE9B,YAAU,MAAM;AACd,eAAW,UAAU;AAAA,KACpB;AAEH,QAAM,cAAc,cAAc,OAAO,CAAC,SAAS,KAAK,IAAI;AAAA,OACvD,gBAAgB,SAAS;AAAA,IAC5B,aAAa,MAAM;AAAA;AAGrB,QAAM,YAAY,cAAc,MAAM,SAAS,IAAI,MAAM;AAEzD,QAAM,eAAe,CAAC,UAAU,CAAC,eAAe,QAAQ,MAAM;AAE9D,SACE,qCAAC,WAAD,MACG,CAAC,EAAE,QAAQ,YACV,qCAAC,gBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA,eAAe;AAAA,KAEd,CAAC,EAAE,iBAAiB,UACnB,qCAAC,MAAD;AAAA,IACE,QAAQ,YAAY,MAAM;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,WAAW,YAAY;AAAA,IACvB,UAAU;AAAA,MACR,OAAO;AAAA,MACP;AAAA,MACA,cAAc,WAAW,WAAY,aAAY;AAAA;AAAA,IAEnD,UAAU;AAAA,IACV;AAAA,IACA;AAAA,KAEC,YAAY;AAAA;AAU3B,IAAO,0BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { sortableElement, sortableContainer } from "react-sortable-hoc";
4
+ import { VirtualizedList } from "./VirtualizedList";
5
+ import { VirtualizedItem } from "./VirtualizedItem";
6
+ const SortableList = sortableContainer(VirtualizedList);
7
+ function VirtualizedSortableList({ items, ...otherProps }) {
8
+ return /* @__PURE__ */ React2.createElement(SortableList, {
9
+ ...otherProps,
10
+ items,
11
+ useDragHandle: true
12
+ }, sortableElement(VirtualizedItem));
13
+ }
14
+ var VirtualizedSortableList_default = VirtualizedSortableList;
15
+ export {
16
+ VirtualizedSortableList,
17
+ VirtualizedSortableList_default as default
18
+ };
19
+ //# sourceMappingURL=VirtualizedSortableList.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/VirtualizedSortableList.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { sortableElement, sortableContainer } from 'react-sortable-hoc';\nimport { VirtualizedList } from './VirtualizedList';\nimport { VirtualizedItem } from './VirtualizedItem';\n\nconst SortableList = sortableContainer(VirtualizedList);\n\nfunction VirtualizedSortableList({ items, ...otherProps }) {\n return (\n <SortableList {...otherProps} items={items} useDragHandle>\n {sortableElement(VirtualizedItem)}\n </SortableList>\n );\n}\n\nexport { VirtualizedSortableList };\nexport default VirtualizedSortableList;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,eAAe,kBAAkB;AAEvC,iCAAiC,EAAE,UAAU,cAAc;AACzD,SACE,qCAAC,cAAD;AAAA,OAAkB;AAAA,IAAY;AAAA,IAAc,eAAa;AAAA,KACtD,gBAAgB;AAAA;AAMvB,IAAO,kCAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { omit, compose, hashArray } from "@elliemae/ds-utilities";
3
+ import * as tree from "treetabular";
4
+ const getHierarchyTypeName = (dest) => !dest ? "hierarchy" : "hierarchyDest";
5
+ const checkHasChildren = (list, currentItem) => list.some((item) => currentItem.id === item.parent);
6
+ const getActiveIdFromHierarchy = (hierarchy = []) => hierarchy[hierarchy.length - 1] || {};
7
+ const filterItemsByHierarchy = (list, hierarchyId, parentField = "parent") => list.filter((item) => item[parentField] === hierarchyId);
8
+ const getItemsById = (ids, list) => ids.reduce((acc, id) => acc.concat(list.find((item) => String(item.id) === String(id))), []).filter((item) => item);
9
+ const toggleInObject = (obj, key, value) => obj[key] ? omit(obj, [key]) : { ...obj, [key]: value };
10
+ const isMovable = (item) => !item.forceNotMovable && (item.hasChildren && item.isMoveableContainer || !item.hasChildren);
11
+ const pipe = (actions) => (initState, props) => actions.reduce((prevState, action) => action(prevState, props), initState);
12
+ const moveItems = ({ oldIndex, newIndex }) => (items) => {
13
+ const sourceItem = items[oldIndex];
14
+ items.splice(oldIndex, 1);
15
+ items.splice(newIndex, 0, sourceItem);
16
+ return items;
17
+ };
18
+ const prepareItems = (items) => compose(tree.fixOrder(), (items2) => items2.map((item) => ({
19
+ ...item,
20
+ hasChildren: checkHasChildren(items2, item)
21
+ })))(items);
22
+ const defaultOptions = {
23
+ parentField: "parent",
24
+ idField: "id",
25
+ op: (hasMoved) => !hasMoved
26
+ };
27
+ function getChildrenFromParent(parentId, options) {
28
+ const { parentField } = { ...defaultOptions, ...options };
29
+ return (items) => items.filter((item) => item[parentField] === parentId);
30
+ }
31
+ function filterMovedItems(movedItems, options) {
32
+ const { idField, op: filterOp } = { ...defaultOptions, ...options };
33
+ const movedItemsHash = hashArray(movedItems, idField);
34
+ return (items) => items.filter((item) => filterOp(!!movedItemsHash[item[idField]]));
35
+ }
36
+ function filterBySearch(term, searching) {
37
+ return (items) => searching ? items.filter((item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1) : items;
38
+ }
39
+ export {
40
+ checkHasChildren,
41
+ filterBySearch,
42
+ filterItemsByHierarchy,
43
+ filterMovedItems,
44
+ getActiveIdFromHierarchy,
45
+ getChildrenFromParent,
46
+ getHierarchyTypeName,
47
+ getItemsById,
48
+ isMovable,
49
+ moveItems,
50
+ pipe,
51
+ prepareItems,
52
+ toggleInObject
53
+ };
54
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/helper.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable prettier/prettier */\n/* eslint-disable no-shadow,no-plusplus */\nimport { omit, compose, hashArray } from '@elliemae/ds-utilities';\nimport * as tree from 'treetabular';\n\nexport const getHierarchyTypeName = (dest) =>\n !dest ? 'hierarchy' : 'hierarchyDest';\nexport const checkHasChildren = (list, currentItem) =>\n list.some((item) => currentItem.id === item.parent);\nexport const getActiveIdFromHierarchy = (hierarchy = []) =>\n hierarchy[hierarchy.length - 1] || {};\n\nexport const filterItemsByHierarchy = (\n list,\n hierarchyId,\n parentField = 'parent',\n) => list.filter((item) => item[parentField] === hierarchyId);\nexport const getItemsById = (ids, list) =>\n ids\n .reduce(\n (acc, id) =>\n acc.concat(list.find((item) => String(item.id) === String(id))),\n [],\n )\n .filter((item) => item);\nexport const toggleInObject = (obj, key, value) =>\n obj[key] ? omit(obj, [key]) : { ...obj, [key]: value };\nexport const isMovable = (item) =>\n !item.forceNotMovable &&\n ((item.hasChildren && item.isMoveableContainer) || !item.hasChildren);\n// utility to execute all specified actions in sequence\nexport const pipe = (actions) => (initState, props) =>\n actions.reduce((prevState, action) => action(prevState, props), initState);\n\nexport const moveItems = ({ oldIndex, newIndex }) => (items) => {\n const sourceItem = items[oldIndex];\n items.splice(oldIndex, 1);\n items.splice(newIndex, 0, sourceItem);\n return items;\n};\n\nexport const prepareItems = (items) =>\n compose(tree.fixOrder(), (items) =>\n items.map((item) => ({\n ...item,\n hasChildren: checkHasChildren(items, item),\n })),\n )(items);\n\nconst defaultOptions = {\n parentField: 'parent',\n idField: 'id',\n op: (hasMoved) => !hasMoved,\n};\n\nexport function getChildrenFromParent(parentId, options) {\n const { parentField } = { ...defaultOptions, ...options };\n return (items) => items.filter((item) => item[parentField] === parentId);\n}\n\nexport function filterMovedItems(movedItems, options) {\n const { idField, op: filterOp } = { ...defaultOptions, ...options };\n const movedItemsHash = hashArray(movedItems, idField);\n return (items) =>\n items.filter((item) => filterOp(!!movedItemsHash[item[idField]]));\n}\n\nexport function filterBySearch(term, searching) {\n return (items) =>\n searching\n ? items.filter(\n (item) =>\n item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1,\n )\n : items;\n}\n"],
5
+ "mappings": "AAA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OAAO,CAAC,SAAS,KAAK,iBAAiB;AAAA;AAG1D,0BAA0B,YAAY,SAAS;AACpD,QAAM,EAAE,SAAS,IAAI,aAAa,KAAK,mBAAmB;AAC1D,QAAM,iBAAiB,UAAU,YAAY;AAC7C,SAAO,CAAC,UACN,MAAM,OAAO,CAAC,SAAS,SAAS,CAAC,CAAC,eAAe,KAAK;AAAA;AAGnD,wBAAwB,MAAM,WAAW;AAC9C,SAAO,CAAC,UACN,YACI,MAAM,OACJ,CAAC,SACC,KAAK,KAAK,cAAc,QAAQ,OAAO,MAAM,mBAAmB,MAEpE;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { default as default2, utils, DSShuttleWithSchema, DSShuttle } from "./DSShuttle";
3
+ export {
4
+ DSShuttle,
5
+ DSShuttleWithSchema,
6
+ default2 as default,
7
+ utils
8
+ };
9
+ //# 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 { default, utils, DSShuttleWithSchema, DSShuttle } from './DSShuttle';\n"],
5
+ "mappings": "AAAA;ACAA;",
6
+ "names": []
7
+ }