@elliemae/ds-shuttle 1.60.0 → 2.0.0-alpha.12

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 (188) hide show
  1. package/cjs/AnimationState.js +26 -42
  2. package/cjs/DSShuttle.js +54 -146
  3. package/cjs/SearchState.js +10 -22
  4. package/cjs/Shuttle.actions.js +65 -73
  5. package/cjs/ShuttleContainer.js +49 -77
  6. package/cjs/ShuttleImpl.js +250 -338
  7. package/cjs/ShuttleRenderer.js +121 -184
  8. package/cjs/ShuttleState.js +22 -39
  9. package/cjs/animation/animationConfig.js +56 -63
  10. package/cjs/classedComponents.js +32 -35
  11. package/cjs/components/LoadingIndicator.js +11 -12
  12. package/cjs/components/OverflowList.js +33 -29
  13. package/cjs/components/ShuttleBreadcrumb.js +26 -32
  14. package/cjs/components/ShuttleInfiniteScrollIndicator.js +17 -13
  15. package/cjs/components/ShuttleListItem/ActionButtons.js +39 -34
  16. package/cjs/components/ShuttleListItem/ShuttleListItem.js +59 -58
  17. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +40 -61
  18. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +35 -50
  19. package/cjs/components/ShuttleListPanel.js +11 -23
  20. package/cjs/components/ShuttleSearchBox.js +79 -102
  21. package/cjs/components/ShuttleSource.js +99 -169
  22. package/cjs/components/ShuttleTarget.js +62 -82
  23. package/cjs/components/VirtualizedItem.js +28 -22
  24. package/cjs/components/VirtualizedList.js +52 -50
  25. package/cjs/components/VirtualizedSortableList.js +25 -23
  26. package/cjs/helper.js +52 -82
  27. package/cjs/index.js +1 -60
  28. package/cjs/updateShuttleStateFromProps.js +41 -40
  29. package/cjs/utils.js +9 -9
  30. package/cjs/withProviders.js +15 -16
  31. package/esm/AnimationState.js +25 -40
  32. package/esm/DSShuttle.js +51 -143
  33. package/esm/SearchState.js +9 -20
  34. package/esm/Shuttle.actions.js +64 -71
  35. package/esm/ShuttleContainer.js +47 -75
  36. package/esm/ShuttleImpl.js +254 -334
  37. package/esm/ShuttleRenderer.js +117 -179
  38. package/esm/ShuttleState.js +17 -32
  39. package/esm/animation/animationConfig.js +56 -63
  40. package/esm/classedComponents.js +30 -33
  41. package/esm/components/LoadingIndicator.js +10 -11
  42. package/esm/components/OverflowList.js +30 -26
  43. package/esm/components/ShuttleBreadcrumb.js +23 -29
  44. package/esm/components/ShuttleInfiniteScrollIndicator.js +16 -12
  45. package/esm/components/ShuttleListItem/ActionButtons.js +38 -33
  46. package/esm/components/ShuttleListItem/ShuttleListItem.js +56 -55
  47. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +36 -56
  48. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +31 -46
  49. package/esm/components/ShuttleListPanel.js +10 -22
  50. package/esm/components/ShuttleSearchBox.js +78 -95
  51. package/esm/components/ShuttleSource.js +89 -157
  52. package/esm/components/ShuttleTarget.js +55 -75
  53. package/esm/components/VirtualizedItem.js +26 -20
  54. package/esm/components/VirtualizedList.js +48 -46
  55. package/esm/components/VirtualizedSortableList.js +21 -18
  56. package/esm/helper.js +49 -77
  57. package/esm/index.js +0 -59
  58. package/esm/updateShuttleStateFromProps.js +40 -38
  59. package/esm/utils.js +6 -4
  60. package/esm/withProviders.js +13 -15
  61. package/package.json +163 -18
  62. package/types/AnimationState.d.ts +26 -0
  63. package/types/DSShuttle.d.ts +341 -0
  64. package/types/SearchState.d.ts +22 -0
  65. package/types/Shuttle.actions.d.ts +11 -0
  66. package/types/ShuttleContainer.d.ts +3 -0
  67. package/types/ShuttleImpl.d.ts +3 -0
  68. package/types/ShuttleRenderer.d.ts +37 -0
  69. package/types/ShuttleState.d.ts +53 -0
  70. package/types/animation/animationConfig.d.ts +68 -0
  71. package/types/classedComponents.d.ts +14 -0
  72. package/types/components/LoadingIndicator.d.ts +3 -0
  73. package/types/components/OverflowList.d.ts +7 -0
  74. package/types/components/ShuttleBreadcrumb.d.ts +7 -0
  75. package/types/components/ShuttleInfiniteScrollIndicator.d.ts +5 -0
  76. package/types/components/ShuttleListItem/ActionButtons.d.ts +4 -0
  77. package/types/components/ShuttleListItem/ShuttleListItem.d.ts +14 -0
  78. package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +13 -0
  79. package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +13 -0
  80. package/types/components/ShuttleListPanel.d.ts +7 -0
  81. package/types/components/ShuttleSearchBox.d.ts +20 -0
  82. package/types/components/ShuttleSource.d.ts +54 -0
  83. package/types/components/ShuttleTarget.d.ts +16 -0
  84. package/types/components/VirtualizedItem.d.ts +3 -0
  85. package/types/components/VirtualizedList.d.ts +12 -0
  86. package/types/components/VirtualizedSortableList.d.ts +6 -0
  87. package/types/helper.d.ts +16 -0
  88. package/types/index.d.ts +1 -0
  89. package/types/tests/DSShuttle.events.test.d.ts +1 -0
  90. package/types/tests/DSShuttle.test.d.ts +1 -0
  91. package/types/tests/utils.d.ts +116 -0
  92. package/types/updateShuttleStateFromProps.d.ts +1 -0
  93. package/types/utils.d.ts +2 -0
  94. package/types/withProviders.d.ts +3 -0
  95. package/AnimationState/package.json +0 -10
  96. package/DSShuttle/package.json +0 -10
  97. package/SearchState/package.json +0 -10
  98. package/Shuttle.actions/package.json +0 -10
  99. package/ShuttleContainer/package.json +0 -10
  100. package/ShuttleImpl/package.json +0 -10
  101. package/ShuttleRenderer/package.json +0 -10
  102. package/ShuttleState/package.json +0 -10
  103. package/animation/animationConfig/package.json +0 -10
  104. package/cjs/AnimationState.js.map +0 -1
  105. package/cjs/DSShuttle.js.map +0 -1
  106. package/cjs/SearchState.js.map +0 -1
  107. package/cjs/Shuttle.actions.js.map +0 -1
  108. package/cjs/ShuttleContainer.js.map +0 -1
  109. package/cjs/ShuttleImpl.js.map +0 -1
  110. package/cjs/ShuttleRenderer.js.map +0 -1
  111. package/cjs/ShuttleState.js.map +0 -1
  112. package/cjs/animation/animationConfig.js.map +0 -1
  113. package/cjs/classedComponents.js.map +0 -1
  114. package/cjs/components/LoadingIndicator.js.map +0 -1
  115. package/cjs/components/OverflowList.js.map +0 -1
  116. package/cjs/components/ShuttleBreadcrumb.js.map +0 -1
  117. package/cjs/components/ShuttleInfiniteScrollIndicator.js.map +0 -1
  118. package/cjs/components/ShuttleListItem/ActionButtons.js.map +0 -1
  119. package/cjs/components/ShuttleListItem/ShuttleListItem.js.map +0 -1
  120. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -1
  121. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -1
  122. package/cjs/components/ShuttleListPanel.js.map +0 -1
  123. package/cjs/components/ShuttleSearchBox.js.map +0 -1
  124. package/cjs/components/ShuttleSource.js.map +0 -1
  125. package/cjs/components/ShuttleTarget.js.map +0 -1
  126. package/cjs/components/VirtualizedItem.js.map +0 -1
  127. package/cjs/components/VirtualizedList.js.map +0 -1
  128. package/cjs/components/VirtualizedSortableList.js.map +0 -1
  129. package/cjs/helper.js.map +0 -1
  130. package/cjs/index.js.map +0 -1
  131. package/cjs/tests/utils.js +0 -1112
  132. package/cjs/tests/utils.js.map +0 -1
  133. package/cjs/updateShuttleStateFromProps.js.map +0 -1
  134. package/cjs/utils.js.map +0 -1
  135. package/cjs/withProviders.js.map +0 -1
  136. package/classedComponents/package.json +0 -10
  137. package/components/LoadingIndicator/package.json +0 -10
  138. package/components/OverflowList/package.json +0 -10
  139. package/components/ShuttleBreadcrumb/package.json +0 -10
  140. package/components/ShuttleInfiniteScrollIndicator/package.json +0 -10
  141. package/components/ShuttleListItem/ActionButtons/package.json +0 -10
  142. package/components/ShuttleListItem/ShuttleListItem/package.json +0 -10
  143. package/components/ShuttleListItem/ShuttleSourceListItem/package.json +0 -10
  144. package/components/ShuttleListItem/ShuttleTargetListItem/package.json +0 -10
  145. package/components/ShuttleListPanel/package.json +0 -10
  146. package/components/ShuttleSearchBox/package.json +0 -10
  147. package/components/ShuttleSource/package.json +0 -10
  148. package/components/ShuttleTarget/package.json +0 -10
  149. package/components/VirtualizedItem/package.json +0 -10
  150. package/components/VirtualizedList/package.json +0 -10
  151. package/components/VirtualizedSortableList/package.json +0 -10
  152. package/esm/AnimationState.js.map +0 -1
  153. package/esm/DSShuttle.js.map +0 -1
  154. package/esm/SearchState.js.map +0 -1
  155. package/esm/Shuttle.actions.js.map +0 -1
  156. package/esm/ShuttleContainer.js.map +0 -1
  157. package/esm/ShuttleImpl.js.map +0 -1
  158. package/esm/ShuttleRenderer.js.map +0 -1
  159. package/esm/ShuttleState.js.map +0 -1
  160. package/esm/animation/animationConfig.js.map +0 -1
  161. package/esm/classedComponents.js.map +0 -1
  162. package/esm/components/LoadingIndicator.js.map +0 -1
  163. package/esm/components/OverflowList.js.map +0 -1
  164. package/esm/components/ShuttleBreadcrumb.js.map +0 -1
  165. package/esm/components/ShuttleInfiniteScrollIndicator.js.map +0 -1
  166. package/esm/components/ShuttleListItem/ActionButtons.js.map +0 -1
  167. package/esm/components/ShuttleListItem/ShuttleListItem.js.map +0 -1
  168. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -1
  169. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -1
  170. package/esm/components/ShuttleListPanel.js.map +0 -1
  171. package/esm/components/ShuttleSearchBox.js.map +0 -1
  172. package/esm/components/ShuttleSource.js.map +0 -1
  173. package/esm/components/ShuttleTarget.js.map +0 -1
  174. package/esm/components/VirtualizedItem.js.map +0 -1
  175. package/esm/components/VirtualizedList.js.map +0 -1
  176. package/esm/components/VirtualizedSortableList.js.map +0 -1
  177. package/esm/helper.js.map +0 -1
  178. package/esm/index.js.map +0 -1
  179. package/esm/tests/utils.js +0 -1100
  180. package/esm/tests/utils.js.map +0 -1
  181. package/esm/updateShuttleStateFromProps.js.map +0 -1
  182. package/esm/utils.js.map +0 -1
  183. package/esm/withProviders.js.map +0 -1
  184. package/helper/package.json +0 -10
  185. package/tests/utils/package.json +0 -10
  186. package/updateShuttleStateFromProps/package.json +0 -10
  187. package/utils/package.json +0 -10
  188. package/withProviders/package.json +0 -10
@@ -1,30 +1,19 @@
1
- import React from 'react';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
2
3
  import DSButton from '@elliemae/ds-button';
3
4
  import { ShuttleListPanel as ShuttleListPanel$1 } from '../classedComponents.js';
4
- import '@elliemae/ds-classnames';
5
- import './ShuttleBreadcrumb.js';
6
- import 'react-spring/web.cjs';
7
- import '@elliemae/ds-breadcrumb';
8
- import '../animation/animationConfig.js';
9
- import './OverflowList.js';
10
- import '@babel/runtime/helpers/esm/defineProperty';
11
- import '../AnimationState.js';
12
- import '@babel/runtime/helpers/esm/slicedToArray';
13
- import 'constate';
14
5
 
15
6
  function ShuttleListPanel(_ref) {
16
- var _ref$onClick = _ref.onClick,
17
- onClick = _ref$onClick === void 0 ? function () {
18
- return null;
19
- } : _ref$onClick,
20
- _ref$open = _ref.open,
21
- open = _ref$open === void 0 ? false : _ref$open,
22
- children = _ref.children;
23
- return /*#__PURE__*/React.createElement(ShuttleListPanel$1, {
7
+ let {
8
+ onClick = () => null,
9
+ open = false,
10
+ children
11
+ } = _ref;
12
+ return /*#__PURE__*/_jsx(ShuttleListPanel$1, {
24
13
  classProps: {
25
- open: open
14
+ open
26
15
  }
27
- }, /*#__PURE__*/React.createElement(DSButton, {
16
+ }, void 0, /*#__PURE__*/_jsx(DSButton, {
28
17
  buttonType: "text",
29
18
  icon: children,
30
19
  onClick: onClick,
@@ -33,4 +22,3 @@ function ShuttleListPanel(_ref) {
33
22
  }
34
23
 
35
24
  export { ShuttleListPanel as default };
36
- //# sourceMappingURL=ShuttleListPanel.js.map
@@ -1,121 +1,104 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
3
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
4
- import _inherits from '@babel/runtime/helpers/esm/inherits';
5
- import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
6
- import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
7
- import React, { Component } from 'react';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import { Component } from 'react';
8
3
  import { aggregatedClasses } from '@elliemae/ds-classnames';
9
4
  import { debounce } from '@elliemae/ds-utilities';
10
5
  import { DSTextBox } from '@elliemae/ds-form';
11
6
 
12
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
-
14
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
- var blockName = 'shuttle-search-box';
16
- var SearchBoxContainer = aggregatedClasses('div')(blockName, null, function (_ref) {
17
- var isOpen = _ref.isOpen;
7
+ const blockName = 'shuttle-search-box';
8
+ const SearchBoxContainer = aggregatedClasses('div')(blockName, null, _ref => {
9
+ let {
10
+ isOpen
11
+ } = _ref;
18
12
  return {
19
13
  opened: isOpen
20
14
  };
21
15
  });
22
- var filterList = debounce(function (term, onFilterCallback) {
16
+ const filterList = debounce((term, onFilterCallback) => {
23
17
  onFilterCallback(term);
24
18
  }, 200);
25
-
26
- var ShuttleSearchBox = /*#__PURE__*/function (_Component) {
27
- _inherits(ShuttleSearchBox, _Component);
28
-
29
- var _super = _createSuper(ShuttleSearchBox);
30
-
31
- function ShuttleSearchBox(props) {
32
- var _this;
33
-
34
- _classCallCheck(this, ShuttleSearchBox);
35
-
36
- _this = _super.call(this, props);
37
- _this.state = {
19
+ class ShuttleSearchBox extends Component {
20
+ constructor(props) {
21
+ super(props);
22
+ this.state = {
38
23
  value: props.value,
39
24
  prevProps: {}
40
25
  };
41
- _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
42
- _this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_this));
43
- return _this;
26
+ this.handleChange = this.handleChange.bind(this);
27
+ this.handleKeyPress = this.handleKeyPress.bind(this);
44
28
  }
45
29
 
46
- _createClass(ShuttleSearchBox, [{
47
- key: "handleChange",
48
- value: function handleChange(e) {
49
- var _this$props = this.props,
50
- onChange = _this$props.onChange,
51
- filterOnKeyStroke = _this$props.filterOnKeyStroke,
52
- onFilter = _this$props.onFilter;
53
- var value = e.target.value;
54
- onChange(value);
55
- if (filterOnKeyStroke) filterList(value, onFilter);
56
- this.setState({
57
- value: value
58
- });
59
- }
60
- }, {
61
- key: "handleKeyPress",
62
- value: function handleKeyPress(e) {
63
- var onFilter = this.props.onFilter;
64
- if (e.keyCode === 13) onFilter(e.target.value);
65
- }
66
- }, {
67
- key: "render",
68
- value: function render() {
69
- var value = this.state.value;
70
- var _this$props2 = this.props,
71
- isOpen = _this$props2.isOpen,
72
- onClose = _this$props2.onClose,
73
- placeholder = _this$props2.placeholder;
74
- return /*#__PURE__*/React.createElement(SearchBoxContainer, {
75
- classProps: {
76
- isOpen: isOpen
30
+ static getDerivedStateFromProps(nextProps, _ref2) {
31
+ let {
32
+ prevProps
33
+ } = _ref2;
34
+ const {
35
+ value
36
+ } = nextProps;
37
+
38
+ if (value !== prevProps.value) {
39
+ return {
40
+ value,
41
+ prevProps: {
42
+ value
77
43
  }
78
- }, /*#__PURE__*/React.createElement(DSTextBox, {
79
- autoFocus: true,
80
- clearable: true,
81
- onChange: this.handleChange,
82
- onClear: onClose,
83
- onKeyDown: this.handleKeyPress,
84
- placeholder: placeholder,
85
- value: value
86
- }));
44
+ };
87
45
  }
88
- }], [{
89
- key: "getDerivedStateFromProps",
90
- value: function getDerivedStateFromProps(nextProps, _ref2) {
91
- var prevProps = _ref2.prevProps;
92
- var value = nextProps.value;
93
46
 
94
- if (value !== prevProps.value) {
95
- return {
96
- value: value,
97
- prevProps: {
98
- value: value
99
- }
100
- };
101
- }
47
+ return null;
48
+ }
102
49
 
103
- return null;
104
- }
105
- }]);
50
+ handleChange(e) {
51
+ const {
52
+ onChange,
53
+ filterOnKeyStroke,
54
+ onFilter
55
+ } = this.props;
56
+ const {
57
+ value
58
+ } = e.target;
59
+ onChange(value);
60
+ if (filterOnKeyStroke) filterList(value, onFilter);
61
+ this.setState({
62
+ value
63
+ });
64
+ }
65
+
66
+ handleKeyPress(e) {
67
+ const {
68
+ onFilter
69
+ } = this.props;
70
+ if (e.keyCode === 13) onFilter(e.target.value);
71
+ }
106
72
 
107
- return ShuttleSearchBox;
108
- }(Component);
73
+ render() {
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, {
87
+ autoFocus: true,
88
+ clearable: true,
89
+ onChange: this.handleChange,
90
+ onClear: onClose,
91
+ onKeyDown: this.handleKeyPress,
92
+ placeholder: placeholder,
93
+ value: value
94
+ }));
95
+ }
109
96
 
97
+ }
110
98
  ShuttleSearchBox.defaultProps = {
111
99
  filterOnKeyStroke: false,
112
- onChange: function onChange() {
113
- return null;
114
- },
115
- onFilter: function onFilter() {
116
- return null;
117
- }
100
+ onChange: () => null,
101
+ onFilter: () => null
118
102
  };
119
103
 
120
104
  export { ShuttleSearchBox as default };
121
- //# sourceMappingURL=ShuttleSearchBox.js.map
@@ -1,8 +1,14 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
2
1
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
2
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
3
3
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
4
- import React, { useContext, useMemo, useCallback } from 'react';
5
- import PropTypes from 'prop-types';
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';
6
12
  import { Search, ArrowShortRight } from '@elliemae/ds-icons';
7
13
  import DSButton from '@elliemae/ds-button';
8
14
  import { runAll } from '@elliemae/ds-utilities';
@@ -17,113 +23,67 @@ import AnimationContext from '../AnimationState.js';
17
23
  import SearchState from '../SearchState.js';
18
24
  import VirtualizedSortableList from './VirtualizedSortableList.js';
19
25
  import LoadingIndicator from './LoadingIndicator.js';
20
- import '@babel/runtime/helpers/esm/classCallCheck';
21
- import '@babel/runtime/helpers/esm/createClass';
22
- import '@babel/runtime/helpers/esm/assertThisInitialized';
23
- import '@babel/runtime/helpers/esm/inherits';
24
- import '@babel/runtime/helpers/esm/possibleConstructorReturn';
25
- import '@babel/runtime/helpers/esm/getPrototypeOf';
26
- import '@elliemae/ds-classnames';
27
- import '@elliemae/ds-form';
28
- import '@elliemae/ds-indeterminate-progress-indicator';
29
- import '@babel/runtime/helpers/esm/slicedToArray';
30
- import './ShuttleListItem/ActionButtons.js';
31
- import './ShuttleListItem/ShuttleListItem.js';
32
- import 'react-spring/web.cjs';
33
- import '@elliemae/ds-truncated-tooltip-text';
34
- import 'react-sortable-hoc';
35
- import './ShuttleBreadcrumb.js';
36
- import '@elliemae/ds-breadcrumb';
37
- import '../animation/animationConfig.js';
38
- import './OverflowList.js';
39
- import 'react-window';
40
- import 'react-window-infinite-loader';
41
- import 'react-virtualized-auto-sizer';
42
- import './VirtualizedItem.js';
43
- import 'treetabular';
44
- import 'constate';
45
- import '@elliemae/ds-circular-progress-indicator';
46
- import 'styled-components';
26
+ import { jsx } from 'react/jsx-runtime';
47
27
 
48
- var _excluded = ["item"];
28
+ const _excluded = ["item"];
29
+
30
+ var _Search, _LoadingList, _ArrowShortRight, _ShuttleInfiniteScrol;
49
31
 
50
32
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
51
33
 
52
34
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
53
35
 
54
- var noop = function noop() {};
36
+ const noop = () => {};
55
37
 
56
38
  function ShuttleSource(_ref) {
57
- var _ref$items = _ref.items,
58
- items = _ref$items === void 0 ? [] : _ref$items,
59
- _ref$checkedItems = _ref.checkedItems,
60
- checkedItems = _ref$checkedItems === void 0 ? [] : _ref$checkedItems,
61
- _ref$hierarchy = _ref.hierarchy,
62
- hierarchy = _ref$hierarchy === void 0 ? [] : _ref$hierarchy,
63
- _ref$onMoveItem = _ref.onMoveItem,
64
- onMoveItem = _ref$onMoveItem === void 0 ? noop : _ref$onMoveItem,
65
- _ref$onCheckItem = _ref.onCheckItem,
66
- onCheckItem = _ref$onCheckItem === void 0 ? noop : _ref$onCheckItem,
67
- _ref$onMoveCheckedIte = _ref.onMoveCheckedItems,
68
- onMoveCheckedItems = _ref$onMoveCheckedIte === void 0 ? noop : _ref$onMoveCheckedIte,
69
- _ref$onNavigateTo = _ref.onNavigateTo,
70
- onNavigateTo = _ref$onNavigateTo === void 0 ? noop : _ref$onNavigateTo,
71
- _ref$onClearCheckedIt = _ref.onClearCheckedItems,
72
- onClearCheckedItems = _ref$onClearCheckedIt === void 0 ? noop : _ref$onClearCheckedIt,
73
- _ref$emptyMessage = _ref.emptyMessage,
74
- emptyMessage = _ref$emptyMessage === void 0 ? 'No items found' : _ref$emptyMessage,
75
- _ref$composeSourceIte = _ref.composeSourceItemProps,
76
- composeSourceItemProps = _ref$composeSourceIte === void 0 ? noop : _ref$composeSourceIte,
77
- _ref$loading = _ref.loading,
78
- loading = _ref$loading === void 0 ? false : _ref$loading,
79
- _ref$onSearch = _ref.onSearch,
80
- onSearch = _ref$onSearch === void 0 ? noop : _ref$onSearch,
81
- _ref$onSearchClose = _ref.onSearchClose,
82
- onSearchClose = _ref$onSearchClose === void 0 ? noop : _ref$onSearchClose,
83
- _ref$onSearchOpen = _ref.onSearchOpen,
84
- onSearchOpen = _ref$onSearchOpen === void 0 ? noop : _ref$onSearchOpen,
85
- _ref$sourceSortable = _ref.sourceSortable,
86
- sourceSortable = _ref$sourceSortable === void 0 ? false : _ref$sourceSortable,
87
- _ref$onSortEnd = _ref.onSortEnd,
88
- onSortEnd = _ref$onSortEnd === void 0 ? noop : _ref$onSortEnd,
89
- _ref$sourceClearItems = _ref.sourceClearItemsText,
90
- sourceClearItemsText = _ref$sourceClearItems === void 0 ? 'CLEAR ALL' : _ref$sourceClearItems,
91
- searchPlaceholder = _ref.searchPlaceholder,
92
- _ref$renderSourceCoun = _ref.renderSourceCounter,
93
- renderSourceCounter = _ref$renderSourceCoun === void 0 ? function (amount) {
94
- return "".concat(amount, " items");
95
- } : _ref$renderSourceCoun,
96
- _ref$onGetMoreItems = _ref.onGetMoreItems,
97
- onGetMoreItems = _ref$onGetMoreItems === void 0 ? function () {} : _ref$onGetMoreItems,
98
- _ref$moreItemsLoading = _ref.moreItemsLoading,
99
- moreItemsLoading = _ref$moreItemsLoading === void 0 ? false : _ref$moreItemsLoading,
100
- _ref$hasNextPage = _ref.hasNextPage,
101
- hasNextPage = _ref$hasNextPage === void 0 ? false : _ref$hasNextPage;
102
-
103
- var _useContext = useContext(AnimationContext.Context),
104
- _useContext$state = _useContext.state,
105
- _useContext$state$isM = _useContext$state.isMovingBack,
106
- isMovingBack = _useContext$state$isM === void 0 ? false : _useContext$state$isM,
107
- isMoving = _useContext$state.isMoving;
108
-
109
- var _useContext2 = useContext(SearchState.Context),
110
- _useContext2$state = _useContext2.state,
111
- searching = _useContext2$state.searching,
112
- searchTerm = _useContext2$state.searchTerm,
113
- setSearchTerm = _useContext2.setSearchTerm,
114
- resetSearch = _useContext2.reset,
115
- toggleSearchBox = _useContext2.toggleSearchBox;
116
-
117
- var hashedCheckedItems = useMemo(function () {
118
- return checkedItems.reduce(function (result, item) {
119
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item, true));
120
- }, {});
121
- }, [checkedItems]);
122
- var handleCloseSearch = useCallback(function () {
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;
64
+ const {
65
+ state: {
66
+ isMovingBack = false,
67
+ isMoving
68
+ }
69
+ } = useContext(AnimationContext.Context);
70
+ const {
71
+ state: {
72
+ searching,
73
+ searchTerm
74
+ },
75
+ setSearchTerm,
76
+ reset: resetSearch,
77
+ toggleSearchBox
78
+ } = useContext(SearchState.Context);
79
+ const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
80
+ [item]: true
81
+ }), {}), [checkedItems]);
82
+ const handleCloseSearch = useCallback(() => {
123
83
  setSearchTerm('');
124
84
  runAll(resetSearch, onSearchClose)();
125
85
  }, [searching]);
126
- var handleToggleSearch = useCallback(function () {
86
+ const handleToggleSearch = useCallback(() => {
127
87
  toggleSearchBox(!searching);
128
88
 
129
89
  if (searching) {
@@ -132,64 +92,62 @@ function ShuttleSource(_ref) {
132
92
  onSearchOpen();
133
93
  }
134
94
  }, [searching]);
135
- var ComponentList = useMemo(function () {
136
- return sourceSortable ? VirtualizedSortableList : VirtualizedList;
137
- }, [sourceSortable]);
95
+ const ComponentList = useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
138
96
 
139
- var handleSortEnd = function handleSortEnd(_ref2) {
140
- var oldIndex = _ref2.oldIndex,
141
- newIndex = _ref2.newIndex;
97
+ const handleSortEnd = _ref2 => {
98
+ let {
99
+ oldIndex,
100
+ newIndex
101
+ } = _ref2;
142
102
  onSortEnd({
143
103
  sourceItem: items[oldIndex],
144
104
  targetItem: items[newIndex]
145
105
  });
146
106
  };
147
107
 
148
- var isEmpty = !items.length;
149
- var hasContent = !loading && !isEmpty;
150
- var contentIsEmpty = !loading && isEmpty;
151
- return /*#__PURE__*/React.createElement(ShuttleWrapper, null, /*#__PURE__*/React.createElement(ShuttleHeader, null, /*#__PURE__*/React.createElement(ShuttleHeaderBreadcrumb, {
108
+ const isEmpty = !items.length;
109
+ const hasContent = !loading && !isEmpty;
110
+ const contentIsEmpty = !loading && isEmpty;
111
+ return /*#__PURE__*/_jsx(ShuttleWrapper, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeader, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeaderBreadcrumb, {
152
112
  hierarchy: hierarchy,
153
113
  onNavigateTo: onNavigateTo
154
- }), /*#__PURE__*/React.createElement(ShuttleHeaderSearchToggle, {
114
+ }), /*#__PURE__*/_jsx(ShuttleHeaderSearchToggle, {
155
115
  buttonType: "text",
156
- icon: /*#__PURE__*/React.createElement(Search, null),
116
+ icon: _Search || (_Search = /*#__PURE__*/_jsx(Search, {})),
157
117
  onClick: handleToggleSearch,
158
118
  containerProps: {
159
119
  'data-testid': 'shuttle-header-search-toggle'
160
120
  }
161
- })), /*#__PURE__*/React.createElement(ShuttleList, {
121
+ })), /*#__PURE__*/_jsx(ShuttleList, {
162
122
  classProps: {
163
123
  showPulse: isMovingBack
164
124
  },
165
125
  style: {
166
126
  pointerEvents: isMoving ? 'none' : null
167
127
  }
168
- }, /*#__PURE__*/React.createElement(ShuttleSearchBox, {
169
- key: searching,
128
+ }, void 0, /*#__PURE__*/_jsx(ShuttleSearchBox, {
170
129
  isOpen: searching,
171
- onClose: runAll(function () {
172
- return toggleSearchBox(false);
173
- }, handleCloseSearch),
130
+ onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
174
131
  onFilter: runAll(setSearchTerm, onSearch),
175
132
  placeholder: searchPlaceholder,
176
133
  value: searchTerm
177
- }), hasContent ? /*#__PURE__*/React.createElement(Overflow, {
134
+ }, searching), hasContent ? /*#__PURE__*/_jsx(Overflow, {
178
135
  activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
179
136
  classProps: {
180
- searching: searching,
137
+ searching,
181
138
  empty: isEmpty
182
139
  }
183
- }, /*#__PURE__*/React.createElement(ComponentList, {
184
- key: searchTerm,
140
+ }, void 0, /*#__PURE__*/_jsx(ComponentList, {
185
141
  helperClass: "drag-helper",
186
- itemRenderer: function itemRenderer(_ref3) {
187
- var item = _ref3.item,
142
+ itemRenderer: _ref3 => {
143
+ let {
144
+ item
145
+ } = _ref3,
188
146
  rest = _objectWithoutProperties(_ref3, _excluded);
189
147
 
190
- return /*#__PURE__*/React.createElement(ShuttleSourceListItem, _extends({
148
+ return /*#__PURE__*/jsx(ShuttleSourceListItem, _objectSpread(_objectSpread(_objectSpread({
191
149
  "data-testid": "source-list-item"
192
- }, rest, composeSourceItemProps(item, rest), {
150
+ }, rest), composeSourceItemProps(item, rest)), {}, {
193
151
  isChecked: !!hashedCheckedItems[item.id],
194
152
  item: item,
195
153
  onItemCheck: onCheckItem,
@@ -202,46 +160,20 @@ function ShuttleSource(_ref) {
202
160
  onSortEnd: handleSortEnd,
203
161
  getMoreItems: onGetMoreItems,
204
162
  hasNextPage: hasNextPage
205
- })) : null, contentIsEmpty ? /*#__PURE__*/React.createElement(LoadingList, {
163
+ }, searchTerm)) : null, contentIsEmpty ? /*#__PURE__*/_jsx(LoadingList, {
206
164
  "data-testid": "shuttle__loading-list"
207
- }, /*#__PURE__*/React.createElement(EmptyMessage, null, emptyMessage)) : null, loading ? /*#__PURE__*/React.createElement(LoadingList, {
165
+ }, void 0, /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage)) : null, loading ? _LoadingList || (_LoadingList = /*#__PURE__*/_jsx(LoadingList, {
208
166
  "data-testid": "shuttle__loading-list"
209
- }, /*#__PURE__*/React.createElement(LoadingIndicator, null)) : null, /*#__PURE__*/React.createElement(ShuttleListPanel, {
167
+ }, void 0, /*#__PURE__*/_jsx(LoadingIndicator, {}))) : null, /*#__PURE__*/_jsx(ShuttleListPanel, {
210
168
  onClick: onMoveCheckedItems,
211
169
  open: checkedItems.length > 1
212
- }, /*#__PURE__*/React.createElement(ArrowShortRight, null)), moreItemsLoading ? /*#__PURE__*/React.createElement(ShuttleInfiniteScrollIndicator, {
170
+ }, void 0, _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx(ArrowShortRight, {}))), moreItemsLoading ? _ShuttleInfiniteScrol || (_ShuttleInfiniteScrol = /*#__PURE__*/_jsx(ShuttleInfiniteScrollIndicator, {
213
171
  isOpen: true
214
- }) : null), /*#__PURE__*/React.createElement(ShuttleFooter, null, /*#__PURE__*/React.createElement(ShuttleFooterActions, null, !!checkedItems.length && /*#__PURE__*/React.createElement(DSButton, {
172
+ })) : null), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!checkedItems.length && /*#__PURE__*/_jsx(DSButton, {
215
173
  buttonType: "link",
216
174
  labelText: sourceClearItemsText,
217
175
  onClick: onClearCheckedItems
218
- })), /*#__PURE__*/React.createElement(ShuttleFooterCounter, null, renderSourceCounter(checkedItems.length))));
176
+ })), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderSourceCounter(checkedItems.length))));
219
177
  }
220
178
 
221
- ShuttleSource.propTypes = {
222
- items: PropTypes.arrayOf(PropTypes.shape({})),
223
- checkedItems: PropTypes.arrayOf(PropTypes.shape({})),
224
- hierarchy: PropTypes.arrayOf(PropTypes.shape({})),
225
- onMoveItem: PropTypes.func,
226
- onCheckItem: PropTypes.func,
227
- onMoveCheckedItems: PropTypes.func,
228
- onNavigateTo: PropTypes.func,
229
- onClearCheckedItems: PropTypes.func,
230
- emptyMessage: PropTypes.string,
231
- composeSourceItemProps: PropTypes.func,
232
- loading: PropTypes.bool,
233
- onSearch: PropTypes.func,
234
- onSearchClose: PropTypes.func,
235
- onSearchOpen: PropTypes.func,
236
- sourceSortable: PropTypes.bool,
237
- onSortEnd: PropTypes.func,
238
- sourceClearItemsText: PropTypes.string,
239
- searchPlaceholder: PropTypes.string,
240
- renderSourceCounter: PropTypes.func,
241
- onGetMoreItems: PropTypes.func,
242
- moreItemsLoading: PropTypes.bool,
243
- hasNextPage: PropTypes.bool
244
- };
245
-
246
179
  export { ShuttleSource as default };
247
- //# sourceMappingURL=ShuttleSource.js.map