@elliemae/ds-fast-list 3.18.0-next.10
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/DSFastListDefinitions.js +36 -0
- package/dist/cjs/DSFastListDefinitions.js.map +7 -0
- package/dist/cjs/FastList.js +46 -0
- package/dist/cjs/FastList.js.map +7 -0
- package/dist/cjs/FastListDataTestID.js +38 -0
- package/dist/cjs/FastListDataTestID.js.map +7 -0
- package/dist/cjs/hooks/useFastList.js +71 -0
- package/dist/cjs/hooks/useFastList.js.map +7 -0
- package/dist/cjs/hooks/useValidateProps.js +40 -0
- package/dist/cjs/hooks/useValidateProps.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/parts/List.js +93 -0
- package/dist/cjs/parts/List.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +53 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/esm/DSFastListDefinitions.js +6 -0
- package/dist/esm/DSFastListDefinitions.js.map +7 -0
- package/dist/esm/FastList.js +16 -0
- package/dist/esm/FastList.js.map +7 -0
- package/dist/esm/FastListDataTestID.js +8 -0
- package/dist/esm/FastListDataTestID.js.map +7 -0
- package/dist/esm/hooks/useFastList.js +41 -0
- package/dist/esm/hooks/useFastList.js.map +7 -0
- package/dist/esm/hooks/useValidateProps.js +10 -0
- package/dist/esm/hooks/useValidateProps.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/parts/List.js +63 -0
- package/dist/esm/parts/List.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +23 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/types/ds-fast-list/src/DSFastListDefinitions.d.ts +1 -0
- package/dist/types/ds-fast-list/src/FastList.d.ts +9 -0
- package/dist/types/ds-fast-list/src/FastListDataTestID.d.ts +3 -0
- package/dist/types/ds-fast-list/src/hooks/useFastList.d.ts +19 -0
- package/dist/types/ds-fast-list/src/hooks/useValidateProps.d.ts +3 -0
- package/dist/types/ds-fast-list/src/index.d.ts +2 -0
- package/dist/types/ds-fast-list/src/parts/List.d.ts +3 -0
- package/dist/types/ds-fast-list/src/react-desc-prop-types.d.ts +28 -0
- package/dist/types/ds-fast-list/src/tests/basicV3.test.d.ts +1 -0
- package/dist/types/ds-test-utils/src/testeable-utils/DSVirtualList.d.ts +9 -0
- package/dist/types/ds-test-utils/src/testeable-utils/axe-core/getMessageAndPass.d.ts +8 -0
- package/dist/types/ds-test-utils/src/testeable-utils/axe-core/index.d.ts +1 -0
- package/dist/types/ds-test-utils/src/testeable-utils/axe-core/reporter.d.ts +2 -0
- package/dist/types/ds-test-utils/src/testeable-utils/axe-core/shouldIgnoreNodeViolation.d.ts +2 -0
- package/dist/types/ds-test-utils/src/testeable-utils/axe-core/toHaveNoViolations.d.ts +12 -0
- package/dist/types/ds-test-utils/src/testeable-utils/index.d.ts +2 -0
- package/package.json +95 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSFastListDefinitions_exports = {};
|
|
30
|
+
__export(DSFastListDefinitions_exports, {
|
|
31
|
+
DSFastListName: () => DSFastListName
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(DSFastListDefinitions_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
const DSFastListName = "DSFastList";
|
|
36
|
+
//# sourceMappingURL=DSFastListDefinitions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSFastListDefinitions.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DSFastListName = 'DSFastList';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,iBAAiB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var FastList_exports = {};
|
|
30
|
+
__export(FastList_exports, {
|
|
31
|
+
DSFastList: () => DSFastList,
|
|
32
|
+
DSFastListWithSchema: () => DSFastListWithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(FastList_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
+
var import_List = require("./parts/List.js");
|
|
39
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
40
|
+
var import_DSFastListDefinitions = require("./DSFastListDefinitions.js");
|
|
41
|
+
const DSFastList = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_List.List, { ...props });
|
|
42
|
+
DSFastList.propTypes = import_react_desc_prop_types.DSFastListPropTypes;
|
|
43
|
+
DSFastList.displayName = import_DSFastListDefinitions.DSFastListName;
|
|
44
|
+
const DSFastListWithSchema = (0, import_ds_props_helpers.describe)(DSFastList).description("DSFastList");
|
|
45
|
+
DSFastListWithSchema.propTypes = import_react_desc_prop_types.DSFastListPropTypes;
|
|
46
|
+
//# sourceMappingURL=FastList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/FastList.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { List } from './parts/List.js';\nimport { DSFastListPropTypes, type DSFastListT } from './react-desc-prop-types.js';\nimport { DSFastListName } from './DSFastListDefinitions.js';\n\n// we create ds-fast-list to solve the issue with the children prop in ds-virtual-list\n// this packages use render props instead of children prop.\n// we are not using a context nor zustand so all the logic is handled in List...\nconst DSFastList = (props: DSFastListT.Props) => <List {...props} />;\n\nDSFastList.propTypes = DSFastListPropTypes;\nDSFastList.displayName = DSFastListName;\nconst DSFastListWithSchema = describe(DSFastList).description('DSFastList');\nDSFastListWithSchema.propTypes = DSFastListPropTypes;\n\nexport { DSFastList, DSFastListWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADS0B;AARjD,8BAAyB;AACzB,kBAAqB;AACrB,mCAAsD;AACtD,mCAA+B;AAK/B,MAAM,aAAa,CAAC,UAA6B,4CAAC,oBAAM,GAAG,OAAO;AAElE,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU,EAAE,YAAY,YAAY;AAC1E,qBAAqB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var FastListDataTestID_exports = {};
|
|
30
|
+
__export(FastListDataTestID_exports, {
|
|
31
|
+
LIST_DATA_TESTID: () => LIST_DATA_TESTID
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(FastListDataTestID_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
const LIST_DATA_TESTID = {
|
|
36
|
+
CONTAINER: "fast-list-container"
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=FastListDataTestID.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/FastListDataTestID.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const LIST_DATA_TESTID = {\n CONTAINER: 'fast-list-container',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AACb;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useFastList_exports = {};
|
|
30
|
+
__export(useFastList_exports, {
|
|
31
|
+
useFastList: () => useFastList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useFastList_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_uid = require("uid");
|
|
37
|
+
var import_react_virtual = require("@tanstack/react-virtual");
|
|
38
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
+
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
40
|
+
var import_useValidateProps = require("./useValidateProps.js");
|
|
41
|
+
const estimateSize = () => 50;
|
|
42
|
+
const useFastList = (propsFromUser) => {
|
|
43
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
|
|
44
|
+
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSFastListPropTypes);
|
|
45
|
+
const { actionRef, count } = propsWithDefault;
|
|
46
|
+
const parentRef = import_react.default.useRef(null);
|
|
47
|
+
const useVirtualHelpers = (0, import_react_virtual.useVirtualizer)({
|
|
48
|
+
count,
|
|
49
|
+
getScrollElement: () => parentRef.current,
|
|
50
|
+
overscan: 15,
|
|
51
|
+
estimateSize
|
|
52
|
+
});
|
|
53
|
+
const totalSize = useVirtualHelpers.getTotalSize();
|
|
54
|
+
import_react.default.useEffect(() => {
|
|
55
|
+
if (actionRef && actionRef.current) {
|
|
56
|
+
actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;
|
|
57
|
+
}
|
|
58
|
+
}, [actionRef, useVirtualHelpers]);
|
|
59
|
+
const instanceUid = import_react.default.useMemo(() => `ds-fast-list-${(0, import_uid.uid)(6)}`, []);
|
|
60
|
+
return import_react.default.useMemo(
|
|
61
|
+
() => ({
|
|
62
|
+
parentRef,
|
|
63
|
+
getVirtualItems: useVirtualHelpers.getVirtualItems,
|
|
64
|
+
totalSize,
|
|
65
|
+
instanceUid,
|
|
66
|
+
measureElement: useVirtualHelpers.measureElement
|
|
67
|
+
}),
|
|
68
|
+
[useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, totalSize, instanceUid]
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=useFastList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useFastList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSFastListT, DSFastListPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nconst estimateSize = () => 50;\n// we \"own\" the interfaces/type instead of importing from react-virtual\n// to abstract our implementation from their\ninterface VirtualItem {\n key: string | number;\n index: number;\n start: number;\n end: number;\n size: number;\n}\ntype MeasureElement = ((element: HTMLElement) => number) | ((node: Element | null) => void);\n\nexport type FastListCTX = {\n parentRef: React.MutableRefObject<HTMLDivElement | null>;\n getVirtualItems: () => VirtualItem[];\n totalSize: number;\n instanceUid: string;\n measureElement: MeasureElement;\n};\nexport const useFastList = (propsFromUser: DSFastListT.Props): FastListCTX => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSFastListT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSFastListPropTypes);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const { actionRef, count } = propsWithDefault;\n const parentRef = React.useRef<HTMLDivElement>(null);\n const useVirtualHelpers = useVirtualizer({\n count,\n getScrollElement: () => parentRef.current,\n overscan: 15,\n estimateSize,\n });\n const totalSize = useVirtualHelpers.getTotalSize();\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;\n }\n }, [actionRef, useVirtualHelpers]);\n\n const instanceUid = React.useMemo(() => `ds-fast-list-${uid(6)}`, []);\n return React.useMemo(\n () => ({\n parentRef,\n getVirtualItems: useVirtualHelpers.getVirtualItems,\n totalSize,\n instanceUid,\n measureElement: useVirtualHelpers.measureElement,\n }),\n [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, totalSize, instanceUid],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,iBAAoB;AACpB,2BAA+B;AAC/B,8BAA6C;AAC7C,mCAAoE;AACpE,8BAAiC;AAEjC,MAAM,eAAe,MAAM;AAmBpB,MAAM,cAAc,CAAC,kBAAkD;AAI5E,QAAM,uBAAmB,sDAAwD,eAAe,yCAAY;AAC5G,gDAAiB,kBAAkB,gDAAmB;AAItD,QAAM,EAAE,WAAW,MAAM,IAAI;AAC7B,QAAM,YAAY,aAAAA,QAAM,OAAuB,IAAI;AACnD,QAAM,wBAAoB,qCAAe;AAAA,IACvC;AAAA,IACA,kBAAkB,MAAM,UAAU;AAAA,IAClC,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AACD,QAAM,YAAY,kBAAkB,aAAa;AACjD,eAAAA,QAAM,UAAU,MAAM;AACpB,QAAI,aAAa,UAAU,SAAS;AAClC,gBAAU,QAAQ,WAAW,kBAAkB;AAAA,IACjD;AAAA,EACF,GAAG,CAAC,WAAW,iBAAiB,CAAC;AAEjC,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,oBAAgB,gBAAI,CAAC,KAAK,CAAC,CAAC;AACpE,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA,iBAAiB,kBAAkB;AAAA,MACnC;AAAA,MACA;AAAA,MACA,gBAAgB,kBAAkB;AAAA,IACpC;AAAA,IACA,CAAC,kBAAkB,iBAAiB,kBAAkB,gBAAgB,WAAW,WAAW;AAAA,EAC9F;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useValidateProps_exports = {};
|
|
30
|
+
__export(useValidateProps_exports, {
|
|
31
|
+
useValidateProps: () => useValidateProps
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_DSFastListDefinitions = require("../DSFastListDefinitions.js");
|
|
37
|
+
const useValidateProps = (props, propTypes) => {
|
|
38
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_DSFastListDefinitions.DSFastListName);
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useValidateProps.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { WeakValidationMap } from 'react';\nimport { type DSFastListT } from '../react-desc-prop-types.js';\nimport { DSFastListName } from '../DSFastListDefinitions.js';\n\nexport const useValidateProps = (props: DSFastListT.InternalProps, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSFastListName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAG/C,mCAA+B;AAExB,MAAM,mBAAmB,CAAC,OAAkC,cAAgD;AAEjH,8DAA+B,OAAO,WAAW,2CAAc;AACjE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
DSFastList: () => import_FastList.DSFastList,
|
|
32
|
+
DSFastListWithSchema: () => import_FastList.DSFastListWithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
37
|
+
var import_FastList = require("./FastList.js");
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\n\nexport { type DSFastListT } from './react-desc-prop-types.js';\nexport { DSFastList, DSFastListWithSchema } from './FastList.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mCAAiC;AACjC,sBAAiD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var List_exports = {};
|
|
30
|
+
__export(List_exports, {
|
|
31
|
+
List: () => List
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(List_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_FastListDataTestID = require("../FastListDataTestID.js");
|
|
38
|
+
var import_useFastList = require("../hooks/useFastList.js");
|
|
39
|
+
const List = import_react.default.memo((props) => {
|
|
40
|
+
const { parentRef, getVirtualItems, totalSize, instanceUid, measureElement } = (0, import_useFastList.useFastList)(props);
|
|
41
|
+
const { ItemRenderer, extraItemProps } = props;
|
|
42
|
+
const virtualItems = getVirtualItems();
|
|
43
|
+
const measureRef = import_react.default.useCallback(
|
|
44
|
+
(node) => measureElement(node),
|
|
45
|
+
[measureElement]
|
|
46
|
+
);
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
ref: parentRef,
|
|
51
|
+
"data-testid": import_FastListDataTestID.LIST_DATA_TESTID.CONTAINER,
|
|
52
|
+
role: "list",
|
|
53
|
+
style: {
|
|
54
|
+
width: "100%",
|
|
55
|
+
height: "100%",
|
|
56
|
+
paddingBottom: 0,
|
|
57
|
+
overflow: "auto"
|
|
58
|
+
},
|
|
59
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
style: {
|
|
63
|
+
width: "100%",
|
|
64
|
+
height: `${totalSize}px`,
|
|
65
|
+
position: "relative"
|
|
66
|
+
},
|
|
67
|
+
children: virtualItems.map((virtualItem) => {
|
|
68
|
+
const { index, start, key } = virtualItem;
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
ref: measureRef,
|
|
73
|
+
"data-index": index,
|
|
74
|
+
style: {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
top: 0,
|
|
77
|
+
left: 0,
|
|
78
|
+
width: "100%",
|
|
79
|
+
transform: `translateY(${start}px)`
|
|
80
|
+
},
|
|
81
|
+
role: "listitem",
|
|
82
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemRenderer, { index, ...extraItemProps })
|
|
83
|
+
},
|
|
84
|
+
`${instanceUid}-item-${key}`
|
|
85
|
+
);
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
},
|
|
90
|
+
instanceUid
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/List.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { LIST_DATA_TESTID } from '../FastListDataTestID.js';\nimport { useFastList } from '../hooks/useFastList.js';\nimport type { DSFastListT } from '../react-desc-prop-types.js';\n\nexport const List = React.memo((props: DSFastListT.Props) => {\n const { parentRef, getVirtualItems, totalSize, instanceUid, measureElement } = useFastList(props);\n const { ItemRenderer, extraItemProps } = props;\n\n const virtualItems = getVirtualItems();\n const measureRef: React.LegacyRef<HTMLDivElement> = React.useCallback(\n (node: HTMLDivElement) => measureElement(node),\n [measureElement],\n );\n return (\n <div\n key={instanceUid}\n ref={parentRef}\n data-testid={LIST_DATA_TESTID.CONTAINER}\n role=\"list\"\n style={{\n width: '100%',\n height: '100%',\n paddingBottom: 0,\n overflow: 'auto',\n }}\n >\n <div\n style={{\n width: '100%',\n height: `${totalSize}px`,\n position: 'relative',\n }}\n >\n {virtualItems.map((virtualItem) => {\n const { index, start, key } = virtualItem;\n return (\n <div\n ref={measureRef}\n data-index={index}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${start}px)`,\n }}\n role=\"listitem\"\n key={`${instanceUid}-item-${key}`}\n >\n <ItemRenderer index={index} {...extraItemProps} />\n </div>\n );\n })}\n </div>\n </div>\n );\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkDT;AAlDd,mBAAkB;AAClB,gCAAiC;AACjC,yBAA4B;AAGrB,MAAM,OAAO,aAAAA,QAAM,KAAK,CAAC,UAA6B;AAC3D,QAAM,EAAE,WAAW,iBAAiB,WAAW,aAAa,eAAe,QAAI,gCAAY,KAAK;AAChG,QAAM,EAAE,cAAc,eAAe,IAAI;AAEzC,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAA8C,aAAAA,QAAM;AAAA,IACxD,CAAC,SAAyB,eAAe,IAAI;AAAA,IAC7C,CAAC,cAAc;AAAA,EACjB;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,KAAK;AAAA,MACL,eAAa,2CAAiB;AAAA,MAC9B,MAAK;AAAA,MACL,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,eAAe;AAAA,QACf,UAAU;AAAA,MACZ;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,OAAO;AAAA,YACP,QAAQ,GAAG;AAAA,YACX,UAAU;AAAA,UACZ;AAAA,UAEC,uBAAa,IAAI,CAAC,gBAAgB;AACjC,kBAAM,EAAE,OAAO,OAAO,IAAI,IAAI;AAC9B,mBACE;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,cAAY;AAAA,gBACZ,OAAO;AAAA,kBACL,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,MAAM;AAAA,kBACN,OAAO;AAAA,kBACP,WAAW,cAAc;AAAA,gBAC3B;AAAA,gBACA,MAAK;AAAA,gBAGL,sDAAC,gBAAa,OAAe,GAAG,gBAAgB;AAAA;AAAA,cAF3C,GAAG,oBAAoB;AAAA,YAG9B;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,IAtCK;AAAA,EAuCP;AAEJ,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSFastListPropTypes: () => DSFastListPropTypes,
|
|
32
|
+
defaultProps: () => defaultProps
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
+
const defaultProps = {};
|
|
38
|
+
const DSFastListPropTypes = {
|
|
39
|
+
actionRef: import_ds_props_helpers.PropTypes.shape({
|
|
40
|
+
current: import_ds_props_helpers.PropTypes.oneOfType([
|
|
41
|
+
import_ds_props_helpers.PropTypes.oneOf([null]),
|
|
42
|
+
import_ds_props_helpers.PropTypes.shape({
|
|
43
|
+
scrollTo: import_ds_props_helpers.PropTypes.func.description("Scroll to a index inside the list").signature(`((index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void)`)
|
|
44
|
+
})
|
|
45
|
+
])
|
|
46
|
+
}).description(`mutable reference where methods will be stored`),
|
|
47
|
+
ItemRenderer: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.object, import_ds_props_helpers.PropTypes.func]).isRequired.description(
|
|
48
|
+
"Render function for each item"
|
|
49
|
+
),
|
|
50
|
+
count: import_ds_props_helpers.PropTypes.number.isRequired.description("Number of items to render"),
|
|
51
|
+
extraItemProps: import_ds_props_helpers.PropTypes.object.description("Extra props to pass to each item")
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type React from 'react';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSFastListT {\n type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';\n type ScrollToOptions = {\n align: ScrollAlignment;\n };\n\n export type ActionRef = {\n scrollTo?: (index: number, options?: ScrollToOptions | undefined) => void;\n };\n export interface RequiredProps {\n ItemRenderer: React.ComponentType<{ index: number }>;\n count: number;\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n actionRef: React.MutableRefObject<ActionRef>;\n extraItemProps?: Record<string, unknown>;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {}\n}\n\nexport const defaultProps: DSFastListT.DefaultProps = {};\n\nexport const DSFastListPropTypes = {\n actionRef: PropTypes.shape({\n current: PropTypes.oneOfType([\n PropTypes.oneOf([null]),\n PropTypes.shape({\n scrollTo: PropTypes.func\n .description('Scroll to a index inside the list')\n .signature(`((index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void)`),\n }),\n ]),\n }).description(`mutable reference where methods will be stored`),\n ItemRenderer: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired.description(\n 'Render function for each item',\n ),\n count: PropTypes.number.isRequired.description('Number of items to render'),\n extraItemProps: PropTypes.object.description('Extra props to pass to each item'),\n} as React.WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAA0B;AA4BnB,MAAM,eAAyC,CAAC;AAEhD,MAAM,sBAAsB;AAAA,EACjC,WAAW,kCAAU,MAAM;AAAA,IACzB,SAAS,kCAAU,UAAU;AAAA,MAC3B,kCAAU,MAAM,CAAC,IAAI,CAAC;AAAA,MACtB,kCAAU,MAAM;AAAA,QACd,UAAU,kCAAU,KACjB,YAAY,mCAAmC,EAC/C,UAAU,2EAA2E;AAAA,MAC1F,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC,EAAE,YAAY,gDAAgD;AAAA,EAC/D,cAAc,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,WAAW;AAAA,IAC/E;AAAA,EACF;AAAA,EACA,OAAO,kCAAU,OAAO,WAAW,YAAY,2BAA2B;AAAA,EAC1E,gBAAgB,kCAAU,OAAO,YAAY,kCAAkC;AACjF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSFastListDefinitions.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSFastListName = 'DSFastList';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,iBAAiB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { describe } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { List } from "./parts/List.js";
|
|
5
|
+
import { DSFastListPropTypes } from "./react-desc-prop-types.js";
|
|
6
|
+
import { DSFastListName } from "./DSFastListDefinitions.js";
|
|
7
|
+
const DSFastList = (props) => /* @__PURE__ */ jsx(List, { ...props });
|
|
8
|
+
DSFastList.propTypes = DSFastListPropTypes;
|
|
9
|
+
DSFastList.displayName = DSFastListName;
|
|
10
|
+
const DSFastListWithSchema = describe(DSFastList).description("DSFastList");
|
|
11
|
+
DSFastListWithSchema.propTypes = DSFastListPropTypes;
|
|
12
|
+
export {
|
|
13
|
+
DSFastList,
|
|
14
|
+
DSFastListWithSchema
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=FastList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/FastList.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { List } from './parts/List.js';\nimport { DSFastListPropTypes, type DSFastListT } from './react-desc-prop-types.js';\nimport { DSFastListName } from './DSFastListDefinitions.js';\n\n// we create ds-fast-list to solve the issue with the children prop in ds-virtual-list\n// this packages use render props instead of children prop.\n// we are not using a context nor zustand so all the logic is handled in List...\nconst DSFastList = (props: DSFastListT.Props) => <List {...props} />;\n\nDSFastList.propTypes = DSFastListPropTypes;\nDSFastList.displayName = DSFastListName;\nconst DSFastListWithSchema = describe(DSFastList).description('DSFastList');\nDSFastListWithSchema.propTypes = DSFastListPropTypes;\n\nexport { DSFastList, DSFastListWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACS0B;AARjD,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,2BAA6C;AACtD,SAAS,sBAAsB;AAK/B,MAAM,aAAa,CAAC,UAA6B,oBAAC,QAAM,GAAG,OAAO;AAElE,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU,EAAE,YAAY,YAAY;AAC1E,qBAAqB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/FastListDataTestID.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const LIST_DATA_TESTID = {\n CONTAINER: 'fast-list-container',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AACb;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { uid } from "uid";
|
|
4
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
5
|
+
import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
|
6
|
+
import { DSFastListPropTypes, defaultProps } from "../react-desc-prop-types.js";
|
|
7
|
+
import { useValidateProps } from "./useValidateProps.js";
|
|
8
|
+
const estimateSize = () => 50;
|
|
9
|
+
const useFastList = (propsFromUser) => {
|
|
10
|
+
const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
|
|
11
|
+
useValidateProps(propsWithDefault, DSFastListPropTypes);
|
|
12
|
+
const { actionRef, count } = propsWithDefault;
|
|
13
|
+
const parentRef = React2.useRef(null);
|
|
14
|
+
const useVirtualHelpers = useVirtualizer({
|
|
15
|
+
count,
|
|
16
|
+
getScrollElement: () => parentRef.current,
|
|
17
|
+
overscan: 15,
|
|
18
|
+
estimateSize
|
|
19
|
+
});
|
|
20
|
+
const totalSize = useVirtualHelpers.getTotalSize();
|
|
21
|
+
React2.useEffect(() => {
|
|
22
|
+
if (actionRef && actionRef.current) {
|
|
23
|
+
actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;
|
|
24
|
+
}
|
|
25
|
+
}, [actionRef, useVirtualHelpers]);
|
|
26
|
+
const instanceUid = React2.useMemo(() => `ds-fast-list-${uid(6)}`, []);
|
|
27
|
+
return React2.useMemo(
|
|
28
|
+
() => ({
|
|
29
|
+
parentRef,
|
|
30
|
+
getVirtualItems: useVirtualHelpers.getVirtualItems,
|
|
31
|
+
totalSize,
|
|
32
|
+
instanceUid,
|
|
33
|
+
measureElement: useVirtualHelpers.measureElement
|
|
34
|
+
}),
|
|
35
|
+
[useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, totalSize, instanceUid]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
useFastList
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=useFastList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useFastList.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { uid } from 'uid';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSFastListT, DSFastListPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nconst estimateSize = () => 50;\n// we \"own\" the interfaces/type instead of importing from react-virtual\n// to abstract our implementation from their\ninterface VirtualItem {\n key: string | number;\n index: number;\n start: number;\n end: number;\n size: number;\n}\ntype MeasureElement = ((element: HTMLElement) => number) | ((node: Element | null) => void);\n\nexport type FastListCTX = {\n parentRef: React.MutableRefObject<HTMLDivElement | null>;\n getVirtualItems: () => VirtualItem[];\n totalSize: number;\n instanceUid: string;\n measureElement: MeasureElement;\n};\nexport const useFastList = (propsFromUser: DSFastListT.Props): FastListCTX => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSFastListT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSFastListPropTypes);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const { actionRef, count } = propsWithDefault;\n const parentRef = React.useRef<HTMLDivElement>(null);\n const useVirtualHelpers = useVirtualizer({\n count,\n getScrollElement: () => parentRef.current,\n overscan: 15,\n estimateSize,\n });\n const totalSize = useVirtualHelpers.getTotalSize();\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;\n }\n }, [actionRef, useVirtualHelpers]);\n\n const instanceUid = React.useMemo(() => `ds-fast-list-${uid(6)}`, []);\n return React.useMemo(\n () => ({\n parentRef,\n getVirtualItems: useVirtualHelpers.getVirtualItems,\n totalSize,\n instanceUid,\n measureElement: useVirtualHelpers.measureElement,\n }),\n [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, totalSize, instanceUid],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAC/B,SAAS,oCAAoC;AAC7C,SAA2B,qBAAqB,oBAAoB;AACpE,SAAS,wBAAwB;AAEjC,MAAM,eAAe,MAAM;AAmBpB,MAAM,cAAc,CAAC,kBAAkD;AAI5E,QAAM,mBAAmB,6BAAwD,eAAe,YAAY;AAC5G,mBAAiB,kBAAkB,mBAAmB;AAItD,QAAM,EAAE,WAAW,MAAM,IAAI;AAC7B,QAAM,YAAYA,OAAM,OAAuB,IAAI;AACnD,QAAM,oBAAoB,eAAe;AAAA,IACvC;AAAA,IACA,kBAAkB,MAAM,UAAU;AAAA,IAClC,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AACD,QAAM,YAAY,kBAAkB,aAAa;AACjD,EAAAA,OAAM,UAAU,MAAM;AACpB,QAAI,aAAa,UAAU,SAAS;AAClC,gBAAU,QAAQ,WAAW,kBAAkB;AAAA,IACjD;AAAA,EACF,GAAG,CAAC,WAAW,iBAAiB,CAAC;AAEjC,QAAM,cAAcA,OAAM,QAAQ,MAAM,gBAAgB,IAAI,CAAC,KAAK,CAAC,CAAC;AACpE,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA,iBAAiB,kBAAkB;AAAA,MACnC;AAAA,MACA;AAAA,MACA,gBAAgB,kBAAkB;AAAA,IACpC;AAAA,IACA,CAAC,kBAAkB,iBAAiB,kBAAkB,gBAAgB,WAAW,WAAW;AAAA,EAC9F;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
import { DSFastListName } from "../DSFastListDefinitions.js";
|
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSFastListName);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useValidateProps
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useValidateProps.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { WeakValidationMap } from 'react';\nimport { type DSFastListT } from '../react-desc-prop-types.js';\nimport { DSFastListName } from '../DSFastListDefinitions.js';\n\nexport const useValidateProps = (props: DSFastListT.InternalProps, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSFastListName);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,sBAAsB;AAExB,MAAM,mBAAmB,CAAC,OAAkC,cAAgD;AAEjH,iCAA+B,OAAO,WAAW,cAAc;AACjE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\n\nexport { type DSFastListT } from './react-desc-prop-types.js';\nexport { DSFastList, DSFastListWithSchema } from './FastList.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACIvB,eAAiC;AACjC,SAAS,YAAY,4BAA4B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import React2 from "react";
|
|
4
|
+
import { LIST_DATA_TESTID } from "../FastListDataTestID.js";
|
|
5
|
+
import { useFastList } from "../hooks/useFastList.js";
|
|
6
|
+
const List = React2.memo((props) => {
|
|
7
|
+
const { parentRef, getVirtualItems, totalSize, instanceUid, measureElement } = useFastList(props);
|
|
8
|
+
const { ItemRenderer, extraItemProps } = props;
|
|
9
|
+
const virtualItems = getVirtualItems();
|
|
10
|
+
const measureRef = React2.useCallback(
|
|
11
|
+
(node) => measureElement(node),
|
|
12
|
+
[measureElement]
|
|
13
|
+
);
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
ref: parentRef,
|
|
18
|
+
"data-testid": LIST_DATA_TESTID.CONTAINER,
|
|
19
|
+
role: "list",
|
|
20
|
+
style: {
|
|
21
|
+
width: "100%",
|
|
22
|
+
height: "100%",
|
|
23
|
+
paddingBottom: 0,
|
|
24
|
+
overflow: "auto"
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
style: {
|
|
30
|
+
width: "100%",
|
|
31
|
+
height: `${totalSize}px`,
|
|
32
|
+
position: "relative"
|
|
33
|
+
},
|
|
34
|
+
children: virtualItems.map((virtualItem) => {
|
|
35
|
+
const { index, start, key } = virtualItem;
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
ref: measureRef,
|
|
40
|
+
"data-index": index,
|
|
41
|
+
style: {
|
|
42
|
+
position: "absolute",
|
|
43
|
+
top: 0,
|
|
44
|
+
left: 0,
|
|
45
|
+
width: "100%",
|
|
46
|
+
transform: `translateY(${start}px)`
|
|
47
|
+
},
|
|
48
|
+
role: "listitem",
|
|
49
|
+
children: /* @__PURE__ */ jsx(ItemRenderer, { index, ...extraItemProps })
|
|
50
|
+
},
|
|
51
|
+
`${instanceUid}-item-${key}`
|
|
52
|
+
);
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
instanceUid
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
List
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/List.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { LIST_DATA_TESTID } from '../FastListDataTestID.js';\nimport { useFastList } from '../hooks/useFastList.js';\nimport type { DSFastListT } from '../react-desc-prop-types.js';\n\nexport const List = React.memo((props: DSFastListT.Props) => {\n const { parentRef, getVirtualItems, totalSize, instanceUid, measureElement } = useFastList(props);\n const { ItemRenderer, extraItemProps } = props;\n\n const virtualItems = getVirtualItems();\n const measureRef: React.LegacyRef<HTMLDivElement> = React.useCallback(\n (node: HTMLDivElement) => measureElement(node),\n [measureElement],\n );\n return (\n <div\n key={instanceUid}\n ref={parentRef}\n data-testid={LIST_DATA_TESTID.CONTAINER}\n role=\"list\"\n style={{\n width: '100%',\n height: '100%',\n paddingBottom: 0,\n overflow: 'auto',\n }}\n >\n <div\n style={{\n width: '100%',\n height: `${totalSize}px`,\n position: 'relative',\n }}\n >\n {virtualItems.map((virtualItem) => {\n const { index, start, key } = virtualItem;\n return (\n <div\n ref={measureRef}\n data-index={index}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${start}px)`,\n }}\n role=\"listitem\"\n key={`${instanceUid}-item-${key}`}\n >\n <ItemRenderer index={index} {...extraItemProps} />\n </div>\n );\n })}\n </div>\n </div>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACkDT;AAlDd,OAAOA,YAAW;AAClB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAGrB,MAAM,OAAOA,OAAM,KAAK,CAAC,UAA6B;AAC3D,QAAM,EAAE,WAAW,iBAAiB,WAAW,aAAa,eAAe,IAAI,YAAY,KAAK;AAChG,QAAM,EAAE,cAAc,eAAe,IAAI;AAEzC,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAA8CA,OAAM;AAAA,IACxD,CAAC,SAAyB,eAAe,IAAI;AAAA,IAC7C,CAAC,cAAc;AAAA,EACjB;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,KAAK;AAAA,MACL,eAAa,iBAAiB;AAAA,MAC9B,MAAK;AAAA,MACL,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,eAAe;AAAA,QACf,UAAU;AAAA,MACZ;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,OAAO;AAAA,YACP,QAAQ,GAAG;AAAA,YACX,UAAU;AAAA,UACZ;AAAA,UAEC,uBAAa,IAAI,CAAC,gBAAgB;AACjC,kBAAM,EAAE,OAAO,OAAO,IAAI,IAAI;AAC9B,mBACE;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,cAAY;AAAA,gBACZ,OAAO;AAAA,kBACL,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,MAAM;AAAA,kBACN,OAAO;AAAA,kBACP,WAAW,cAAc;AAAA,gBAC3B;AAAA,gBACA,MAAK;AAAA,gBAGL,8BAAC,gBAAa,OAAe,GAAG,gBAAgB;AAAA;AAAA,cAF3C,GAAG,oBAAoB;AAAA,YAG9B;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,IAtCK;AAAA,EAuCP;AAEJ,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
const defaultProps = {};
|
|
4
|
+
const DSFastListPropTypes = {
|
|
5
|
+
actionRef: PropTypes.shape({
|
|
6
|
+
current: PropTypes.oneOfType([
|
|
7
|
+
PropTypes.oneOf([null]),
|
|
8
|
+
PropTypes.shape({
|
|
9
|
+
scrollTo: PropTypes.func.description("Scroll to a index inside the list").signature(`((index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void)`)
|
|
10
|
+
})
|
|
11
|
+
])
|
|
12
|
+
}).description(`mutable reference where methods will be stored`),
|
|
13
|
+
ItemRenderer: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired.description(
|
|
14
|
+
"Render function for each item"
|
|
15
|
+
),
|
|
16
|
+
count: PropTypes.number.isRequired.description("Number of items to render"),
|
|
17
|
+
extraItemProps: PropTypes.object.description("Extra props to pass to each item")
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
DSFastListPropTypes,
|
|
21
|
+
defaultProps
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type React from 'react';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSFastListT {\n type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';\n type ScrollToOptions = {\n align: ScrollAlignment;\n };\n\n export type ActionRef = {\n scrollTo?: (index: number, options?: ScrollToOptions | undefined) => void;\n };\n export interface RequiredProps {\n ItemRenderer: React.ComponentType<{ index: number }>;\n count: number;\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n actionRef: React.MutableRefObject<ActionRef>;\n extraItemProps?: Record<string, unknown>;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {}\n}\n\nexport const defaultProps: DSFastListT.DefaultProps = {};\n\nexport const DSFastListPropTypes = {\n actionRef: PropTypes.shape({\n current: PropTypes.oneOfType([\n PropTypes.oneOf([null]),\n PropTypes.shape({\n scrollTo: PropTypes.func\n .description('Scroll to a index inside the list')\n .signature(`((index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void)`),\n }),\n ]),\n }).description(`mutable reference where methods will be stored`),\n ItemRenderer: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired.description(\n 'Render function for each item',\n ),\n count: PropTypes.number.isRequired.description('Number of items to render'),\n extraItemProps: PropTypes.object.description('Extra props to pass to each item'),\n} as React.WeakValidationMap<unknown>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AA4BnB,MAAM,eAAyC,CAAC;AAEhD,MAAM,sBAAsB;AAAA,EACjC,WAAW,UAAU,MAAM;AAAA,IACzB,SAAS,UAAU,UAAU;AAAA,MAC3B,UAAU,MAAM,CAAC,IAAI,CAAC;AAAA,MACtB,UAAU,MAAM;AAAA,QACd,UAAU,UAAU,KACjB,YAAY,mCAAmC,EAC/C,UAAU,2EAA2E;AAAA,MAC1F,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC,EAAE,YAAY,gDAAgD;AAAA,EAC/D,cAAc,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,WAAW;AAAA,IAC/E;AAAA,EACF;AAAA,EACA,OAAO,UAAU,OAAO,WAAW,YAAY,2BAA2B;AAAA,EAC1E,gBAAgB,UAAU,OAAO,YAAY,kCAAkC;AACjF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DSFastListName = "DSFastList";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DSFastListT } from './react-desc-prop-types.js';
|
|
3
|
+
declare const DSFastList: {
|
|
4
|
+
(props: DSFastListT.Props): import("react/jsx-runtime.js").JSX.Element;
|
|
5
|
+
propTypes: React.WeakValidationMap<unknown>;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
declare const DSFastListWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSFastListT.Props>;
|
|
9
|
+
export { DSFastList, DSFastListWithSchema };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DSFastListT } from '../react-desc-prop-types.js';
|
|
3
|
+
interface VirtualItem {
|
|
4
|
+
key: string | number;
|
|
5
|
+
index: number;
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
size: number;
|
|
9
|
+
}
|
|
10
|
+
type MeasureElement = ((element: HTMLElement) => number) | ((node: Element | null) => void);
|
|
11
|
+
export type FastListCTX = {
|
|
12
|
+
parentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
13
|
+
getVirtualItems: () => VirtualItem[];
|
|
14
|
+
totalSize: number;
|
|
15
|
+
instanceUid: string;
|
|
16
|
+
measureElement: MeasureElement;
|
|
17
|
+
};
|
|
18
|
+
export declare const useFastList: (propsFromUser: DSFastListT.Props) => FastListCTX;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare namespace DSFastListT {
|
|
3
|
+
type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';
|
|
4
|
+
type ScrollToOptions = {
|
|
5
|
+
align: ScrollAlignment;
|
|
6
|
+
};
|
|
7
|
+
type ActionRef = {
|
|
8
|
+
scrollTo?: (index: number, options?: ScrollToOptions | undefined) => void;
|
|
9
|
+
};
|
|
10
|
+
interface RequiredProps {
|
|
11
|
+
ItemRenderer: React.ComponentType<{
|
|
12
|
+
index: number;
|
|
13
|
+
}>;
|
|
14
|
+
count: number;
|
|
15
|
+
}
|
|
16
|
+
interface DefaultProps {
|
|
17
|
+
}
|
|
18
|
+
interface OptionalProps {
|
|
19
|
+
actionRef: React.MutableRefObject<ActionRef>;
|
|
20
|
+
extraItemProps?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {
|
|
23
|
+
}
|
|
24
|
+
interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export declare const defaultProps: DSFastListT.DefaultProps;
|
|
28
|
+
export declare const DSFastListPropTypes: React.WeakValidationMap<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type MakeTesteableParams = {
|
|
2
|
+
overscan: number;
|
|
3
|
+
itemHeight: number;
|
|
4
|
+
parentHeight: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const makeDSVirtualListTesteable: ({ overscan, itemHeight, parentHeight, width, }: MakeTesteableParams) => void;
|
|
8
|
+
export declare const undoDSVirtualListTesteable: () => Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { toHaveNoViolations } from './toHaveNoViolations.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AxeResults, Result } from 'axe-core';
|
|
2
|
+
export declare const toHaveNoViolations: {
|
|
3
|
+
toHaveNoViolations(results: AxeResults): {
|
|
4
|
+
message: () => string;
|
|
5
|
+
pass: true;
|
|
6
|
+
actual: Result[];
|
|
7
|
+
} | {
|
|
8
|
+
message: () => string;
|
|
9
|
+
pass: false;
|
|
10
|
+
actual: Result[];
|
|
11
|
+
};
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-fast-list",
|
|
3
|
+
"version": "3.18.0-next.10",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "ICE MT - Dimsum - Virtual List",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./VirtualListDataTestID": {
|
|
18
|
+
"import": "./dist/esm/VirtualListDataTestID.js",
|
|
19
|
+
"require": "./dist/cjs/VirtualListDataTestID.js"
|
|
20
|
+
},
|
|
21
|
+
"./VirtualList": {
|
|
22
|
+
"import": "./dist/esm/VirtualList.js",
|
|
23
|
+
"require": "./dist/cjs/VirtualList.js"
|
|
24
|
+
},
|
|
25
|
+
"./styled": {
|
|
26
|
+
"import": "./dist/esm/styled.js",
|
|
27
|
+
"require": "./dist/cjs/styled.js"
|
|
28
|
+
},
|
|
29
|
+
"./props": {
|
|
30
|
+
"import": "./dist/esm/props.js",
|
|
31
|
+
"require": "./dist/cjs/props.js"
|
|
32
|
+
},
|
|
33
|
+
"./parts/List": {
|
|
34
|
+
"import": "./dist/esm/parts/List.js",
|
|
35
|
+
"require": "./dist/cjs/parts/List.js"
|
|
36
|
+
},
|
|
37
|
+
"./hooks/useVirtualList": {
|
|
38
|
+
"import": "./dist/esm/hooks/useVirtualList.js",
|
|
39
|
+
"require": "./dist/cjs/hooks/useVirtualList.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": [
|
|
43
|
+
"*.css",
|
|
44
|
+
"*.scss"
|
|
45
|
+
],
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"pnpm": ">=6",
|
|
52
|
+
"node": ">=16"
|
|
53
|
+
},
|
|
54
|
+
"author": "ICE MT",
|
|
55
|
+
"jestSonar": {
|
|
56
|
+
"sonar56x": true,
|
|
57
|
+
"reportPath": "reports",
|
|
58
|
+
"reportFile": "tests.xml",
|
|
59
|
+
"indent": 4
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@tanstack/react-virtual": "3.0.0-beta.54",
|
|
63
|
+
"@xstyled/system": "3.7.0",
|
|
64
|
+
"axe-core": "^4.6.3",
|
|
65
|
+
"uid": "^2.0.1",
|
|
66
|
+
"@elliemae/ds-props-helpers": "3.18.0-next.10",
|
|
67
|
+
"@elliemae/ds-system": "3.18.0-next.10"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@testing-library/react": "^11.2.6",
|
|
71
|
+
"styled-components": "~5.3.9",
|
|
72
|
+
"@elliemae/ds-test-utils": "3.18.0-next.10"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"lodash": "^4.17.21",
|
|
76
|
+
"react": "~17.0.2",
|
|
77
|
+
"react-dom": "^17.0.2",
|
|
78
|
+
"styled-components": "~5.3.6"
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public",
|
|
82
|
+
"typeSafety": false
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
86
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
87
|
+
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../.eslintrc.js' src/",
|
|
88
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
89
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
|
90
|
+
"dev:build": "pnpm --filter {.}... build",
|
|
91
|
+
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
92
|
+
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\"",
|
|
93
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch"
|
|
94
|
+
}
|
|
95
|
+
}
|