@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,35 +1,60 @@
1
- 'use strict';
2
-
3
- require('core-js/modules/web.dom-collections.iterator.js');
4
- var react = require('react');
5
- var createContainer = require('constate');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var createContainer__default = /*#__PURE__*/_interopDefaultLegacy(createContainer);
10
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var AnimationState_exports = {};
29
+ __export(AnimationState_exports, {
30
+ AnimationState: () => AnimationState,
31
+ default: () => AnimationState_default
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_react = require("react");
35
+ var import_constate = __toESM(require("constate"));
11
36
  function useShuttleAnimationState() {
12
- const [animationState, setAnimationState] = react.useState({
37
+ const [animationState, setAnimationState] = (0, import_react.useState)({
13
38
  isMoving: false,
14
39
  isMovingBack: false,
15
40
  isDrillingDown: false
16
41
  });
17
- const reset = react.useCallback(() => setAnimationState({
42
+ const reset = (0, import_react.useCallback)(() => setAnimationState({
18
43
  isMoving: false,
19
44
  isMovingBack: false,
20
45
  isDrillingDown: false
21
46
  }), []);
22
- const move = react.useCallback(() => setAnimationState({
47
+ const move = (0, import_react.useCallback)(() => setAnimationState({
23
48
  isMovingBack: false,
24
49
  isMoving: true,
25
50
  isDrillingDown: false
26
51
  }), []);
27
- const moveBack = react.useCallback(() => setAnimationState({
52
+ const moveBack = (0, import_react.useCallback)(() => setAnimationState({
28
53
  isMovingBack: true,
29
54
  isMoving: false,
30
55
  isDrillingDown: false
31
56
  }), []);
32
- const drilldown = react.useCallback(() => setAnimationState({
57
+ const drilldown = (0, import_react.useCallback)(() => setAnimationState({
33
58
  isMovingBack: false,
34
59
  isMoving: false,
35
60
  isDrillingDown: true
@@ -42,7 +67,9 @@ function useShuttleAnimationState() {
42
67
  reset
43
68
  };
44
69
  }
45
-
46
- var AnimationContext = createContainer__default["default"](useShuttleAnimationState, value => [value.state]);
47
-
48
- module.exports = AnimationContext;
70
+ const AnimationState = (0, import_constate.default)(useShuttleAnimationState, (value) => [
71
+ value.state
72
+ ]);
73
+ var AnimationState_default = AnimationState;
74
+ module.exports = __toCommonJS(AnimationState_exports);
75
+ //# sourceMappingURL=AnimationState.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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;ACAA,YAAuB;ADAvB,mBAAsC;AACtC,sBAA4B;AAE5B,oCAAoC;AAClC,QAAM,CAAC,gBAAgB,qBAAqB,2BAAS;AAAA,IACnD,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA;AAElB,QAAM,QAAQ,8BACZ,MACE,kBAAkB;AAAA,IAChB,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA,MAEpB;AAEF,QAAM,OAAO,8BACX,MACE,kBAAkB;AAAA,IAChB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,gBAAgB;AAAA,MAEpB;AAGF,QAAM,WAAW,8BACf,MACE,kBAAkB;AAAA,IAChB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,gBAAgB;AAAA,MAEpB;AAGF,QAAM,YAAY,8BAChB,MACE,kBAAkB;AAAA,IAChB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,gBAAgB;AAAA,MAEpB;AAGF,SAAO;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB;AAAA;AAAA;AAIJ,MAAM,iBAAiB,6BAAgB,0BAA0B,WAAS;AAAA,EACxE,MAAM;AAAA;AAIR,IAAO,yBAAQ;",
6
+ "names": []
7
+ }
package/cjs/DSShuttle.js CHANGED
@@ -1,223 +1,170 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _jsx = require('@babel/runtime/helpers/jsx');
6
- require('core-js/modules/web.dom-collections.iterator.js');
7
- require('react');
8
- var lodash = require('lodash');
9
- var reactDesc = require('react-desc');
10
- var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
11
- var ShuttleImpl = require('./ShuttleImpl.js');
12
- var utils = require('./utils.js');
13
-
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
-
16
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
17
-
18
- const noop = () => {};
19
-
20
- const DSShuttle = _ref => {
21
- let {
22
- containerProps = {},
23
- idField = 'id',
24
- parentIdField = 'parent',
25
- showIcons = true,
26
- items = [],
27
- selectedItems = undefined,
28
- // if defined it becomes controlled (v1)
29
- // TODO make `nonSelectedItems` the default controlled behavior (v2)
30
- nonSelectedItems = undefined,
31
- onSearch = noop,
32
- onSearchOpen = noop,
33
- onSearchClose = noop,
34
- onDrillDown = noop,
35
- onDrillDownTarget = noop,
36
- onTargetSortEnd = noop,
37
- setGetStatus = noop,
38
- targetSortable = true,
39
- sourceEmptyMessage = 'No Items Found',
40
- sourceRootTitle = 'Category',
41
- targetEmptyMessage = 'No Items Selected',
42
- targetRootTitle = 'Selected Items',
43
- composeSourceItemProps = () => ({}),
44
- composeTargetItemProps = () => ({}),
45
- onAddToTarget = noop,
46
- onAddCheckedItems = noop,
47
- onRemoveFromTarget = noop,
48
- onRemoveAllFromTarget = noop,
49
- onChange = noop,
50
- renderSourceCounter = noop,
51
- renderTargetCounter = noop,
52
- sourceClearItemsText = 'CLEAR ALL',
53
- targetClearItemsText = 'CLEAR ALL',
54
- searchPlaceholder = 'Search field ID, name, etc.',
55
- loadingSource = false,
56
- loadingTarget = false,
57
- onGetMoreItems = () => null,
58
- hasNextPage = false,
59
- moreItemsLoading
60
- } = _ref;
61
- return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.TooltipTextProvider, {}, void 0, /*#__PURE__*/_jsx__default["default"](ShuttleImpl, {
62
- composeSourceItemProps: composeSourceItemProps,
63
- composeTargetItemProps: composeTargetItemProps,
64
- containerProps: containerProps,
65
- idField: idField,
66
- items: items,
67
- onAddCheckedItems: onAddCheckedItems,
68
- onAddToTarget: onAddToTarget,
69
- onChange: onChange,
70
- onDrillDown: onDrillDown,
71
- nonSelectedItems: nonSelectedItems,
72
- onDrillDownTarget: onDrillDownTarget,
73
- onRemoveAllFromTarget: onRemoveAllFromTarget,
74
- onRemoveFromTarget: onRemoveFromTarget,
75
- onSearch: onSearch,
76
- onSearchClose: onSearchClose,
77
- onSearchOpen: onSearchOpen,
78
- onTargetSortEnd: onTargetSortEnd,
79
- parentIdField: parentIdField,
80
- renderSourceCounter: renderSourceCounter,
81
- renderTargetCounter: renderTargetCounter,
82
- searchPlaceholder: searchPlaceholder,
83
- selectedItems: selectedItems,
84
- setGetStatus: setGetStatus,
85
- showIcons: showIcons,
86
- sourceClearItemsText: sourceClearItemsText,
87
- sourceEmptyMessage: sourceEmptyMessage,
88
- sourceRootTitle: sourceRootTitle,
89
- targetClearItemsText: targetClearItemsText,
90
- targetEmptyMessage: targetEmptyMessage,
91
- targetRootTitle: targetRootTitle,
92
- targetSortable: targetSortable,
93
- loadingSource: loadingSource,
94
- loadingTarget: loadingTarget,
95
- onGetMoreItems: lodash.debounce(function () {
96
- onGetMoreItems(...arguments);
97
- }, 500),
98
- moreItemsLoading: moreItemsLoading,
99
- hasNextPage: hasNextPage
100
- }));
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
101
11
  };
102
-
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var DSShuttle_exports = {};
29
+ __export(DSShuttle_exports, {
30
+ DSShuttle: () => DSShuttle,
31
+ DSShuttleWithSchema: () => DSShuttleWithSchema,
32
+ default: () => DSShuttle_default,
33
+ utils: () => import_utils.default
34
+ });
35
+ var React = __toESM(require("react"));
36
+ var import_react = __toESM(require("react"));
37
+ var import_lodash = require("lodash");
38
+ var import_react_desc = require("react-desc");
39
+ var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
40
+ var import_ShuttleImpl = require("./ShuttleImpl");
41
+ var import_utils = __toESM(require("./utils"));
42
+ const noop = () => {
43
+ };
44
+ const DSShuttle = ({
45
+ containerProps = {},
46
+ idField = "id",
47
+ parentIdField = "parent",
48
+ showIcons = true,
49
+ items = [],
50
+ selectedItems = void 0,
51
+ nonSelectedItems = void 0,
52
+ onSearch = noop,
53
+ onSearchOpen = noop,
54
+ onSearchClose = noop,
55
+ onDrillDown = noop,
56
+ onDrillDownTarget = noop,
57
+ onTargetSortEnd = noop,
58
+ setGetStatus = noop,
59
+ targetSortable = true,
60
+ sourceEmptyMessage = "No Items Found",
61
+ sourceRootTitle = "Category",
62
+ targetEmptyMessage = "No Items Selected",
63
+ targetRootTitle = "Selected Items",
64
+ composeSourceItemProps = () => ({}),
65
+ composeTargetItemProps = () => ({}),
66
+ onAddToTarget = noop,
67
+ onAddCheckedItems = noop,
68
+ onRemoveFromTarget = noop,
69
+ onRemoveAllFromTarget = noop,
70
+ onChange = noop,
71
+ renderSourceCounter = noop,
72
+ renderTargetCounter = noop,
73
+ sourceClearItemsText = "CLEAR ALL",
74
+ targetClearItemsText = "CLEAR ALL",
75
+ searchPlaceholder = "Search field ID, name, etc.",
76
+ loadingSource = false,
77
+ loadingTarget = false,
78
+ onGetMoreItems = () => null,
79
+ hasNextPage = false,
80
+ moreItemsLoading
81
+ }) => /* @__PURE__ */ import_react.default.createElement(import_ds_truncated_tooltip_text.TooltipTextProvider, null, /* @__PURE__ */ import_react.default.createElement(import_ShuttleImpl.ShuttleImpl, {
82
+ composeSourceItemProps,
83
+ composeTargetItemProps,
84
+ containerProps,
85
+ idField,
86
+ items,
87
+ onAddCheckedItems,
88
+ onAddToTarget,
89
+ onChange,
90
+ onDrillDown,
91
+ nonSelectedItems,
92
+ onDrillDownTarget,
93
+ onRemoveAllFromTarget,
94
+ onRemoveFromTarget,
95
+ onSearch,
96
+ onSearchClose,
97
+ onSearchOpen,
98
+ onTargetSortEnd,
99
+ parentIdField,
100
+ renderSourceCounter,
101
+ renderTargetCounter,
102
+ searchPlaceholder,
103
+ selectedItems,
104
+ setGetStatus,
105
+ showIcons,
106
+ sourceClearItemsText,
107
+ sourceEmptyMessage,
108
+ sourceRootTitle,
109
+ targetClearItemsText,
110
+ targetEmptyMessage,
111
+ targetRootTitle,
112
+ targetSortable,
113
+ loadingSource,
114
+ loadingTarget,
115
+ onGetMoreItems: (0, import_lodash.debounce)((...args) => {
116
+ onGetMoreItems(...args);
117
+ }, 500),
118
+ moreItemsLoading,
119
+ hasNextPage
120
+ }));
103
121
  const props = {
104
- /** inject props to shuttle wrapper */
105
- containerProps: reactDesc.PropTypes.object.description('inject props to shuttle wrapper'),
106
-
107
- /** The identifier field for the item object */
108
- idField: reactDesc.PropTypes.string.description('The identifier field for the item object'),
109
-
110
- /** The parent identifier field for the item object */
111
- parentIdField: reactDesc.PropTypes.string.description('The parent identifier field for the item object'),
112
-
113
- /** Whether to show the icons or not */
114
- showIcons: reactDesc.PropTypes.string.description('Whether to show the icons or not'),
115
-
116
- /** List of items */
117
- items: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.shape({
118
- disableDrillDown: reactDesc.PropTypes.bool,
119
- icon: reactDesc.PropTypes.element,
120
- name: reactDesc.PropTypes.string,
121
- readOnly: reactDesc.PropTypes.bool,
122
- description: reactDesc.PropTypes.string
123
- })).description('list of items'),
124
-
125
- /** Array of item ids that are selected. If passed the component behaves as controlled */
126
- selectedItems: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string).description('Array of item ids that are selected. If passed the component behaves as controlled'),
127
-
128
- /** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */
129
- nonSelectedItems: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string).description("Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"),
130
-
131
- /** Handler on search */
132
- onSearch: reactDesc.PropTypes.func.description('Handler on search'),
133
-
134
- /** Handler when the searchbox is visible */
135
- onSearchOpen: reactDesc.PropTypes.func.description('Handler when the searchbox is visible'),
136
-
137
- /** Handler when the searchbox is not visible */
138
- onSearchClose: reactDesc.PropTypes.func.description('Handler when the searchbox is not visible'),
139
-
140
- /** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
141
- onDrillDown: reactDesc.PropTypes.func.description('Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
142
-
143
- /** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
144
- onDrillDownTarget: reactDesc.PropTypes.func.description('Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
145
-
146
- /** Target handler when user stops dragging an item */
147
- onTargetSortEnd: reactDesc.PropTypes.func.description('Target handler when user stops dragging an item'),
148
-
149
- /** Callback function that gets more items for Infinite Scroll */
150
- onGetMoreItems: reactDesc.PropTypes.func.description('Callback function that gets more items for Infinite Scroll'),
151
-
152
- /** Wheter there are mor items loading for Infinite Scroll */
153
- moreItemsLoading: reactDesc.PropTypes.bool.description('Wheter there are mor items loading for Infinite Scroll'),
154
-
155
- /** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */
156
- hasNextPage: reactDesc.PropTypes.bool.description('Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems'),
157
-
158
- /** Function that takes as a parameter an internal getter for the state */
159
- setGetStatus: reactDesc.PropTypes.func.description('Function that takes as a parameter an internal getter for the state'),
160
-
161
- /** Whether the target can be sortable with DnD */
162
- targetSortable: reactDesc.PropTypes.bool.description('Whether the target can be sortable with DnD'),
163
-
164
- /** Handler when the searchbox is visible */
165
- sourceRootTitle: reactDesc.PropTypes.string.description('Handler when the searchbox is visible'),
166
-
167
- /** Source text when there is no items */
168
- sourceEmptyMessage: reactDesc.PropTypes.string.description('Source text when there is no items'),
169
-
170
- /** Target text when there is no items */
171
- targetEmptyMessage: reactDesc.PropTypes.string.description('Target text when there is no items'),
172
-
173
- /** Target text for the first hierarchy item */
174
- targetRootTitle: reactDesc.PropTypes.string.description('Target text for the first hierarchy item'),
175
-
176
- /** Function that allow to compose the item props in the source */
177
- composeSourceItemProps: reactDesc.PropTypes.func.description('Function that allow to compose the item props in the source'),
178
-
179
- /** Function that allow to compose the item props in the target */
180
- composeTargetItemProps: reactDesc.PropTypes.func.description('Function that allow to compose the item props in the target'),
181
-
182
- /** Handler when a users moves an item to the target */
183
- onAddToTarget: reactDesc.PropTypes.func.description('Handler when a users moves an item to the target'),
184
-
185
- /** Handler when a users moves all the 'checked' items to the target */
186
- onAddCheckedItems: reactDesc.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
187
-
188
- /** Handler when a user removes an item from the target */
189
- onRemoveFromTarget: reactDesc.PropTypes.func.description('Handler when a user removes an item from the target'),
190
-
191
- /** Handler when a user removes all the items from the target */
192
- onRemoveAllFromTarget: reactDesc.PropTypes.func.description('Handler when a user removes all the items from the target'),
193
-
194
- /** Handler for every change on the state */
195
- onChange: reactDesc.PropTypes.func.description('Handler for every change on the state'),
196
-
197
- /** Function that returns an element for the source counter */
198
- renderSourceCounter: reactDesc.PropTypes.func.description('Function that returns an element for the source counter'),
199
-
200
- /** Function that returns an element for the target counter */
201
- renderTargetCounter: reactDesc.PropTypes.func.description('Function that returns an element for the target counter'),
202
-
203
- /** Source text for the clear items button */
204
- sourceClearItemsText: reactDesc.PropTypes.string.description('Source text for the clear items button'),
205
-
206
- /** Target text for the clear items button */
207
- targetClearItemsText: reactDesc.PropTypes.string.description('Target text for the clear items button'),
208
-
209
- /** Searchbox placeholder */
210
- searchPlaceholder: reactDesc.PropTypes.string.description('Searchbox placeholder'),
211
-
212
- /** Displays loading indicator on source section */
213
- loadingSource: reactDesc.PropTypes.bool.description('Displays loading indicator on source section'),
214
-
215
- /** Displays loading indicator on target section */
216
- loadingTarget: reactDesc.PropTypes.bool.description('Displays loading indicator on target section')
122
+ containerProps: import_react_desc.PropTypes.object.description("inject props to shuttle wrapper"),
123
+ idField: import_react_desc.PropTypes.string.description("The identifier field for the item object"),
124
+ parentIdField: import_react_desc.PropTypes.string.description("The parent identifier field for the item object"),
125
+ showIcons: import_react_desc.PropTypes.string.description("Whether to show the icons or not"),
126
+ items: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.shape({
127
+ disableDrillDown: import_react_desc.PropTypes.bool,
128
+ icon: import_react_desc.PropTypes.element,
129
+ name: import_react_desc.PropTypes.string,
130
+ readOnly: import_react_desc.PropTypes.bool,
131
+ description: import_react_desc.PropTypes.string
132
+ })).description("list of items"),
133
+ selectedItems: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.string).description("Array of item ids that are selected. If passed the component behaves as controlled"),
134
+ nonSelectedItems: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.string).description("Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"),
135
+ onSearch: import_react_desc.PropTypes.func.description("Handler on search"),
136
+ onSearchOpen: import_react_desc.PropTypes.func.description("Handler when the searchbox is visible"),
137
+ onSearchClose: import_react_desc.PropTypes.func.description("Handler when the searchbox is not visible"),
138
+ onDrillDown: import_react_desc.PropTypes.func.description('Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
139
+ onDrillDownTarget: import_react_desc.PropTypes.func.description('Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
140
+ onTargetSortEnd: import_react_desc.PropTypes.func.description("Target handler when user stops dragging an item"),
141
+ onGetMoreItems: import_react_desc.PropTypes.func.description("Callback function that gets more items for Infinite Scroll"),
142
+ moreItemsLoading: import_react_desc.PropTypes.bool.description("Wheter there are mor items loading for Infinite Scroll"),
143
+ hasNextPage: import_react_desc.PropTypes.bool.description("Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems"),
144
+ setGetStatus: import_react_desc.PropTypes.func.description("Function that takes as a parameter an internal getter for the state"),
145
+ targetSortable: import_react_desc.PropTypes.bool.description("Whether the target can be sortable with DnD"),
146
+ sourceRootTitle: import_react_desc.PropTypes.string.description("Handler when the searchbox is visible"),
147
+ sourceEmptyMessage: import_react_desc.PropTypes.string.description("Source text when there is no items"),
148
+ targetEmptyMessage: import_react_desc.PropTypes.string.description("Target text when there is no items"),
149
+ targetRootTitle: import_react_desc.PropTypes.string.description("Target text for the first hierarchy item"),
150
+ composeSourceItemProps: import_react_desc.PropTypes.func.description("Function that allow to compose the item props in the source"),
151
+ composeTargetItemProps: import_react_desc.PropTypes.func.description("Function that allow to compose the item props in the target"),
152
+ onAddToTarget: import_react_desc.PropTypes.func.description("Handler when a users moves an item to the target"),
153
+ onAddCheckedItems: import_react_desc.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
154
+ onRemoveFromTarget: import_react_desc.PropTypes.func.description("Handler when a user removes an item from the target"),
155
+ onRemoveAllFromTarget: import_react_desc.PropTypes.func.description("Handler when a user removes all the items from the target"),
156
+ onChange: import_react_desc.PropTypes.func.description("Handler for every change on the state"),
157
+ renderSourceCounter: import_react_desc.PropTypes.func.description("Function that returns an element for the source counter"),
158
+ renderTargetCounter: import_react_desc.PropTypes.func.description("Function that returns an element for the target counter"),
159
+ sourceClearItemsText: import_react_desc.PropTypes.string.description("Source text for the clear items button"),
160
+ targetClearItemsText: import_react_desc.PropTypes.string.description("Target text for the clear items button"),
161
+ searchPlaceholder: import_react_desc.PropTypes.string.description("Searchbox placeholder"),
162
+ loadingSource: import_react_desc.PropTypes.bool.description("Displays loading indicator on source section"),
163
+ loadingTarget: import_react_desc.PropTypes.bool.description("Displays loading indicator on target section")
217
164
  };
218
- const DSShuttleWithSchema = reactDesc.describe(DSShuttle);
165
+ DSShuttle.propTypes = props;
166
+ const DSShuttleWithSchema = (0, import_react_desc.describe)(DSShuttle);
219
167
  DSShuttleWithSchema.propTypes = props;
220
-
221
- exports.utils = utils;
222
- exports.DSShuttleWithSchema = DSShuttleWithSchema;
223
- exports["default"] = DSShuttle;
168
+ var DSShuttle_default = DSShuttle;
169
+ module.exports = __toCommonJS(DSShuttle_exports);
170
+ //# sourceMappingURL=DSShuttle.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 'react-desc';\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;\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": "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",
6
+ "names": []
7
+ }
@@ -1,41 +1,60 @@
1
- 'use strict';
2
-
3
- require('core-js/modules/web.dom-collections.iterator.js');
4
- var react = require('react');
5
- var createContainer = require('constate');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var createContainer__default = /*#__PURE__*/_interopDefaultLegacy(createContainer);
10
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var SearchState_exports = {};
29
+ __export(SearchState_exports, {
30
+ SearchState: () => SearchState,
31
+ default: () => SearchState_default
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_react = require("react");
35
+ var import_constate = __toESM(require("constate"));
11
36
  function useSearchState() {
12
- const [searchTerm, setSearchTerm] = react.useState('');
13
- const [searching, setSearchBoxVisibility] = react.useState(false); // todo: create a hook for Visibility behavior
14
-
37
+ const [searchTerm, setSearchTerm] = (0, import_react.useState)("");
38
+ const [searching, setSearchBoxVisibility] = (0, import_react.useState)(false);
15
39
  function toggleSearchBox(userVisible) {
16
- if (userVisible !== undefined) {
40
+ if (userVisible !== void 0) {
17
41
  setSearchBoxVisibility(userVisible);
18
42
  } else {
19
43
  setSearchBoxVisibility(!searching);
20
44
  }
21
45
  }
22
-
23
46
  function reset() {
24
- setSearchTerm('');
47
+ setSearchTerm("");
25
48
  setSearchBoxVisibility(false);
26
49
  }
27
-
28
50
  return {
29
- state: {
30
- searchTerm,
31
- searching
32
- },
51
+ state: { searchTerm, searching },
33
52
  setSearchTerm,
34
53
  toggleSearchBox,
35
54
  reset
36
55
  };
37
56
  }
38
-
39
- var SearchState = createContainer__default["default"](useSearchState, value => [value.state]);
40
-
41
- module.exports = SearchState;
57
+ const SearchState = (0, import_constate.default)(useSearchState, (value) => [value.state]);
58
+ var SearchState_default = SearchState;
59
+ module.exports = __toCommonJS(SearchState_exports);
60
+ //# sourceMappingURL=SearchState.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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;ACAA,YAAuB;ADAvB,mBAAyB;AACzB,sBAA4B;AAE5B,0BAA0B;AACxB,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAC7C,QAAM,CAAC,WAAW,0BAA0B,2BAAS;AAErD,2BAAyB,aAAa;AACpC,QAAI,gBAAgB,QAAW;AAC7B,6BAAuB;AAAA,WAClB;AACL,6BAAuB,CAAC;AAAA;AAAA;AAI5B,mBAAiB;AACf,kBAAc;AACd,2BAAuB;AAAA;AAGzB,SAAO;AAAA,IACL,OAAO,EAAE,YAAY;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAIJ,MAAM,cAAc,6BAAgB,gBAAgB,WAAS,CAAC,MAAM;AAEpE,IAAO,sBAAQ;",
6
+ "names": []
7
+ }