@elliemae/ds-shuttle 1.55.0-next.7 → 2.0.0-alpha.10

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