@elliemae/ds-shuttle 2.2.0-alpha.4 → 3.0.0-next.2

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 (148) hide show
  1. package/cjs/AnimationState.js +19 -46
  2. package/cjs/DSShuttle.js +219 -166
  3. package/cjs/SearchState.js +25 -44
  4. package/cjs/Shuttle.actions.js +98 -87
  5. package/cjs/ShuttleContainer.js +61 -56
  6. package/cjs/ShuttleImpl.js +206 -109
  7. package/cjs/ShuttleRenderer.js +135 -140
  8. package/cjs/ShuttleState.js +53 -57
  9. package/cjs/animation/animationConfig.js +56 -53
  10. package/cjs/classedComponents.js +69 -70
  11. package/cjs/components/LoadingIndicator.js +22 -49
  12. package/cjs/components/OverflowList.js +48 -50
  13. package/cjs/components/ShuttleBreadcrumb.js +40 -52
  14. package/cjs/components/ShuttleInfiniteScrollIndicator.js +37 -46
  15. package/cjs/components/ShuttleListItem/ActionButtons.js +51 -56
  16. package/cjs/components/ShuttleListItem/ShuttleListItem.js +80 -78
  17. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +64 -78
  18. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +56 -72
  19. package/cjs/components/ShuttleListPanel.js +26 -44
  20. package/cjs/components/ShuttleSearchBox.js +72 -61
  21. package/cjs/components/ShuttleSource.js +146 -150
  22. package/cjs/components/ShuttleTarget.js +100 -88
  23. package/cjs/components/VirtualizedItem.js +40 -45
  24. package/cjs/components/VirtualizedList.js +86 -81
  25. package/cjs/components/VirtualizedSortableList.js +40 -47
  26. package/cjs/helper.js +103 -69
  27. package/cjs/index.js +12 -38
  28. package/cjs/updateShuttleStateFromProps.js +69 -73
  29. package/cjs/utils.js +42 -40
  30. package/cjs/withProviders.js +27 -43
  31. package/esm/AnimationState.js +8 -12
  32. package/esm/DSShuttle.js +198 -126
  33. package/esm/SearchState.js +19 -15
  34. package/esm/Shuttle.actions.js +80 -63
  35. package/esm/ShuttleContainer.js +50 -34
  36. package/esm/ShuttleImpl.js +183 -78
  37. package/esm/ShuttleRenderer.js +128 -111
  38. package/esm/ShuttleState.js +53 -34
  39. package/esm/animation/animationConfig.js +52 -24
  40. package/esm/classedComponents.js +51 -43
  41. package/esm/components/LoadingIndicator.js +15 -20
  42. package/esm/components/OverflowList.js +41 -21
  43. package/esm/components/ShuttleBreadcrumb.js +33 -23
  44. package/esm/components/ShuttleInfiniteScrollIndicator.js +31 -18
  45. package/esm/components/ShuttleListItem/ActionButtons.js +39 -27
  46. package/esm/components/ShuttleListItem/ShuttleListItem.js +72 -50
  47. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +52 -45
  48. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +47 -42
  49. package/esm/components/ShuttleListPanel.js +19 -15
  50. package/esm/components/ShuttleSearchBox.js +66 -32
  51. package/esm/components/ShuttleSource.js +129 -125
  52. package/esm/components/ShuttleTarget.js +89 -68
  53. package/esm/components/VirtualizedItem.js +33 -15
  54. package/esm/components/VirtualizedList.js +75 -50
  55. package/esm/components/VirtualizedSortableList.js +32 -17
  56. package/esm/helper.js +67 -43
  57. package/esm/index.js +2 -9
  58. package/esm/updateShuttleStateFromProps.js +58 -39
  59. package/esm/utils.js +18 -12
  60. package/esm/withProviders.js +20 -14
  61. package/package.json +11 -11
  62. package/types/AnimationState.d.ts +2 -3
  63. package/types/DSShuttle.d.ts +1 -1
  64. package/types/SearchState.d.ts +2 -3
  65. package/types/ShuttleImpl.d.ts +2 -3
  66. package/types/ShuttleRenderer.d.ts +0 -1
  67. package/types/ShuttleState.d.ts +2 -3
  68. package/types/components/LoadingIndicator.d.ts +0 -1
  69. package/types/components/OverflowList.d.ts +0 -1
  70. package/types/components/ShuttleBreadcrumb.d.ts +0 -1
  71. package/types/components/ShuttleInfiniteScrollIndicator.d.ts +0 -1
  72. package/types/components/ShuttleListItem/ShuttleListItem.d.ts +0 -1
  73. package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +0 -1
  74. package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +0 -1
  75. package/types/components/ShuttleListPanel.d.ts +0 -1
  76. package/types/components/ShuttleSearchBox.d.ts +1 -3
  77. package/types/components/ShuttleSource.d.ts +0 -1
  78. package/types/components/ShuttleTarget.d.ts +0 -1
  79. package/types/components/VirtualizedItem.d.ts +0 -1
  80. package/types/components/VirtualizedList.d.ts +0 -1
  81. package/types/components/VirtualizedSortableList.d.ts +0 -1
  82. package/types/index.d.ts +1 -1
  83. package/types/updateShuttleStateFromProps.d.ts +1 -3
  84. package/types/withProviders.d.ts +0 -1
  85. package/cjs/AnimationState.js.map +0 -7
  86. package/cjs/DSShuttle.js.map +0 -7
  87. package/cjs/SearchState.js.map +0 -7
  88. package/cjs/Shuttle.actions.js.map +0 -7
  89. package/cjs/ShuttleContainer.js.map +0 -7
  90. package/cjs/ShuttleImpl.js.map +0 -7
  91. package/cjs/ShuttleRenderer.js.map +0 -7
  92. package/cjs/ShuttleState.js.map +0 -7
  93. package/cjs/animation/animationConfig.js.map +0 -7
  94. package/cjs/classedComponents.js.map +0 -7
  95. package/cjs/components/LoadingIndicator.js.map +0 -7
  96. package/cjs/components/OverflowList.js.map +0 -7
  97. package/cjs/components/ShuttleBreadcrumb.js.map +0 -7
  98. package/cjs/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
  99. package/cjs/components/ShuttleListItem/ActionButtons.js.map +0 -7
  100. package/cjs/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
  101. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
  102. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
  103. package/cjs/components/ShuttleListPanel.js.map +0 -7
  104. package/cjs/components/ShuttleSearchBox.js.map +0 -7
  105. package/cjs/components/ShuttleSource.js.map +0 -7
  106. package/cjs/components/ShuttleTarget.js.map +0 -7
  107. package/cjs/components/VirtualizedItem.js.map +0 -7
  108. package/cjs/components/VirtualizedList.js.map +0 -7
  109. package/cjs/components/VirtualizedSortableList.js.map +0 -7
  110. package/cjs/helper.js.map +0 -7
  111. package/cjs/index.js.map +0 -7
  112. package/cjs/tests/utils.js +0 -1218
  113. package/cjs/tests/utils.js.map +0 -7
  114. package/cjs/updateShuttleStateFromProps.js.map +0 -7
  115. package/cjs/utils.js.map +0 -7
  116. package/cjs/withProviders.js.map +0 -7
  117. package/esm/AnimationState.js.map +0 -7
  118. package/esm/DSShuttle.js.map +0 -7
  119. package/esm/SearchState.js.map +0 -7
  120. package/esm/Shuttle.actions.js.map +0 -7
  121. package/esm/ShuttleContainer.js.map +0 -7
  122. package/esm/ShuttleImpl.js.map +0 -7
  123. package/esm/ShuttleRenderer.js.map +0 -7
  124. package/esm/ShuttleState.js.map +0 -7
  125. package/esm/animation/animationConfig.js.map +0 -7
  126. package/esm/classedComponents.js.map +0 -7
  127. package/esm/components/LoadingIndicator.js.map +0 -7
  128. package/esm/components/OverflowList.js.map +0 -7
  129. package/esm/components/ShuttleBreadcrumb.js.map +0 -7
  130. package/esm/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
  131. package/esm/components/ShuttleListItem/ActionButtons.js.map +0 -7
  132. package/esm/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
  133. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
  134. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
  135. package/esm/components/ShuttleListPanel.js.map +0 -7
  136. package/esm/components/ShuttleSearchBox.js.map +0 -7
  137. package/esm/components/ShuttleSource.js.map +0 -7
  138. package/esm/components/ShuttleTarget.js.map +0 -7
  139. package/esm/components/VirtualizedItem.js.map +0 -7
  140. package/esm/components/VirtualizedList.js.map +0 -7
  141. package/esm/components/VirtualizedSortableList.js.map +0 -7
  142. package/esm/helper.js.map +0 -7
  143. package/esm/index.js.map +0 -7
  144. package/esm/tests/utils.js +0 -1189
  145. package/esm/tests/utils.js.map +0 -7
  146. package/esm/updateShuttleStateFromProps.js.map +0 -7
  147. package/esm/utils.js.map +0 -7
  148. package/esm/withProviders.js.map +0 -7
@@ -1,10 +1,18 @@
1
- import * as React from "react";
2
- import React2, { Component } from "react";
3
- import { aggregatedClasses } from "@elliemae/ds-classnames";
4
- import { debounce } from "@elliemae/ds-utilities";
5
- import { DSTextBox } from "@elliemae/ds-form";
6
- const blockName = "shuttle-search-box";
7
- const SearchBoxContainer = aggregatedClasses("div")(blockName, null, ({ isOpen }) => ({ opened: isOpen }));
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import { Component } from 'react';
3
+ import { aggregatedClasses } from '@elliemae/ds-classnames';
4
+ import { debounce } from '@elliemae/ds-utilities';
5
+ import { DSTextBox } from '@elliemae/ds-form';
6
+
7
+ const blockName = 'shuttle-search-box';
8
+ const SearchBoxContainer = aggregatedClasses('div')(blockName, null, _ref => {
9
+ let {
10
+ isOpen
11
+ } = _ref;
12
+ return {
13
+ opened: isOpen
14
+ };
15
+ });
8
16
  const filterList = debounce((term, onFilterCallback) => {
9
17
  onFilterCallback(term);
10
18
  }, 200);
@@ -15,56 +23,82 @@ class ShuttleSearchBox extends Component {
15
23
  value: props.value,
16
24
  prevProps: {}
17
25
  };
18
- this.handleKeyPress = this.handleKeyPress.bind(this);
19
26
  this.handleChange = this.handleChange.bind(this);
27
+ this.handleKeyPress = this.handleKeyPress.bind(this);
20
28
  }
21
- static getDerivedStateFromProps(nextProps, { prevProps }) {
22
- const { value } = nextProps;
29
+
30
+ static getDerivedStateFromProps(nextProps, _ref2) {
31
+ let {
32
+ prevProps
33
+ } = _ref2;
34
+ const {
35
+ value
36
+ } = nextProps;
37
+
23
38
  if (value !== prevProps.value) {
24
39
  return {
25
40
  value,
26
- prevProps: { value }
41
+ prevProps: {
42
+ value
43
+ }
27
44
  };
28
45
  }
46
+
29
47
  return null;
30
48
  }
49
+
31
50
  handleChange(e) {
32
- const { onChange, filterOnKeyStroke, onFilter } = this.props;
33
- const { value } = e.target;
51
+ const {
52
+ onChange,
53
+ filterOnKeyStroke,
54
+ onFilter
55
+ } = this.props;
56
+ const {
57
+ value
58
+ } = e.target;
34
59
  onChange(value);
35
- if (filterOnKeyStroke)
36
- filterList(value, onFilter);
37
- this.setState({ value });
60
+ if (filterOnKeyStroke) filterList(value, onFilter);
61
+ this.setState({
62
+ value
63
+ });
38
64
  }
65
+
39
66
  handleKeyPress(e) {
40
- const { onFilter } = this.props;
41
- if (e.keyCode === 13)
42
- onFilter(e.target.value);
67
+ const {
68
+ onFilter
69
+ } = this.props;
70
+ if (e.keyCode === 13) onFilter(e.target.value);
43
71
  }
72
+
44
73
  render() {
45
- const { value } = this.state;
46
- const { isOpen, onClose, placeholder } = this.props;
47
- return /* @__PURE__ */ React2.createElement(SearchBoxContainer, {
48
- classProps: { isOpen }
49
- }, /* @__PURE__ */ React2.createElement(DSTextBox, {
74
+ const {
75
+ value
76
+ } = this.state;
77
+ const {
78
+ isOpen,
79
+ onClose,
80
+ placeholder
81
+ } = this.props;
82
+ return /*#__PURE__*/_jsx(SearchBoxContainer, {
83
+ classProps: {
84
+ isOpen
85
+ }
86
+ }, void 0, /*#__PURE__*/_jsx(DSTextBox, {
50
87
  autoFocus: true,
51
88
  clearable: true,
52
89
  onChange: this.handleChange,
53
90
  onClear: onClose,
54
91
  onKeyDown: this.handleKeyPress,
55
- placeholder,
56
- value
92
+ placeholder: placeholder,
93
+ value: value
57
94
  }));
58
95
  }
96
+
59
97
  }
60
98
  ShuttleSearchBox.defaultProps = {
61
99
  filterOnKeyStroke: false,
62
100
  onChange: () => null,
63
101
  onFilter: () => null
64
102
  };
65
- var ShuttleSearchBox_default = ShuttleSearchBox;
66
- export {
67
- ShuttleSearchBox,
68
- ShuttleSearchBox_default as default
69
- };
70
- //# sourceMappingURL=ShuttleSearchBox.js.map
103
+
104
+ export { ShuttleSearchBox as default };
@@ -1,75 +1,91 @@
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
- }) {
1
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
2
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
3
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
5
+ import 'core-js/modules/esnext.iterator.constructor.js';
6
+ import 'core-js/modules/esnext.iterator.reduce.js';
7
+ import 'core-js/modules/esnext.async-iterator.filter.js';
8
+ import 'core-js/modules/esnext.iterator.filter.js';
9
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
10
+ import 'core-js/modules/esnext.iterator.for-each.js';
11
+ import { useContext, useMemo, useCallback } from 'react';
12
+ import { Search, ArrowShortRight } from '@elliemae/ds-icons';
13
+ import DSButton from '@elliemae/ds-button';
14
+ import { runAll } from '@elliemae/ds-utilities';
15
+ import ShuttleSearchBox from './ShuttleSearchBox.js';
16
+ import ShuttleInfiniteScrollIndicator from './ShuttleInfiniteScrollIndicator.js';
17
+ import ShuttleSourceListItem from './ShuttleListItem/ShuttleSourceListItem.js';
18
+ import { ShuttleWrapper, ShuttleHeader, ShuttleHeaderBreadcrumb, ShuttleHeaderSearchToggle, ShuttleList, Overflow, LoadingList, EmptyMessage, ShuttleFooter, ShuttleFooterActions, ShuttleFooterCounter } from '../classedComponents.js';
19
+ import ShuttleListPanel from './ShuttleListPanel.js';
20
+ import VirtualizedList from './VirtualizedList.js';
21
+ import { getActiveIdFromHierarchy } from '../helper.js';
22
+ import AnimationContext from '../AnimationState.js';
23
+ import SearchState from '../SearchState.js';
24
+ import VirtualizedSortableList from './VirtualizedSortableList.js';
25
+ import LoadingIndicator from './LoadingIndicator.js';
26
+ import { jsx } from 'react/jsx-runtime';
27
+
28
+ const _excluded = ["item"];
29
+
30
+ var _Search, _LoadingList, _ArrowShortRight, _ShuttleInfiniteScrol;
31
+
32
+ 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; }
33
+
34
+ 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; }
35
+
36
+ const noop = () => {};
37
+
38
+ function ShuttleSource(_ref) {
39
+ let {
40
+ items = [],
41
+ checkedItems = [],
42
+ // build Map() and memoize it for better performance
43
+ hierarchy = [],
44
+ onMoveItem = noop,
45
+ onCheckItem = noop,
46
+ onMoveCheckedItems = noop,
47
+ onNavigateTo = noop,
48
+ onClearCheckedItems = noop,
49
+ emptyMessage = 'No items found',
50
+ composeSourceItemProps = noop,
51
+ loading = false,
52
+ onSearch = noop,
53
+ onSearchClose = noop,
54
+ onSearchOpen = noop,
55
+ sourceSortable = false,
56
+ onSortEnd = noop,
57
+ sourceClearItemsText = 'CLEAR ALL',
58
+ searchPlaceholder,
59
+ renderSourceCounter = amount => "".concat(amount, " items"),
60
+ onGetMoreItems = () => {},
61
+ moreItemsLoading = false,
62
+ hasNextPage = false
63
+ } = _ref;
57
64
  const {
58
- state: { isMovingBack = false, isMoving }
59
- } = useContext(AnimationState.Context);
65
+ state: {
66
+ isMovingBack = false,
67
+ isMoving
68
+ }
69
+ } = useContext(AnimationContext.Context);
60
70
  const {
61
- state: { searching, searchTerm },
71
+ state: {
72
+ searching,
73
+ searchTerm
74
+ },
62
75
  setSearchTerm,
63
76
  reset: resetSearch,
64
77
  toggleSearchBox
65
78
  } = useContext(SearchState.Context);
66
- const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}), [checkedItems]);
79
+ const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
80
+ [item]: true
81
+ }), {}), [checkedItems]);
67
82
  const handleCloseSearch = useCallback(() => {
68
- setSearchTerm("");
83
+ setSearchTerm('');
69
84
  runAll(resetSearch, onSearchClose)();
70
85
  }, [searching]);
71
86
  const handleToggleSearch = useCallback(() => {
72
87
  toggleSearchBox(!searching);
88
+
73
89
  if (searching) {
74
90
  handleCloseSearch();
75
91
  } else {
@@ -77,99 +93,87 @@ function ShuttleSource({
77
93
  }
78
94
  }, [searching]);
79
95
  const ComponentList = useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
80
- const handleSortEnd = ({ oldIndex, newIndex }) => {
96
+
97
+ const handleSortEnd = _ref2 => {
98
+ let {
99
+ oldIndex,
100
+ newIndex
101
+ } = _ref2;
81
102
  onSortEnd({
82
103
  sourceItem: items[oldIndex],
83
104
  targetItem: items[newIndex]
84
105
  });
85
106
  };
107
+
86
108
  const isEmpty = !items.length;
87
109
  const hasContent = !loading && !isEmpty;
88
110
  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, {
111
+ return /*#__PURE__*/_jsx(ShuttleWrapper, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeader, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeaderBreadcrumb, {
112
+ hierarchy: hierarchy,
113
+ onNavigateTo: onNavigateTo
114
+ }), /*#__PURE__*/_jsx(ShuttleHeaderSearchToggle, {
93
115
  buttonType: "text",
94
- icon: /* @__PURE__ */ React2.createElement(Search, null),
116
+ icon: _Search || (_Search = /*#__PURE__*/_jsx(Search, {})),
95
117
  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,
118
+ containerProps: {
119
+ 'data-testid': 'shuttle-header-search-toggle'
120
+ }
121
+ })), /*#__PURE__*/_jsx(ShuttleList, {
122
+ classProps: {
123
+ showPulse: isMovingBack
124
+ },
125
+ style: {
126
+ pointerEvents: isMoving ? 'none' : null
127
+ }
128
+ }, void 0, /*#__PURE__*/_jsx(ShuttleSearchBox, {
102
129
  isOpen: searching,
103
130
  onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
104
131
  onFilter: runAll(setSearchTerm, onSearch),
105
132
  placeholder: searchPlaceholder,
106
133
  value: searchTerm
107
- }), hasContent ? /* @__PURE__ */ React2.createElement(Overflow, {
134
+ }, searching), hasContent ? /*#__PURE__*/_jsx(Overflow, {
108
135
  activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
109
136
  classProps: {
110
137
  searching,
111
138
  empty: isEmpty
112
139
  }
113
- }, /* @__PURE__ */ React2.createElement(ComponentList, {
114
- key: searchTerm,
140
+ }, void 0, /*#__PURE__*/_jsx(ComponentList, {
115
141
  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,
142
+ itemRenderer: _ref3 => {
143
+ let {
144
+ item
145
+ } = _ref3,
146
+ rest = _objectWithoutProperties(_ref3, _excluded);
147
+
148
+ return /*#__PURE__*/jsx(ShuttleSourceListItem, _objectSpread(_objectSpread(_objectSpread({
149
+ "data-testid": "source-list-item"
150
+ }, rest), composeSourceItemProps(item, rest)), {}, {
151
+ isChecked: !!hashedCheckedItems[item.id],
152
+ item: item,
153
+ onItemCheck: onCheckItem,
154
+ onMoveToTarget: onMoveItem,
155
+ onNavigateOnSourceTo: onNavigateTo,
156
+ showSortHandler: sourceSortable
157
+ }));
158
+ },
159
+ items: items,
128
160
  onSortEnd: handleSortEnd,
129
161
  getMoreItems: onGetMoreItems,
130
- hasNextPage
131
- })) : null, contentIsEmpty ? /* @__PURE__ */ React2.createElement(LoadingList, {
162
+ hasNextPage: hasNextPage
163
+ }, searchTerm)) : null, contentIsEmpty ? /*#__PURE__*/_jsx(LoadingList, {
132
164
  "data-testid": "shuttle__loading-list"
133
- }, /* @__PURE__ */ React2.createElement(EmptyMessage, null, emptyMessage)) : null, loading ? /* @__PURE__ */ React2.createElement(LoadingList, {
165
+ }, void 0, /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage)) : null, loading ? _LoadingList || (_LoadingList = /*#__PURE__*/_jsx(LoadingList, {
134
166
  "data-testid": "shuttle__loading-list"
135
- }, /* @__PURE__ */ React2.createElement(LoadingIndicator, null)) : null, /* @__PURE__ */ React2.createElement(ShuttleListPanel, {
167
+ }, void 0, /*#__PURE__*/_jsx(LoadingIndicator, {}))) : null, /*#__PURE__*/_jsx(ShuttleListPanel, {
136
168
  onClick: onMoveCheckedItems,
137
169
  open: checkedItems.length > 1
138
- }, /* @__PURE__ */ React2.createElement(ArrowShortRight, null)), moreItemsLoading ? /* @__PURE__ */ React2.createElement(ShuttleInfiniteScrollIndicator, {
170
+ }, void 0, _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx(ArrowShortRight, {}))), moreItemsLoading ? _ShuttleInfiniteScrol || (_ShuttleInfiniteScrol = /*#__PURE__*/_jsx(ShuttleInfiniteScrollIndicator, {
139
171
  isOpen: true
140
- }) : null), /* @__PURE__ */ React2.createElement(ShuttleFooter, null, /* @__PURE__ */ React2.createElement(ShuttleFooterActions, null, !!checkedItems.length && /* @__PURE__ */ React2.createElement(DSButton, {
172
+ })) : null), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!checkedItems.length && /*#__PURE__*/_jsx(DSButton, {
141
173
  buttonType: "link",
142
174
  labelText: sourceClearItemsText,
143
175
  onClick: onClearCheckedItems
144
- })), /* @__PURE__ */ React2.createElement(ShuttleFooterCounter, null, renderSourceCounter(checkedItems.length))));
176
+ })), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderSourceCounter(checkedItems.length))));
145
177
  }
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
178
+
179
+ export { ShuttleSource as default };
@@ -1,86 +1,107 @@
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
- }) {
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 _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
8
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
9
+ import { useContext } from 'react';
10
+ import DSButton from '@elliemae/ds-button';
11
+ import { ShuttleWrapper, ShuttleHeader, ShuttleHeaderBreadcrumb, ShuttleList, Overflow, LoadingList, ShuttleFooter, ShuttleFooterActions, ShuttleFooterCounter, EmptyMessage } from '../classedComponents.js';
12
+ import { getActiveIdFromHierarchy } from '../helper.js';
13
+ import AnimationContext from '../AnimationState.js';
14
+ import VirtualizedList from './VirtualizedList.js';
15
+ import ShuttleTargetListItem from './ShuttleListItem/ShuttleTargetListItem.js';
16
+ import VirtualizedSortableList from './VirtualizedSortableList.js';
17
+ import LoadingIndicator from './LoadingIndicator.js';
18
+ import { jsx } from 'react/jsx-runtime';
19
+
20
+ const _excluded = ["item"];
21
+
22
+ var _LoadingIndicator;
23
+
24
+ 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; }
25
+
26
+ 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; }
27
+
28
+ const noop = () => {};
29
+
30
+ function ShuttleTarget(_ref) {
31
+ let {
32
+ items = [],
33
+ hierarchy = [],
34
+ onNavigateTo = noop,
35
+ onMoveItem = noop,
36
+ onClearMovedItems = noop,
37
+ emptyMessage = 'No items selected',
38
+ composeTargetItemProps = () => ({}),
39
+ targetSortable = false,
40
+ onSortEnd = noop,
41
+ targetClearItemsText = 'CLEAR ALL',
42
+ renderTargetCounter = amount => "".concat(amount, " items"),
43
+ loading = false
44
+ } = _ref;
38
45
  const {
39
- state: { isMoving = false }
40
- } = useContext(AnimationState.Context);
46
+ state: {
47
+ isMoving = false
48
+ }
49
+ } = useContext(AnimationContext.Context);
41
50
  const isEmpty = !items.length;
42
- const emptyContent = loading ? /* @__PURE__ */ React2.createElement(LoadingIndicator, null) : /* @__PURE__ */ React2.createElement(EmptyMessage, null, emptyMessage);
51
+ const emptyContent = loading ? _LoadingIndicator || (_LoadingIndicator = /*#__PURE__*/_jsx(LoadingIndicator, {})) : /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage);
43
52
  const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;
44
- const handleSortEnd = ({ oldIndex, newIndex }) => {
53
+
54
+ const handleSortEnd = _ref2 => {
55
+ let {
56
+ oldIndex,
57
+ newIndex
58
+ } = _ref2;
45
59
  onSortEnd({
46
60
  sourceItem: items[oldIndex],
47
61
  targetItem: items[newIndex]
48
62
  });
49
63
  };
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, {
64
+
65
+ return /*#__PURE__*/_jsx(ShuttleWrapper, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeader, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeaderBreadcrumb, {
66
+ hierarchy: hierarchy,
67
+ onNavigateTo: onNavigateTo
68
+ })), /*#__PURE__*/_jsx(ShuttleList, {
69
+ classProps: {
70
+ showPulse: isMoving
71
+ }
72
+ }, void 0, !loading && !isEmpty ? /*#__PURE__*/_jsx(Overflow, {
56
73
  activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
57
74
  classProps: {
58
75
  empty: !items.length
59
76
  }
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,
77
+ }, void 0, /*#__PURE__*/_jsx(ComponentList, {
78
+ itemRenderer: _ref3 => {
79
+ let {
80
+ item
81
+ } = _ref3,
82
+ rest = _objectWithoutProperties(_ref3, _excluded);
83
+
84
+ return /*#__PURE__*/jsx(ShuttleTargetListItem, _objectSpread(_objectSpread(_objectSpread({
85
+ "data-testid": "target-list-item"
86
+ }, rest), composeTargetItemProps(item, rest)), {}, {
87
+ isRoot: !getActiveIdFromHierarchy(hierarchy).id,
88
+ item: item,
89
+ onMoveToSource: onMoveItem,
90
+ onNavigateOnTargetTo: onNavigateTo,
91
+ showSortHandler: targetSortable
92
+ }));
93
+ },
94
+ items: items,
72
95
  onSortEnd: handleSortEnd,
73
96
  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" },
97
+ })) : /*#__PURE__*/_jsx(LoadingList, {}, void 0, emptyContent)), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!items.length && /*#__PURE__*/_jsx(DSButton, {
98
+ containerProps: {
99
+ 'data-testid': 'shuttle-clear-all-target'
100
+ },
76
101
  buttonType: "link",
77
102
  labelText: targetClearItemsText,
78
103
  onClick: onClearMovedItems
79
- })), /* @__PURE__ */ React2.createElement(ShuttleFooterCounter, null, renderTargetCounter(items.length))));
104
+ })), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderTargetCounter(items.length))));
80
105
  }
81
- var ShuttleTarget_default = ShuttleTarget;
82
- export {
83
- ShuttleTarget,
84
- ShuttleTarget_default as default
85
- };
86
- //# sourceMappingURL=ShuttleTarget.js.map
106
+
107
+ export { ShuttleTarget as default };