@elliemae/ds-treeview 2.2.0 → 2.3.0-alpha.3
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/cjs/TreeView.js +47 -31
- package/cjs/TreeView.js.map +7 -0
- package/cjs/TreeViewContext.js +55 -43
- package/cjs/TreeViewContext.js.map +7 -0
- package/cjs/config/cssClassesConstants.js +41 -13
- package/cjs/config/cssClassesConstants.js.map +7 -0
- package/cjs/config/useTreeview.js +102 -88
- package/cjs/config/useTreeview.js.map +7 -0
- package/cjs/hoc/DnDTreeContext.js +45 -0
- package/cjs/hoc/DnDTreeContext.js.map +7 -0
- package/cjs/hoc/SortableItemContext.js +46 -0
- package/cjs/hoc/SortableItemContext.js.map +7 -0
- package/cjs/hoc/WithConditionalDnDContext.js +128 -0
- package/cjs/hoc/WithConditionalDnDContext.js.map +7 -0
- package/cjs/hoc/WithDnDSortableItemContext.js +69 -0
- package/cjs/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/cjs/index.js +37 -27
- package/cjs/index.js.map +7 -0
- package/cjs/parts/CheckboxSelectable.js +70 -59
- package/cjs/parts/CheckboxSelectable.js.map +7 -0
- package/cjs/parts/ChildrenCountDisplayer.js +45 -28
- package/cjs/parts/ChildrenCountDisplayer.js.map +7 -0
- package/cjs/parts/DnDHandle.js +57 -0
- package/cjs/parts/DnDHandle.js.map +7 -0
- package/cjs/parts/DropIndicator.js +80 -0
- package/cjs/parts/DropIndicator.js.map +7 -0
- package/cjs/parts/ExpandCaret.js +85 -83
- package/cjs/parts/ExpandCaret.js.map +7 -0
- package/cjs/parts/Icon.js +46 -31
- package/cjs/parts/Icon.js.map +7 -0
- package/cjs/parts/NestingSpace.js +43 -35
- package/cjs/parts/NestingSpace.js.map +7 -0
- package/cjs/parts/RadioSelectable.js +52 -37
- package/cjs/parts/RadioSelectable.js.map +7 -0
- package/cjs/parts/TreeItem.js +121 -165
- package/cjs/parts/TreeItem.js.map +7 -0
- package/cjs/parts/TreeItemText.js +88 -95
- package/cjs/parts/TreeItemText.js.map +7 -0
- package/cjs/parts/TreeList.js +114 -132
- package/cjs/parts/TreeList.js.map +7 -0
- package/cjs/plugins/dnd/TreeDndPlugin.js +34 -43
- package/cjs/plugins/dnd/TreeDndPlugin.js.map +7 -0
- package/cjs/plugins/dnd/index.js +28 -10
- package/cjs/plugins/dnd/index.js.map +7 -0
- package/cjs/plugins/index.js +34 -22
- package/cjs/plugins/index.js.map +7 -0
- package/cjs/plugins/roving/TreeRovingPlugin.js +35 -7
- package/cjs/plugins/roving/TreeRovingPlugin.js.map +7 -0
- package/cjs/plugins/roving/index.js +28 -9
- package/cjs/plugins/roving/index.js.map +7 -0
- package/cjs/plugins/searchable/SearchableTreePlugin.js +35 -7
- package/cjs/plugins/searchable/SearchableTreePlugin.js.map +7 -0
- package/cjs/plugins/searchable/index.js +28 -9
- package/cjs/plugins/searchable/index.js.map +7 -0
- package/cjs/plugins/selectable/SelectablePluginTree.js +35 -7
- package/cjs/plugins/selectable/SelectablePluginTree.js.map +7 -0
- package/cjs/plugins/selectable/index.js +28 -9
- package/cjs/plugins/selectable/index.js.map +7 -0
- package/cjs/plugins/toolbar/TreeToolbarPlugin.js +35 -7
- package/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
- package/cjs/plugins/toolbar/index.js +28 -9
- package/cjs/plugins/toolbar/index.js.map +7 -0
- package/cjs/plugins/tree/TreeDataPlugin.js +35 -7
- package/cjs/plugins/tree/TreeDataPlugin.js.map +7 -0
- package/cjs/plugins/tree/index.js +28 -9
- package/cjs/plugins/tree/index.js.map +7 -0
- package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +35 -7
- package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
- package/cjs/plugins/virtualization/index.js +28 -9
- package/cjs/plugins/virtualization/index.js.map +7 -0
- package/cjs/react-desc-prop-types.js +83 -53
- package/cjs/react-desc-prop-types.js.map +7 -0
- package/cjs/related-components/TreeViewSearchBar.js +42 -40
- package/cjs/related-components/TreeViewSearchBar.js.map +7 -0
- package/cjs/sharedTypes.js +27 -2
- package/cjs/sharedTypes.js.map +7 -0
- package/cjs/utils/array-helpers.js +35 -11
- package/cjs/utils/array-helpers.js.map +7 -0
- package/cjs/utils/group-expands-helpers.js +86 -59
- package/cjs/utils/group-expands-helpers.js.map +7 -0
- package/cjs/utils/keyboard-helpers.js +86 -90
- package/cjs/utils/keyboard-helpers.js.map +7 -0
- package/cjs/utils/object-helpers.js +43 -36
- package/cjs/utils/object-helpers.js.map +7 -0
- package/cjs/utils/refs-helpers.js +43 -22
- package/cjs/utils/refs-helpers.js.map +7 -0
- package/cjs/utils/selectable-helper.js +61 -53
- package/cjs/utils/selectable-helper.js.map +7 -0
- package/cjs/utils/string-helpers.js +35 -7
- package/cjs/utils/string-helpers.js.map +7 -0
- package/cjs/utils/tree-helpers.js +125 -135
- package/cjs/utils/tree-helpers.js.map +7 -0
- package/cjs/utils/useInstanceRefActions.js +54 -43
- package/cjs/utils/useInstanceRefActions.js.map +7 -0
- package/cjs/utils/useTree.js +78 -78
- package/cjs/utils/useTree.js.map +7 -0
- package/esm/TreeView.js +16 -20
- package/esm/TreeView.js.map +7 -0
- package/esm/TreeViewContext.js +26 -37
- package/esm/TreeViewContext.js.map +7 -0
- package/esm/config/cssClassesConstants.js +12 -6
- package/esm/config/cssClassesConstants.js.map +7 -0
- package/esm/config/useTreeview.js +59 -66
- package/esm/config/useTreeview.js.map +7 -0
- package/esm/hoc/DnDTreeContext.js +16 -0
- package/esm/hoc/DnDTreeContext.js.map +7 -0
- package/esm/hoc/SortableItemContext.js +17 -0
- package/esm/hoc/SortableItemContext.js.map +7 -0
- package/esm/hoc/WithConditionalDnDContext.js +99 -0
- package/esm/hoc/WithConditionalDnDContext.js.map +7 -0
- package/esm/hoc/WithDnDSortableItemContext.js +40 -0
- package/esm/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/esm/index.js +8 -9
- package/esm/index.js.map +7 -0
- package/esm/parts/CheckboxSelectable.js +36 -46
- package/esm/parts/CheckboxSelectable.js.map +7 -0
- package/esm/parts/ChildrenCountDisplayer.js +16 -20
- package/esm/parts/ChildrenCountDisplayer.js.map +7 -0
- package/esm/parts/DnDHandle.js +28 -0
- package/esm/parts/DnDHandle.js.map +7 -0
- package/esm/parts/DropIndicator.js +51 -0
- package/esm/parts/DropIndicator.js.map +7 -0
- package/esm/parts/ExpandCaret.js +54 -72
- package/esm/parts/ExpandCaret.js.map +7 -0
- package/esm/parts/Icon.js +16 -22
- package/esm/parts/Icon.js.map +7 -0
- package/esm/parts/NestingSpace.js +14 -27
- package/esm/parts/NestingSpace.js.map +7 -0
- package/esm/parts/RadioSelectable.js +20 -28
- package/esm/parts/RadioSelectable.js.map +7 -0
- package/esm/parts/TreeItem.js +89 -150
- package/esm/parts/TreeItem.js.map +7 -0
- package/esm/parts/TreeItemText.js +58 -85
- package/esm/parts/TreeItemText.js.map +7 -0
- package/esm/parts/TreeList.js +86 -120
- package/esm/parts/TreeList.js.map +7 -0
- package/esm/plugins/dnd/TreeDndPlugin.js +5 -34
- package/esm/plugins/dnd/TreeDndPlugin.js.map +7 -0
- package/esm/plugins/dnd/index.js +3 -1
- package/esm/plugins/dnd/index.js.map +7 -0
- package/esm/plugins/index.js +9 -7
- package/esm/plugins/index.js.map +7 -0
- package/esm/plugins/roving/TreeRovingPlugin.js +6 -3
- package/esm/plugins/roving/TreeRovingPlugin.js.map +7 -0
- package/esm/plugins/roving/index.js +3 -1
- package/esm/plugins/roving/index.js.map +7 -0
- package/esm/plugins/searchable/SearchableTreePlugin.js +6 -3
- package/esm/plugins/searchable/SearchableTreePlugin.js.map +7 -0
- package/esm/plugins/searchable/index.js +3 -1
- package/esm/plugins/searchable/index.js.map +7 -0
- package/esm/plugins/selectable/SelectablePluginTree.js +6 -3
- package/esm/plugins/selectable/SelectablePluginTree.js.map +7 -0
- package/esm/plugins/selectable/index.js +3 -1
- package/esm/plugins/selectable/index.js.map +7 -0
- package/esm/plugins/toolbar/TreeToolbarPlugin.js +6 -3
- package/esm/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
- package/esm/plugins/toolbar/index.js +3 -1
- package/esm/plugins/toolbar/index.js.map +7 -0
- package/esm/plugins/tree/TreeDataPlugin.js +6 -3
- package/esm/plugins/tree/TreeDataPlugin.js.map +7 -0
- package/esm/plugins/tree/index.js +3 -1
- package/esm/plugins/tree/index.js.map +7 -0
- package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +6 -3
- package/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
- package/esm/plugins/virtualization/index.js +3 -1
- package/esm/plugins/virtualization/index.js.map +7 -0
- package/esm/react-desc-prop-types.js +48 -43
- package/esm/react-desc-prop-types.js.map +7 -0
- package/esm/related-components/TreeViewSearchBar.js +13 -32
- package/esm/related-components/TreeViewSearchBar.js.map +7 -0
- package/esm/sharedTypes.js +2 -1
- package/esm/sharedTypes.js.map +7 -0
- package/esm/utils/array-helpers.js +6 -6
- package/esm/utils/array-helpers.js.map +7 -0
- package/esm/utils/group-expands-helpers.js +56 -46
- package/esm/utils/group-expands-helpers.js.map +7 -0
- package/esm/utils/keyboard-helpers.js +47 -74
- package/esm/utils/keyboard-helpers.js.map +7 -0
- package/esm/utils/object-helpers.js +14 -31
- package/esm/utils/object-helpers.js.map +7 -0
- package/esm/utils/refs-helpers.js +15 -19
- package/esm/utils/refs-helpers.js.map +7 -0
- package/esm/utils/selectable-helper.js +32 -43
- package/esm/utils/selectable-helper.js.map +7 -0
- package/esm/utils/string-helpers.js +6 -3
- package/esm/utils/string-helpers.js.map +7 -0
- package/esm/utils/tree-helpers.js +94 -119
- package/esm/utils/tree-helpers.js.map +7 -0
- package/esm/utils/useInstanceRefActions.js +21 -35
- package/esm/utils/useInstanceRefActions.js.map +7 -0
- package/esm/utils/useTree.js +37 -57
- package/esm/utils/useTree.js.map +7 -0
- package/package.json +34 -18
- package/types/hoc/DnDTreeContext.d.ts +14 -0
- package/types/hoc/SortableItemContext.d.ts +19 -0
- package/types/hoc/WithConditionalDnDContext.d.ts +4 -0
- package/types/hoc/WithDnDSortableItemContext.d.ts +4 -0
- package/types/parts/DnDHandle.d.ts +6 -0
- package/types/parts/DropIndicator.d.ts +10 -0
- package/types/parts/TreeItem.d.ts +4 -11
- package/types/parts/TreeList.d.ts +0 -4
- package/types/plugins/dnd/TreeDndPlugin.d.ts +0 -2
- package/types/react-desc-prop-types.d.ts +17 -3
- package/types/sharedTypes.d.ts +1 -8
- package/types/utils/keyboard-helpers.d.ts +2 -1
- package/types/utils/refs-helpers.d.ts +1 -1
- package/types/utils/tree-helpers.d.ts +4 -1
- package/types/utils/useTree.d.ts +1 -0
- package/cjs/utils/dnd-helpers.js +0 -140
- package/cjs/utils/useDnDHelpers.js +0 -220
- package/esm/utils/dnd-helpers.js +0 -132
- package/esm/utils/useDnDHelpers.js +0 -216
- package/types/utils/dnd-helpers.d.ts +0 -39
- package/types/utils/useDnDHelpers.d.ts +0 -26
|
@@ -0,0 +1,57 @@
|
|
|
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 DnDHandle_exports = {};
|
|
29
|
+
__export(DnDHandle_exports, {
|
|
30
|
+
DnDHandle: () => DnDHandle
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
35
|
+
var import_SortableItemContext = require("../hoc/SortableItemContext");
|
|
36
|
+
const DnDHandle = ({ id, isDragOverlay }) => {
|
|
37
|
+
const { draggableProps } = (0, import_react.useContext)(import_SortableItemContext.SortableItemContext);
|
|
38
|
+
const isDragging = draggableProps && draggableProps.isDragging;
|
|
39
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.GripperVertical, {
|
|
40
|
+
role: "button",
|
|
41
|
+
...draggableProps && {
|
|
42
|
+
...draggableProps.listeners,
|
|
43
|
+
...draggableProps.attributes
|
|
44
|
+
},
|
|
45
|
+
"data-testid": "drag-handle",
|
|
46
|
+
"data-isactive": draggableProps && !!draggableProps.active,
|
|
47
|
+
"data-isdragoverlay": isDragOverlay,
|
|
48
|
+
id: `${id}-drag-handle`,
|
|
49
|
+
key: `${id}-drag-handle`,
|
|
50
|
+
className: `drag-handle ${isDragging ? "" : "focuseable"}`,
|
|
51
|
+
color: ["brand-primary", "800"],
|
|
52
|
+
size: "s",
|
|
53
|
+
tabIndex: 0
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
module.exports = __toCommonJS(DnDHandle_exports);
|
|
57
|
+
//# sourceMappingURL=DnDHandle.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/DnDHandle.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { SortableItemContext } from '../hoc/SortableItemContext';\nimport { DSTreeviewT } from '../react-desc-prop-types';\n\nexport const DnDHandle = ({ id, isDragOverlay }: { id: DSTreeviewT.StringOrNum; isDragOverlay: boolean }) => {\n const { draggableProps } = useContext(SortableItemContext);\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n return (\n <GripperVertical\n role=\"button\"\n {...(draggableProps && {\n ...draggableProps.listeners,\n ...draggableProps.attributes,\n })}\n data-testid=\"drag-handle\"\n data-isactive={draggableProps && !!draggableProps.active}\n data-isdragoverlay={isDragOverlay}\n id={`${id}-drag-handle`}\n key={`${id}-drag-handle`}\n className={`drag-handle ${isDragging ? '' : 'focuseable'}`}\n color={['brand-primary', '800']}\n size=\"s\"\n tabIndex={0}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,sBAAgC;AAChC,iCAAoC;AAG7B,MAAM,YAAY,CAAC,EAAE,IAAI,oBAA6E;AAC3G,QAAM,EAAE,mBAAmB,6BAAW;AAEtC,QAAM,aAAa,kBAAkB,eAAe;AAEpD,SACE,mDAAC,iCAAD;AAAA,IACE,MAAK;AAAA,OACA,kBAAkB;AAAA,SAClB,eAAe;AAAA,SACf,eAAe;AAAA;AAAA,IAEpB,eAAY;AAAA,IACZ,iBAAe,kBAAkB,CAAC,CAAC,eAAe;AAAA,IAClD,sBAAoB;AAAA,IACpB,IAAI,GAAG;AAAA,IACP,KAAK,GAAG;AAAA,IACR,WAAW,eAAe,aAAa,KAAK;AAAA,IAC5C,OAAO,CAAC,iBAAiB;AAAA,IACzB,MAAK;AAAA,IACL,UAAU;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 DropIndicator_exports = {};
|
|
29
|
+
__export(DropIndicator_exports, {
|
|
30
|
+
default: () => DropIndicator_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
35
|
+
var import_SortableItemContext = require("../hoc/SortableItemContext");
|
|
36
|
+
const getPositionStyles = ({ dropIndicatorPosition }) => `
|
|
37
|
+
top: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "0" : "unset"};
|
|
38
|
+
bottom: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "0" : "unset"};
|
|
39
|
+
left: -2px;
|
|
40
|
+
`;
|
|
41
|
+
const getCircleStyles = ({ dropIndicatorPosition }) => ({
|
|
42
|
+
position: "absolute",
|
|
43
|
+
zIndex: 20,
|
|
44
|
+
top: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "unset" : "-2px",
|
|
45
|
+
bottom: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "unset" : "-2px",
|
|
46
|
+
left: "0px",
|
|
47
|
+
opacity: 1
|
|
48
|
+
});
|
|
49
|
+
const StyledIndicator = import_styled_components.default.div`
|
|
50
|
+
position: absolute;
|
|
51
|
+
${getPositionStyles}
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
width: ${(props) => props.vertical ? "2px" : "100%"};
|
|
54
|
+
height: ${(props) => props.vertical ? "100%" : "2px"};
|
|
55
|
+
background-color: ${({ isDropValid, theme }) => isDropValid ? theme.colors.brand[600] : theme.colors.danger[900]};
|
|
56
|
+
z-index: 20;
|
|
57
|
+
`;
|
|
58
|
+
const CircleIndicator = (style, isDropValid) => /* @__PURE__ */ import_react.default.createElement("svg", {
|
|
59
|
+
height: "6",
|
|
60
|
+
width: "6",
|
|
61
|
+
style
|
|
62
|
+
}, /* @__PURE__ */ import_react.default.createElement("circle", {
|
|
63
|
+
cx: "3",
|
|
64
|
+
cy: "3",
|
|
65
|
+
r: "3",
|
|
66
|
+
strokeWidth: "0",
|
|
67
|
+
fill: isDropValid ? "#1E79C2" : "#C64252"
|
|
68
|
+
}));
|
|
69
|
+
const DropIndicator = ({ dropIndicatorPosition, isLast, isDropValid }) => {
|
|
70
|
+
if (![import_SortableItemContext.DropIndicatorPosition.After, import_SortableItemContext.DropIndicatorPosition.Before].includes(dropIndicatorPosition))
|
|
71
|
+
return null;
|
|
72
|
+
const safeDropIndicatorPosition = isLast ? import_SortableItemContext.DropIndicatorPosition.Before : dropIndicatorPosition;
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid), /* @__PURE__ */ import_react.default.createElement(StyledIndicator, {
|
|
74
|
+
dropIndicatorPosition: safeDropIndicatorPosition,
|
|
75
|
+
isDropValid
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
var DropIndicator_default = DropIndicator;
|
|
79
|
+
module.exports = __toCommonJS(DropIndicator_exports);
|
|
80
|
+
//# sourceMappingURL=DropIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/DropIndicator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport styled from 'styled-components';\nimport { DropIndicatorPosition } from '../hoc/SortableItemContext';\n\ninterface DropIndicatorProps {\n vertical?: boolean;\n dropIndicatorPosition: DropIndicatorPosition | false;\n isLast?: boolean;\n isDropValid?: boolean;\n}\n\nconst getPositionStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => `\n top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n left: -2px;\n `;\n\nconst getCircleStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => ({\n position: 'absolute',\n zIndex: 20,\n top: dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n left: '0px',\n opacity: 1,\n});\n\nconst StyledIndicator = styled.div<DropIndicatorProps>`\n position: absolute;\n ${getPositionStyles}\n box-sizing: border-box;\n width: ${(props) => (props.vertical ? '2px' : '100%')};\n height: ${(props) => (props.vertical ? '100%' : '2px')};\n background-color: ${({ isDropValid, theme }) => (isDropValid ? theme.colors.brand[600] : theme.colors.danger[900])};\n z-index: 20;\n`;\n\nconst CircleIndicator = (style: Record<string, unknown>, isDropValid: boolean | null | undefined) => (\n <svg height=\"6\" width=\"6\" style={style}>\n <circle cx=\"3\" cy=\"3\" r=\"3\" strokeWidth=\"0\" fill={isDropValid ? '#1E79C2' : '#C64252'} />\n </svg>\n);\n\nconst DropIndicator: React.ComponentType<DropIndicatorProps> = ({ dropIndicatorPosition, isLast, isDropValid }) => {\n if (\n ![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(\n dropIndicatorPosition as DropIndicatorPosition,\n )\n )\n return null;\n\n const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;\n\n return (\n <>\n {CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid)}\n <StyledIndicator dropIndicatorPosition={safeDropIndicatorPosition} isDropValid={isDropValid} />\n </>\n );\n};\n\nexport default DropIndicator;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,+BAAmB;AACnB,iCAAsC;AAStC,MAAM,oBAAoB,CAAC,EAAE,4BAAgD;AAAA,aAChE,0BAA0B,iDAAsB,SAAS,MAAM;AAAA,gBAC5D,0BAA0B,iDAAsB,QAAQ,MAAM;AAAA;AAAA;AAI9E,MAAM,kBAAkB,CAAC,EAAE,4BAAiD;AAAA,EAC1E,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,KAAK,0BAA0B,iDAAsB,QAAQ,UAAU;AAAA,EACvE,QAAQ,0BAA0B,iDAAsB,SAAS,UAAU;AAAA,EAC3E,MAAM;AAAA,EACN,SAAS;AAAA;AAGX,MAAM,kBAAkB,iCAAO;AAAA;AAAA,IAE3B;AAAA;AAAA,WAEO,CAAC,UAAW,MAAM,WAAW,QAAQ;AAAA,YACpC,CAAC,UAAW,MAAM,WAAW,SAAS;AAAA,sBAC5B,CAAC,EAAE,aAAa,YAAa,cAAc,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,OAAO;AAAA;AAAA;AAI/G,MAAM,kBAAkB,CAAC,OAAgC,gBACvD,mDAAC,OAAD;AAAA,EAAK,QAAO;AAAA,EAAI,OAAM;AAAA,EAAI;AAAA,GACxB,mDAAC,UAAD;AAAA,EAAQ,IAAG;AAAA,EAAI,IAAG;AAAA,EAAI,GAAE;AAAA,EAAI,aAAY;AAAA,EAAI,MAAM,cAAc,YAAY;AAAA;AAIhF,MAAM,gBAAyD,CAAC,EAAE,uBAAuB,QAAQ,kBAAkB;AACjH,MACE,CAAC,CAAC,iDAAsB,OAAO,iDAAsB,QAAQ,SAC3D;AAGF,WAAO;AAET,QAAM,4BAA4B,SAAS,iDAAsB,SAAS;AAE1E,SACE,wFACG,gBAAgB,gBAAgB,EAAE,uBAAuB,8BAA8B,cACxF,mDAAC,iBAAD;AAAA,IAAiB,uBAAuB;AAAA,IAA2B;AAAA;AAAA;AAKzE,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/parts/ExpandCaret.js
CHANGED
|
@@ -1,94 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 ExpandCaret_exports = {};
|
|
29
|
+
__export(ExpandCaret_exports, {
|
|
30
|
+
ExpandCaret: () => ExpandCaret
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_button = __toESM(require("@elliemae/ds-button"));
|
|
35
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
36
|
+
var import_group_expands_helpers = require("../utils/group-expands-helpers");
|
|
37
|
+
var import_tree_helpers = require("../utils/tree-helpers");
|
|
38
|
+
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
39
|
+
const ExpandCaret = (props) => {
|
|
40
|
+
const defaultHandleExpandGroup = (0, import_react.useCallback)(import_group_expands_helpers.toggleItemExpand, []);
|
|
41
|
+
const { item } = props;
|
|
42
|
+
const { id, isExpanded, isGroup, children } = item;
|
|
30
43
|
const isGroupOrHasChildrens = isGroup || Array.isArray(children) && children.length > 0;
|
|
31
|
-
const ctx =
|
|
44
|
+
const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
32
45
|
const {
|
|
33
|
-
props: {
|
|
34
|
-
onItemFocus
|
|
35
|
-
},
|
|
46
|
+
props: { onItemFocus },
|
|
36
47
|
handleExpandGroup = defaultHandleExpandGroup,
|
|
37
48
|
triggerTreeRerender,
|
|
38
49
|
updateUserExpandedState,
|
|
39
50
|
setLatestToggledItem,
|
|
40
51
|
setFocusedItem,
|
|
41
|
-
virtualListHelpers: {
|
|
42
|
-
scrollToIndex
|
|
43
|
-
}
|
|
52
|
+
virtualListHelpers: { scrollToIndex }
|
|
44
53
|
} = ctx;
|
|
45
|
-
if (isGroupOrHasChildrens)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
if (isGroupOrHasChildrens)
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
|
|
56
|
+
buttonType: "text",
|
|
57
|
+
className: "expandable-arrow",
|
|
58
|
+
"data-testid": "tree-item-expand-toggle",
|
|
59
|
+
key: `${id}-expand-addon`,
|
|
60
|
+
icon: isExpanded ? /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ArrowheadDown, {
|
|
61
|
+
size: "s",
|
|
62
|
+
"data-testid": "ic-arrow-head-down"
|
|
63
|
+
}) : /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ArrowheadRight, {
|
|
64
|
+
size: "s",
|
|
65
|
+
"data-testid": "ic-arrow-head-right"
|
|
66
|
+
}),
|
|
67
|
+
onMouseDown: (e) => {
|
|
68
|
+
if (e) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
if (e)
|
|
75
|
+
handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);
|
|
76
|
+
setLatestToggledItem(item);
|
|
77
|
+
const itemVitualIndex = item.virtualIndex;
|
|
78
|
+
if (typeof itemVitualIndex === "number") {
|
|
79
|
+
onItemFocus({
|
|
80
|
+
itemIndex: itemVitualIndex,
|
|
81
|
+
scrollToItem: (opts = { align: "start" }) => scrollToIndex(itemVitualIndex, opts),
|
|
82
|
+
item
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
setFocusedItem(item);
|
|
86
|
+
(0, import_tree_helpers.focusItem)(item);
|
|
87
|
+
},
|
|
53
88
|
size: "s",
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (e) {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
onClick: e => {
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
if (e) handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);
|
|
65
|
-
setLatestToggledItem(item);
|
|
66
|
-
const itemVitualIndex = item.virtualIndex;
|
|
67
|
-
|
|
68
|
-
if (typeof itemVitualIndex === 'number') {
|
|
69
|
-
onItemFocus({
|
|
70
|
-
itemIndex: itemVitualIndex,
|
|
71
|
-
scrollToItem: function () {
|
|
72
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
73
|
-
align: 'start'
|
|
74
|
-
};
|
|
75
|
-
return scrollToIndex(itemVitualIndex, opts);
|
|
76
|
-
},
|
|
77
|
-
item
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
setFocusedItem(item);
|
|
82
|
-
treeHelpers.focusItem(item);
|
|
83
|
-
},
|
|
84
|
-
size: "s",
|
|
85
|
-
tabIndex: -1
|
|
86
|
-
}, "".concat(id, "-expand-addon"));
|
|
87
|
-
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
88
|
-
style: {
|
|
89
|
-
width: '24px'
|
|
90
|
-
}
|
|
89
|
+
tabIndex: -1
|
|
90
|
+
});
|
|
91
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
92
|
+
style: { width: "24px" }
|
|
91
93
|
});
|
|
92
94
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
module.exports = __toCommonJS(ExpandCaret_exports);
|
|
96
|
+
//# sourceMappingURL=ExpandCaret.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/ExpandCaret.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback } from 'react';\nimport Button from '@elliemae/ds-button';\nimport { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';\nimport { toggleItemExpand } from '../utils/group-expands-helpers';\nimport { focusItem } from '../utils/tree-helpers';\nimport TreeViewContext from '../TreeViewContext';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\n\ninterface PropsT {\n item: DSTreeviewT.Item;\n}\n\nexport const ExpandCaret = (props: PropsT): JSX.Element | null => {\n const defaultHandleExpandGroup = useCallback(toggleItemExpand, []);\n const { item } = props;\n const { id, isExpanded, isGroup, children } = item;\n const isGroupOrHasChildrens = isGroup || (Array.isArray(children) && children.length > 0);\n const ctx = useContext(TreeViewContext);\n const {\n props: { onItemFocus },\n handleExpandGroup = defaultHandleExpandGroup,\n triggerTreeRerender,\n updateUserExpandedState,\n setLatestToggledItem,\n setFocusedItem,\n virtualListHelpers: { scrollToIndex },\n } = ctx;\n\n if (isGroupOrHasChildrens)\n return (\n <Button\n buttonType=\"text\"\n className=\"expandable-arrow\"\n data-testid=\"tree-item-expand-toggle\"\n key={`${id}-expand-addon`}\n icon={\n isExpanded ? (\n <ArrowheadDown size=\"s\" data-testid=\"ic-arrow-head-down\" />\n ) : (\n <ArrowheadRight size=\"s\" data-testid=\"ic-arrow-head-right\" />\n )\n }\n onMouseDown={(e: React.MouseEvent) => {\n // prevent focusing the caret\n if (e) {\n e.preventDefault();\n }\n }}\n onClick={(e) => {\n e.stopPropagation();\n if (e) handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);\n setLatestToggledItem(item);\n const itemVitualIndex = item.virtualIndex;\n if (typeof itemVitualIndex === 'number') {\n onItemFocus({\n itemIndex: itemVitualIndex,\n scrollToItem: (opts = { align: 'start' }) => scrollToIndex(itemVitualIndex, opts),\n item,\n });\n }\n setFocusedItem(item);\n focusItem(item);\n }}\n size=\"s\"\n tabIndex={-1}\n />\n );\n return <div style={{ width: '24px' }} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAC/C,uBAAmB;AACnB,sBAA8C;AAC9C,mCAAiC;AACjC,0BAA0B;AAC1B,6BAA4B;AAOrB,MAAM,cAAc,CAAC,UAAsC;AAChE,QAAM,2BAA2B,8BAAY,+CAAkB;AAC/D,QAAM,EAAE,SAAS;AACjB,QAAM,EAAE,IAAI,YAAY,SAAS,aAAa;AAC9C,QAAM,wBAAwB,WAAY,MAAM,QAAQ,aAAa,SAAS,SAAS;AACvF,QAAM,MAAM,6BAAW;AACvB,QAAM;AAAA,IACJ,OAAO,EAAE;AAAA,IACT,oBAAoB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,EAAE;AAAA,MACpB;AAEJ,MAAI;AACF,WACE,mDAAC,0BAAD;AAAA,MACE,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,KAAK,GAAG;AAAA,MACR,MACE,aACE,mDAAC,+BAAD;AAAA,QAAe,MAAK;AAAA,QAAI,eAAY;AAAA,WAEpC,mDAAC,gCAAD;AAAA,QAAgB,MAAK;AAAA,QAAI,eAAY;AAAA;AAAA,MAGzC,aAAa,CAAC,MAAwB;AAEpC,YAAI,GAAG;AACL,YAAE;AAAA;AAAA;AAAA,MAGN,SAAS,CAAC,MAAM;AACd,UAAE;AACF,YAAI;AAAG,4BAAkB,MAAM,qBAAqB,yBAAyB,eAAe;AAC5F,6BAAqB;AACrB,cAAM,kBAAkB,KAAK;AAC7B,YAAI,OAAO,oBAAoB,UAAU;AACvC,sBAAY;AAAA,YACV,WAAW;AAAA,YACX,cAAc,CAAC,OAAO,EAAE,OAAO,cAAc,cAAc,iBAAiB;AAAA,YAC5E;AAAA;AAAA;AAGJ,uBAAe;AACf,2CAAU;AAAA;AAAA,MAEZ,MAAK;AAAA,MACL,UAAU;AAAA;AAGhB,SAAO,mDAAC,OAAD;AAAA,IAAK,OAAO,EAAE,OAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/parts/Icon.js
CHANGED
|
@@ -1,37 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 Icon_exports = {};
|
|
29
|
+
__export(Icon_exports, {
|
|
30
|
+
Icon: () => Icon
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
|
+
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
36
|
+
const Icon = (props) => {
|
|
37
|
+
const { item } = props;
|
|
17
38
|
const isGroupOrHasChildrens = item.isGroup || Array.isArray(item.children) && item.children.length > 0;
|
|
18
|
-
const ctx =
|
|
39
|
+
const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
19
40
|
const {
|
|
20
|
-
props: {
|
|
21
|
-
groupIcon,
|
|
22
|
-
itemIcon
|
|
23
|
-
}
|
|
41
|
+
props: { groupIcon, itemIcon }
|
|
24
42
|
} = ctx;
|
|
25
43
|
const icon = isGroupOrHasChildrens ? groupIcon : itemIcon;
|
|
26
|
-
if (!icon)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// untill then, just eslint-ignore and move on
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
|
33
|
-
className: dsUtilities.cx(icon.props.className, 'tree-item-icon')
|
|
44
|
+
if (!icon)
|
|
45
|
+
return null;
|
|
46
|
+
return import_react.default.cloneElement(icon, {
|
|
47
|
+
"data-testid": isGroupOrHasChildrens ? "tree-item-group-icon" : "tree-item-icon",
|
|
48
|
+
className: (0, import_ds_utilities.cx)(icon.props.className, "tree-item-icon")
|
|
34
49
|
});
|
|
35
50
|
};
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
module.exports = __toCommonJS(Icon_exports);
|
|
52
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/Icon.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { cx } from '@elliemae/ds-utilities';\n\nimport TreeViewContext from '../TreeViewContext';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\ninterface PropsT {\n item: DSTreeviewT.Item;\n}\nexport const Icon = (props: PropsT): JSX.Element | null => {\n const { item } = props;\n const isGroupOrHasChildrens = item.isGroup || (Array.isArray(item.children) && item.children.length > 0);\n const ctx = useContext(TreeViewContext);\n const {\n props: { groupIcon, itemIcon },\n } = ctx;\n const icon = isGroupOrHasChildrens ? groupIcon : itemIcon;\n if (!icon) return null;\n\n return React.cloneElement(icon, {\n 'data-testid': isGroupOrHasChildrens ? 'tree-item-group-icon' : 'tree-item-icon',\n // legacy class-name way of handling things,\n // this will eventually be deprecated in favor of styled components\n // untill then, just eslint-ignore and move on\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n className: cx(icon.props.className, 'tree-item-icon'),\n });\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,0BAAmB;AAEnB,6BAA4B;AAKrB,MAAM,OAAO,CAAC,UAAsC;AACzD,QAAM,EAAE,SAAS;AACjB,QAAM,wBAAwB,KAAK,WAAY,MAAM,QAAQ,KAAK,aAAa,KAAK,SAAS,SAAS;AACtG,QAAM,MAAM,6BAAW;AACvB,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW;AAAA,MAClB;AACJ,QAAM,OAAO,wBAAwB,YAAY;AACjD,MAAI,CAAC;AAAM,WAAO;AAElB,SAAO,qBAAM,aAAa,MAAM;AAAA,IAC9B,eAAe,wBAAwB,yBAAyB;AAAA,IAKhE,WAAW,4BAAG,KAAK,MAAM,WAAW;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,47 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 NestingSpace_exports = {};
|
|
29
|
+
__export(NestingSpace_exports, {
|
|
30
|
+
NestingSpace: () => NestingSpace
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
12
34
|
const getItemNestingLeftPadding = (level, opts) => {
|
|
13
|
-
const {
|
|
14
|
-
spaceForNestingLevel = 1.5
|
|
15
|
-
} = opts;
|
|
35
|
+
const { spaceForNestingLevel = 1.5 } = opts;
|
|
16
36
|
const groupLeftPadding = spaceForNestingLevel * (level - 1);
|
|
17
|
-
const finalLeftPadding = groupLeftPadding + spaceForNestingLevel - 0.1;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return finalLeftPadding > 0 ? "".concat(finalLeftPadding, "em") : '0';
|
|
37
|
+
const finalLeftPadding = groupLeftPadding + spaceForNestingLevel - 0.1;
|
|
38
|
+
return finalLeftPadding > 0 ? `${finalLeftPadding}em` : "0";
|
|
21
39
|
};
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const {
|
|
25
|
-
item,
|
|
26
|
-
spaceForNestingLevel
|
|
27
|
-
} = props;
|
|
28
|
-
const {
|
|
29
|
-
treeDepth
|
|
30
|
-
} = item;
|
|
31
|
-
|
|
40
|
+
const NestingSpace = (props) => {
|
|
41
|
+
const { item, spaceForNestingLevel } = props;
|
|
42
|
+
const { treeDepth } = item;
|
|
32
43
|
if (treeDepth) {
|
|
33
44
|
const itemNestingLeftPadding = getItemNestingLeftPadding(treeDepth - 1, {
|
|
34
45
|
spaceForNestingLevel
|
|
35
46
|
});
|
|
36
|
-
return
|
|
47
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
37
48
|
"data-testid": "tree-item-nested-space",
|
|
38
|
-
style: {
|
|
39
|
-
width: itemNestingLeftPadding
|
|
40
|
-
}
|
|
49
|
+
style: { width: itemNestingLeftPadding }
|
|
41
50
|
});
|
|
42
51
|
}
|
|
43
|
-
|
|
44
52
|
return null;
|
|
45
53
|
};
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
module.exports = __toCommonJS(NestingSpace_exports);
|
|
55
|
+
//# sourceMappingURL=NestingSpace.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/NestingSpace.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\n\nconst getItemNestingLeftPadding = (level: number, opts: { spaceForNestingLevel: number }) => {\n const { spaceForNestingLevel = 1.5 } = opts;\n const groupLeftPadding = spaceForNestingLevel * (level - 1);\n const finalLeftPadding = groupLeftPadding + spaceForNestingLevel - 0.1;\n // root level left-padding would be negative and would not be applied\n // if \"root-level\" nesting, then defaults to 0 left-padding.\n return finalLeftPadding > 0 ? `${finalLeftPadding}em` : '0';\n};\n\ntype NestingSpacePropsType = {\n item: DSTreeviewT.Item;\n spaceForNestingLevel: number;\n};\n\nexport const NestingSpace = (props: NestingSpacePropsType): JSX.Element | null => {\n const { item, spaceForNestingLevel } = props;\n const { treeDepth } = item;\n if (treeDepth) {\n const itemNestingLeftPadding = getItemNestingLeftPadding(treeDepth - 1, {\n spaceForNestingLevel,\n });\n\n return <div data-testid=\"tree-item-nested-space\" style={{ width: itemNestingLeftPadding }} />;\n }\n return null;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAGlB,MAAM,4BAA4B,CAAC,OAAe,SAA2C;AAC3F,QAAM,EAAE,uBAAuB,QAAQ;AACvC,QAAM,mBAAmB,uBAAwB,SAAQ;AACzD,QAAM,mBAAmB,mBAAmB,uBAAuB;AAGnE,SAAO,mBAAmB,IAAI,GAAG,uBAAuB;AAAA;AAQnD,MAAM,eAAe,CAAC,UAAqD;AAChF,QAAM,EAAE,MAAM,yBAAyB;AACvC,QAAM,EAAE,cAAc;AACtB,MAAI,WAAW;AACb,UAAM,yBAAyB,0BAA0B,YAAY,GAAG;AAAA,MACtE;AAAA;AAGF,WAAO,mDAAC,OAAD;AAAA,MAAK,eAAY;AAAA,MAAyB,OAAO,EAAE,OAAO;AAAA;AAAA;AAEnE,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|