@elliemae/ds-shuttle 2.3.0-next.0 → 3.0.0-alpha.0
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.
- package/dist/cjs/AnimationState.js +75 -0
- package/dist/cjs/AnimationState.js.map +7 -0
- package/dist/cjs/DSShuttle.js +170 -0
- package/dist/cjs/DSShuttle.js.map +7 -0
- package/dist/cjs/SearchState.js +60 -0
- package/dist/cjs/SearchState.js.map +7 -0
- package/dist/cjs/Shuttle.actions.js +126 -0
- package/dist/cjs/Shuttle.actions.js.map +7 -0
- package/dist/cjs/ShuttleContainer.js +82 -0
- package/dist/cjs/ShuttleContainer.js.map +7 -0
- package/dist/cjs/ShuttleImpl.js +214 -0
- package/dist/cjs/ShuttleImpl.js.map +7 -0
- package/dist/cjs/ShuttleRenderer.js +144 -0
- package/dist/cjs/ShuttleRenderer.js.map +7 -0
- package/dist/cjs/ShuttleState.js +84 -0
- package/dist/cjs/ShuttleState.js.map +7 -0
- package/dist/cjs/animation/animationConfig.js +78 -0
- package/dist/cjs/animation/animationConfig.js.map +7 -0
- package/dist/cjs/classedComponents.js +72 -0
- package/dist/cjs/classedComponents.js.map +7 -0
- package/dist/cjs/components/LoadingIndicator.js +52 -0
- package/dist/cjs/components/LoadingIndicator.js.map +7 -0
- package/dist/cjs/components/OverflowList.js +55 -0
- package/dist/cjs/components/OverflowList.js.map +7 -0
- package/dist/cjs/components/ShuttleBreadcrumb.js +54 -0
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +7 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +48 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +60 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +83 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +90 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +73 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListPanel.js +49 -0
- package/dist/cjs/components/ShuttleListPanel.js.map +7 -0
- package/dist/cjs/components/ShuttleSearchBox.js +99 -0
- package/dist/cjs/components/ShuttleSearchBox.js.map +7 -0
- package/dist/cjs/components/ShuttleSource.js +192 -0
- package/dist/cjs/components/ShuttleSource.js.map +7 -0
- package/dist/cjs/components/ShuttleTarget.js +104 -0
- package/dist/cjs/components/ShuttleTarget.js.map +7 -0
- package/dist/cjs/components/VirtualizedItem.js +51 -0
- package/dist/cjs/components/VirtualizedItem.js.map +7 -0
- package/dist/cjs/components/VirtualizedList.js +88 -0
- package/dist/cjs/components/VirtualizedList.js.map +7 -0
- package/dist/cjs/components/VirtualizedSortableList.js +48 -0
- package/dist/cjs/components/VirtualizedSortableList.js.map +7 -0
- package/dist/cjs/helper.js +83 -0
- package/dist/cjs/helper.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/tests/utils.js +1218 -0
- package/dist/cjs/tests/utils.js.map +7 -0
- package/dist/cjs/updateShuttleStateFromProps.js +98 -0
- package/dist/cjs/updateShuttleStateFromProps.js.map +7 -0
- package/dist/cjs/utils.js +41 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/cjs/withProviders.js +45 -0
- package/dist/cjs/withProviders.js.map +7 -0
- package/{esm → dist/esm}/AnimationState.js +12 -8
- package/dist/esm/AnimationState.js.map +7 -0
- package/dist/esm/DSShuttle.js +141 -0
- package/dist/esm/DSShuttle.js.map +7 -0
- package/dist/esm/SearchState.js +31 -0
- package/dist/esm/SearchState.js.map +7 -0
- package/dist/esm/Shuttle.actions.js +106 -0
- package/dist/esm/Shuttle.actions.js.map +7 -0
- package/dist/esm/ShuttleContainer.js +64 -0
- package/dist/esm/ShuttleContainer.js.map +7 -0
- package/dist/esm/ShuttleImpl.js +199 -0
- package/dist/esm/ShuttleImpl.js.map +7 -0
- package/dist/esm/ShuttleRenderer.js +115 -0
- package/dist/esm/ShuttleRenderer.js.map +7 -0
- package/dist/esm/ShuttleState.js +55 -0
- package/dist/esm/ShuttleState.js.map +7 -0
- package/dist/esm/animation/animationConfig.js +49 -0
- package/dist/esm/animation/animationConfig.js.map +7 -0
- package/dist/esm/classedComponents.js +43 -0
- package/dist/esm/classedComponents.js.map +7 -0
- package/dist/esm/components/LoadingIndicator.js +23 -0
- package/dist/esm/components/LoadingIndicator.js.map +7 -0
- package/dist/esm/components/OverflowList.js +26 -0
- package/dist/esm/components/OverflowList.js.map +7 -0
- package/dist/esm/components/ShuttleBreadcrumb.js +25 -0
- package/dist/esm/components/ShuttleBreadcrumb.js.map +7 -0
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +19 -0
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +31 -0
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +54 -0
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +61 -0
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +44 -0
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListPanel.js +20 -0
- package/dist/esm/components/ShuttleListPanel.js.map +7 -0
- package/dist/esm/components/ShuttleSearchBox.js +70 -0
- package/dist/esm/components/ShuttleSearchBox.js.map +7 -0
- package/dist/esm/components/ShuttleSource.js +175 -0
- package/dist/esm/components/ShuttleSource.js.map +7 -0
- package/dist/esm/components/ShuttleTarget.js +86 -0
- package/dist/esm/components/ShuttleTarget.js.map +7 -0
- package/dist/esm/components/VirtualizedItem.js +22 -0
- package/dist/esm/components/VirtualizedItem.js.map +7 -0
- package/dist/esm/components/VirtualizedList.js +59 -0
- package/dist/esm/components/VirtualizedList.js.map +7 -0
- package/dist/esm/components/VirtualizedSortableList.js +19 -0
- package/dist/esm/components/VirtualizedSortableList.js.map +7 -0
- package/dist/esm/helper.js +54 -0
- package/dist/esm/helper.js.map +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/tests/utils.js +1189 -0
- package/dist/esm/tests/utils.js.map +7 -0
- package/dist/esm/updateShuttleStateFromProps.js +69 -0
- package/dist/esm/updateShuttleStateFromProps.js.map +7 -0
- package/dist/esm/utils.js +12 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/esm/withProviders.js +16 -0
- package/dist/esm/withProviders.js.map +7 -0
- package/{types → dist/types}/AnimationState.d.ts +3 -2
- package/{types → dist/types}/DSShuttle.d.ts +1 -1
- package/{types → dist/types}/SearchState.d.ts +3 -2
- package/{types → dist/types}/Shuttle.actions.d.ts +0 -0
- package/{types → dist/types}/ShuttleContainer.d.ts +0 -0
- package/dist/types/ShuttleImpl.d.ts +4 -0
- package/{types → dist/types}/ShuttleRenderer.d.ts +1 -0
- package/{types → dist/types}/ShuttleState.d.ts +3 -2
- package/{types → dist/types}/animation/animationConfig.d.ts +0 -0
- package/{types → dist/types}/classedComponents.d.ts +0 -0
- package/{types → dist/types}/components/LoadingIndicator.d.ts +1 -0
- package/{types → dist/types}/components/OverflowList.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleBreadcrumb.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleInfiniteScrollIndicator.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListItem/ActionButtons.d.ts +0 -0
- package/{types → dist/types}/components/ShuttleListItem/ShuttleListItem.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListItem/ShuttleSourceListItem.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListItem/ShuttleTargetListItem.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListPanel.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleSearchBox.d.ts +3 -1
- package/{types → dist/types}/components/ShuttleSource.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleTarget.d.ts +1 -0
- package/{types → dist/types}/components/VirtualizedItem.d.ts +1 -0
- package/{types → dist/types}/components/VirtualizedList.d.ts +1 -0
- package/{types → dist/types}/components/VirtualizedSortableList.d.ts +1 -0
- package/{types → dist/types}/helper.d.ts +0 -0
- package/dist/types/index.d.ts +1 -0
- package/{types → dist/types}/tests/DSShuttle.events.test.d.ts +0 -0
- package/{types → dist/types}/tests/DSShuttle.test.d.ts +0 -0
- package/{types → dist/types}/tests/utils.d.ts +0 -0
- package/dist/types/updateShuttleStateFromProps.d.ts +3 -0
- package/{types → dist/types}/utils.d.ts +0 -0
- package/{types → dist/types}/withProviders.d.ts +1 -0
- package/package.json +97 -89
- package/cjs/AnimationState.js +0 -48
- package/cjs/DSShuttle.js +0 -223
- package/cjs/SearchState.js +0 -41
- package/cjs/Shuttle.actions.js +0 -137
- package/cjs/ShuttleContainer.js +0 -87
- package/cjs/ShuttleImpl.js +0 -311
- package/cjs/ShuttleRenderer.js +0 -139
- package/cjs/ShuttleState.js +0 -80
- package/cjs/animation/animationConfig.js +0 -81
- package/cjs/classedComponents.js +0 -71
- package/cjs/components/LoadingIndicator.js +0 -25
- package/cjs/components/OverflowList.js +0 -53
- package/cjs/components/ShuttleBreadcrumb.js +0 -42
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +0 -39
- package/cjs/components/ShuttleListItem/ActionButtons.js +0 -55
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +0 -85
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +0 -76
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +0 -57
- package/cjs/components/ShuttleListPanel.js +0 -31
- package/cjs/components/ShuttleSearchBox.js +0 -110
- package/cjs/components/ShuttleSource.js +0 -188
- package/cjs/components/ShuttleTarget.js +0 -116
- package/cjs/components/VirtualizedItem.js +0 -46
- package/cjs/components/VirtualizedList.js +0 -93
- package/cjs/components/VirtualizedSortableList.js +0 -41
- package/cjs/helper.js +0 -117
- package/cjs/index.js +0 -12
- package/cjs/updateShuttleStateFromProps.js +0 -94
- package/cjs/utils.js +0 -43
- package/cjs/withProviders.js +0 -29
- package/esm/DSShuttle.js +0 -213
- package/esm/SearchState.js +0 -35
- package/esm/Shuttle.actions.js +0 -123
- package/esm/ShuttleContainer.js +0 -80
- package/esm/ShuttleImpl.js +0 -304
- package/esm/ShuttleRenderer.js +0 -132
- package/esm/ShuttleState.js +0 -74
- package/esm/animation/animationConfig.js +0 -77
- package/esm/classedComponents.js +0 -51
- package/esm/components/LoadingIndicator.js +0 -18
- package/esm/components/OverflowList.js +0 -46
- package/esm/components/ShuttleBreadcrumb.js +0 -35
- package/esm/components/ShuttleInfiniteScrollIndicator.js +0 -32
- package/esm/components/ShuttleListItem/ActionButtons.js +0 -43
- package/esm/components/ShuttleListItem/ShuttleListItem.js +0 -76
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +0 -68
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +0 -49
- package/esm/components/ShuttleListPanel.js +0 -24
- package/esm/components/ShuttleSearchBox.js +0 -104
- package/esm/components/ShuttleSource.js +0 -179
- package/esm/components/ShuttleTarget.js +0 -107
- package/esm/components/VirtualizedItem.js +0 -40
- package/esm/components/VirtualizedList.js +0 -84
- package/esm/components/VirtualizedSortableList.js +0 -34
- package/esm/helper.js +0 -78
- package/esm/index.js +0 -2
- package/esm/updateShuttleStateFromProps.js +0 -88
- package/esm/utils.js +0 -18
- package/esm/withProviders.js +0 -22
- package/types/ShuttleImpl.d.ts +0 -3
- package/types/index.d.ts +0 -1
- package/types/updateShuttleStateFromProps.d.ts +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
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 ShuttleTargetListItem_exports = {};
|
|
29
|
+
__export(ShuttleTargetListItem_exports, {
|
|
30
|
+
ShuttleTargetListItem: () => ShuttleTargetListItem,
|
|
31
|
+
default: () => ShuttleTargetListItem_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_ActionButtons = require("./ActionButtons");
|
|
36
|
+
var import_ShuttleListItem = require("./ShuttleListItem");
|
|
37
|
+
function ShuttleTargetListItem({
|
|
38
|
+
item = {},
|
|
39
|
+
onMoveToSource = () => null,
|
|
40
|
+
onNavigateOnTargetTo = () => null,
|
|
41
|
+
isRoot = false,
|
|
42
|
+
showDeleteButton = true,
|
|
43
|
+
showDrillDownButton = true,
|
|
44
|
+
showActions = true,
|
|
45
|
+
index,
|
|
46
|
+
...rest
|
|
47
|
+
}) {
|
|
48
|
+
const moveToSource = (0, import_react.useCallback)(() => onMoveToSource(item), [item]);
|
|
49
|
+
const navigateOnTargetTo = (0, import_react.useCallback)(() => onNavigateOnTargetTo(item), [
|
|
50
|
+
item
|
|
51
|
+
]);
|
|
52
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ShuttleListItem.ShuttleListItem, {
|
|
53
|
+
...rest,
|
|
54
|
+
actions: [
|
|
55
|
+
showDrillDownButton && /* @__PURE__ */ import_react.default.createElement(import_ActionButtons.DrillDownButton, {
|
|
56
|
+
key: "drill-down",
|
|
57
|
+
disabled: !item.hasChildren && !item.asyncLoad || item.readOnly || item.disableDrillDown,
|
|
58
|
+
onClick: navigateOnTargetTo
|
|
59
|
+
}),
|
|
60
|
+
showDeleteButton && isRoot && /* @__PURE__ */ import_react.default.createElement(import_ActionButtons.DeleteButton, {
|
|
61
|
+
key: "delete",
|
|
62
|
+
disabled: item.readOnly,
|
|
63
|
+
onClick: moveToSource,
|
|
64
|
+
"data-testid": "ds-shuttle__close-button"
|
|
65
|
+
})
|
|
66
|
+
],
|
|
67
|
+
item,
|
|
68
|
+
showActions
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
var ShuttleTargetListItem_default = ShuttleTargetListItem;
|
|
72
|
+
module.exports = __toCommonJS(ShuttleTargetListItem_exports);
|
|
73
|
+
//# sourceMappingURL=ShuttleTargetListItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/ShuttleListItem/ShuttleTargetListItem.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-underscore-dangle */\nimport React, { useCallback } from 'react';\nimport { DeleteButton, DrillDownButton } from './ActionButtons';\nimport { ShuttleListItem } from './ShuttleListItem';\n\nfunction ShuttleTargetListItem({\n item = {},\n onMoveToSource = () => null,\n onNavigateOnTargetTo = () => null,\n isRoot = false,\n showDeleteButton = true,\n showDrillDownButton = true,\n showActions = true,\n index,\n ...rest\n}) {\n const moveToSource = useCallback(() => onMoveToSource(item), [item]);\n const navigateOnTargetTo = useCallback(() => onNavigateOnTargetTo(item), [\n item,\n ]);\n return (\n <ShuttleListItem\n {...rest}\n actions={[\n showDrillDownButton && (\n <DrillDownButton\n key=\"drill-down\"\n disabled={\n (!item.hasChildren && !item.asyncLoad) ||\n item.readOnly ||\n item.disableDrillDown\n }\n onClick={navigateOnTargetTo}\n />\n ),\n showDeleteButton && isRoot && (\n <DeleteButton\n key=\"delete\"\n disabled={item.readOnly}\n onClick={moveToSource}\n data-testid=\"ds-shuttle__close-button\"\n />\n ),\n ]}\n item={item}\n showActions={showActions}\n />\n );\n}\n\nexport { ShuttleTargetListItem };\nexport default ShuttleTargetListItem;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAmC;AACnC,2BAA8C;AAC9C,6BAAgC;AAEhC,+BAA+B;AAAA,EAC7B,OAAO;AAAA,EACP,iBAAiB,MAAM;AAAA,EACvB,uBAAuB,MAAM;AAAA,EAC7B,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,cAAc;AAAA,EACd;AAAA,KACG;AAAA,GACF;AACD,QAAM,eAAe,8BAAY,MAAM,eAAe,OAAO,CAAC;AAC9D,QAAM,qBAAqB,8BAAY,MAAM,qBAAqB,OAAO;AAAA,IACvE;AAAA;AAEF,SACE,mDAAC,wCAAD;AAAA,OACM;AAAA,IACJ,SAAS;AAAA,MACP,uBACE,mDAAC,sCAAD;AAAA,QACE,KAAI;AAAA,QACJ,UACG,CAAC,KAAK,eAAe,CAAC,KAAK,aAC5B,KAAK,YACL,KAAK;AAAA,QAEP,SAAS;AAAA;AAAA,MAGb,oBAAoB,UAClB,mDAAC,mCAAD;AAAA,QACE,KAAI;AAAA,QACJ,UAAU,KAAK;AAAA,QACf,SAAS;AAAA,QACT,eAAY;AAAA;AAAA;AAAA,IAIlB;AAAA,IACA;AAAA;AAAA;AAMN,IAAO,gCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 ShuttleListPanel_exports = {};
|
|
29
|
+
__export(ShuttleListPanel_exports, {
|
|
30
|
+
ShuttleListPanel: () => ShuttleListPanel,
|
|
31
|
+
default: () => ShuttleListPanel_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_ds_button = require("@elliemae/ds-button");
|
|
36
|
+
var import_classedComponents = require("../classedComponents");
|
|
37
|
+
function ShuttleListPanel({ onClick = () => null, open = false, children }) {
|
|
38
|
+
return /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleListPanel, {
|
|
39
|
+
classProps: { open }
|
|
40
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_button.DSButton, {
|
|
41
|
+
buttonType: "text",
|
|
42
|
+
icon: children,
|
|
43
|
+
onClick,
|
|
44
|
+
"data-testid": "list-panel-btn"
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
var ShuttleListPanel_default = ShuttleListPanel;
|
|
48
|
+
module.exports = __toCommonJS(ShuttleListPanel_exports);
|
|
49
|
+
//# sourceMappingURL=ShuttleListPanel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ShuttleListPanel.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { DSButton } from '@elliemae/ds-button';\nimport { ShuttleListPanel as Wrapper } from '../classedComponents';\n\nfunction ShuttleListPanel({ onClick = () => null, open = false, children }) {\n return (\n <Wrapper classProps={{ open }}>\n <DSButton buttonType=\"text\" icon={children} onClick={onClick} data-testid=\"list-panel-btn\" />\n </Wrapper>\n );\n}\n\nexport { ShuttleListPanel };\nexport default ShuttleListPanel;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,uBAAyB;AACzB,+BAA4C;AAE5C,0BAA0B,EAAE,UAAU,MAAM,MAAM,OAAO,OAAO,YAAY;AAC1E,SACE,mDAAC,2CAAD;AAAA,IAAS,YAAY,EAAE;AAAA,KACrB,mDAAC,2BAAD;AAAA,IAAU,YAAW;AAAA,IAAO,MAAM;AAAA,IAAU;AAAA,IAAkB,eAAY;AAAA;AAAA;AAMhF,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 ShuttleSearchBox_exports = {};
|
|
29
|
+
__export(ShuttleSearchBox_exports, {
|
|
30
|
+
ShuttleSearchBox: () => ShuttleSearchBox,
|
|
31
|
+
default: () => ShuttleSearchBox_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
36
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
37
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
38
|
+
const blockName = "shuttle-search-box";
|
|
39
|
+
const SearchBoxContainer = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, null, ({ isOpen }) => ({ opened: isOpen }));
|
|
40
|
+
const filterList = (0, import_ds_utilities.debounce)((term, onFilterCallback) => {
|
|
41
|
+
onFilterCallback(term);
|
|
42
|
+
}, 200);
|
|
43
|
+
class ShuttleSearchBox extends import_react.Component {
|
|
44
|
+
constructor(props) {
|
|
45
|
+
super(props);
|
|
46
|
+
this.state = {
|
|
47
|
+
value: props.value,
|
|
48
|
+
prevProps: {}
|
|
49
|
+
};
|
|
50
|
+
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
51
|
+
this.handleChange = this.handleChange.bind(this);
|
|
52
|
+
}
|
|
53
|
+
static getDerivedStateFromProps(nextProps, { prevProps }) {
|
|
54
|
+
const { value } = nextProps;
|
|
55
|
+
if (value !== prevProps.value) {
|
|
56
|
+
return {
|
|
57
|
+
value,
|
|
58
|
+
prevProps: { value }
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
handleChange(e) {
|
|
64
|
+
const { onChange, filterOnKeyStroke, onFilter } = this.props;
|
|
65
|
+
const { value } = e.target;
|
|
66
|
+
onChange(value);
|
|
67
|
+
if (filterOnKeyStroke)
|
|
68
|
+
filterList(value, onFilter);
|
|
69
|
+
this.setState({ value });
|
|
70
|
+
}
|
|
71
|
+
handleKeyPress(e) {
|
|
72
|
+
const { onFilter } = this.props;
|
|
73
|
+
if (e.keyCode === 13)
|
|
74
|
+
onFilter(e.target.value);
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
const { value } = this.state;
|
|
78
|
+
const { isOpen, onClose, placeholder } = this.props;
|
|
79
|
+
return /* @__PURE__ */ import_react.default.createElement(SearchBoxContainer, {
|
|
80
|
+
classProps: { isOpen }
|
|
81
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSTextBox, {
|
|
82
|
+
autoFocus: true,
|
|
83
|
+
clearable: true,
|
|
84
|
+
onChange: this.handleChange,
|
|
85
|
+
onClear: onClose,
|
|
86
|
+
onKeyDown: this.handleKeyPress,
|
|
87
|
+
placeholder,
|
|
88
|
+
value
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
ShuttleSearchBox.defaultProps = {
|
|
93
|
+
filterOnKeyStroke: false,
|
|
94
|
+
onChange: () => null,
|
|
95
|
+
onFilter: () => null
|
|
96
|
+
};
|
|
97
|
+
var ShuttleSearchBox_default = ShuttleSearchBox;
|
|
98
|
+
module.exports = __toCommonJS(ShuttleSearchBox_exports);
|
|
99
|
+
//# sourceMappingURL=ShuttleSearchBox.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ShuttleSearchBox.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unused-state */\nimport React, { Component } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { debounce } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '@elliemae/ds-form';\n\nconst blockName = 'shuttle-search-box';\n\nconst SearchBoxContainer = aggregatedClasses('div')(blockName, null, ({ isOpen }) => ({ opened: isOpen }));\n\nconst filterList = debounce((term, onFilterCallback) => {\n onFilterCallback(term);\n}, 200);\n\nclass ShuttleSearchBox extends Component {\n static defaultProps = {\n filterOnKeyStroke: false,\n onChange: () => null,\n onFilter: () => null,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n prevProps: {},\n };\n this.handleKeyPress = this.handleKeyPress.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, { prevProps }) {\n const { value } = nextProps;\n if (value !== prevProps.value) {\n return {\n value,\n prevProps: { value },\n };\n }\n return null;\n }\n\n handleChange(e) {\n const { onChange, filterOnKeyStroke, onFilter } = this.props;\n const { value } = e.target;\n onChange(value);\n if (filterOnKeyStroke) filterList(value, onFilter);\n this.setState({ value });\n }\n\n handleKeyPress(e) {\n const { onFilter } = this.props;\n if (e.keyCode === 13) onFilter(e.target.value);\n }\n\n render() {\n const { value } = this.state;\n const { isOpen, onClose, placeholder } = this.props;\n return (\n <SearchBoxContainer classProps={{ isOpen }}>\n <DSTextBox\n autoFocus\n clearable\n onChange={this.handleChange}\n onClear={onClose}\n onKeyDown={this.handleKeyPress}\n placeholder={placeholder}\n value={value}\n />\n </SearchBoxContainer>\n );\n }\n}\n\nexport { ShuttleSearchBox };\nexport default ShuttleSearchBox;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiC;AACjC,2BAAkC;AAClC,0BAAyB;AACzB,qBAA0B;AAE1B,MAAM,YAAY;AAElB,MAAM,qBAAqB,4CAAkB,OAAO,WAAW,MAAM,CAAC,EAAE,aAAc,GAAE,QAAQ;AAEhG,MAAM,aAAa,kCAAS,CAAC,MAAM,qBAAqB;AACtD,mBAAiB;AAAA,GAChB;AAEH,+BAA+B,uBAAU;AAAA,EAOvC,YAAY,OAAO;AACjB,UAAM;AACN,SAAK,QAAQ;AAAA,MACX,OAAO,MAAM;AAAA,MACb,WAAW;AAAA;AAEb,SAAK,iBAAiB,KAAK,eAAe,KAAK;AAC/C,SAAK,eAAe,KAAK,aAAa,KAAK;AAAA;AAAA,SAGtC,yBAAyB,WAAW,EAAE,aAAa;AACxD,UAAM,EAAE,UAAU;AAClB,QAAI,UAAU,UAAU,OAAO;AAC7B,aAAO;AAAA,QACL;AAAA,QACA,WAAW,EAAE;AAAA;AAAA;AAGjB,WAAO;AAAA;AAAA,EAGT,aAAa,GAAG;AACd,UAAM,EAAE,UAAU,mBAAmB,aAAa,KAAK;AACvD,UAAM,EAAE,UAAU,EAAE;AACpB,aAAS;AACT,QAAI;AAAmB,iBAAW,OAAO;AACzC,SAAK,SAAS,EAAE;AAAA;AAAA,EAGlB,eAAe,GAAG;AAChB,UAAM,EAAE,aAAa,KAAK;AAC1B,QAAI,EAAE,YAAY;AAAI,eAAS,EAAE,OAAO;AAAA;AAAA,EAG1C,SAAS;AACP,UAAM,EAAE,UAAU,KAAK;AACvB,UAAM,EAAE,QAAQ,SAAS,gBAAgB,KAAK;AAC9C,WACE,mDAAC,oBAAD;AAAA,MAAoB,YAAY,EAAE;AAAA,OAChC,mDAAC,0BAAD;AAAA,MACE,WAAS;AAAA,MACT,WAAS;AAAA,MACT,UAAU,KAAK;AAAA,MACf,SAAS;AAAA,MACT,WAAW,KAAK;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA;AApDD,AADT,iBACS,eAAe;AAAA,EACpB,mBAAmB;AAAA,EACnB,UAAU,MAAM;AAAA,EAChB,UAAU,MAAM;AAAA;AAyDpB,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
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 ShuttleSource_exports = {};
|
|
29
|
+
__export(ShuttleSource_exports, {
|
|
30
|
+
ShuttleSource: () => ShuttleSource,
|
|
31
|
+
default: () => ShuttleSource_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_prop_types = __toESM(require("prop-types"));
|
|
36
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
37
|
+
var import_ds_button = require("@elliemae/ds-button");
|
|
38
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
39
|
+
var import_ShuttleSearchBox = require("./ShuttleSearchBox");
|
|
40
|
+
var import_ShuttleInfiniteScrollIndicator = require("./ShuttleInfiniteScrollIndicator");
|
|
41
|
+
var import_ShuttleSourceListItem = require("./ShuttleListItem/ShuttleSourceListItem");
|
|
42
|
+
var import_classedComponents = require("../classedComponents");
|
|
43
|
+
var import_ShuttleListPanel = require("./ShuttleListPanel");
|
|
44
|
+
var import_VirtualizedList = require("./VirtualizedList");
|
|
45
|
+
var import_helper = require("../helper");
|
|
46
|
+
var import_AnimationState = require("../AnimationState");
|
|
47
|
+
var import_SearchState = require("../SearchState");
|
|
48
|
+
var import_VirtualizedSortableList = require("./VirtualizedSortableList");
|
|
49
|
+
var import_LoadingIndicator = require("./LoadingIndicator");
|
|
50
|
+
const noop = () => {
|
|
51
|
+
};
|
|
52
|
+
function ShuttleSource({
|
|
53
|
+
items = [],
|
|
54
|
+
checkedItems = [],
|
|
55
|
+
hierarchy = [],
|
|
56
|
+
onMoveItem = noop,
|
|
57
|
+
onCheckItem = noop,
|
|
58
|
+
onMoveCheckedItems = noop,
|
|
59
|
+
onNavigateTo = noop,
|
|
60
|
+
onClearCheckedItems = noop,
|
|
61
|
+
emptyMessage = "No items found",
|
|
62
|
+
composeSourceItemProps = noop,
|
|
63
|
+
loading = false,
|
|
64
|
+
onSearch = noop,
|
|
65
|
+
onSearchClose = noop,
|
|
66
|
+
onSearchOpen = noop,
|
|
67
|
+
sourceSortable = false,
|
|
68
|
+
onSortEnd = noop,
|
|
69
|
+
sourceClearItemsText = "CLEAR ALL",
|
|
70
|
+
searchPlaceholder,
|
|
71
|
+
renderSourceCounter = (amount) => `${amount} items`,
|
|
72
|
+
onGetMoreItems = () => {
|
|
73
|
+
},
|
|
74
|
+
moreItemsLoading = false,
|
|
75
|
+
hasNextPage = false
|
|
76
|
+
}) {
|
|
77
|
+
const {
|
|
78
|
+
state: { isMovingBack = false, isMoving }
|
|
79
|
+
} = (0, import_react.useContext)(import_AnimationState.AnimationState.Context);
|
|
80
|
+
const {
|
|
81
|
+
state: { searching, searchTerm },
|
|
82
|
+
setSearchTerm,
|
|
83
|
+
reset: resetSearch,
|
|
84
|
+
toggleSearchBox
|
|
85
|
+
} = (0, import_react.useContext)(import_SearchState.SearchState.Context);
|
|
86
|
+
const hashedCheckedItems = (0, import_react.useMemo)(() => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}), [checkedItems]);
|
|
87
|
+
const handleCloseSearch = (0, import_react.useCallback)(() => {
|
|
88
|
+
setSearchTerm("");
|
|
89
|
+
(0, import_ds_utilities.runAll)(resetSearch, onSearchClose)();
|
|
90
|
+
}, [searching]);
|
|
91
|
+
const handleToggleSearch = (0, import_react.useCallback)(() => {
|
|
92
|
+
toggleSearchBox(!searching);
|
|
93
|
+
if (searching) {
|
|
94
|
+
handleCloseSearch();
|
|
95
|
+
} else {
|
|
96
|
+
onSearchOpen();
|
|
97
|
+
}
|
|
98
|
+
}, [searching]);
|
|
99
|
+
const ComponentList = (0, import_react.useMemo)(() => sourceSortable ? import_VirtualizedSortableList.VirtualizedSortableList : import_VirtualizedList.VirtualizedList, [sourceSortable]);
|
|
100
|
+
const handleSortEnd = ({ oldIndex, newIndex }) => {
|
|
101
|
+
onSortEnd({
|
|
102
|
+
sourceItem: items[oldIndex],
|
|
103
|
+
targetItem: items[newIndex]
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const isEmpty = !items.length;
|
|
107
|
+
const hasContent = !loading && !isEmpty;
|
|
108
|
+
const contentIsEmpty = !loading && isEmpty;
|
|
109
|
+
return /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleWrapper, null, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleHeader, null, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleHeaderBreadcrumb, {
|
|
110
|
+
hierarchy,
|
|
111
|
+
onNavigateTo
|
|
112
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleHeaderSearchToggle, {
|
|
113
|
+
buttonType: "text",
|
|
114
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.Search, null),
|
|
115
|
+
onClick: handleToggleSearch,
|
|
116
|
+
containerProps: { "data-testid": "shuttle-header-search-toggle" }
|
|
117
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleList, {
|
|
118
|
+
classProps: { showPulse: isMovingBack },
|
|
119
|
+
style: { pointerEvents: isMoving ? "none" : null }
|
|
120
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ShuttleSearchBox.ShuttleSearchBox, {
|
|
121
|
+
key: searching,
|
|
122
|
+
isOpen: searching,
|
|
123
|
+
onClose: (0, import_ds_utilities.runAll)(() => toggleSearchBox(false), handleCloseSearch),
|
|
124
|
+
onFilter: (0, import_ds_utilities.runAll)(setSearchTerm, onSearch),
|
|
125
|
+
placeholder: searchPlaceholder,
|
|
126
|
+
value: searchTerm
|
|
127
|
+
}), hasContent ? /* @__PURE__ */ import_react.default.createElement(import_classedComponents.Overflow, {
|
|
128
|
+
activeHierarchy: (0, import_helper.getActiveIdFromHierarchy)(hierarchy).id,
|
|
129
|
+
classProps: {
|
|
130
|
+
searching,
|
|
131
|
+
empty: isEmpty
|
|
132
|
+
}
|
|
133
|
+
}, /* @__PURE__ */ import_react.default.createElement(ComponentList, {
|
|
134
|
+
key: searchTerm,
|
|
135
|
+
helperClass: "drag-helper",
|
|
136
|
+
itemRenderer: ({ item, ...rest }) => /* @__PURE__ */ import_react.default.createElement(import_ShuttleSourceListItem.ShuttleSourceListItem, {
|
|
137
|
+
"data-testid": "source-list-item",
|
|
138
|
+
...rest,
|
|
139
|
+
...composeSourceItemProps(item, rest),
|
|
140
|
+
isChecked: !!hashedCheckedItems[item.id],
|
|
141
|
+
item,
|
|
142
|
+
onItemCheck: onCheckItem,
|
|
143
|
+
onMoveToTarget: onMoveItem,
|
|
144
|
+
onNavigateOnSourceTo: onNavigateTo,
|
|
145
|
+
showSortHandler: sourceSortable
|
|
146
|
+
}),
|
|
147
|
+
items,
|
|
148
|
+
onSortEnd: handleSortEnd,
|
|
149
|
+
getMoreItems: onGetMoreItems,
|
|
150
|
+
hasNextPage
|
|
151
|
+
})) : null, contentIsEmpty ? /* @__PURE__ */ import_react.default.createElement(import_classedComponents.LoadingList, {
|
|
152
|
+
"data-testid": "shuttle__loading-list"
|
|
153
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.EmptyMessage, null, emptyMessage)) : null, loading ? /* @__PURE__ */ import_react.default.createElement(import_classedComponents.LoadingList, {
|
|
154
|
+
"data-testid": "shuttle__loading-list"
|
|
155
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_LoadingIndicator.LoadingIndicator, null)) : null, /* @__PURE__ */ import_react.default.createElement(import_ShuttleListPanel.ShuttleListPanel, {
|
|
156
|
+
onClick: onMoveCheckedItems,
|
|
157
|
+
open: checkedItems.length > 1
|
|
158
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ArrowShortRight, null)), moreItemsLoading ? /* @__PURE__ */ import_react.default.createElement(import_ShuttleInfiniteScrollIndicator.ShuttleInfiniteScrollIndicator, {
|
|
159
|
+
isOpen: true
|
|
160
|
+
}) : null), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleFooter, null, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleFooterActions, null, !!checkedItems.length && /* @__PURE__ */ import_react.default.createElement(import_ds_button.DSButton, {
|
|
161
|
+
buttonType: "link",
|
|
162
|
+
labelText: sourceClearItemsText,
|
|
163
|
+
onClick: onClearCheckedItems
|
|
164
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleFooterCounter, null, renderSourceCounter(checkedItems.length))));
|
|
165
|
+
}
|
|
166
|
+
ShuttleSource.propTypes = {
|
|
167
|
+
items: import_prop_types.default.arrayOf(import_prop_types.default.shape({})),
|
|
168
|
+
checkedItems: import_prop_types.default.arrayOf(import_prop_types.default.shape({})),
|
|
169
|
+
hierarchy: import_prop_types.default.arrayOf(import_prop_types.default.shape({})),
|
|
170
|
+
onMoveItem: import_prop_types.default.func,
|
|
171
|
+
onCheckItem: import_prop_types.default.func,
|
|
172
|
+
onMoveCheckedItems: import_prop_types.default.func,
|
|
173
|
+
onNavigateTo: import_prop_types.default.func,
|
|
174
|
+
onClearCheckedItems: import_prop_types.default.func,
|
|
175
|
+
emptyMessage: import_prop_types.default.string,
|
|
176
|
+
composeSourceItemProps: import_prop_types.default.func,
|
|
177
|
+
loading: import_prop_types.default.bool,
|
|
178
|
+
onSearch: import_prop_types.default.func,
|
|
179
|
+
onSearchClose: import_prop_types.default.func,
|
|
180
|
+
onSearchOpen: import_prop_types.default.func,
|
|
181
|
+
sourceSortable: import_prop_types.default.bool,
|
|
182
|
+
onSortEnd: import_prop_types.default.func,
|
|
183
|
+
sourceClearItemsText: import_prop_types.default.string,
|
|
184
|
+
searchPlaceholder: import_prop_types.default.string,
|
|
185
|
+
renderSourceCounter: import_prop_types.default.func,
|
|
186
|
+
onGetMoreItems: import_prop_types.default.func,
|
|
187
|
+
moreItemsLoading: import_prop_types.default.bool,
|
|
188
|
+
hasNextPage: import_prop_types.default.bool
|
|
189
|
+
};
|
|
190
|
+
var ShuttleSource_default = ShuttleSource;
|
|
191
|
+
module.exports = __toCommonJS(ShuttleSource_exports);
|
|
192
|
+
//# sourceMappingURL=ShuttleSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ShuttleSource.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable no-shadow */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { ArrowShortRight, Search } from '@elliemae/ds-icons';\nimport { DSButton } from '@elliemae/ds-button';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { ShuttleSearchBox } from './ShuttleSearchBox';\nimport { ShuttleInfiniteScrollIndicator } from './ShuttleInfiniteScrollIndicator';\nimport { ShuttleSourceListItem } from './ShuttleListItem/ShuttleSourceListItem';\nimport {\n ShuttleFooterCounter,\n Overflow,\n ShuttleFooter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleHeaderSearchToggle,\n ShuttleList,\n ShuttleWrapper,\n ShuttleFooterActions,\n EmptyMessage,\n LoadingList,\n} from '../classedComponents';\nimport { ShuttleListPanel } from './ShuttleListPanel';\nimport { VirtualizedList } from './VirtualizedList';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { SearchState } from '../SearchState';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleSource({\n items = [],\n checkedItems = [], // build Map() and memoize it for better performance\n hierarchy = [],\n onMoveItem = noop,\n onCheckItem = noop,\n onMoveCheckedItems = noop,\n onNavigateTo = noop,\n onClearCheckedItems = noop,\n emptyMessage = 'No items found',\n composeSourceItemProps = noop,\n loading = false,\n onSearch = noop,\n onSearchClose = noop,\n onSearchOpen = noop,\n sourceSortable = false,\n onSortEnd = noop,\n sourceClearItemsText = 'CLEAR ALL',\n searchPlaceholder,\n renderSourceCounter = (amount) => `${amount} items`,\n onGetMoreItems = () => {},\n moreItemsLoading = false,\n hasNextPage = false,\n}) {\n const {\n state: { isMovingBack = false, isMoving },\n } = useContext(AnimationState.Context);\n const {\n state: { searching, searchTerm },\n setSearchTerm,\n reset: resetSearch,\n toggleSearchBox,\n } = useContext(SearchState.Context);\n\n const hashedCheckedItems = useMemo(\n () => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}),\n [checkedItems],\n );\n\n const handleCloseSearch = useCallback(() => {\n setSearchTerm('');\n runAll(resetSearch, onSearchClose)();\n }, [searching]);\n\n const handleToggleSearch = useCallback(() => {\n toggleSearchBox(!searching);\n if (searching) {\n handleCloseSearch();\n } else {\n onSearchOpen();\n }\n }, [searching]);\n\n const ComponentList = useMemo(() => (sourceSortable ? VirtualizedSortableList : VirtualizedList), [sourceSortable]);\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n const isEmpty = !items.length;\n const hasContent = !loading && !isEmpty;\n const contentIsEmpty = !loading && isEmpty;\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n <ShuttleHeaderSearchToggle\n buttonType=\"text\"\n icon={<Search />}\n onClick={handleToggleSearch}\n containerProps={{ 'data-testid': 'shuttle-header-search-toggle' }}\n />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMovingBack }} style={{ pointerEvents: isMoving ? 'none' : null }}>\n <ShuttleSearchBox\n key={searching}\n isOpen={searching}\n onClose={runAll(() => toggleSearchBox(false), handleCloseSearch)}\n onFilter={runAll(setSearchTerm, onSearch)}\n placeholder={searchPlaceholder}\n value={searchTerm}\n />\n {hasContent ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n searching,\n empty: isEmpty,\n }}\n >\n <ComponentList\n key={searchTerm}\n helperClass=\"drag-helper\"\n itemRenderer={({ item, ...rest }) => (\n <ShuttleSourceListItem\n data-testid=\"source-list-item\"\n {...rest}\n {...composeSourceItemProps(item, rest)}\n isChecked={!!hashedCheckedItems[item.id]}\n item={item}\n onItemCheck={onCheckItem}\n onMoveToTarget={onMoveItem}\n onNavigateOnSourceTo={onNavigateTo}\n showSortHandler={sourceSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n getMoreItems={onGetMoreItems}\n hasNextPage={hasNextPage}\n />\n </Overflow>\n ) : null}\n {contentIsEmpty ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <EmptyMessage>{emptyMessage}</EmptyMessage>\n </LoadingList>\n ) : null}\n {loading ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <LoadingIndicator />\n </LoadingList>\n ) : null}\n <ShuttleListPanel onClick={onMoveCheckedItems} open={checkedItems.length > 1}>\n <ArrowShortRight />\n </ShuttleListPanel>\n {moreItemsLoading ? <ShuttleInfiniteScrollIndicator isOpen /> : null}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!checkedItems.length && (\n <DSButton buttonType=\"link\" labelText={sourceClearItemsText} onClick={onClearCheckedItems} />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderSourceCounter(checkedItems.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nShuttleSource.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})),\n checkedItems: PropTypes.arrayOf(PropTypes.shape({})),\n hierarchy: PropTypes.arrayOf(PropTypes.shape({})),\n onMoveItem: PropTypes.func,\n onCheckItem: PropTypes.func,\n onMoveCheckedItems: PropTypes.func,\n onNavigateTo: PropTypes.func,\n onClearCheckedItems: PropTypes.func,\n emptyMessage: PropTypes.string,\n composeSourceItemProps: PropTypes.func,\n loading: PropTypes.bool,\n onSearch: PropTypes.func,\n onSearchClose: PropTypes.func,\n onSearchOpen: PropTypes.func,\n sourceSortable: PropTypes.bool,\n onSortEnd: PropTypes.func,\n sourceClearItemsText: PropTypes.string,\n searchPlaceholder: PropTypes.string,\n renderSourceCounter: PropTypes.func,\n onGetMoreItems: PropTypes.func,\n moreItemsLoading: PropTypes.bool,\n hasNextPage: PropTypes.bool,\n};\n\nexport { ShuttleSource };\nexport default ShuttleSource;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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 ShuttleTarget_exports = {};
|
|
29
|
+
__export(ShuttleTarget_exports, {
|
|
30
|
+
ShuttleTarget: () => ShuttleTarget,
|
|
31
|
+
default: () => ShuttleTarget_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_ds_button = require("@elliemae/ds-button");
|
|
36
|
+
var import_classedComponents = require("../classedComponents");
|
|
37
|
+
var import_helper = require("../helper");
|
|
38
|
+
var import_AnimationState = require("../AnimationState");
|
|
39
|
+
var import_VirtualizedList = require("./VirtualizedList");
|
|
40
|
+
var import_ShuttleTargetListItem = require("./ShuttleListItem/ShuttleTargetListItem");
|
|
41
|
+
var import_VirtualizedSortableList = require("./VirtualizedSortableList");
|
|
42
|
+
var import_LoadingIndicator = require("./LoadingIndicator");
|
|
43
|
+
const noop = () => {
|
|
44
|
+
};
|
|
45
|
+
function ShuttleTarget({
|
|
46
|
+
items = [],
|
|
47
|
+
hierarchy = [],
|
|
48
|
+
onNavigateTo = noop,
|
|
49
|
+
onMoveItem = noop,
|
|
50
|
+
onClearMovedItems = noop,
|
|
51
|
+
emptyMessage = "No items selected",
|
|
52
|
+
composeTargetItemProps = () => ({}),
|
|
53
|
+
targetSortable = false,
|
|
54
|
+
onSortEnd = noop,
|
|
55
|
+
targetClearItemsText = "CLEAR ALL",
|
|
56
|
+
renderTargetCounter = (amount) => `${amount} items`,
|
|
57
|
+
loading = false
|
|
58
|
+
}) {
|
|
59
|
+
const {
|
|
60
|
+
state: { isMoving = false }
|
|
61
|
+
} = (0, import_react.useContext)(import_AnimationState.AnimationState.Context);
|
|
62
|
+
const isEmpty = !items.length;
|
|
63
|
+
const emptyContent = loading ? /* @__PURE__ */ import_react.default.createElement(import_LoadingIndicator.LoadingIndicator, null) : /* @__PURE__ */ import_react.default.createElement(import_classedComponents.EmptyMessage, null, emptyMessage);
|
|
64
|
+
const ComponentList = targetSortable ? import_VirtualizedSortableList.VirtualizedSortableList : import_VirtualizedList.VirtualizedList;
|
|
65
|
+
const handleSortEnd = ({ oldIndex, newIndex }) => {
|
|
66
|
+
onSortEnd({
|
|
67
|
+
sourceItem: items[oldIndex],
|
|
68
|
+
targetItem: items[newIndex]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleWrapper, null, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleHeader, null, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleHeaderBreadcrumb, {
|
|
72
|
+
hierarchy,
|
|
73
|
+
onNavigateTo
|
|
74
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleList, {
|
|
75
|
+
classProps: { showPulse: isMoving }
|
|
76
|
+
}, !loading && !isEmpty ? /* @__PURE__ */ import_react.default.createElement(import_classedComponents.Overflow, {
|
|
77
|
+
activeHierarchy: (0, import_helper.getActiveIdFromHierarchy)(hierarchy).id,
|
|
78
|
+
classProps: {
|
|
79
|
+
empty: !items.length
|
|
80
|
+
}
|
|
81
|
+
}, /* @__PURE__ */ import_react.default.createElement(ComponentList, {
|
|
82
|
+
itemRenderer: ({ item, ...rest }) => /* @__PURE__ */ import_react.default.createElement(import_ShuttleTargetListItem.ShuttleTargetListItem, {
|
|
83
|
+
"data-testid": "target-list-item",
|
|
84
|
+
...rest,
|
|
85
|
+
...composeTargetItemProps(item, rest),
|
|
86
|
+
isRoot: !(0, import_helper.getActiveIdFromHierarchy)(hierarchy).id,
|
|
87
|
+
item,
|
|
88
|
+
onMoveToSource: onMoveItem,
|
|
89
|
+
onNavigateOnTargetTo: onNavigateTo,
|
|
90
|
+
showSortHandler: targetSortable
|
|
91
|
+
}),
|
|
92
|
+
items,
|
|
93
|
+
onSortEnd: handleSortEnd,
|
|
94
|
+
target: true
|
|
95
|
+
})) : /* @__PURE__ */ import_react.default.createElement(import_classedComponents.LoadingList, null, emptyContent)), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleFooter, null, /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleFooterActions, null, !!items.length && /* @__PURE__ */ import_react.default.createElement(import_ds_button.DSButton, {
|
|
96
|
+
containerProps: { "data-testid": "shuttle-clear-all-target" },
|
|
97
|
+
buttonType: "link",
|
|
98
|
+
labelText: targetClearItemsText,
|
|
99
|
+
onClick: onClearMovedItems
|
|
100
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_classedComponents.ShuttleFooterCounter, null, renderTargetCounter(items.length))));
|
|
101
|
+
}
|
|
102
|
+
var ShuttleTarget_default = ShuttleTarget;
|
|
103
|
+
module.exports = __toCommonJS(ShuttleTarget_exports);
|
|
104
|
+
//# sourceMappingURL=ShuttleTarget.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ShuttleTarget.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSButton } from '@elliemae/ds-button';\n\nimport {\n EmptyMessage,\n Overflow,\n ShuttleFooter,\n ShuttleFooterActions,\n ShuttleFooterCounter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleList,\n ShuttleWrapper,\n LoadingList,\n} from '../classedComponents';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { VirtualizedList } from './VirtualizedList';\nimport { ShuttleTargetListItem } from './ShuttleListItem/ShuttleTargetListItem';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleTarget({\n items = [],\n hierarchy = [],\n onNavigateTo = noop,\n onMoveItem = noop,\n onClearMovedItems = noop,\n emptyMessage = 'No items selected',\n composeTargetItemProps = () => ({}),\n targetSortable = false,\n onSortEnd = noop,\n targetClearItemsText = 'CLEAR ALL',\n renderTargetCounter = (amount) => `${amount} items`,\n loading = false,\n}) {\n const {\n state: { isMoving = false },\n } = useContext(AnimationState.Context);\n const isEmpty = !items.length;\n const emptyContent = loading ? <LoadingIndicator /> : <EmptyMessage>{emptyMessage}</EmptyMessage>;\n\n const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMoving }}>\n {!loading && !isEmpty ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n empty: !items.length,\n }}\n >\n <ComponentList\n itemRenderer={({ item, ...rest }) => (\n <ShuttleTargetListItem\n data-testid=\"target-list-item\"\n {...rest}\n {...composeTargetItemProps(item, rest)}\n isRoot={!getActiveIdFromHierarchy(hierarchy).id}\n item={item}\n onMoveToSource={onMoveItem}\n onNavigateOnTargetTo={onNavigateTo}\n showSortHandler={targetSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n target\n />\n </Overflow>\n ) : (\n <LoadingList>{emptyContent}</LoadingList>\n )}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!items.length && (\n <DSButton\n containerProps={{ 'data-testid': 'shuttle-clear-all-target' }}\n buttonType=\"link\"\n labelText={targetClearItemsText}\n onClick={onClearMovedItems}\n />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderTargetCounter(items.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nexport { ShuttleTarget };\nexport default ShuttleTarget;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,uBAAyB;AAEzB,+BAWO;AACP,oBAAyC;AACzC,4BAA+B;AAC/B,6BAAgC;AAChC,mCAAsC;AACtC,qCAAwC;AACxC,8BAAiC;AAEjC,MAAM,OAAO,MAAM;AAAA;AAEnB,uBAAuB;AAAA,EACrB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,yBAAyB,MAAO;AAAA,EAChC,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,uBAAuB;AAAA,EACvB,sBAAsB,CAAC,WAAW,GAAG;AAAA,EACrC,UAAU;AAAA,GACT;AACD,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW;AAAA,MAClB,6BAAW,qCAAe;AAC9B,QAAM,UAAU,CAAC,MAAM;AACvB,QAAM,eAAe,UAAU,mDAAC,0CAAD,QAAuB,mDAAC,uCAAD,MAAe;AAErE,QAAM,gBAAgB,iBAAiB,yDAA0B;AAEjE,QAAM,gBAAgB,CAAC,EAAE,UAAU,eAAe;AAChD,cAAU;AAAA,MACR,YAAY,MAAM;AAAA,MAClB,YAAY,MAAM;AAAA;AAAA;AAItB,SACE,mDAAC,yCAAD,MACE,mDAAC,wCAAD,MACE,mDAAC,kDAAD;AAAA,IAAyB;AAAA,IAAsB;AAAA,OAEjD,mDAAC,sCAAD;AAAA,IAAa,YAAY,EAAE,WAAW;AAAA,KACnC,CAAC,WAAW,CAAC,UACZ,mDAAC,mCAAD;AAAA,IACE,iBAAiB,4CAAyB,WAAW;AAAA,IACrD,YAAY;AAAA,MACV,OAAO,CAAC,MAAM;AAAA;AAAA,KAGhB,mDAAC,eAAD;AAAA,IACE,cAAc,CAAC,EAAE,SAAS,WACxB,mDAAC,oDAAD;AAAA,MACE,eAAY;AAAA,SACR;AAAA,SACA,uBAAuB,MAAM;AAAA,MACjC,QAAQ,CAAC,4CAAyB,WAAW;AAAA,MAC7C;AAAA,MACA,gBAAgB;AAAA,MAChB,sBAAsB;AAAA,MACtB,iBAAiB;AAAA;AAAA,IAGrB;AAAA,IACA,WAAW;AAAA,IACX,QAAM;AAAA,QAIV,mDAAC,sCAAD,MAAc,gBAGlB,mDAAC,wCAAD,MACE,mDAAC,+CAAD,MACG,CAAC,CAAC,MAAM,UACP,mDAAC,2BAAD;AAAA,IACE,gBAAgB,EAAE,eAAe;AAAA,IACjC,YAAW;AAAA,IACX,WAAW;AAAA,IACX,SAAS;AAAA,OAIf,mDAAC,+CAAD,MAAuB,oBAAoB,MAAM;AAAA;AAOzD,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|