@elliemae/ds-shuttle 3.16.0-next.2 → 3.16.0-next.20

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 (130) hide show
  1. package/dist/cjs/AnimationState.js +5 -3
  2. package/dist/cjs/AnimationState.js.map +2 -2
  3. package/dist/cjs/DSShuttle.js +88 -46
  4. package/dist/cjs/DSShuttle.js.map +2 -2
  5. package/dist/cjs/SearchState.js +4 -0
  6. package/dist/cjs/SearchState.js.map +2 -2
  7. package/dist/cjs/Shuttle.actions.js +10 -15
  8. package/dist/cjs/Shuttle.actions.js.map +3 -3
  9. package/dist/cjs/ShuttleContainer.js +10 -10
  10. package/dist/cjs/ShuttleContainer.js.map +2 -2
  11. package/dist/cjs/ShuttleImpl.js +32 -55
  12. package/dist/cjs/ShuttleImpl.js.map +2 -2
  13. package/dist/cjs/ShuttleRenderer.js +15 -19
  14. package/dist/cjs/ShuttleRenderer.js.map +2 -2
  15. package/dist/cjs/ShuttleState.js +8 -8
  16. package/dist/cjs/ShuttleState.js.map +2 -2
  17. package/dist/cjs/animation/animationConfig.js +4 -0
  18. package/dist/cjs/animation/animationConfig.js.map +2 -2
  19. package/dist/cjs/classedComponents.js +6 -2
  20. package/dist/cjs/classedComponents.js.map +2 -2
  21. package/dist/cjs/components/LoadingIndicator.js +4 -0
  22. package/dist/cjs/components/LoadingIndicator.js.map +1 -1
  23. package/dist/cjs/components/OverflowList.js +6 -2
  24. package/dist/cjs/components/OverflowList.js.map +2 -2
  25. package/dist/cjs/components/ShuttleBreadcrumb.js +7 -3
  26. package/dist/cjs/components/ShuttleBreadcrumb.js.map +2 -2
  27. package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +4 -0
  28. package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +1 -1
  29. package/dist/cjs/components/ShuttleListItem/ActionButtons.js +4 -0
  30. package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +1 -1
  31. package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +30 -23
  32. package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +2 -2
  33. package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +11 -9
  34. package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +2 -2
  35. package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +10 -8
  36. package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +2 -2
  37. package/dist/cjs/components/ShuttleListPanel.js +6 -4
  38. package/dist/cjs/components/ShuttleListPanel.js.map +2 -2
  39. package/dist/cjs/components/ShuttleSearchBox.js +4 -0
  40. package/dist/cjs/components/ShuttleSearchBox.js.map +1 -1
  41. package/dist/cjs/components/ShuttleSource.js +19 -14
  42. package/dist/cjs/components/ShuttleSource.js.map +2 -2
  43. package/dist/cjs/components/ShuttleTarget.js +14 -10
  44. package/dist/cjs/components/ShuttleTarget.js.map +2 -2
  45. package/dist/cjs/components/VirtualizedItem.js +17 -16
  46. package/dist/cjs/components/VirtualizedItem.js.map +2 -2
  47. package/dist/cjs/components/VirtualizedList.js +26 -30
  48. package/dist/cjs/components/VirtualizedList.js.map +2 -2
  49. package/dist/cjs/components/VirtualizedSortableList.js +7 -5
  50. package/dist/cjs/components/VirtualizedSortableList.js.map +2 -2
  51. package/dist/cjs/helper.js +4 -0
  52. package/dist/cjs/helper.js.map +2 -2
  53. package/dist/cjs/index.js +5 -1
  54. package/dist/cjs/index.js.map +2 -2
  55. package/dist/cjs/package.json +7 -0
  56. package/dist/cjs/tests/utils.js +5 -3
  57. package/dist/cjs/tests/utils.js.map +2 -2
  58. package/dist/cjs/updateShuttleStateFromProps.js +13 -10
  59. package/dist/cjs/updateShuttleStateFromProps.js.map +2 -2
  60. package/dist/cjs/utils.js +5 -1
  61. package/dist/cjs/utils.js.map +2 -2
  62. package/dist/cjs/withProviders.js +10 -4
  63. package/dist/cjs/withProviders.js.map +2 -2
  64. package/dist/esm/AnimationState.js +1 -3
  65. package/dist/esm/AnimationState.js.map +2 -2
  66. package/dist/esm/DSShuttle.js +41 -3
  67. package/dist/esm/DSShuttle.js.map +2 -2
  68. package/dist/esm/SearchState.js.map +2 -2
  69. package/dist/esm/Shuttle.actions.js +7 -25
  70. package/dist/esm/Shuttle.actions.js.map +3 -3
  71. package/dist/esm/ShuttleContainer.js +7 -22
  72. package/dist/esm/ShuttleContainer.js.map +2 -2
  73. package/dist/esm/ShuttleImpl.js +20 -47
  74. package/dist/esm/ShuttleImpl.js.map +2 -2
  75. package/dist/esm/ShuttleRenderer.js +11 -19
  76. package/dist/esm/ShuttleRenderer.js.map +2 -2
  77. package/dist/esm/ShuttleState.js +4 -8
  78. package/dist/esm/ShuttleState.js.map +2 -2
  79. package/dist/esm/animation/animationConfig.js.map +2 -2
  80. package/dist/esm/classedComponents.js +2 -2
  81. package/dist/esm/classedComponents.js.map +1 -1
  82. package/dist/esm/components/OverflowList.js +2 -2
  83. package/dist/esm/components/OverflowList.js.map +1 -1
  84. package/dist/esm/components/ShuttleBreadcrumb.js +3 -3
  85. package/dist/esm/components/ShuttleBreadcrumb.js.map +2 -2
  86. package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +26 -23
  87. package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +2 -2
  88. package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +7 -9
  89. package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +2 -2
  90. package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +6 -8
  91. package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +2 -2
  92. package/dist/esm/components/ShuttleListPanel.js +2 -4
  93. package/dist/esm/components/ShuttleListPanel.js.map +2 -2
  94. package/dist/esm/components/ShuttleSource.js +15 -14
  95. package/dist/esm/components/ShuttleSource.js.map +2 -2
  96. package/dist/esm/components/ShuttleTarget.js +10 -10
  97. package/dist/esm/components/ShuttleTarget.js.map +2 -2
  98. package/dist/esm/components/VirtualizedItem.js +13 -16
  99. package/dist/esm/components/VirtualizedItem.js.map +2 -2
  100. package/dist/esm/components/VirtualizedList.js +22 -30
  101. package/dist/esm/components/VirtualizedList.js.map +2 -2
  102. package/dist/esm/components/VirtualizedSortableList.js +3 -5
  103. package/dist/esm/components/VirtualizedSortableList.js.map +2 -2
  104. package/dist/esm/helper.js.map +2 -2
  105. package/dist/esm/index.js +1 -1
  106. package/dist/esm/index.js.map +1 -1
  107. package/dist/esm/package.json +7 -0
  108. package/dist/esm/tests/utils.js +1 -3
  109. package/dist/esm/tests/utils.js.map +2 -2
  110. package/dist/esm/updateShuttleStateFromProps.js +7 -8
  111. package/dist/esm/updateShuttleStateFromProps.js.map +2 -2
  112. package/dist/esm/utils.js +1 -1
  113. package/dist/esm/utils.js.map +2 -2
  114. package/dist/esm/withProviders.js +6 -4
  115. package/dist/esm/withProviders.js.map +2 -2
  116. package/dist/types/DSShuttle.d.ts +38 -38
  117. package/dist/types/Shuttle.actions.d.ts +7 -7
  118. package/dist/types/ShuttleRenderer.d.ts +2 -2
  119. package/dist/types/ShuttleState.d.ts +1 -1
  120. package/dist/types/components/ShuttleBreadcrumb.d.ts +2 -2
  121. package/dist/types/components/ShuttleListItem/ShuttleListItem.d.ts +2 -2
  122. package/dist/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +2 -2
  123. package/dist/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +2 -2
  124. package/dist/types/components/ShuttleListPanel.d.ts +2 -2
  125. package/dist/types/components/ShuttleSource.d.ts +27 -28
  126. package/dist/types/components/ShuttleTarget.d.ts +2 -2
  127. package/dist/types/components/VirtualizedList.d.ts +2 -2
  128. package/dist/types/components/VirtualizedSortableList.d.ts +2 -2
  129. package/dist/types/index.d.ts +1 -1
  130. package/package.json +21 -19
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -77,8 +81,6 @@ function useShuttleAnimationState() {
77
81
  reset
78
82
  };
79
83
  }
80
- const AnimationState = (0, import_constate.default)(useShuttleAnimationState, (value) => [
81
- value.state
82
- ]);
84
+ const AnimationState = (0, import_constate.default)(useShuttleAnimationState, (value) => [value.state]);
83
85
  var AnimationState_default = AnimationState;
84
86
  //# sourceMappingURL=AnimationState.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/AnimationState.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useCallback, useState } from 'react';\nimport createContainer from 'constate';\n\nfunction useShuttleAnimationState() {\n const [animationState, setAnimationState] = useState({\n isMoving: false,\n isMovingBack: false,\n isDrillingDown: false,\n });\n const reset = useCallback(\n () =>\n setAnimationState({\n isMoving: false,\n isMovingBack: false,\n isDrillingDown: false,\n }),\n [],\n );\n const move = useCallback(\n () =>\n setAnimationState({\n isMovingBack: false,\n isMoving: true,\n isDrillingDown: false,\n }),\n [],\n );\n\n const moveBack = useCallback(\n () =>\n setAnimationState({\n isMovingBack: true,\n isMoving: false,\n isDrillingDown: false,\n }),\n [],\n );\n\n const drilldown = useCallback(\n () =>\n setAnimationState({\n isMovingBack: false,\n isMoving: false,\n isDrillingDown: true,\n }),\n [],\n );\n\n return {\n state: animationState,\n setIsMoving: move,\n setIsMovingBack: moveBack,\n setIsDrillingDown: drilldown,\n reset,\n };\n}\n\nconst AnimationState = createContainer(useShuttleAnimationState, value => [\n value.state,\n]);\n\nexport { AnimationState };\nexport default AnimationState;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsC;AACtC,sBAA4B;AAE5B,SAAS,2BAA2B;AAClC,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAS;AAAA,IACnD,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB,CAAC;AACD,QAAM,YAAQ;AAAA,IACZ,MACE,kBAAkB;AAAA,MAChB,UAAU;AAAA,MACV,cAAc;AAAA,MACd,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,QAAM,WAAO;AAAA,IACX,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,eAAW;AAAA,IACf,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,gBAAY;AAAA,IAChB,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB;AAAA,EACF;AACF;AAEA,MAAM,qBAAiB,gBAAAA,SAAgB,0BAA0B,WAAS;AAAA,EACxE,MAAM;AACR,CAAC;AAGD,IAAO,yBAAQ;",
4
+ "sourcesContent": ["import { useCallback, useState } from 'react';\nimport createContainer from 'constate';\n\nfunction useShuttleAnimationState() {\n const [animationState, setAnimationState] = useState({\n isMoving: false,\n isMovingBack: false,\n isDrillingDown: false,\n });\n const reset = useCallback(\n () =>\n setAnimationState({\n isMoving: false,\n isMovingBack: false,\n isDrillingDown: false,\n }),\n [],\n );\n const move = useCallback(\n () =>\n setAnimationState({\n isMovingBack: false,\n isMoving: true,\n isDrillingDown: false,\n }),\n [],\n );\n\n const moveBack = useCallback(\n () =>\n setAnimationState({\n isMovingBack: true,\n isMoving: false,\n isDrillingDown: false,\n }),\n [],\n );\n\n const drilldown = useCallback(\n () =>\n setAnimationState({\n isMovingBack: false,\n isMoving: false,\n isDrillingDown: true,\n }),\n [],\n );\n\n return {\n state: animationState,\n setIsMoving: move,\n setIsMovingBack: moveBack,\n setIsDrillingDown: drilldown,\n reset,\n };\n}\n\nconst AnimationState = createContainer(useShuttleAnimationState, (value) => [value.state]);\n\nexport { AnimationState };\nexport default AnimationState;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsC;AACtC,sBAA4B;AAE5B,SAAS,2BAA2B;AAClC,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAS;AAAA,IACnD,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB,CAAC;AACD,QAAM,YAAQ;AAAA,IACZ,MACE,kBAAkB;AAAA,MAChB,UAAU;AAAA,MACV,cAAc;AAAA,MACd,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,QAAM,WAAO;AAAA,IACX,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,eAAW;AAAA,IACf,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,gBAAY;AAAA,IAChB,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB;AAAA,EACF;AACF;AAEA,MAAM,qBAAiB,gBAAAA,SAAgB,0BAA0B,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAGzF,IAAO,yBAAQ;",
6
6
  "names": ["createContainer"]
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -33,10 +37,10 @@ module.exports = __toCommonJS(DSShuttle_exports);
33
37
  var React = __toESM(require("react"));
34
38
  var import_jsx_runtime = require("react/jsx-runtime");
35
39
  var import_lodash = require("lodash");
36
- var import_ds_utilities = require("@elliemae/ds-utilities");
40
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
41
  var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
38
- var import_ShuttleImpl = require("./ShuttleImpl");
39
- var import_utils = __toESM(require("./utils"));
42
+ var import_ShuttleImpl = require("./ShuttleImpl.js");
43
+ var import_utils = __toESM(require("./utils.js"));
40
44
  const noop = () => {
41
45
  };
42
46
  const DSShuttle = ({
@@ -46,6 +50,8 @@ const DSShuttle = ({
46
50
  showIcons = true,
47
51
  items = [],
48
52
  selectedItems = void 0,
53
+ // if defined it becomes controlled (v1)
54
+ // TODO make `nonSelectedItems` the default controlled behavior (v2)
49
55
  nonSelectedItems = void 0,
50
56
  onSearch = noop,
51
57
  onSearchOpen = noop,
@@ -120,64 +126,100 @@ const DSShuttle = ({
120
126
  }
121
127
  ) });
122
128
  const props = {
123
- containerProps: import_ds_utilities.PropTypes.object.description("inject props to shuttle wrapper"),
124
- idField: import_ds_utilities.PropTypes.string.description("The identifier field for the item object"),
125
- parentIdField: import_ds_utilities.PropTypes.string.description("The parent identifier field for the item object"),
126
- showIcons: import_ds_utilities.PropTypes.string.description("Whether to show the icons or not"),
127
- items: import_ds_utilities.PropTypes.arrayOf(
128
- import_ds_utilities.PropTypes.shape({
129
- disableDrillDown: import_ds_utilities.PropTypes.bool,
130
- icon: import_ds_utilities.PropTypes.element,
131
- name: import_ds_utilities.PropTypes.string,
132
- readOnly: import_ds_utilities.PropTypes.bool,
133
- description: import_ds_utilities.PropTypes.string
129
+ /** inject props to shuttle wrapper */
130
+ containerProps: import_ds_props_helpers.PropTypes.object.description("inject props to shuttle wrapper"),
131
+ /** The identifier field for the item object */
132
+ idField: import_ds_props_helpers.PropTypes.string.description("The identifier field for the item object"),
133
+ /** The parent identifier field for the item object */
134
+ parentIdField: import_ds_props_helpers.PropTypes.string.description("The parent identifier field for the item object"),
135
+ /** Whether to show the icons or not */
136
+ showIcons: import_ds_props_helpers.PropTypes.string.description("Whether to show the icons or not"),
137
+ /** List of items */
138
+ items: import_ds_props_helpers.PropTypes.arrayOf(
139
+ import_ds_props_helpers.PropTypes.shape({
140
+ disableDrillDown: import_ds_props_helpers.PropTypes.bool,
141
+ icon: import_ds_props_helpers.PropTypes.element,
142
+ name: import_ds_props_helpers.PropTypes.string,
143
+ readOnly: import_ds_props_helpers.PropTypes.bool,
144
+ description: import_ds_props_helpers.PropTypes.string
134
145
  })
135
146
  ).description("list of items"),
136
- selectedItems: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.string).description(
147
+ /** Array of item ids that are selected. If passed the component behaves as controlled */
148
+ selectedItems: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.string).description(
137
149
  "Array of item ids that are selected. If passed the component behaves as controlled"
138
150
  ),
139
- nonSelectedItems: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.string).description(
151
+ /** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */
152
+ nonSelectedItems: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.string).description(
140
153
  "Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"
141
154
  ),
142
- onSearch: import_ds_utilities.PropTypes.func.description("Handler on search"),
143
- onSearchOpen: import_ds_utilities.PropTypes.func.description("Handler when the searchbox is visible"),
144
- onSearchClose: import_ds_utilities.PropTypes.func.description("Handler when the searchbox is not visible"),
145
- onDrillDown: import_ds_utilities.PropTypes.func.description(
155
+ /** Handler on search */
156
+ onSearch: import_ds_props_helpers.PropTypes.func.description("Handler on search"),
157
+ /** Handler when the searchbox is visible */
158
+ onSearchOpen: import_ds_props_helpers.PropTypes.func.description("Handler when the searchbox is visible"),
159
+ /** Handler when the searchbox is not visible */
160
+ onSearchClose: import_ds_props_helpers.PropTypes.func.description("Handler when the searchbox is not visible"),
161
+ /** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
162
+ onDrillDown: import_ds_props_helpers.PropTypes.func.description(
146
163
  'Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'
147
164
  ),
148
- onDrillDownTarget: import_ds_utilities.PropTypes.func.description(
165
+ /** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
166
+ onDrillDownTarget: import_ds_props_helpers.PropTypes.func.description(
149
167
  'Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'
150
168
  ),
151
- onTargetSortEnd: import_ds_utilities.PropTypes.func.description("Target handler when user stops dragging an item"),
152
- onGetMoreItems: import_ds_utilities.PropTypes.func.description("Callback function that gets more items for Infinite Scroll"),
153
- moreItemsLoading: import_ds_utilities.PropTypes.bool.description("Wheter there are mor items loading for Infinite Scroll"),
154
- hasNextPage: import_ds_utilities.PropTypes.bool.description(
169
+ /** Target handler when user stops dragging an item */
170
+ onTargetSortEnd: import_ds_props_helpers.PropTypes.func.description("Target handler when user stops dragging an item"),
171
+ /** Callback function that gets more items for Infinite Scroll */
172
+ onGetMoreItems: import_ds_props_helpers.PropTypes.func.description("Callback function that gets more items for Infinite Scroll"),
173
+ /** Wheter there are mor items loading for Infinite Scroll */
174
+ moreItemsLoading: import_ds_props_helpers.PropTypes.bool.description("Wheter there are mor items loading for Infinite Scroll"),
175
+ /** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */
176
+ hasNextPage: import_ds_props_helpers.PropTypes.bool.description(
155
177
  "Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems"
156
178
  ),
157
- setGetStatus: import_ds_utilities.PropTypes.func.description("Function that takes as a parameter an internal getter for the state"),
158
- targetSortable: import_ds_utilities.PropTypes.bool.description("Whether the target can be sortable with DnD"),
159
- sourceRootTitle: import_ds_utilities.PropTypes.string.description("Handler when the searchbox is visible"),
160
- sourceEmptyMessage: import_ds_utilities.PropTypes.string.description("Source text when there is no items"),
161
- targetEmptyMessage: import_ds_utilities.PropTypes.string.description("Target text when there is no items"),
162
- targetRootTitle: import_ds_utilities.PropTypes.string.description("Target text for the first hierarchy item"),
163
- composeSourceItemProps: import_ds_utilities.PropTypes.func.description("Function that allow to compose the item props in the source"),
164
- composeTargetItemProps: import_ds_utilities.PropTypes.func.description("Function that allow to compose the item props in the target"),
165
- onAddToTarget: import_ds_utilities.PropTypes.func.description("Handler when a users moves an item to the target"),
166
- onAddCheckedItems: import_ds_utilities.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
167
- onRemoveFromTarget: import_ds_utilities.PropTypes.func.description("Handler when a user removes an item from the target"),
168
- onRemoveAllFromTarget: import_ds_utilities.PropTypes.func.description("Handler when a user removes all the items from the target"),
169
- onChange: import_ds_utilities.PropTypes.func.description("Handler for every change on the state"),
170
- renderSourceCounter: import_ds_utilities.PropTypes.func.description("Function that returns an element for the source counter"),
171
- renderTargetCounter: import_ds_utilities.PropTypes.func.description("Function that returns an element for the target counter"),
172
- sourceClearItemsText: import_ds_utilities.PropTypes.string.description("Source text for the clear items button"),
173
- targetClearItemsText: import_ds_utilities.PropTypes.string.description("Target text for the clear items button"),
174
- searchPlaceholder: import_ds_utilities.PropTypes.string.description("Searchbox placeholder"),
175
- loadingSource: import_ds_utilities.PropTypes.bool.description("Displays loading indicator on source section"),
176
- loadingTarget: import_ds_utilities.PropTypes.bool.description("Displays loading indicator on target section")
179
+ /** Function that takes as a parameter an internal getter for the state */
180
+ setGetStatus: import_ds_props_helpers.PropTypes.func.description("Function that takes as a parameter an internal getter for the state"),
181
+ /** Whether the target can be sortable with DnD */
182
+ targetSortable: import_ds_props_helpers.PropTypes.bool.description("Whether the target can be sortable with DnD"),
183
+ /** Handler when the searchbox is visible */
184
+ sourceRootTitle: import_ds_props_helpers.PropTypes.string.description("Handler when the searchbox is visible"),
185
+ /** Source text when there is no items */
186
+ sourceEmptyMessage: import_ds_props_helpers.PropTypes.string.description("Source text when there is no items"),
187
+ /** Target text when there is no items */
188
+ targetEmptyMessage: import_ds_props_helpers.PropTypes.string.description("Target text when there is no items"),
189
+ /** Target text for the first hierarchy item */
190
+ targetRootTitle: import_ds_props_helpers.PropTypes.string.description("Target text for the first hierarchy item"),
191
+ /** Function that allow to compose the item props in the source */
192
+ composeSourceItemProps: import_ds_props_helpers.PropTypes.func.description("Function that allow to compose the item props in the source"),
193
+ /** Function that allow to compose the item props in the target */
194
+ composeTargetItemProps: import_ds_props_helpers.PropTypes.func.description("Function that allow to compose the item props in the target"),
195
+ /** Handler when a users moves an item to the target */
196
+ onAddToTarget: import_ds_props_helpers.PropTypes.func.description("Handler when a users moves an item to the target"),
197
+ /** Handler when a users moves all the 'checked' items to the target */
198
+ onAddCheckedItems: import_ds_props_helpers.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
199
+ /** Handler when a user removes an item from the target */
200
+ onRemoveFromTarget: import_ds_props_helpers.PropTypes.func.description("Handler when a user removes an item from the target"),
201
+ /** Handler when a user removes all the items from the target */
202
+ onRemoveAllFromTarget: import_ds_props_helpers.PropTypes.func.description("Handler when a user removes all the items from the target"),
203
+ /** Handler for every change on the state */
204
+ onChange: import_ds_props_helpers.PropTypes.func.description("Handler for every change on the state"),
205
+ /** Function that returns an element for the source counter */
206
+ renderSourceCounter: import_ds_props_helpers.PropTypes.func.description("Function that returns an element for the source counter"),
207
+ /** Function that returns an element for the target counter */
208
+ renderTargetCounter: import_ds_props_helpers.PropTypes.func.description("Function that returns an element for the target counter"),
209
+ /** Source text for the clear items button */
210
+ sourceClearItemsText: import_ds_props_helpers.PropTypes.string.description("Source text for the clear items button"),
211
+ /** Target text for the clear items button */
212
+ targetClearItemsText: import_ds_props_helpers.PropTypes.string.description("Target text for the clear items button"),
213
+ /** Searchbox placeholder */
214
+ searchPlaceholder: import_ds_props_helpers.PropTypes.string.description("Searchbox placeholder"),
215
+ /** Displays loading indicator on source section */
216
+ loadingSource: import_ds_props_helpers.PropTypes.bool.description("Displays loading indicator on source section"),
217
+ /** Displays loading indicator on target section */
218
+ loadingTarget: import_ds_props_helpers.PropTypes.bool.description("Displays loading indicator on target section")
177
219
  };
178
220
  DSShuttle.propTypes = props;
179
221
  DSShuttle.displayName = "DSShuttle";
180
- const DSShuttleWithSchema = (0, import_ds_utilities.describe)(DSShuttle);
222
+ const DSShuttleWithSchema = (0, import_ds_props_helpers.describe)(DSShuttle);
181
223
  DSShuttleWithSchema.propTypes = props;
182
224
  var DSShuttle_default = DSShuttle;
183
225
  //# sourceMappingURL=DSShuttle.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSShuttle.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { debounce } from 'lodash';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { TooltipTextProvider } from '@elliemae/ds-truncated-tooltip-text';\nimport { ShuttleImpl } from './ShuttleImpl';\nimport utils from './utils';\n\nconst noop = () => {};\n\nconst DSShuttle = ({\n containerProps = {},\n idField = 'id',\n parentIdField = 'parent',\n showIcons = true,\n items = [],\n selectedItems = undefined, // if defined it becomes controlled (v1)\n // TODO make `nonSelectedItems` the default controlled behavior (v2)\n nonSelectedItems = undefined,\n onSearch = noop,\n onSearchOpen = noop,\n onSearchClose = noop,\n onDrillDown = noop,\n onDrillDownTarget = noop,\n onTargetSortEnd = noop,\n setGetStatus = noop,\n targetSortable = true,\n sourceEmptyMessage = 'No Items Found',\n sourceRootTitle = 'Category',\n targetEmptyMessage = 'No Items Selected',\n targetRootTitle = 'Selected Items',\n composeSourceItemProps = () => ({}),\n composeTargetItemProps = () => ({}),\n onAddToTarget = noop,\n onAddCheckedItems = noop,\n onRemoveFromTarget = noop,\n onRemoveAllFromTarget = noop,\n onChange = noop,\n renderSourceCounter = noop,\n renderTargetCounter = noop,\n sourceClearItemsText = 'CLEAR ALL',\n targetClearItemsText = 'CLEAR ALL',\n searchPlaceholder = 'Search field ID, name, etc.',\n loadingSource = false,\n loadingTarget = false,\n onGetMoreItems = () => null,\n hasNextPage = false,\n moreItemsLoading,\n}) => (\n <TooltipTextProvider>\n <ShuttleImpl\n composeSourceItemProps={composeSourceItemProps}\n composeTargetItemProps={composeTargetItemProps}\n containerProps={containerProps}\n idField={idField}\n items={items}\n onAddCheckedItems={onAddCheckedItems}\n onAddToTarget={onAddToTarget}\n onChange={onChange}\n onDrillDown={onDrillDown}\n nonSelectedItems={nonSelectedItems}\n onDrillDownTarget={onDrillDownTarget}\n onRemoveAllFromTarget={onRemoveAllFromTarget}\n onRemoveFromTarget={onRemoveFromTarget}\n onSearch={onSearch}\n onSearchClose={onSearchClose}\n onSearchOpen={onSearchOpen}\n onTargetSortEnd={onTargetSortEnd}\n parentIdField={parentIdField}\n renderSourceCounter={renderSourceCounter}\n renderTargetCounter={renderTargetCounter}\n searchPlaceholder={searchPlaceholder}\n selectedItems={selectedItems}\n setGetStatus={setGetStatus}\n showIcons={showIcons}\n sourceClearItemsText={sourceClearItemsText}\n sourceEmptyMessage={sourceEmptyMessage}\n sourceRootTitle={sourceRootTitle}\n targetClearItemsText={targetClearItemsText}\n targetEmptyMessage={targetEmptyMessage}\n targetRootTitle={targetRootTitle}\n targetSortable={targetSortable}\n loadingSource={loadingSource}\n loadingTarget={loadingTarget}\n onGetMoreItems={debounce((...args) => {\n onGetMoreItems(...args);\n }, 500)}\n moreItemsLoading={moreItemsLoading}\n hasNextPage={hasNextPage}\n />\n </TooltipTextProvider>\n);\n\nconst props = {\n /** inject props to shuttle wrapper */\n containerProps: PropTypes.object.description('inject props to shuttle wrapper'),\n /** The identifier field for the item object */\n idField: PropTypes.string.description('The identifier field for the item object'),\n /** The parent identifier field for the item object */\n parentIdField: PropTypes.string.description('The parent identifier field for the item object'),\n /** Whether to show the icons or not */\n showIcons: PropTypes.string.description('Whether to show the icons or not'),\n /** List of items */\n items: PropTypes.arrayOf(\n PropTypes.shape({\n disableDrillDown: PropTypes.bool,\n icon: PropTypes.element,\n name: PropTypes.string,\n readOnly: PropTypes.bool,\n description: PropTypes.string,\n }),\n ).description('list of items'),\n /** Array of item ids that are selected. If passed the component behaves as controlled */\n selectedItems: PropTypes.arrayOf(PropTypes.string).description(\n 'Array of item ids that are selected. If passed the component behaves as controlled',\n ),\n /** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */\n nonSelectedItems: PropTypes.arrayOf(PropTypes.string).description(\n \"Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered\",\n ),\n /** Handler on search */\n onSearch: PropTypes.func.description('Handler on search'),\n /** Handler when the searchbox is visible */\n onSearchOpen: PropTypes.func.description('Handler when the searchbox is visible'),\n /** Handler when the searchbox is not visible */\n onSearchClose: PropTypes.func.description('Handler when the searchbox is not visible'),\n /** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\") */\n onDrillDown: PropTypes.func.description(\n 'Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\")',\n ),\n /** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\") */\n onDrillDownTarget: PropTypes.func.description(\n 'Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\")',\n ),\n /** Target handler when user stops dragging an item */\n onTargetSortEnd: PropTypes.func.description('Target handler when user stops dragging an item'),\n /** Callback function that gets more items for Infinite Scroll */\n onGetMoreItems: PropTypes.func.description('Callback function that gets more items for Infinite Scroll'),\n /** Wheter there are mor items loading for Infinite Scroll */\n moreItemsLoading: PropTypes.bool.description('Wheter there are mor items loading for Infinite Scroll'),\n /** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */\n hasNextPage: PropTypes.bool.description(\n 'Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems',\n ),\n /** Function that takes as a parameter an internal getter for the state */\n setGetStatus: PropTypes.func.description('Function that takes as a parameter an internal getter for the state'),\n /** Whether the target can be sortable with DnD */\n targetSortable: PropTypes.bool.description('Whether the target can be sortable with DnD'),\n /** Handler when the searchbox is visible */\n sourceRootTitle: PropTypes.string.description('Handler when the searchbox is visible'),\n /** Source text when there is no items */\n sourceEmptyMessage: PropTypes.string.description('Source text when there is no items'),\n /** Target text when there is no items */\n targetEmptyMessage: PropTypes.string.description('Target text when there is no items'),\n /** Target text for the first hierarchy item */\n targetRootTitle: PropTypes.string.description('Target text for the first hierarchy item'),\n /** Function that allow to compose the item props in the source */\n composeSourceItemProps: PropTypes.func.description('Function that allow to compose the item props in the source'),\n /** Function that allow to compose the item props in the target */\n composeTargetItemProps: PropTypes.func.description('Function that allow to compose the item props in the target'),\n /** Handler when a users moves an item to the target */\n onAddToTarget: PropTypes.func.description('Handler when a users moves an item to the target'),\n /** Handler when a users moves all the 'checked' items to the target */\n onAddCheckedItems: PropTypes.func.description(\"Handler when a users moves all the 'checked' items to the target\"),\n /** Handler when a user removes an item from the target */\n onRemoveFromTarget: PropTypes.func.description('Handler when a user removes an item from the target'),\n /** Handler when a user removes all the items from the target */\n onRemoveAllFromTarget: PropTypes.func.description('Handler when a user removes all the items from the target'),\n /** Handler for every change on the state */\n onChange: PropTypes.func.description('Handler for every change on the state'),\n /** Function that returns an element for the source counter */\n renderSourceCounter: PropTypes.func.description('Function that returns an element for the source counter'),\n /** Function that returns an element for the target counter */\n renderTargetCounter: PropTypes.func.description('Function that returns an element for the target counter'),\n /** Source text for the clear items button */\n sourceClearItemsText: PropTypes.string.description('Source text for the clear items button'),\n /** Target text for the clear items button */\n targetClearItemsText: PropTypes.string.description('Target text for the clear items button'),\n /** Searchbox placeholder */\n searchPlaceholder: PropTypes.string.description('Searchbox placeholder'),\n /** Displays loading indicator on source section */\n loadingSource: PropTypes.bool.description('Displays loading indicator on source section'),\n /** Displays loading indicator on target section */\n loadingTarget: PropTypes.bool.description('Displays loading indicator on target section'),\n};\n\nDSShuttle.propTypes = props;\nDSShuttle.displayName = 'DSShuttle';\nconst DSShuttleWithSchema = describe(DSShuttle);\nDSShuttleWithSchema.propTypes = props;\n\nexport { utils, DSShuttleWithSchema, DSShuttle };\n\nexport default DSShuttle;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA;AAAA;ACAA,YAAuB;ADkDnB;AAhDJ,oBAAyB;AACzB,0BAAoC;AACpC,uCAAoC;AACpC,yBAA4B;AAC5B,mBAAkB;AAElB,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,YAAY,CAAC;AAAA,EACjB,iBAAiB,CAAC;AAAA,EAClB,UAAU;AAAA,EACV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BAAU,OAAO,YAAY,oCAAoC;AAAA,EAErF,iBAAiB,8BAAU,OAAO,YAAY,0CAA0C;AAAA,EAExF,wBAAwB,8BAAU,KAAK,YAAY,6DAA6D;AAAA,EAEhH,wBAAwB,8BAAU,KAAK,YAAY,6DAA6D;AAAA,EAEhH,eAAe,8BAAU,KAAK,YAAY,kDAAkD;AAAA,EAE5F,mBAAmB,8BAAU,KAAK,YAAY,kEAAkE;AAAA,EAEhH,oBAAoB,8BAAU,KAAK,YAAY,qDAAqD;AAAA,EAEpG,uBAAuB,8BAAU,KAAK,YAAY,2DAA2D;AAAA,EAE7G,UAAU,8BAAU,KAAK,YAAY,uCAAuC;AAAA,EAE5E,qBAAqB,8BAAU,KAAK,YAAY,yDAAyD;AAAA,EAEzG,qBAAqB,8BAAU,KAAK,YAAY,yDAAyD;AAAA,EAEzG,sBAAsB,8BAAU,OAAO,YAAY,wCAAwC;AAAA,EAE3F,sBAAsB,8BAAU,OAAO,YAAY,wCAAwC;AAAA,EAE3F,mBAAmB,8BAAU,OAAO,YAAY,uBAAuB;AAAA,EAEvE,eAAe,8BAAU,KAAK,YAAY,8CAA8C;AAAA,EAExF,eAAe,8BAAU,KAAK,YAAY,8CAA8C;AAC1F;AAEA,UAAU,YAAY;AACtB,UAAU,cAAc;AACxB,MAAM,0BAAsB,8BAAS,SAAS;AAC9C,oBAAoB,YAAY;AAIhC,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { debounce } from 'lodash';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { TooltipTextProvider } from '@elliemae/ds-truncated-tooltip-text';\nimport { ShuttleImpl } from './ShuttleImpl.js';\nimport utils from './utils.js';\n\nconst noop = () => {};\n\nconst DSShuttle = ({\n containerProps = {},\n idField = 'id',\n parentIdField = 'parent',\n showIcons = true,\n items = [],\n selectedItems = undefined, // if defined it becomes controlled (v1)\n // TODO make `nonSelectedItems` the default controlled behavior (v2)\n nonSelectedItems = undefined,\n onSearch = noop,\n onSearchOpen = noop,\n onSearchClose = noop,\n onDrillDown = noop,\n onDrillDownTarget = noop,\n onTargetSortEnd = noop,\n setGetStatus = noop,\n targetSortable = true,\n sourceEmptyMessage = 'No Items Found',\n sourceRootTitle = 'Category',\n targetEmptyMessage = 'No Items Selected',\n targetRootTitle = 'Selected Items',\n composeSourceItemProps = () => ({}),\n composeTargetItemProps = () => ({}),\n onAddToTarget = noop,\n onAddCheckedItems = noop,\n onRemoveFromTarget = noop,\n onRemoveAllFromTarget = noop,\n onChange = noop,\n renderSourceCounter = noop,\n renderTargetCounter = noop,\n sourceClearItemsText = 'CLEAR ALL',\n targetClearItemsText = 'CLEAR ALL',\n searchPlaceholder = 'Search field ID, name, etc.',\n loadingSource = false,\n loadingTarget = false,\n onGetMoreItems = () => null,\n hasNextPage = false,\n moreItemsLoading,\n}) => (\n <TooltipTextProvider>\n <ShuttleImpl\n composeSourceItemProps={composeSourceItemProps}\n composeTargetItemProps={composeTargetItemProps}\n containerProps={containerProps}\n idField={idField}\n items={items}\n onAddCheckedItems={onAddCheckedItems}\n onAddToTarget={onAddToTarget}\n onChange={onChange}\n onDrillDown={onDrillDown}\n nonSelectedItems={nonSelectedItems}\n onDrillDownTarget={onDrillDownTarget}\n onRemoveAllFromTarget={onRemoveAllFromTarget}\n onRemoveFromTarget={onRemoveFromTarget}\n onSearch={onSearch}\n onSearchClose={onSearchClose}\n onSearchOpen={onSearchOpen}\n onTargetSortEnd={onTargetSortEnd}\n parentIdField={parentIdField}\n renderSourceCounter={renderSourceCounter}\n renderTargetCounter={renderTargetCounter}\n searchPlaceholder={searchPlaceholder}\n selectedItems={selectedItems}\n setGetStatus={setGetStatus}\n showIcons={showIcons}\n sourceClearItemsText={sourceClearItemsText}\n sourceEmptyMessage={sourceEmptyMessage}\n sourceRootTitle={sourceRootTitle}\n targetClearItemsText={targetClearItemsText}\n targetEmptyMessage={targetEmptyMessage}\n targetRootTitle={targetRootTitle}\n targetSortable={targetSortable}\n loadingSource={loadingSource}\n loadingTarget={loadingTarget}\n onGetMoreItems={debounce((...args) => {\n onGetMoreItems(...args);\n }, 500)}\n moreItemsLoading={moreItemsLoading}\n hasNextPage={hasNextPage}\n />\n </TooltipTextProvider>\n);\n\nconst props = {\n /** inject props to shuttle wrapper */\n containerProps: PropTypes.object.description('inject props to shuttle wrapper'),\n /** The identifier field for the item object */\n idField: PropTypes.string.description('The identifier field for the item object'),\n /** The parent identifier field for the item object */\n parentIdField: PropTypes.string.description('The parent identifier field for the item object'),\n /** Whether to show the icons or not */\n showIcons: PropTypes.string.description('Whether to show the icons or not'),\n /** List of items */\n items: PropTypes.arrayOf(\n PropTypes.shape({\n disableDrillDown: PropTypes.bool,\n icon: PropTypes.element,\n name: PropTypes.string,\n readOnly: PropTypes.bool,\n description: PropTypes.string,\n }),\n ).description('list of items'),\n /** Array of item ids that are selected. If passed the component behaves as controlled */\n selectedItems: PropTypes.arrayOf(PropTypes.string).description(\n 'Array of item ids that are selected. If passed the component behaves as controlled',\n ),\n /** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */\n nonSelectedItems: PropTypes.arrayOf(PropTypes.string).description(\n \"Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered\",\n ),\n /** Handler on search */\n onSearch: PropTypes.func.description('Handler on search'),\n /** Handler when the searchbox is visible */\n onSearchOpen: PropTypes.func.description('Handler when the searchbox is visible'),\n /** Handler when the searchbox is not visible */\n onSearchClose: PropTypes.func.description('Handler when the searchbox is not visible'),\n /** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\") */\n onDrillDown: PropTypes.func.description(\n 'Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\")',\n ),\n /** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\") */\n onDrillDownTarget: PropTypes.func.description(\n 'Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\")',\n ),\n /** Target handler when user stops dragging an item */\n onTargetSortEnd: PropTypes.func.description('Target handler when user stops dragging an item'),\n /** Callback function that gets more items for Infinite Scroll */\n onGetMoreItems: PropTypes.func.description('Callback function that gets more items for Infinite Scroll'),\n /** Wheter there are mor items loading for Infinite Scroll */\n moreItemsLoading: PropTypes.bool.description('Wheter there are mor items loading for Infinite Scroll'),\n /** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */\n hasNextPage: PropTypes.bool.description(\n 'Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems',\n ),\n /** Function that takes as a parameter an internal getter for the state */\n setGetStatus: PropTypes.func.description('Function that takes as a parameter an internal getter for the state'),\n /** Whether the target can be sortable with DnD */\n targetSortable: PropTypes.bool.description('Whether the target can be sortable with DnD'),\n /** Handler when the searchbox is visible */\n sourceRootTitle: PropTypes.string.description('Handler when the searchbox is visible'),\n /** Source text when there is no items */\n sourceEmptyMessage: PropTypes.string.description('Source text when there is no items'),\n /** Target text when there is no items */\n targetEmptyMessage: PropTypes.string.description('Target text when there is no items'),\n /** Target text for the first hierarchy item */\n targetRootTitle: PropTypes.string.description('Target text for the first hierarchy item'),\n /** Function that allow to compose the item props in the source */\n composeSourceItemProps: PropTypes.func.description('Function that allow to compose the item props in the source'),\n /** Function that allow to compose the item props in the target */\n composeTargetItemProps: PropTypes.func.description('Function that allow to compose the item props in the target'),\n /** Handler when a users moves an item to the target */\n onAddToTarget: PropTypes.func.description('Handler when a users moves an item to the target'),\n /** Handler when a users moves all the 'checked' items to the target */\n onAddCheckedItems: PropTypes.func.description(\"Handler when a users moves all the 'checked' items to the target\"),\n /** Handler when a user removes an item from the target */\n onRemoveFromTarget: PropTypes.func.description('Handler when a user removes an item from the target'),\n /** Handler when a user removes all the items from the target */\n onRemoveAllFromTarget: PropTypes.func.description('Handler when a user removes all the items from the target'),\n /** Handler for every change on the state */\n onChange: PropTypes.func.description('Handler for every change on the state'),\n /** Function that returns an element for the source counter */\n renderSourceCounter: PropTypes.func.description('Function that returns an element for the source counter'),\n /** Function that returns an element for the target counter */\n renderTargetCounter: PropTypes.func.description('Function that returns an element for the target counter'),\n /** Source text for the clear items button */\n sourceClearItemsText: PropTypes.string.description('Source text for the clear items button'),\n /** Target text for the clear items button */\n targetClearItemsText: PropTypes.string.description('Target text for the clear items button'),\n /** Searchbox placeholder */\n searchPlaceholder: PropTypes.string.description('Searchbox placeholder'),\n /** Displays loading indicator on source section */\n loadingSource: PropTypes.bool.description('Displays loading indicator on source section'),\n /** Displays loading indicator on target section */\n loadingTarget: PropTypes.bool.description('Displays loading indicator on target section'),\n};\n\nDSShuttle.propTypes = props;\nDSShuttle.displayName = 'DSShuttle';\nconst DSShuttleWithSchema = describe(DSShuttle);\nDSShuttleWithSchema.propTypes = props;\n\nexport { utils, DSShuttleWithSchema, DSShuttle };\n\nexport default DSShuttle;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA;AAAA;ACAA,YAAuB;ADkDnB;AAhDJ,oBAAyB;AACzB,8BAAoC;AACpC,uCAAoC;AACpC,yBAA4B;AAC5B,mBAAkB;AAElB,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,YAAY,CAAC;AAAA,EACjB,iBAAiB,CAAC;AAAA,EAClB,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA;AAAA;AAAA,EAEhB,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,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EhH,eAAe,kCAAU,KAAK,YAAY,kDAAkD;AAAA;AAAA,EAE5F,mBAAmB,kCAAU,KAAK,YAAY,kEAAkE;AAAA;AAAA,EAEhH,oBAAoB,kCAAU,KAAK,YAAY,qDAAqD;AAAA;AAAA,EAEpG,uBAAuB,kCAAU,KAAK,YAAY,2DAA2D;AAAA;AAAA,EAE7G,UAAU,kCAAU,KAAK,YAAY,uCAAuC;AAAA;AAAA,EAE5E,qBAAqB,kCAAU,KAAK,YAAY,yDAAyD;AAAA;AAAA,EAEzG,qBAAqB,kCAAU,KAAK,YAAY,yDAAyD;AAAA;AAAA,EAEzG,sBAAsB,kCAAU,OAAO,YAAY,wCAAwC;AAAA;AAAA,EAE3F,sBAAsB,kCAAU,OAAO,YAAY,wCAAwC;AAAA;AAAA,EAE3F,mBAAmB,kCAAU,OAAO,YAAY,uBAAuB;AAAA;AAAA,EAEvE,eAAe,kCAAU,KAAK,YAAY,8CAA8C;AAAA;AAAA,EAExF,eAAe,kCAAU,KAAK,YAAY,8CAA8C;AAC1F;AAEA,UAAU,YAAY;AACtB,UAAU,cAAc;AACxB,MAAM,0BAAsB,kCAAS,SAAS;AAC9C,oBAAoB,YAAY;AAIhC,IAAO,oBAAQ;",
6
6
  "names": ["utils"]
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SearchState.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useState } from 'react';\nimport createContainer from 'constate';\n\nfunction useSearchState() {\n const [searchTerm, setSearchTerm] = useState('');\n const [searching, setSearchBoxVisibility] = useState(false); // todo: create a hook for Visibility behavior\n\n function toggleSearchBox(userVisible) {\n if (userVisible !== undefined) {\n setSearchBoxVisibility(userVisible);\n } else {\n setSearchBoxVisibility(!searching);\n }\n }\n\n function reset() {\n setSearchTerm('');\n setSearchBoxVisibility(false);\n }\n\n return {\n state: { searchTerm, searching },\n setSearchTerm,\n toggleSearchBox,\n reset,\n };\n}\n\nconst SearchState = createContainer(useSearchState, value => [value.state]);\nexport { SearchState };\nexport default SearchState;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyB;AACzB,sBAA4B;AAE5B,SAAS,iBAAiB;AACxB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,EAAE;AAC/C,QAAM,CAAC,WAAW,sBAAsB,QAAI,uBAAS,KAAK;AAE1D,WAAS,gBAAgB,aAAa;AACpC,QAAI,gBAAgB,QAAW;AAC7B,6BAAuB,WAAW;AAAA,IACpC,OAAO;AACL,6BAAuB,CAAC,SAAS;AAAA,IACnC;AAAA,EACF;AAEA,WAAS,QAAQ;AACf,kBAAc,EAAE;AAChB,2BAAuB,KAAK;AAAA,EAC9B;AAEA,SAAO;AAAA,IACL,OAAO,EAAE,YAAY,UAAU;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,kBAAc,gBAAAA,SAAgB,gBAAgB,WAAS,CAAC,MAAM,KAAK,CAAC;AAE1E,IAAO,sBAAQ;",
4
+ "sourcesContent": ["import { useState } from 'react';\nimport createContainer from 'constate';\n\nfunction useSearchState() {\n const [searchTerm, setSearchTerm] = useState('');\n const [searching, setSearchBoxVisibility] = useState(false); // todo: create a hook for Visibility behavior\n\n function toggleSearchBox(userVisible) {\n if (userVisible !== undefined) {\n setSearchBoxVisibility(userVisible);\n } else {\n setSearchBoxVisibility(!searching);\n }\n }\n\n function reset() {\n setSearchTerm('');\n setSearchBoxVisibility(false);\n }\n\n return {\n state: { searchTerm, searching },\n setSearchTerm,\n toggleSearchBox,\n reset,\n };\n}\n\nconst SearchState = createContainer(useSearchState, (value) => [value.state]);\nexport { SearchState };\nexport default SearchState;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyB;AACzB,sBAA4B;AAE5B,SAAS,iBAAiB;AACxB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,EAAE;AAC/C,QAAM,CAAC,WAAW,sBAAsB,QAAI,uBAAS,KAAK;AAE1D,WAAS,gBAAgB,aAAa;AACpC,QAAI,gBAAgB,QAAW;AAC7B,6BAAuB,WAAW;AAAA,IACpC,OAAO;AACL,6BAAuB,CAAC,SAAS;AAAA,IACnC;AAAA,EACF;AAEA,WAAS,QAAQ;AACf,kBAAc,EAAE;AAChB,2BAAuB,KAAK;AAAA,EAC9B;AAEA,SAAO;AAAA,IACL,OAAO,EAAE,YAAY,UAAU;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,kBAAc,gBAAAA,SAAgB,gBAAgB,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAE5E,IAAO,sBAAQ;",
6
6
  "names": ["createContainer"]
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -35,8 +39,8 @@ __export(Shuttle_actions_exports, {
35
39
  module.exports = __toCommonJS(Shuttle_actions_exports);
36
40
  var React = __toESM(require("react"));
37
41
  var import_ds_utilities = require("@elliemae/ds-utilities");
38
- var import_helper = require("./helper");
39
- var import_utils = __toESM(require("./utils"));
42
+ var import_helper = require("./helper.js");
43
+ var import_utils = __toESM(require("./utils.js"));
40
44
  function toggleItemSelection(itemId) {
41
45
  return (state) => ({
42
46
  ...state,
@@ -46,9 +50,7 @@ function toggleItemSelection(itemId) {
46
50
  function navigateTo(item, dest) {
47
51
  const hierarchyType = (0, import_helper.getHierarchyTypeName)(dest);
48
52
  return (state) => {
49
- const indexInHierarchy = state[hierarchyType].findIndex(
50
- (hItem) => hItem.id === item.id
51
- );
53
+ const indexInHierarchy = state[hierarchyType].findIndex((hItem) => hItem.id === item.id);
52
54
  const hierarchy = state[hierarchyType];
53
55
  return {
54
56
  ...state,
@@ -94,14 +96,9 @@ function addToTarget(itemToAdd, collection) {
94
96
  function removeFromTarget(itemToRemove) {
95
97
  return (state, { idField }) => {
96
98
  let targetItems = (0, import_ds_utilities.cloneDeep)(state.targetItems);
97
- const itemIndex = targetItems.findIndex(
98
- (fItem) => fItem.id === itemToRemove.id
99
- );
99
+ const itemIndex = targetItems.findIndex((fItem) => fItem.id === itemToRemove.id);
100
100
  const item = targetItems[itemIndex];
101
- const children = item?.hasChildren ? (0, import_ds_utilities.compose)(
102
- (0, import_helper.filterMovedItems)(state.movedItems),
103
- import_utils.default.getChildren({ index: itemIndex })
104
- )(targetItems) || [] : [];
101
+ const children = item?.hasChildren ? (0, import_ds_utilities.compose)((0, import_helper.filterMovedItems)(state.movedItems), import_utils.default.getChildren({ index: itemIndex }))(targetItems) || [] : [];
105
102
  targetItems.splice(itemIndex, 1);
106
103
  if (item?.hasChildren && children.length) {
107
104
  const childrenHash = (0, import_ds_utilities.hashArray)(children, "id");
@@ -109,9 +106,7 @@ function removeFromTarget(itemToRemove) {
109
106
  }
110
107
  return {
111
108
  ...state,
112
- movedItems: state.movedItems.filter(
113
- (mItem) => mItem[idField] !== itemToRemove[idField]
114
- ),
109
+ movedItems: state.movedItems.filter((mItem) => mItem[idField] !== itemToRemove[idField]),
115
110
  targetItems
116
111
  };
117
112
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/Shuttle.actions.js", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import {\n addOrRemove,\n cloneDeep,\n hashArray,\n compose,\n} from '@elliemae/ds-utilities';\nimport {\n getHierarchyTypeName,\n toggleInObject,\n filterMovedItems,\n} from './helper';\n\nimport utils from './utils';\n\nexport function toggleItemSelection(itemId) {\n return state => ({\n ...state,\n checkedItems: addOrRemove(state.checkedItems, itemId),\n });\n}\nexport function navigateTo(item, dest) {\n const hierarchyType = getHierarchyTypeName(dest);\n return state => {\n const indexInHierarchy = state[hierarchyType].findIndex(\n hItem => hItem.id === item.id,\n );\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]:\n indexInHierarchy !== -1\n ? hierarchy.slice(0, indexInHierarchy + 1)\n : [...hierarchy, item],\n };\n };\n}\nexport function moveItem(item) {\n return state => {\n const movedItems = toggleInObject(state.movedItems, item.id, item);\n return {\n ...state,\n movedItems,\n };\n };\n}\n\nconst defaultOptions = {\n parentField: 'parent',\n idField: 'id',\n op: hasMoved => !hasMoved,\n};\n\n// todo: optimize this\nfunction getItemDeep({ collection, id, options }) {\n const { idField } = { ...defaultOptions, ...options };\n const itemIndex = collection.findIndex(fItem => fItem[idField] === id);\n\n // get item with nested children\n const item = collection[itemIndex];\n const children = item?.hasChildren\n ? compose(utils.getChildren({ index: itemIndex }))(collection) || []\n : [];\n\n return { item, children };\n}\n\nexport function addToTarget(itemToAdd, collection) {\n return (state, { idField }) => {\n const items = collection || state.preparedItems;\n\n const { item, children } = getItemDeep({\n collection: items,\n id: itemToAdd[idField],\n });\n\n return {\n ...state,\n movedItems: [...state.movedItems, item],\n targetItems: [...state.targetItems, item, ...children],\n };\n };\n}\n\n// todo: optimize this\nexport function removeFromTarget(itemToRemove) {\n return (state, { idField }) => {\n let targetItems = cloneDeep(state.targetItems);\n\n const itemIndex = targetItems.findIndex(\n fItem => fItem.id === itemToRemove.id,\n );\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(\n filterMovedItems(state.movedItems),\n utils.getChildren({ index: itemIndex }),\n )(targetItems) || []\n : [];\n\n targetItems.splice(itemIndex, 1);\n if (item?.hasChildren && children.length) {\n const childrenHash = hashArray(children, 'id');\n targetItems = targetItems.filter(i => !childrenHash[i.id]);\n }\n\n return {\n ...state,\n movedItems: state.movedItems.filter(\n mItem => mItem[idField] !== itemToRemove[idField],\n ),\n targetItems,\n };\n };\n}\n\nexport function resetCheckedItems() {\n return state => ({\n ...state,\n checkedItems: [],\n });\n}\nexport function resetMovedItems() {\n return state => ({\n ...state,\n movedItems: [],\n targetItems: [],\n });\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAKO;AACP,oBAIO;AAEP,mBAAkB;AAEX,SAAS,oBAAoB,QAAQ;AAC1C,SAAO,YAAU;AAAA,IACf,GAAG;AAAA,IACH,kBAAc,iCAAY,MAAM,cAAc,MAAM;AAAA,EACtD;AACF;AACO,SAAS,WAAW,MAAM,MAAM;AACrC,QAAM,oBAAgB,oCAAqB,IAAI;AAC/C,SAAO,WAAS;AACd,UAAM,mBAAmB,MAAM,eAAe;AAAA,MAC5C,WAAS,MAAM,OAAO,KAAK;AAAA,IAC7B;AACA,UAAM,YAAY,MAAM;AACxB,WAAO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,WAAW;AAE7C,UAAM,YAAY,YAAY;AAAA,MAC5B,WAAS,MAAM,OAAO,aAAa;AAAA,IACrC;AAEA,UAAM,OAAO,YAAY;AACzB,UAAM,WAAW,MAAM,kBACnB;AAAA,UACE,gCAAiB,MAAM,UAAU;AAAA,MACjC,aAAAA,QAAM,YAAY,EAAE,OAAO,UAAU,CAAC;AAAA,IACxC,EAAE,WAAW,KAAK,CAAC,IACnB,CAAC;AAEL,gBAAY,OAAO,WAAW,CAAC;AAC/B,QAAI,MAAM,eAAe,SAAS,QAAQ;AACxC,YAAM,mBAAe,+BAAU,UAAU,IAAI;AAC7C,oBAAc,YAAY,OAAO,OAAK,CAAC,aAAa,EAAE,GAAG;AAAA,IAC3D;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY,MAAM,WAAW;AAAA,QAC3B,WAAS,MAAM,aAAa,aAAa;AAAA,MAC3C;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,oBAAoB;AAClC,SAAO,YAAU;AAAA,IACf,GAAG;AAAA,IACH,cAAc,CAAC;AAAA,EACjB;AACF;AACO,SAAS,kBAAkB;AAChC,SAAO,YAAU;AAAA,IACf,GAAG;AAAA,IACH,YAAY,CAAC;AAAA,IACb,aAAa,CAAC;AAAA,EAChB;AACF;",
3
+ "sources": ["../../src/Shuttle.actions.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { addOrRemove, cloneDeep, hashArray, compose } from '@elliemae/ds-utilities';\nimport { getHierarchyTypeName, toggleInObject, filterMovedItems } from './helper.js';\nimport utils from './utils.js';\n\nexport function toggleItemSelection(itemId) {\n return (state) => ({\n ...state,\n checkedItems: addOrRemove(state.checkedItems, itemId),\n });\n}\nexport function navigateTo(item, dest) {\n const hierarchyType = getHierarchyTypeName(dest);\n return (state) => {\n const indexInHierarchy = state[hierarchyType].findIndex((hItem) => hItem.id === item.id);\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...hierarchy, item],\n };\n };\n}\nexport function moveItem(item) {\n return (state) => {\n const movedItems = toggleInObject(state.movedItems, item.id, item);\n return {\n ...state,\n movedItems,\n };\n };\n}\n\nconst defaultOptions = {\n parentField: 'parent',\n idField: 'id',\n op: (hasMoved) => !hasMoved,\n};\n\n// todo: optimize this\nfunction getItemDeep({ collection, id, options }) {\n const { idField } = { ...defaultOptions, ...options };\n const itemIndex = collection.findIndex((fItem) => fItem[idField] === id);\n\n // get item with nested children\n const item = collection[itemIndex];\n const children = item?.hasChildren ? compose(utils.getChildren({ index: itemIndex }))(collection) || [] : [];\n\n return { item, children };\n}\n\nexport function addToTarget(itemToAdd, collection) {\n return (state, { idField }) => {\n const items = collection || state.preparedItems;\n\n const { item, children } = getItemDeep({\n collection: items,\n id: itemToAdd[idField],\n });\n\n return {\n ...state,\n movedItems: [...state.movedItems, item],\n targetItems: [...state.targetItems, item, ...children],\n };\n };\n}\n\n// todo: optimize this\nexport function removeFromTarget(itemToRemove) {\n return (state, { idField }) => {\n let targetItems = cloneDeep(state.targetItems);\n\n const itemIndex = targetItems.findIndex((fItem) => fItem.id === itemToRemove.id);\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(filterMovedItems(state.movedItems), utils.getChildren({ index: itemIndex }))(targetItems) || []\n : [];\n\n targetItems.splice(itemIndex, 1);\n if (item?.hasChildren && children.length) {\n const childrenHash = hashArray(children, 'id');\n targetItems = targetItems.filter((i) => !childrenHash[i.id]);\n }\n\n return {\n ...state,\n movedItems: state.movedItems.filter((mItem) => mItem[idField] !== itemToRemove[idField]),\n targetItems,\n };\n };\n}\n\nexport function resetCheckedItems() {\n return (state) => ({\n ...state,\n checkedItems: [],\n });\n}\nexport function resetMovedItems() {\n return (state) => ({\n ...state,\n movedItems: [],\n targetItems: [],\n });\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;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SAAS,kBAAkB;AAChC,SAAO,CAAC,WAAW;AAAA,IACjB,GAAG;AAAA,IACH,YAAY,CAAC;AAAA,IACb,aAAa,CAAC;AAAA,EAChB;AACF;",
6
6
  "names": ["utils"]
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -30,19 +34,17 @@ module.exports = __toCommonJS(ShuttleContainer_exports);
30
34
  var React = __toESM(require("react"));
31
35
  var import_react = require("react");
32
36
  var import_ds_utilities = require("@elliemae/ds-utilities");
33
- var import_withProviders = require("./withProviders");
34
- var import_helper = require("./helper");
35
- var import_SearchState = require("./SearchState");
36
- var import_ShuttleState = require("./ShuttleState");
37
+ var import_withProviders = require("./withProviders.js");
38
+ var import_helper = require("./helper.js");
39
+ var import_SearchState = require("./SearchState.js");
40
+ var import_ShuttleState = require("./ShuttleState.js");
37
41
  function filterItemsByTerm(items, term) {
38
42
  return items.filter(
39
43
  (item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1
40
44
  );
41
45
  }
42
46
  function ShuttleContainer({ items = [], children }) {
43
- const { state: shuttleState, ...handlers } = (0, import_react.useContext)(
44
- import_ShuttleState.ShuttleState.Context
45
- );
47
+ const { state: shuttleState, ...handlers } = (0, import_react.useContext)(import_ShuttleState.ShuttleState.Context);
46
48
  const { state: searchState } = (0, import_react.useContext)(import_SearchState.SearchState.Context);
47
49
  const {
48
50
  movedItems,
@@ -71,9 +73,7 @@ function ShuttleContainer({ items = [], children }) {
71
73
  const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
72
74
  return (0, import_ds_utilities.compose)(
73
75
  (items2) => (0, import_ds_utilities.sortBy)(items2, ["name"]),
74
- (items2) => hierarchyId ? (0, import_helper.filterItemsByHierarchy)(items2, hierarchyId).filter(
75
- (item) => !movedItems[item.id]
76
- ) : (0, import_ds_utilities.uniqBy)((0, import_ds_utilities.values)(movedItems), "id")
76
+ (items2) => hierarchyId ? (0, import_helper.filterItemsByHierarchy)(items2, hierarchyId).filter((item) => !movedItems[item.id]) : (0, import_ds_utilities.uniqBy)((0, import_ds_utilities.values)(movedItems), "id")
77
77
  )(items);
78
78
  }, [items, searching, hierarchyDest, movedItems]);
79
79
  return (0, import_ds_utilities.isFunction)(children) && children({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ShuttleContainer.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport {\n isFunction,\n compose,\n uniqBy,\n values,\n sortBy,\n} from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders';\nimport {\n prepareItems,\n getActiveIdFromHierarchy,\n filterItemsByHierarchy,\n getItemsById,\n} from './helper';\nimport { SearchState } from './SearchState';\nimport { ShuttleState } from './ShuttleState';\n\nfunction filterItemsByTerm(items, term) {\n return items.filter(\n item =>\n item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 ||\n String(item.id).indexOf(String(term).toLowerCase()) !== -1,\n );\n}\n\nfunction ShuttleContainer({ items = [], children }) {\n const { state: shuttleState, ...handlers } = useContext(\n ShuttleState.Context,\n );\n const { state: searchState } = useContext(SearchState.Context);\n const {\n movedItems,\n hierarchy,\n hierarchyDest,\n checkedItems,\n searchTerm,\n searching,\n toggleItemSelection,\n resetCheckedItems,\n resetMovedItems,\n moveCheckedItems,\n moveItem,\n navigate,\n } = { ...shuttleState, ...searchState, ...handlers };\n\n const sourceItems = useMemo(\n () =>\n compose(\n items => items.filter(item => !movedItems[item.id]),\n items =>\n searchTerm && searching\n ? filterItemsByTerm(items, searchTerm)\n : items,\n items =>\n filterItemsByHierarchy(items, getActiveIdFromHierarchy(hierarchy).id),\n items => prepareItems(items),\n )(items),\n [items, searchTerm, searching, hierarchy, movedItems],\n );\n\n const targetItems = useMemo(() => {\n const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;\n return compose(\n items => sortBy(items, ['name']),\n items =>\n hierarchyId\n ? filterItemsByHierarchy(items, hierarchyId).filter(\n item => !movedItems[item.id],\n )\n : uniqBy(values(movedItems), 'id'),\n )(items);\n }, [items, searching, hierarchyDest, movedItems]);\n\n return (\n isFunction(children) &&\n children({\n checkedItems,\n hierarchy,\n hierarchyDest,\n onCheckItem: toggleItemSelection,\n onClearCheckedItems: resetCheckedItems,\n onClearMovedItems: resetMovedItems,\n onMoveCheckedItems: () =>\n moveCheckedItems(getItemsById(checkedItems, items)),\n onMoveItemToSource: item => moveItem(item, false),\n onMoveItemToTarget: item => moveItem(item, true),\n onNavigateOnSourceTo: item => navigate(item, false),\n onNavigateOnTargetTo: item => navigate(item, true),\n sourceItems,\n targetItems,\n })\n );\n}\n\nexport default withProviders(ShuttleContainer);\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAoC;AACpC,0BAMO;AACP,2BAA8B;AAC9B,oBAKO;AACP,yBAA4B;AAC5B,0BAA6B;AAE7B,SAAS,kBAAkB,OAAO,MAAM;AACtC,SAAO,MAAM;AAAA,IACX,UACE,KAAK,KAAK,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM,MAChE,OAAO,KAAK,EAAE,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM;AAAA,EA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;AAAA,IACrB,mBAAmB;AAAA,IACnB,oBAAoB,MAClB,qBAAiB,4BAAa,cAAc,KAAK,CAAC;AAAA,IACpD,oBAAoB,UAAQ,SAAS,MAAM,KAAK;AAAA,IAChD,oBAAoB,UAAQ,SAAS,MAAM,IAAI;AAAA,IAC/C,sBAAsB,UAAQ,SAAS,MAAM,KAAK;AAAA,IAClD,sBAAsB,UAAQ,SAAS,MAAM,IAAI;AAAA,IACjD;AAAA,IACA;AAAA,EACF,CAAC;AAEL;AAEA,IAAO,+BAAQ,oCAAc,gBAAgB;",
4
+ "sourcesContent": ["/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport { isFunction, compose, uniqBy, values, sortBy } from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders.js';\nimport { prepareItems, getActiveIdFromHierarchy, filterItemsByHierarchy, getItemsById } from './helper.js';\nimport { SearchState } from './SearchState.js';\nimport { ShuttleState } from './ShuttleState.js';\n\nfunction filterItemsByTerm(items, term) {\n return items.filter(\n (item) =>\n item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 ||\n String(item.id).indexOf(String(term).toLowerCase()) !== -1,\n );\n}\n\nfunction ShuttleContainer({ items = [], children }) {\n const { state: shuttleState, ...handlers } = useContext(ShuttleState.Context);\n const { state: searchState } = useContext(SearchState.Context);\n const {\n movedItems,\n hierarchy,\n hierarchyDest,\n checkedItems,\n searchTerm,\n searching,\n toggleItemSelection,\n resetCheckedItems,\n resetMovedItems,\n moveCheckedItems,\n moveItem,\n navigate,\n } = { ...shuttleState, ...searchState, ...handlers };\n\n const sourceItems = useMemo(\n () =>\n compose(\n (items) => items.filter((item) => !movedItems[item.id]),\n (items) => (searchTerm && searching ? filterItemsByTerm(items, searchTerm) : items),\n (items) => filterItemsByHierarchy(items, getActiveIdFromHierarchy(hierarchy).id),\n (items) => prepareItems(items),\n )(items),\n [items, searchTerm, searching, hierarchy, movedItems],\n );\n\n const targetItems = useMemo(() => {\n const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;\n return compose(\n (items) => sortBy(items, ['name']),\n (items) =>\n hierarchyId\n ? filterItemsByHierarchy(items, hierarchyId).filter((item) => !movedItems[item.id])\n : uniqBy(values(movedItems), 'id'),\n )(items);\n }, [items, searching, hierarchyDest, movedItems]);\n\n return (\n isFunction(children) &&\n children({\n checkedItems,\n hierarchy,\n hierarchyDest,\n onCheckItem: toggleItemSelection,\n onClearCheckedItems: resetCheckedItems,\n onClearMovedItems: resetMovedItems,\n onMoveCheckedItems: () => moveCheckedItems(getItemsById(checkedItems, items)),\n onMoveItemToSource: (item) => moveItem(item, false),\n onMoveItemToTarget: (item) => moveItem(item, true),\n onNavigateOnSourceTo: (item) => navigate(item, false),\n onNavigateOnTargetTo: (item) => navigate(item, true),\n sourceItems,\n targetItems,\n })\n );\n}\n\nexport default withProviders(ShuttleContainer);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAoC;AACpC,0BAA4D;AAC5D,2BAA8B;AAC9B,oBAA6F;AAC7F,yBAA4B;AAC5B,0BAA6B;AAE7B,SAAS,kBAAkB,OAAO,MAAM;AACtC,SAAO,MAAM;AAAA,IACX,CAAC,SACC,KAAK,KAAK,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM,MAChE,OAAO,KAAK,EAAE,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM;AAAA,EAC5D;AACF;AAEA,SAAS,iBAAiB,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAG;AAClD,QAAM,EAAE,OAAO,cAAc,GAAG,SAAS,QAAI,yBAAW,iCAAa,OAAO;AAC5E,QAAM,EAAE,OAAO,YAAY,QAAI,yBAAW,+BAAY,OAAO;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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