@elliemae/ds-shuttle 2.2.0-next.3 → 2.3.0-alpha.1

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 +46 -19
  2. package/cjs/AnimationState.js.map +7 -0
  3. package/cjs/DSShuttle.js +166 -219
  4. package/cjs/DSShuttle.js.map +7 -0
  5. package/cjs/SearchState.js +44 -25
  6. package/cjs/SearchState.js.map +7 -0
  7. package/cjs/Shuttle.actions.js +87 -98
  8. package/cjs/Shuttle.actions.js.map +7 -0
  9. package/cjs/ShuttleContainer.js +56 -61
  10. package/cjs/ShuttleContainer.js.map +7 -0
  11. package/cjs/ShuttleImpl.js +109 -206
  12. package/cjs/ShuttleImpl.js.map +7 -0
  13. package/cjs/ShuttleRenderer.js +140 -135
  14. package/cjs/ShuttleRenderer.js.map +7 -0
  15. package/cjs/ShuttleState.js +57 -53
  16. package/cjs/ShuttleState.js.map +7 -0
  17. package/cjs/animation/animationConfig.js +53 -56
  18. package/cjs/animation/animationConfig.js.map +7 -0
  19. package/cjs/classedComponents.js +70 -69
  20. package/cjs/classedComponents.js.map +7 -0
  21. package/cjs/components/LoadingIndicator.js +49 -22
  22. package/cjs/components/LoadingIndicator.js.map +7 -0
  23. package/cjs/components/OverflowList.js +50 -48
  24. package/cjs/components/OverflowList.js.map +7 -0
  25. package/cjs/components/ShuttleBreadcrumb.js +52 -40
  26. package/cjs/components/ShuttleBreadcrumb.js.map +7 -0
  27. package/cjs/components/ShuttleInfiniteScrollIndicator.js +46 -37
  28. package/cjs/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
  29. package/cjs/components/ShuttleListItem/ActionButtons.js +56 -51
  30. package/cjs/components/ShuttleListItem/ActionButtons.js.map +7 -0
  31. package/cjs/components/ShuttleListItem/ShuttleListItem.js +78 -80
  32. package/cjs/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
  33. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +78 -64
  34. package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
  35. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +72 -56
  36. package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
  37. package/cjs/components/ShuttleListPanel.js +44 -26
  38. package/cjs/components/ShuttleListPanel.js.map +7 -0
  39. package/cjs/components/ShuttleSearchBox.js +61 -72
  40. package/cjs/components/ShuttleSearchBox.js.map +7 -0
  41. package/cjs/components/ShuttleSource.js +150 -146
  42. package/cjs/components/ShuttleSource.js.map +7 -0
  43. package/cjs/components/ShuttleTarget.js +88 -100
  44. package/cjs/components/ShuttleTarget.js.map +7 -0
  45. package/cjs/components/VirtualizedItem.js +45 -40
  46. package/cjs/components/VirtualizedItem.js.map +7 -0
  47. package/cjs/components/VirtualizedList.js +81 -86
  48. package/cjs/components/VirtualizedList.js.map +7 -0
  49. package/cjs/components/VirtualizedSortableList.js +47 -40
  50. package/cjs/components/VirtualizedSortableList.js.map +7 -0
  51. package/cjs/helper.js +69 -103
  52. package/cjs/helper.js.map +7 -0
  53. package/cjs/index.js +38 -12
  54. package/cjs/index.js.map +7 -0
  55. package/cjs/tests/utils.js +1218 -0
  56. package/cjs/tests/utils.js.map +7 -0
  57. package/cjs/updateShuttleStateFromProps.js +73 -69
  58. package/cjs/updateShuttleStateFromProps.js.map +7 -0
  59. package/cjs/utils.js +40 -42
  60. package/cjs/utils.js.map +7 -0
  61. package/cjs/withProviders.js +43 -27
  62. package/cjs/withProviders.js.map +7 -0
  63. package/esm/AnimationState.js +12 -8
  64. package/esm/AnimationState.js.map +7 -0
  65. package/esm/DSShuttle.js +126 -198
  66. package/esm/DSShuttle.js.map +7 -0
  67. package/esm/SearchState.js +15 -19
  68. package/esm/SearchState.js.map +7 -0
  69. package/esm/Shuttle.actions.js +63 -80
  70. package/esm/Shuttle.actions.js.map +7 -0
  71. package/esm/ShuttleContainer.js +34 -50
  72. package/esm/ShuttleContainer.js.map +7 -0
  73. package/esm/ShuttleImpl.js +78 -183
  74. package/esm/ShuttleImpl.js.map +7 -0
  75. package/esm/ShuttleRenderer.js +111 -128
  76. package/esm/ShuttleRenderer.js.map +7 -0
  77. package/esm/ShuttleState.js +34 -53
  78. package/esm/ShuttleState.js.map +7 -0
  79. package/esm/animation/animationConfig.js +24 -52
  80. package/esm/animation/animationConfig.js.map +7 -0
  81. package/esm/classedComponents.js +43 -51
  82. package/esm/classedComponents.js.map +7 -0
  83. package/esm/components/LoadingIndicator.js +20 -15
  84. package/esm/components/LoadingIndicator.js.map +7 -0
  85. package/esm/components/OverflowList.js +21 -41
  86. package/esm/components/OverflowList.js.map +7 -0
  87. package/esm/components/ShuttleBreadcrumb.js +23 -33
  88. package/esm/components/ShuttleBreadcrumb.js.map +7 -0
  89. package/esm/components/ShuttleInfiniteScrollIndicator.js +18 -31
  90. package/esm/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
  91. package/esm/components/ShuttleListItem/ActionButtons.js +27 -39
  92. package/esm/components/ShuttleListItem/ActionButtons.js.map +7 -0
  93. package/esm/components/ShuttleListItem/ShuttleListItem.js +50 -72
  94. package/esm/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
  95. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +45 -52
  96. package/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
  97. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +42 -47
  98. package/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
  99. package/esm/components/ShuttleListPanel.js +15 -19
  100. package/esm/components/ShuttleListPanel.js.map +7 -0
  101. package/esm/components/ShuttleSearchBox.js +32 -66
  102. package/esm/components/ShuttleSearchBox.js.map +7 -0
  103. package/esm/components/ShuttleSource.js +125 -129
  104. package/esm/components/ShuttleSource.js.map +7 -0
  105. package/esm/components/ShuttleTarget.js +68 -89
  106. package/esm/components/ShuttleTarget.js.map +7 -0
  107. package/esm/components/VirtualizedItem.js +15 -33
  108. package/esm/components/VirtualizedItem.js.map +7 -0
  109. package/esm/components/VirtualizedList.js +50 -75
  110. package/esm/components/VirtualizedList.js.map +7 -0
  111. package/esm/components/VirtualizedSortableList.js +17 -32
  112. package/esm/components/VirtualizedSortableList.js.map +7 -0
  113. package/esm/helper.js +43 -67
  114. package/esm/helper.js.map +7 -0
  115. package/esm/index.js +9 -2
  116. package/esm/index.js.map +7 -0
  117. package/esm/tests/utils.js +1189 -0
  118. package/esm/tests/utils.js.map +7 -0
  119. package/esm/updateShuttleStateFromProps.js +39 -58
  120. package/esm/updateShuttleStateFromProps.js.map +7 -0
  121. package/esm/utils.js +12 -18
  122. package/esm/utils.js.map +7 -0
  123. package/esm/withProviders.js +14 -20
  124. package/esm/withProviders.js.map +7 -0
  125. package/package.json +11 -11
  126. package/types/AnimationState.d.ts +3 -2
  127. package/types/DSShuttle.d.ts +2 -39
  128. package/types/SearchState.d.ts +3 -2
  129. package/types/ShuttleImpl.d.ts +3 -2
  130. package/types/ShuttleRenderer.d.ts +1 -0
  131. package/types/ShuttleState.d.ts +3 -2
  132. package/types/components/LoadingIndicator.d.ts +1 -0
  133. package/types/components/OverflowList.d.ts +1 -0
  134. package/types/components/ShuttleBreadcrumb.d.ts +1 -0
  135. package/types/components/ShuttleInfiniteScrollIndicator.d.ts +1 -0
  136. package/types/components/ShuttleListItem/ShuttleListItem.d.ts +1 -0
  137. package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +1 -0
  138. package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +1 -0
  139. package/types/components/ShuttleListPanel.d.ts +1 -0
  140. package/types/components/ShuttleSearchBox.d.ts +3 -1
  141. package/types/components/ShuttleSource.d.ts +1 -0
  142. package/types/components/ShuttleTarget.d.ts +1 -0
  143. package/types/components/VirtualizedItem.d.ts +1 -0
  144. package/types/components/VirtualizedList.d.ts +1 -0
  145. package/types/components/VirtualizedSortableList.d.ts +1 -0
  146. package/types/index.d.ts +1 -1
  147. package/types/updateShuttleStateFromProps.d.ts +3 -1
  148. package/types/withProviders.d.ts +1 -0
@@ -1,49 +1,44 @@
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 _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import { useCallback } from 'react';
10
- import { DrillDownButton, DeleteButton } from './ActionButtons.js';
11
- import ShuttleListItem from './ShuttleListItem.js';
12
- import { jsx } from 'react/jsx-runtime';
13
-
14
- const _excluded = ["item", "onMoveToSource", "onNavigateOnTargetTo", "isRoot", "showDeleteButton", "showDrillDownButton", "showActions", "index"];
15
-
16
- 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; }
17
-
18
- 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; }
19
-
20
- function ShuttleTargetListItem(_ref) {
21
- let {
22
- item = {},
23
- onMoveToSource = () => null,
24
- onNavigateOnTargetTo = () => null,
25
- isRoot = false,
26
- showDeleteButton = true,
27
- showDrillDownButton = true,
28
- showActions = true,
29
- index
30
- } = _ref,
31
- rest = _objectWithoutProperties(_ref, _excluded);
32
-
1
+ import * as React from "react";
2
+ import React2, { useCallback } from "react";
3
+ import { DeleteButton, DrillDownButton } from "./ActionButtons";
4
+ import { ShuttleListItem } from "./ShuttleListItem";
5
+ function ShuttleTargetListItem({
6
+ item = {},
7
+ onMoveToSource = () => null,
8
+ onNavigateOnTargetTo = () => null,
9
+ isRoot = false,
10
+ showDeleteButton = true,
11
+ showDrillDownButton = true,
12
+ showActions = true,
13
+ index,
14
+ ...rest
15
+ }) {
33
16
  const moveToSource = useCallback(() => onMoveToSource(item), [item]);
34
- const navigateOnTargetTo = useCallback(() => onNavigateOnTargetTo(item), [item]);
35
- return /*#__PURE__*/jsx(ShuttleListItem, _objectSpread(_objectSpread({}, rest), {}, {
36
- actions: [showDrillDownButton && /*#__PURE__*/_jsx(DrillDownButton, {
37
- disabled: !item.hasChildren && !item.asyncLoad || item.readOnly || item.disableDrillDown,
38
- onClick: navigateOnTargetTo
39
- }, "drill-down"), showDeleteButton && isRoot && /*#__PURE__*/_jsx(DeleteButton, {
40
- disabled: item.readOnly,
41
- onClick: moveToSource,
42
- "data-testid": "ds-shuttle__close-button"
43
- }, "delete")],
44
- item: item,
45
- showActions: showActions
46
- }));
17
+ const navigateOnTargetTo = useCallback(() => onNavigateOnTargetTo(item), [
18
+ item
19
+ ]);
20
+ return /* @__PURE__ */ React2.createElement(ShuttleListItem, {
21
+ ...rest,
22
+ actions: [
23
+ showDrillDownButton && /* @__PURE__ */ React2.createElement(DrillDownButton, {
24
+ key: "drill-down",
25
+ disabled: !item.hasChildren && !item.asyncLoad || item.readOnly || item.disableDrillDown,
26
+ onClick: navigateOnTargetTo
27
+ }),
28
+ showDeleteButton && isRoot && /* @__PURE__ */ React2.createElement(DeleteButton, {
29
+ key: "delete",
30
+ disabled: item.readOnly,
31
+ onClick: moveToSource,
32
+ "data-testid": "ds-shuttle__close-button"
33
+ })
34
+ ],
35
+ item,
36
+ showActions
37
+ });
47
38
  }
48
-
49
- export { ShuttleTargetListItem as default };
39
+ var ShuttleTargetListItem_default = ShuttleTargetListItem;
40
+ export {
41
+ ShuttleTargetListItem,
42
+ ShuttleTargetListItem_default as default
43
+ };
44
+ //# sourceMappingURL=ShuttleTargetListItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/ShuttleListItem/ShuttleTargetListItem.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\nimport React, { useCallback } from 'react';\nimport { DeleteButton, DrillDownButton } from './ActionButtons';\nimport { ShuttleListItem } from './ShuttleListItem';\n\nfunction ShuttleTargetListItem({\n item = {},\n onMoveToSource = () => null,\n onNavigateOnTargetTo = () => null,\n isRoot = false,\n showDeleteButton = true,\n showDrillDownButton = true,\n showActions = true,\n index,\n ...rest\n}) {\n const moveToSource = useCallback(() => onMoveToSource(item), [item]);\n const navigateOnTargetTo = useCallback(() => onNavigateOnTargetTo(item), [\n item,\n ]);\n return (\n <ShuttleListItem\n {...rest}\n actions={[\n showDrillDownButton && (\n <DrillDownButton\n key=\"drill-down\"\n disabled={\n (!item.hasChildren && !item.asyncLoad) ||\n item.readOnly ||\n item.disableDrillDown\n }\n onClick={navigateOnTargetTo}\n />\n ),\n showDeleteButton && isRoot && (\n <DeleteButton\n key=\"delete\"\n disabled={item.readOnly}\n onClick={moveToSource}\n data-testid=\"ds-shuttle__close-button\"\n />\n ),\n ]}\n item={item}\n showActions={showActions}\n />\n );\n}\n\nexport { ShuttleTargetListItem };\nexport default ShuttleTargetListItem;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AAEA,+BAA+B;AAAA,EAC7B,OAAO;AAAA,EACP,iBAAiB,MAAM;AAAA,EACvB,uBAAuB,MAAM;AAAA,EAC7B,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,cAAc;AAAA,EACd;AAAA,KACG;AAAA,GACF;AACD,QAAM,eAAe,YAAY,MAAM,eAAe,OAAO,CAAC;AAC9D,QAAM,qBAAqB,YAAY,MAAM,qBAAqB,OAAO;AAAA,IACvE;AAAA;AAEF,SACE,qCAAC,iBAAD;AAAA,OACM;AAAA,IACJ,SAAS;AAAA,MACP,uBACE,qCAAC,iBAAD;AAAA,QACE,KAAI;AAAA,QACJ,UACG,CAAC,KAAK,eAAe,CAAC,KAAK,aAC5B,KAAK,YACL,KAAK;AAAA,QAEP,SAAS;AAAA;AAAA,MAGb,oBAAoB,UAClB,qCAAC,cAAD;AAAA,QACE,KAAI;AAAA,QACJ,UAAU,KAAK;AAAA,QACf,SAAS;AAAA,QACT,eAAY;AAAA;AAAA;AAAA,IAIlB;AAAA,IACA;AAAA;AAAA;AAMN,IAAO,gCAAQ;",
6
+ "names": []
7
+ }
@@ -1,24 +1,20 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import DSButton from '@elliemae/ds-button';
4
- import { ShuttleListPanel as ShuttleListPanel$1 } from '../classedComponents.js';
5
-
6
- function ShuttleListPanel(_ref) {
7
- let {
8
- onClick = () => null,
9
- open = false,
10
- children
11
- } = _ref;
12
- return /*#__PURE__*/_jsx(ShuttleListPanel$1, {
13
- classProps: {
14
- open
15
- }
16
- }, void 0, /*#__PURE__*/_jsx(DSButton, {
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { DSButton } from "@elliemae/ds-button";
4
+ import { ShuttleListPanel as Wrapper } from "../classedComponents";
5
+ function ShuttleListPanel({ onClick = () => null, open = false, children }) {
6
+ return /* @__PURE__ */ React2.createElement(Wrapper, {
7
+ classProps: { open }
8
+ }, /* @__PURE__ */ React2.createElement(DSButton, {
17
9
  buttonType: "text",
18
10
  icon: children,
19
- onClick: onClick,
11
+ onClick,
20
12
  "data-testid": "list-panel-btn"
21
13
  }));
22
14
  }
23
-
24
- export { ShuttleListPanel as default };
15
+ var ShuttleListPanel_default = ShuttleListPanel;
16
+ export {
17
+ ShuttleListPanel,
18
+ ShuttleListPanel_default as default
19
+ };
20
+ //# sourceMappingURL=ShuttleListPanel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleListPanel.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { DSButton } from '@elliemae/ds-button';\nimport { ShuttleListPanel as Wrapper } from '../classedComponents';\n\nfunction ShuttleListPanel({ onClick = () => null, open = false, children }) {\n return (\n <Wrapper classProps={{ open }}>\n <DSButton buttonType=\"text\" icon={children} onClick={onClick} data-testid=\"list-panel-btn\" />\n </Wrapper>\n );\n}\n\nexport { ShuttleListPanel };\nexport default ShuttleListPanel;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAEA,0BAA0B,EAAE,UAAU,MAAM,MAAM,OAAO,OAAO,YAAY;AAC1E,SACE,qCAAC,SAAD;AAAA,IAAS,YAAY,EAAE;AAAA,KACrB,qCAAC,UAAD;AAAA,IAAU,YAAW;AAAA,IAAO,MAAM;AAAA,IAAU;AAAA,IAAkB,eAAY;AAAA;AAAA;AAMhF,IAAO,2BAAQ;",
6
+ "names": []
7
+ }
@@ -1,18 +1,10 @@
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
- });
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 }));
16
8
  const filterList = debounce((term, onFilterCallback) => {
17
9
  onFilterCallback(term);
18
10
  }, 200);
@@ -23,82 +15,56 @@ class ShuttleSearchBox extends Component {
23
15
  value: props.value,
24
16
  prevProps: {}
25
17
  };
26
- this.handleChange = this.handleChange.bind(this);
27
18
  this.handleKeyPress = this.handleKeyPress.bind(this);
19
+ this.handleChange = this.handleChange.bind(this);
28
20
  }
29
-
30
- static getDerivedStateFromProps(nextProps, _ref2) {
31
- let {
32
- prevProps
33
- } = _ref2;
34
- const {
35
- value
36
- } = nextProps;
37
-
21
+ static getDerivedStateFromProps(nextProps, { prevProps }) {
22
+ const { value } = nextProps;
38
23
  if (value !== prevProps.value) {
39
24
  return {
40
25
  value,
41
- prevProps: {
42
- value
43
- }
26
+ prevProps: { value }
44
27
  };
45
28
  }
46
-
47
29
  return null;
48
30
  }
49
-
50
31
  handleChange(e) {
51
- const {
52
- onChange,
53
- filterOnKeyStroke,
54
- onFilter
55
- } = this.props;
56
- const {
57
- value
58
- } = e.target;
32
+ const { onChange, filterOnKeyStroke, onFilter } = this.props;
33
+ const { value } = e.target;
59
34
  onChange(value);
60
- if (filterOnKeyStroke) filterList(value, onFilter);
61
- this.setState({
62
- value
63
- });
35
+ if (filterOnKeyStroke)
36
+ filterList(value, onFilter);
37
+ this.setState({ value });
64
38
  }
65
-
66
39
  handleKeyPress(e) {
67
- const {
68
- onFilter
69
- } = this.props;
70
- if (e.keyCode === 13) onFilter(e.target.value);
40
+ const { onFilter } = this.props;
41
+ if (e.keyCode === 13)
42
+ onFilter(e.target.value);
71
43
  }
72
-
73
44
  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, {
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, {
87
50
  autoFocus: true,
88
51
  clearable: true,
89
52
  onChange: this.handleChange,
90
53
  onClear: onClose,
91
54
  onKeyDown: this.handleKeyPress,
92
- placeholder: placeholder,
93
- value: value
55
+ placeholder,
56
+ value
94
57
  }));
95
58
  }
96
-
97
59
  }
98
60
  ShuttleSearchBox.defaultProps = {
99
61
  filterOnKeyStroke: false,
100
62
  onChange: () => null,
101
63
  onFilter: () => null
102
64
  };
103
-
104
- export { ShuttleSearchBox as default };
65
+ var ShuttleSearchBox_default = ShuttleSearchBox;
66
+ export {
67
+ ShuttleSearchBox,
68
+ ShuttleSearchBox_default as default
69
+ };
70
+ //# sourceMappingURL=ShuttleSearchBox.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleSearchBox.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/no-unused-state */\nimport React, { Component } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { debounce } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '@elliemae/ds-form';\n\nconst blockName = 'shuttle-search-box';\n\nconst SearchBoxContainer = aggregatedClasses('div')(blockName, null, ({ isOpen }) => ({ opened: isOpen }));\n\nconst filterList = debounce((term, onFilterCallback) => {\n onFilterCallback(term);\n}, 200);\n\nclass ShuttleSearchBox extends Component {\n static defaultProps = {\n filterOnKeyStroke: false,\n onChange: () => null,\n onFilter: () => null,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n prevProps: {},\n };\n this.handleKeyPress = this.handleKeyPress.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, { prevProps }) {\n const { value } = nextProps;\n if (value !== prevProps.value) {\n return {\n value,\n prevProps: { value },\n };\n }\n return null;\n }\n\n handleChange(e) {\n const { onChange, filterOnKeyStroke, onFilter } = this.props;\n const { value } = e.target;\n onChange(value);\n if (filterOnKeyStroke) filterList(value, onFilter);\n this.setState({ value });\n }\n\n handleKeyPress(e) {\n const { onFilter } = this.props;\n if (e.keyCode === 13) onFilter(e.target.value);\n }\n\n render() {\n const { value } = this.state;\n const { isOpen, onClose, placeholder } = this.props;\n return (\n <SearchBoxContainer classProps={{ isOpen }}>\n <DSTextBox\n autoFocus\n clearable\n onChange={this.handleChange}\n onClear={onClose}\n onKeyDown={this.handleKeyPress}\n placeholder={placeholder}\n value={value}\n />\n </SearchBoxContainer>\n );\n }\n}\n\nexport { ShuttleSearchBox };\nexport default ShuttleSearchBox;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,qBAAqB,kBAAkB,OAAO,WAAW,MAAM,CAAC,EAAE,aAAc,GAAE,QAAQ;AAEhG,MAAM,aAAa,SAAS,CAAC,MAAM,qBAAqB;AACtD,mBAAiB;AAAA,GAChB;AAEH,+BAA+B,UAAU;AAAA,EAOvC,YAAY,OAAO;AACjB,UAAM;AACN,SAAK,QAAQ;AAAA,MACX,OAAO,MAAM;AAAA,MACb,WAAW;AAAA;AAEb,SAAK,iBAAiB,KAAK,eAAe,KAAK;AAC/C,SAAK,eAAe,KAAK,aAAa,KAAK;AAAA;AAAA,SAGtC,yBAAyB,WAAW,EAAE,aAAa;AACxD,UAAM,EAAE,UAAU;AAClB,QAAI,UAAU,UAAU,OAAO;AAC7B,aAAO;AAAA,QACL;AAAA,QACA,WAAW,EAAE;AAAA;AAAA;AAGjB,WAAO;AAAA;AAAA,EAGT,aAAa,GAAG;AACd,UAAM,EAAE,UAAU,mBAAmB,aAAa,KAAK;AACvD,UAAM,EAAE,UAAU,EAAE;AACpB,aAAS;AACT,QAAI;AAAmB,iBAAW,OAAO;AACzC,SAAK,SAAS,EAAE;AAAA;AAAA,EAGlB,eAAe,GAAG;AAChB,UAAM,EAAE,aAAa,KAAK;AAC1B,QAAI,EAAE,YAAY;AAAI,eAAS,EAAE,OAAO;AAAA;AAAA,EAG1C,SAAS;AACP,UAAM,EAAE,UAAU,KAAK;AACvB,UAAM,EAAE,QAAQ,SAAS,gBAAgB,KAAK;AAC9C,WACE,qCAAC,oBAAD;AAAA,MAAoB,YAAY,EAAE;AAAA,OAChC,qCAAC,WAAD;AAAA,MACE,WAAS;AAAA,MACT,WAAS;AAAA,MACT,UAAU,KAAK;AAAA,MACf,SAAS;AAAA,MACT,WAAW,KAAK;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA;AApDD,AADT,iBACS,eAAe;AAAA,EACpB,mBAAmB;AAAA,EACnB,UAAU,MAAM;AAAA,EAChB,UAAU,MAAM;AAAA;AAyDpB,IAAO,2BAAQ;",
6
+ "names": []
7
+ }
@@ -1,91 +1,75 @@
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;
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
+ }) {
64
57
  const {
65
- state: {
66
- isMovingBack = false,
67
- isMoving
68
- }
69
- } = useContext(AnimationContext.Context);
58
+ state: { isMovingBack = false, isMoving }
59
+ } = useContext(AnimationState.Context);
70
60
  const {
71
- state: {
72
- searching,
73
- searchTerm
74
- },
61
+ state: { searching, searchTerm },
75
62
  setSearchTerm,
76
63
  reset: resetSearch,
77
64
  toggleSearchBox
78
65
  } = useContext(SearchState.Context);
79
- const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
80
- [item]: true
81
- }), {}), [checkedItems]);
66
+ const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}), [checkedItems]);
82
67
  const handleCloseSearch = useCallback(() => {
83
- setSearchTerm('');
68
+ setSearchTerm("");
84
69
  runAll(resetSearch, onSearchClose)();
85
70
  }, [searching]);
86
71
  const handleToggleSearch = useCallback(() => {
87
72
  toggleSearchBox(!searching);
88
-
89
73
  if (searching) {
90
74
  handleCloseSearch();
91
75
  } else {
@@ -93,87 +77,99 @@ function ShuttleSource(_ref) {
93
77
  }
94
78
  }, [searching]);
95
79
  const ComponentList = useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
96
-
97
- const handleSortEnd = _ref2 => {
98
- let {
99
- oldIndex,
100
- newIndex
101
- } = _ref2;
80
+ const handleSortEnd = ({ oldIndex, newIndex }) => {
102
81
  onSortEnd({
103
82
  sourceItem: items[oldIndex],
104
83
  targetItem: items[newIndex]
105
84
  });
106
85
  };
107
-
108
86
  const isEmpty = !items.length;
109
87
  const hasContent = !loading && !isEmpty;
110
88
  const contentIsEmpty = !loading && isEmpty;
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, {
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, {
115
93
  buttonType: "text",
116
- icon: _Search || (_Search = /*#__PURE__*/_jsx(Search, {})),
94
+ icon: /* @__PURE__ */ React2.createElement(Search, null),
117
95
  onClick: handleToggleSearch,
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, {
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,
129
102
  isOpen: searching,
130
103
  onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
131
104
  onFilter: runAll(setSearchTerm, onSearch),
132
105
  placeholder: searchPlaceholder,
133
106
  value: searchTerm
134
- }, searching), hasContent ? /*#__PURE__*/_jsx(Overflow, {
107
+ }), hasContent ? /* @__PURE__ */ React2.createElement(Overflow, {
135
108
  activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
136
109
  classProps: {
137
110
  searching,
138
111
  empty: isEmpty
139
112
  }
140
- }, void 0, /*#__PURE__*/_jsx(ComponentList, {
113
+ }, /* @__PURE__ */ React2.createElement(ComponentList, {
114
+ key: searchTerm,
141
115
  helperClass: "drag-helper",
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,
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,
160
128
  onSortEnd: handleSortEnd,
161
129
  getMoreItems: onGetMoreItems,
162
- hasNextPage: hasNextPage
163
- }, searchTerm)) : null, contentIsEmpty ? /*#__PURE__*/_jsx(LoadingList, {
130
+ hasNextPage
131
+ })) : null, contentIsEmpty ? /* @__PURE__ */ React2.createElement(LoadingList, {
164
132
  "data-testid": "shuttle__loading-list"
165
- }, void 0, /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage)) : null, loading ? _LoadingList || (_LoadingList = /*#__PURE__*/_jsx(LoadingList, {
133
+ }, /* @__PURE__ */ React2.createElement(EmptyMessage, null, emptyMessage)) : null, loading ? /* @__PURE__ */ React2.createElement(LoadingList, {
166
134
  "data-testid": "shuttle__loading-list"
167
- }, void 0, /*#__PURE__*/_jsx(LoadingIndicator, {}))) : null, /*#__PURE__*/_jsx(ShuttleListPanel, {
135
+ }, /* @__PURE__ */ React2.createElement(LoadingIndicator, null)) : null, /* @__PURE__ */ React2.createElement(ShuttleListPanel, {
168
136
  onClick: onMoveCheckedItems,
169
137
  open: checkedItems.length > 1
170
- }, void 0, _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx(ArrowShortRight, {}))), moreItemsLoading ? _ShuttleInfiniteScrol || (_ShuttleInfiniteScrol = /*#__PURE__*/_jsx(ShuttleInfiniteScrollIndicator, {
138
+ }, /* @__PURE__ */ React2.createElement(ArrowShortRight, null)), moreItemsLoading ? /* @__PURE__ */ React2.createElement(ShuttleInfiniteScrollIndicator, {
171
139
  isOpen: true
172
- })) : null), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!checkedItems.length && /*#__PURE__*/_jsx(DSButton, {
140
+ }) : null), /* @__PURE__ */ React2.createElement(ShuttleFooter, null, /* @__PURE__ */ React2.createElement(ShuttleFooterActions, null, !!checkedItems.length && /* @__PURE__ */ React2.createElement(DSButton, {
173
141
  buttonType: "link",
174
142
  labelText: sourceClearItemsText,
175
143
  onClick: onClearCheckedItems
176
- })), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderSourceCounter(checkedItems.length))));
144
+ })), /* @__PURE__ */ React2.createElement(ShuttleFooterCounter, null, renderSourceCounter(checkedItems.length))));
177
145
  }
178
-
179
- export { ShuttleSource as default };
146
+ ShuttleSource.propTypes = {
147
+ items: PropTypes.arrayOf(PropTypes.shape({})),
148
+ checkedItems: PropTypes.arrayOf(PropTypes.shape({})),
149
+ hierarchy: PropTypes.arrayOf(PropTypes.shape({})),
150
+ onMoveItem: PropTypes.func,
151
+ onCheckItem: PropTypes.func,
152
+ onMoveCheckedItems: PropTypes.func,
153
+ onNavigateTo: PropTypes.func,
154
+ onClearCheckedItems: PropTypes.func,
155
+ emptyMessage: PropTypes.string,
156
+ composeSourceItemProps: PropTypes.func,
157
+ loading: PropTypes.bool,
158
+ onSearch: PropTypes.func,
159
+ onSearchClose: PropTypes.func,
160
+ onSearchOpen: PropTypes.func,
161
+ sourceSortable: PropTypes.bool,
162
+ onSortEnd: PropTypes.func,
163
+ sourceClearItemsText: PropTypes.string,
164
+ searchPlaceholder: PropTypes.string,
165
+ renderSourceCounter: PropTypes.func,
166
+ onGetMoreItems: PropTypes.func,
167
+ moreItemsLoading: PropTypes.bool,
168
+ hasNextPage: PropTypes.bool
169
+ };
170
+ var ShuttleSource_default = ShuttleSource;
171
+ export {
172
+ ShuttleSource,
173
+ ShuttleSource_default as default
174
+ };
175
+ //# sourceMappingURL=ShuttleSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleSource.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable no-shadow */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { ArrowShortRight, Search } from '@elliemae/ds-icons';\nimport { DSButton } from '@elliemae/ds-button';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { ShuttleSearchBox } from './ShuttleSearchBox';\nimport { ShuttleInfiniteScrollIndicator } from './ShuttleInfiniteScrollIndicator';\nimport { ShuttleSourceListItem } from './ShuttleListItem/ShuttleSourceListItem';\nimport {\n ShuttleFooterCounter,\n Overflow,\n ShuttleFooter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleHeaderSearchToggle,\n ShuttleList,\n ShuttleWrapper,\n ShuttleFooterActions,\n EmptyMessage,\n LoadingList,\n} from '../classedComponents';\nimport { ShuttleListPanel } from './ShuttleListPanel';\nimport { VirtualizedList } from './VirtualizedList';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { SearchState } from '../SearchState';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleSource({\n items = [],\n checkedItems = [], // build Map() and memoize it for better performance\n hierarchy = [],\n onMoveItem = noop,\n onCheckItem = noop,\n onMoveCheckedItems = noop,\n onNavigateTo = noop,\n onClearCheckedItems = noop,\n emptyMessage = 'No items found',\n composeSourceItemProps = noop,\n loading = false,\n onSearch = noop,\n onSearchClose = noop,\n onSearchOpen = noop,\n sourceSortable = false,\n onSortEnd = noop,\n sourceClearItemsText = 'CLEAR ALL',\n searchPlaceholder,\n renderSourceCounter = (amount) => `${amount} items`,\n onGetMoreItems = () => {},\n moreItemsLoading = false,\n hasNextPage = false,\n}) {\n const {\n state: { isMovingBack = false, isMoving },\n } = useContext(AnimationState.Context);\n const {\n state: { searching, searchTerm },\n setSearchTerm,\n reset: resetSearch,\n toggleSearchBox,\n } = useContext(SearchState.Context);\n\n const hashedCheckedItems = useMemo(\n () => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}),\n [checkedItems],\n );\n\n const handleCloseSearch = useCallback(() => {\n setSearchTerm('');\n runAll(resetSearch, onSearchClose)();\n }, [searching]);\n\n const handleToggleSearch = useCallback(() => {\n toggleSearchBox(!searching);\n if (searching) {\n handleCloseSearch();\n } else {\n onSearchOpen();\n }\n }, [searching]);\n\n const ComponentList = useMemo(() => (sourceSortable ? VirtualizedSortableList : VirtualizedList), [sourceSortable]);\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n const isEmpty = !items.length;\n const hasContent = !loading && !isEmpty;\n const contentIsEmpty = !loading && isEmpty;\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n <ShuttleHeaderSearchToggle\n buttonType=\"text\"\n icon={<Search />}\n onClick={handleToggleSearch}\n containerProps={{ 'data-testid': 'shuttle-header-search-toggle' }}\n />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMovingBack }} style={{ pointerEvents: isMoving ? 'none' : null }}>\n <ShuttleSearchBox\n key={searching}\n isOpen={searching}\n onClose={runAll(() => toggleSearchBox(false), handleCloseSearch)}\n onFilter={runAll(setSearchTerm, onSearch)}\n placeholder={searchPlaceholder}\n value={searchTerm}\n />\n {hasContent ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n searching,\n empty: isEmpty,\n }}\n >\n <ComponentList\n key={searchTerm}\n helperClass=\"drag-helper\"\n itemRenderer={({ item, ...rest }) => (\n <ShuttleSourceListItem\n data-testid=\"source-list-item\"\n {...rest}\n {...composeSourceItemProps(item, rest)}\n isChecked={!!hashedCheckedItems[item.id]}\n item={item}\n onItemCheck={onCheckItem}\n onMoveToTarget={onMoveItem}\n onNavigateOnSourceTo={onNavigateTo}\n showSortHandler={sourceSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n getMoreItems={onGetMoreItems}\n hasNextPage={hasNextPage}\n />\n </Overflow>\n ) : null}\n {contentIsEmpty ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <EmptyMessage>{emptyMessage}</EmptyMessage>\n </LoadingList>\n ) : null}\n {loading ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <LoadingIndicator />\n </LoadingList>\n ) : null}\n <ShuttleListPanel onClick={onMoveCheckedItems} open={checkedItems.length > 1}>\n <ArrowShortRight />\n </ShuttleListPanel>\n {moreItemsLoading ? <ShuttleInfiniteScrollIndicator isOpen /> : null}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!checkedItems.length && (\n <DSButton buttonType=\"link\" labelText={sourceClearItemsText} onClick={onClearCheckedItems} />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderSourceCounter(checkedItems.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nShuttleSource.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})),\n checkedItems: PropTypes.arrayOf(PropTypes.shape({})),\n hierarchy: PropTypes.arrayOf(PropTypes.shape({})),\n onMoveItem: PropTypes.func,\n onCheckItem: PropTypes.func,\n onMoveCheckedItems: PropTypes.func,\n onNavigateTo: PropTypes.func,\n onClearCheckedItems: PropTypes.func,\n emptyMessage: PropTypes.string,\n composeSourceItemProps: PropTypes.func,\n loading: PropTypes.bool,\n onSearch: PropTypes.func,\n onSearchClose: PropTypes.func,\n onSearchOpen: PropTypes.func,\n sourceSortable: PropTypes.bool,\n onSortEnd: PropTypes.func,\n sourceClearItemsText: PropTypes.string,\n searchPlaceholder: PropTypes.string,\n renderSourceCounter: PropTypes.func,\n onGetMoreItems: PropTypes.func,\n moreItemsLoading: PropTypes.bool,\n hasNextPage: PropTypes.bool,\n};\n\nexport { ShuttleSource };\nexport default ShuttleSource;\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }