@elliemae/ds-virtual-list 3.14.0-next.1 → 3.14.0-next.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.
@@ -32,15 +32,11 @@ var React = __toESM(require("react"));
32
32
  var import_jsx_runtime = require("react/jsx-runtime");
33
33
  var import_ds_utilities = require("@elliemae/ds-utilities");
34
34
  var import_List = require("./parts/List");
35
- var import_props = require("./props");
35
+ var import_react_desc_prop_types = require("./react-desc-prop-types");
36
36
  var import_DSVirtualListDefinitions = require("./DSVirtualListDefinitions");
37
- const DSVirtualList = (props) => {
38
- const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_props.defaultProps);
39
- (0, import_ds_utilities.useValidateTypescriptPropTypes)(propsWithDefault, import_props.DSVirtualListSchema, import_DSVirtualListDefinitions.DSVirtualListName);
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_List.List, { ...propsWithDefault });
41
- };
42
- DSVirtualList.propTypes = import_props.DSVirtualListSchema;
37
+ const DSVirtualList = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_List.List, { ...props });
38
+ DSVirtualList.propTypes = import_react_desc_prop_types.DSVirtualListPropTypes;
43
39
  DSVirtualList.displayName = import_DSVirtualListDefinitions.DSVirtualListName;
44
40
  const DSVirtualListWithSchema = (0, import_ds_utilities.describe)(DSVirtualList).description("DSVirtualList");
45
- DSVirtualListWithSchema.propTypes = import_props.DSVirtualListSchema;
41
+ DSVirtualListWithSchema.propTypes = import_react_desc_prop_types.DSVirtualListPropTypes;
46
42
  //# sourceMappingURL=VirtualList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/VirtualList.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from '@elliemae/ds-utilities';\nimport { List } from './parts/List';\nimport { DSVirtualListSchema, defaultProps } from './props';\nimport type { DSVirtualListProps } from './index.d';\nimport { DSVirtualListName } from './DSVirtualListDefinitions';\n\nconst DSVirtualList: React.ComponentType<DSVirtualListProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSVirtualListSchema, DSVirtualListName);\n\n return <List {...propsWithDefault} />;\n};\n\nDSVirtualList.propTypes = DSVirtualListSchema;\nDSVirtualList.displayName = DSVirtualListName;\nconst DSVirtualListWithSchema = describe(DSVirtualList).description('DSVirtualList');\nDSVirtualListWithSchema.propTypes = DSVirtualListSchema;\n\nexport { DSVirtualList, DSVirtualListWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWd;AAVT,0BAAuF;AACvF,kBAAqB;AACrB,mBAAkD;AAElD,sCAAkC;AAElC,MAAM,gBAAyD,CAAC,UAAU;AACxE,QAAM,uBAAmB,kDAA6B,OAAO,yBAAY;AACzE,0DAA+B,kBAAkB,kCAAqB,iDAAiB;AAEvF,SAAO,4CAAC,oBAAM,GAAG,kBAAkB;AACrC;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,8BAA0B,8BAAS,aAAa,EAAE,YAAY,eAAe;AACnF,wBAAwB,YAAY;",
4
+ "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { List } from './parts/List';\nimport { DSVirtualListPropTypes, type DSVirtualListT } from './react-desc-prop-types';\nimport { DSVirtualListName } from './DSVirtualListDefinitions';\n\n// we are not using a context nor zustand so all the logic is handled in List...\nconst DSVirtualList = (props: DSVirtualListT.Props) => <List {...props} />;\n\nDSVirtualList.propTypes = DSVirtualListPropTypes;\nDSVirtualList.displayName = DSVirtualListName;\nconst DSVirtualListWithSchema = describe(DSVirtualList).description('DSVirtualList');\nDSVirtualListWithSchema.propTypes = DSVirtualListPropTypes;\n\nexport { DSVirtualList, DSVirtualListWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADOgC;AANvD,0BAAyB;AACzB,kBAAqB;AACrB,mCAA4D;AAC5D,sCAAkC;AAGlC,MAAM,gBAAgB,CAAC,UAAgC,4CAAC,oBAAM,GAAG,OAAO;AAExE,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,8BAA0B,8BAAS,aAAa,EAAE,YAAY,eAAe;AACnF,wBAAwB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -22,31 +22,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var styled_exports = {};
26
- __export(styled_exports, {
27
- StyledContainerContentList: () => StyledContainerContentList,
28
- StyledVirtualList: () => StyledVirtualList,
29
- VirtualItemStyled: () => VirtualItemStyled
25
+ var useValidateProps_exports = {};
26
+ __export(useValidateProps_exports, {
27
+ useValidateProps: () => useValidateProps
30
28
  });
31
- module.exports = __toCommonJS(styled_exports);
29
+ module.exports = __toCommonJS(useValidateProps_exports);
32
30
  var React = __toESM(require("react"));
33
- var import_ds_system = require("@elliemae/ds-system");
34
- const StyledContainerContentList = import_ds_system.styled.div`
35
- width: 100%;
36
- height: 100%;
37
- padding-bottom: 0;
38
- overflow-y: auto;
39
- overflow-x: hidden;
40
- `;
41
- const StyledVirtualList = import_ds_system.styled.div`
42
- width: 100%;
43
- height: ${(props) => props.height};
44
- position: relative;
45
- `;
46
- const VirtualItemStyled = import_ds_system.styled.div`
47
- position: absolute;
48
- top: 0;
49
- left: 0;
50
- width: 100%;
51
- `;
52
- //# sourceMappingURL=styled.js.map
31
+ var import_ds_utilities = require("@elliemae/ds-utilities");
32
+ var import_DSVirtualListDefinitions = require("../DSVirtualListDefinitions");
33
+ const useValidateProps = (props, propTypes) => {
34
+ (0, import_ds_utilities.useValidateTypescriptPropTypes)(props, propTypes, import_DSVirtualListDefinitions.DSVirtualListName);
35
+ };
36
+ //# 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-utilities';\nimport type { WeakValidationMap } from 'react';\nimport { type DSVirtualListT } from '../react-desc-prop-types';\nimport { DSVirtualListName } from '../DSVirtualListDefinitions';\n\nexport const useValidateProps = (props: DSVirtualListT.InternalProps, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSVirtualListName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA+C;AAG/C,sCAAkC;AAE3B,MAAM,mBAAmB,CAAC,OAAqC,cAAgD;AAEpH,0DAA+B,OAAO,WAAW,iDAAiB;AACpE;",
6
+ "names": []
7
+ }
@@ -24,34 +24,49 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
25
  var useVirtualList_exports = {};
26
26
  __export(useVirtualList_exports, {
27
- useVirtualList: () => useVirtualList
27
+ useVirtualListV3: () => useVirtualListV3
28
28
  });
29
29
  module.exports = __toCommonJS(useVirtualList_exports);
30
30
  var React = __toESM(require("react"));
31
31
  var import_react = __toESM(require("react"));
32
- var import_react_virtual = require("react-virtual");
33
- const useVirtualList = (config) => {
34
- const { children, actionRef } = config;
35
- const parentRef = import_react.default.useRef();
32
+ var import_uid = require("uid");
33
+ var import_react_virtual = require("@tanstack/react-virtual");
34
+ var import_ds_utilities = require("@elliemae/ds-utilities");
35
+ var import_react_desc_prop_types = require("../react-desc-prop-types");
36
+ var import_useValidateProps = require("./useValidateProps");
37
+ const estimateSize = () => 50;
38
+ const useVirtualListV3 = (propsFromUser) => {
39
+ const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
40
+ (0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSVirtualListPropTypes);
41
+ const { children, actionRef } = propsWithDefault;
42
+ const parentRef = import_react.default.useRef(null);
36
43
  const filteredChildren = import_react.default.useMemo(
37
- () => import_react.default.Children.toArray(children).filter((child) => child),
44
+ () => import_react.default.Children.toArray(children).filter((child) => child !== void 0 && child !== null),
38
45
  [children]
39
46
  );
40
- const useVirtualHelpers = (0, import_react_virtual.useVirtual)({
41
- size: filteredChildren.length,
42
- parentRef,
43
- overscan: 15
47
+ const useVirtualHelpers = (0, import_react_virtual.useVirtualizer)({
48
+ count: filteredChildren.length,
49
+ getScrollElement: () => parentRef.current,
50
+ overscan: 15,
51
+ estimateSize
44
52
  });
53
+ const totalSize = useVirtualHelpers.getTotalSize();
45
54
  import_react.default.useEffect(() => {
46
- if (actionRef) {
55
+ if (actionRef && actionRef.current) {
47
56
  actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;
48
57
  }
49
58
  }, [actionRef, useVirtualHelpers]);
50
- return {
51
- parentRef,
52
- virtualItems: useVirtualHelpers.virtualItems,
53
- filteredChildren,
54
- totalSize: useVirtualHelpers.totalSize
55
- };
59
+ const instanceUid = import_react.default.useMemo(() => `ds-virtual-list-${(0, import_uid.uid)(6)}`, []);
60
+ return import_react.default.useMemo(
61
+ () => ({
62
+ parentRef,
63
+ getVirtualItems: useVirtualHelpers.getVirtualItems,
64
+ filteredChildren,
65
+ totalSize,
66
+ instanceUid,
67
+ measureElement: useVirtualHelpers.measureElement
68
+ }),
69
+ [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, filteredChildren, totalSize, instanceUid]
70
+ );
56
71
  };
57
72
  //# sourceMappingURL=useVirtualList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useVirtualList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport type { VirtualItem } from 'react-virtual';\nimport { useVirtual } from 'react-virtual';\nimport type { DSVirtualListProps } from '../index.d';\n\nexport const useVirtualList = (\n config: DSVirtualListProps,\n): {\n parentRef: React.MutableRefObject<HTMLDivElement>;\n virtualItems: VirtualItem[];\n filteredChildren: React.ReactNode[];\n totalSize: number;\n} => {\n const { children, actionRef } = config;\n const parentRef = React.useRef<HTMLDivElement>();\n const filteredChildren = React.useMemo(\n () => React.Children.toArray(children).filter((child) => child),\n [children],\n ) as React.ReactNode[];\n const useVirtualHelpers = useVirtual({\n size: filteredChildren.length,\n parentRef,\n overscan: 15,\n });\n React.useEffect(() => {\n if (actionRef) {\n actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;\n }\n }, [actionRef, useVirtualHelpers]);\n\n return {\n parentRef,\n virtualItems: useVirtualHelpers.virtualItems,\n filteredChildren,\n totalSize: useVirtualHelpers.totalSize,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,2BAA2B;AAGpB,MAAM,iBAAiB,CAC5B,WAMG;AACH,QAAM,EAAE,UAAU,UAAU,IAAI;AAChC,QAAM,YAAY,aAAAA,QAAM,OAAuB;AAC/C,QAAM,mBAAmB,aAAAA,QAAM;AAAA,IAC7B,MAAM,aAAAA,QAAM,SAAS,QAAQ,QAAQ,EAAE,OAAO,CAAC,UAAU,KAAK;AAAA,IAC9D,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,wBAAoB,iCAAW;AAAA,IACnC,MAAM,iBAAiB;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,eAAAA,QAAM,UAAU,MAAM;AACpB,QAAI,WAAW;AACb,gBAAU,QAAQ,WAAW,kBAAkB;AAAA,IACjD;AAAA,EACF,GAAG,CAAC,WAAW,iBAAiB,CAAC;AAEjC,SAAO;AAAA,IACL;AAAA,IACA,cAAc,kBAAkB;AAAA,IAChC;AAAA,IACA,WAAW,kBAAkB;AAAA,EAC/B;AACF;",
4
+ "sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { type DSVirtualListT, DSVirtualListPropTypes, defaultProps } from '../react-desc-prop-types';\nimport { useValidateProps } from './useValidateProps';\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 VirtualListCTX = {\n parentRef: React.MutableRefObject<HTMLDivElement | null>;\n getVirtualItems: () => VirtualItem[];\n filteredChildren: React.ReactNode[];\n totalSize: number;\n instanceUid: string;\n measureElement: MeasureElement;\n};\nexport const useVirtualListV3 = (propsFromUser: DSVirtualListT.Props): VirtualListCTX => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSVirtualListT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSVirtualListPropTypes);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const { children, actionRef } = propsWithDefault;\n const parentRef = React.useRef<HTMLDivElement>(null);\n const filteredChildren = React.useMemo(\n () => React.Children.toArray(children).filter((child) => child !== undefined && child !== null),\n [children],\n ) as React.ReactNode[];\n const useVirtualHelpers = useVirtualizer({\n count: filteredChildren.length,\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-virtual-list-${uid(6)}`, []);\n return React.useMemo(\n () => ({\n parentRef,\n getVirtualItems: useVirtualHelpers.getVirtualItems,\n filteredChildren,\n totalSize,\n instanceUid,\n measureElement: useVirtualHelpers.measureElement,\n }),\n [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, filteredChildren, 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,0BAA6C;AAC7C,mCAA0E;AAC1E,8BAAiC;AAEjC,MAAM,eAAe,MAAM;AAoBpB,MAAM,mBAAmB,CAAC,kBAAwD;AAIvF,QAAM,uBAAmB,kDAA2D,eAAe,yCAAY;AAC/G,gDAAiB,kBAAkB,mDAAsB;AAIzD,QAAM,EAAE,UAAU,UAAU,IAAI;AAChC,QAAM,YAAY,aAAAA,QAAM,OAAuB,IAAI;AACnD,QAAM,mBAAmB,aAAAA,QAAM;AAAA,IAC7B,MAAM,aAAAA,QAAM,SAAS,QAAQ,QAAQ,EAAE,OAAO,CAAC,UAAU,UAAU,UAAa,UAAU,IAAI;AAAA,IAC9F,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,wBAAoB,qCAAe;AAAA,IACvC,OAAO,iBAAiB;AAAA,IACxB,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,uBAAmB,gBAAI,CAAC,KAAK,CAAC,CAAC;AACvE,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA,iBAAiB,kBAAkB;AAAA,MACnC;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,kBAAkB;AAAA,IACpC;AAAA,IACA,CAAC,kBAAkB,iBAAiB,kBAAkB,gBAAgB,kBAAkB,WAAW,WAAW;AAAA,EAChH;AACF;",
6
6
  "names": ["React"]
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
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
+ };
8
12
  var __copyProps = (to, from, except, desc) => {
9
13
  if (from && typeof from === "object" || typeof from === "function") {
10
14
  for (let key of __getOwnPropNames(from))
@@ -13,14 +17,18 @@ var __copyProps = (to, from, except, desc) => {
13
17
  }
14
18
  return to;
15
19
  };
16
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
19
22
  mod
20
23
  ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var src_exports = {};
26
+ __export(src_exports, {
27
+ DSVirtualList: () => import_VirtualList.DSVirtualList,
28
+ DSVirtualListWithSchema: () => import_VirtualList.DSVirtualListWithSchema
29
+ });
23
30
  module.exports = __toCommonJS(src_exports);
24
31
  var React = __toESM(require("react"));
25
- __reExport(src_exports, require("./VirtualList"), module.exports);
32
+ var import_react_desc_prop_types = require("./react-desc-prop-types");
33
+ var import_VirtualList = require("./VirtualList");
26
34
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './VirtualList';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,0BAAd;",
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 DSVirtualListT } from './react-desc-prop-types';\nexport { DSVirtualList, DSVirtualListWithSchema } from './VirtualList';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mCAAoC;AACpC,yBAAuD;",
6
6
  "names": []
7
7
  }
@@ -30,35 +30,59 @@ module.exports = __toCommonJS(List_exports);
30
30
  var React = __toESM(require("react"));
31
31
  var import_jsx_runtime = require("react/jsx-runtime");
32
32
  var import_react = __toESM(require("react"));
33
- var import_uid = require("uid");
34
- var import_styled = require("../styled");
35
33
  var import_VirtualListDataTestID = require("../VirtualListDataTestID");
36
34
  var import_useVirtualList = require("../hooks/useVirtualList");
37
35
  const List = (props) => {
38
- const { parentRef, virtualItems, filteredChildren, totalSize } = (0, import_useVirtualList.useVirtualList)(props);
39
- const [dynamicRerenderWorkaround, setDynamicRerenderWorkaround] = import_react.default.useState((0, import_uid.uid)(6));
40
- const virtualChildren = import_react.default.useMemo(
41
- () => virtualItems.map((virtualItem) => {
42
- const { index, measureRef, start } = virtualItem;
43
- const style = {
44
- transform: `translateY(${start}px)`
45
- };
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.VirtualItemStyled, { ref: measureRef, style, role: "listitem", children: filteredChildren[index] }, `ds-virtual-list-item-${(0, import_uid.uid)(6)}`);
47
- }),
48
- [filteredChildren, virtualItems]
36
+ const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement } = (0, import_useVirtualList.useVirtualListV3)(props);
37
+ const virtualItems = getVirtualItems();
38
+ const measureRef = import_react.default.useCallback(
39
+ (node) => measureElement(node),
40
+ [measureElement]
49
41
  );
50
- import_react.default.useEffect(() => {
51
- setDynamicRerenderWorkaround((0, import_uid.uid)(6));
52
- }, [filteredChildren]);
53
42
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
- import_styled.StyledContainerContentList,
43
+ "div",
55
44
  {
56
45
  ref: parentRef,
57
46
  "data-testid": import_VirtualListDataTestID.LIST_DATA_TESTID.CONTAINER,
58
47
  role: "list",
59
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledVirtualList, { height: `${totalSize}px`, children: virtualChildren })
48
+ style: {
49
+ width: "100%",
50
+ height: "100%",
51
+ paddingBottom: 0,
52
+ overflow: "auto"
53
+ },
54
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
+ "div",
56
+ {
57
+ style: {
58
+ width: "100%",
59
+ height: `${totalSize}px`,
60
+ position: "relative"
61
+ },
62
+ children: virtualItems.map((virtualItem) => {
63
+ const { index, start, key } = virtualItem;
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ "div",
66
+ {
67
+ ref: measureRef,
68
+ "data-index": index,
69
+ style: {
70
+ position: "absolute",
71
+ top: 0,
72
+ left: 0,
73
+ width: "100%",
74
+ transform: `translateY(${start}px)`
75
+ },
76
+ role: "listitem",
77
+ children: filteredChildren[index]
78
+ },
79
+ `${instanceUid}-item-${key}`
80
+ );
81
+ })
82
+ }
83
+ )
60
84
  },
61
- `ds-virtual-list-${dynamicRerenderWorkaround}`
85
+ instanceUid
62
86
  );
63
87
  };
64
88
  //# sourceMappingURL=List.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/parts/List.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from '../styled';\n\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID';\n\nimport type { DSVirtualListProps } from '../index.d';\nimport { useVirtualList } from '../hooks/useVirtualList';\n\n/**\n * List component: renders a list of items\n * Accessibility: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/List_role\n *\n * @param {DSVirtualListProps} props\n * @returns JSX\n */\nexport const List: React.FC<DSVirtualListProps> = (props: DSVirtualListProps) => {\n const { parentRef, virtualItems, filteredChildren, totalSize } = useVirtualList(props);\n const [dynamicRerenderWorkaround, setDynamicRerenderWorkaround] = React.useState(uid(6));\n const virtualChildren = React.useMemo(\n () =>\n virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const style = {\n transform: `translateY(${start}px)`,\n };\n return (\n <VirtualItemStyled ref={measureRef} style={style} role=\"listitem\" key={`ds-virtual-list-item-${uid(6)}`}>\n {filteredChildren[index]}\n </VirtualItemStyled>\n );\n }),\n [filteredChildren, virtualItems],\n );\n React.useEffect(() => {\n setDynamicRerenderWorkaround(uid(6));\n }, [filteredChildren]);\n return (\n <StyledContainerContentList\n key={`ds-virtual-list-${dynamicRerenderWorkaround}`}\n ref={parentRef}\n data-testid={LIST_DATA_TESTID.CONTAINER}\n role=\"list\"\n >\n <StyledVirtualList height={`${totalSize}px`}>{virtualChildren}</StyledVirtualList>\n </StyledContainerContentList>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2Bb;AA3BV,mBAAkB;AAClB,iBAAoB;AACpB,oBAAiF;AAEjF,mCAAiC;AAGjC,4BAA+B;AASxB,MAAM,OAAqC,CAAC,UAA8B;AAC/E,QAAM,EAAE,WAAW,cAAc,kBAAkB,UAAU,QAAI,sCAAe,KAAK;AACrF,QAAM,CAAC,2BAA2B,4BAA4B,IAAI,aAAAA,QAAM,aAAS,gBAAI,CAAC,CAAC;AACvF,QAAM,kBAAkB,aAAAA,QAAM;AAAA,IAC5B,MACE,aAAa,IAAI,CAAC,gBAAgB;AAChC,YAAM,EAAE,OAAO,YAAY,MAAM,IAAI;AACrC,YAAM,QAAQ;AAAA,QACZ,WAAW,cAAc;AAAA,MAC3B;AACA,aACE,4CAAC,mCAAkB,KAAK,YAAY,OAAc,MAAK,YACpD,2BAAiB,UADmD,4BAAwB,gBAAI,CAAC,GAEpG;AAAA,IAEJ,CAAC;AAAA,IACH,CAAC,kBAAkB,YAAY;AAAA,EACjC;AACA,eAAAA,QAAM,UAAU,MAAM;AACpB,qCAA6B,gBAAI,CAAC,CAAC;AAAA,EACrC,GAAG,CAAC,gBAAgB,CAAC;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,KAAK;AAAA,MACL,eAAa,8CAAiB;AAAA,MAC9B,MAAK;AAAA,MAEL,sDAAC,mCAAkB,QAAQ,GAAG,eAAgB,2BAAgB;AAAA;AAAA,IALzD,mBAAmB;AAAA,EAM1B;AAEJ;",
4
+ "sourcesContent": ["import React from 'react';\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID';\nimport { useVirtualListV3 } from '../hooks/useVirtualList';\nimport type { DSVirtualListT } from '../react-desc-prop-types';\n\nexport const List = (props: DSVirtualListT.Props) => {\n const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement } =\n useVirtualListV3(props);\n const virtualItems = getVirtualItems();\n const measureRef: React.LegacyRef<HTMLDivElement> = React.useCallback(\n (node: HTMLDivElement) => measureElement(node),\n [measureElement],\n );\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 {filteredChildren[index]}\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;ADqCX;AArCZ,mBAAkB;AAClB,mCAAiC;AACjC,4BAAiC;AAG1B,MAAM,OAAO,CAAC,UAAgC;AACnD,QAAM,EAAE,WAAW,iBAAiB,kBAAkB,WAAW,aAAa,eAAe,QAC3F,wCAAiB,KAAK;AACxB,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAA8C,aAAAA,QAAM;AAAA,IACxD,CAAC,SAAyB,eAAe,IAAI;AAAA,IAC7C,CAAC,cAAc;AAAA,EACjB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,KAAK;AAAA,MACL,eAAa,8CAAiB;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,gBAGJ,2BAAiB;AAAA;AAAA,cAFb,GAAG,oBAAoB;AAAA,YAG9B;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,IAtCK;AAAA,EAuCP;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,45 @@
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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var react_desc_prop_types_exports = {};
26
+ __export(react_desc_prop_types_exports, {
27
+ DSVirtualListPropTypes: () => DSVirtualListPropTypes,
28
+ defaultProps: () => defaultProps
29
+ });
30
+ module.exports = __toCommonJS(react_desc_prop_types_exports);
31
+ var React = __toESM(require("react"));
32
+ var import_ds_utilities = require("@elliemae/ds-utilities");
33
+ const defaultProps = {};
34
+ const DSVirtualListPropTypes = {
35
+ children: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.node).description("Children list").isRequired,
36
+ actionRef: import_ds_utilities.PropTypes.shape({
37
+ current: import_ds_utilities.PropTypes.oneOfType([
38
+ import_ds_utilities.PropTypes.oneOf([null]),
39
+ import_ds_utilities.PropTypes.shape({
40
+ scrollTo: import_ds_utilities.PropTypes.func.description("Scroll to a index inside the list").signature(`((index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void)`)
41
+ })
42
+ ])
43
+ }).description(`mutable reference where methods will be stored`)
44
+ };
45
+ //# 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 React from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\n\nexport declare namespace DSVirtualListT {\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 children: React.ReactNode;\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n actionRef: React.MutableRefObject<ActionRef>;\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: DSVirtualListT.DefaultProps = {};\n\nexport const DSVirtualListPropTypes = {\n children: PropTypes.arrayOf(PropTypes.node).description('Children list').isRequired,\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} as React.WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,0BAA0B;AA0BnB,MAAM,eAA4C,CAAC;AAEnD,MAAM,yBAAyB;AAAA,EACpC,UAAU,8BAAU,QAAQ,8BAAU,IAAI,EAAE,YAAY,eAAe,EAAE;AAAA,EACzE,WAAW,8BAAU,MAAM;AAAA,IACzB,SAAS,8BAAU,UAAU;AAAA,MAC3B,8BAAU,MAAM,CAAC,IAAI,CAAC;AAAA,MACtB,8BAAU,MAAM;AAAA,QACd,UAAU,8BAAU,KACjB,YAAY,mCAAmC,EAC/C,UAAU,2EAA2E;AAAA,MAC1F,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC,EAAE,YAAY,gDAAgD;AACjE;",
6
+ "names": []
7
+ }
@@ -1,18 +1,14 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from "@elliemae/ds-utilities";
3
+ import { describe } from "@elliemae/ds-utilities";
4
4
  import { List } from "./parts/List";
5
- import { DSVirtualListSchema, defaultProps } from "./props";
5
+ import { DSVirtualListPropTypes } from "./react-desc-prop-types";
6
6
  import { DSVirtualListName } from "./DSVirtualListDefinitions";
7
- const DSVirtualList = (props) => {
8
- const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
9
- useValidateTypescriptPropTypes(propsWithDefault, DSVirtualListSchema, DSVirtualListName);
10
- return /* @__PURE__ */ jsx(List, { ...propsWithDefault });
11
- };
12
- DSVirtualList.propTypes = DSVirtualListSchema;
7
+ const DSVirtualList = (props) => /* @__PURE__ */ jsx(List, { ...props });
8
+ DSVirtualList.propTypes = DSVirtualListPropTypes;
13
9
  DSVirtualList.displayName = DSVirtualListName;
14
10
  const DSVirtualListWithSchema = describe(DSVirtualList).description("DSVirtualList");
15
- DSVirtualListWithSchema.propTypes = DSVirtualListSchema;
11
+ DSVirtualListWithSchema.propTypes = DSVirtualListPropTypes;
16
12
  export {
17
13
  DSVirtualList,
18
14
  DSVirtualListWithSchema
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/VirtualList.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from '@elliemae/ds-utilities';\nimport { List } from './parts/List';\nimport { DSVirtualListSchema, defaultProps } from './props';\nimport type { DSVirtualListProps } from './index.d';\nimport { DSVirtualListName } from './DSVirtualListDefinitions';\n\nconst DSVirtualList: React.ComponentType<DSVirtualListProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSVirtualListSchema, DSVirtualListName);\n\n return <List {...propsWithDefault} />;\n};\n\nDSVirtualList.propTypes = DSVirtualListSchema;\nDSVirtualList.displayName = DSVirtualListName;\nconst DSVirtualListWithSchema = describe(DSVirtualList).description('DSVirtualList');\nDSVirtualListWithSchema.propTypes = DSVirtualListSchema;\n\nexport { DSVirtualList, DSVirtualListWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACWd;AAVT,SAAS,8BAA8B,gCAAgC,gBAAgB;AACvF,SAAS,YAAY;AACrB,SAAS,qBAAqB,oBAAoB;AAElD,SAAS,yBAAyB;AAElC,MAAM,gBAAyD,CAAC,UAAU;AACxE,QAAM,mBAAmB,6BAA6B,OAAO,YAAY;AACzE,iCAA+B,kBAAkB,qBAAqB,iBAAiB;AAEvF,SAAO,oBAAC,QAAM,GAAG,kBAAkB;AACrC;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa,EAAE,YAAY,eAAe;AACnF,wBAAwB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { List } from './parts/List';\nimport { DSVirtualListPropTypes, type DSVirtualListT } from './react-desc-prop-types';\nimport { DSVirtualListName } from './DSVirtualListDefinitions';\n\n// we are not using a context nor zustand so all the logic is handled in List...\nconst DSVirtualList = (props: DSVirtualListT.Props) => <List {...props} />;\n\nDSVirtualList.propTypes = DSVirtualListPropTypes;\nDSVirtualList.displayName = DSVirtualListName;\nconst DSVirtualListWithSchema = describe(DSVirtualList).description('DSVirtualList');\nDSVirtualListWithSchema.propTypes = DSVirtualListPropTypes;\n\nexport { DSVirtualList, DSVirtualListWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACOgC;AANvD,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,8BAAmD;AAC5D,SAAS,yBAAyB;AAGlC,MAAM,gBAAgB,CAAC,UAAgC,oBAAC,QAAM,GAAG,OAAO;AAExE,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa,EAAE,YAAY,eAAe;AACnF,wBAAwB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
3
+ import { DSVirtualListName } from "../DSVirtualListDefinitions";
4
+ const useValidateProps = (props, propTypes) => {
5
+ useValidateTypescriptPropTypes(props, propTypes, DSVirtualListName);
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-utilities';\nimport type { WeakValidationMap } from 'react';\nimport { type DSVirtualListT } from '../react-desc-prop-types';\nimport { DSVirtualListName } from '../DSVirtualListDefinitions';\n\nexport const useValidateProps = (props: DSVirtualListT.InternalProps, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSVirtualListName);\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,yBAAyB;AAE3B,MAAM,mBAAmB,CAAC,OAAqC,cAAgD;AAEpH,iCAA+B,OAAO,WAAW,iBAAiB;AACpE;",
6
+ "names": []
7
+ }
@@ -1,31 +1,46 @@
1
1
  import * as React from "react";
2
2
  import React2 from "react";
3
- import { useVirtual } from "react-virtual";
4
- const useVirtualList = (config) => {
5
- const { children, actionRef } = config;
6
- const parentRef = React2.useRef();
3
+ import { uid } from "uid";
4
+ import { useVirtualizer } from "@tanstack/react-virtual";
5
+ import { useMemoMergePropsWithDefault } from "@elliemae/ds-utilities";
6
+ import { DSVirtualListPropTypes, defaultProps } from "../react-desc-prop-types";
7
+ import { useValidateProps } from "./useValidateProps";
8
+ const estimateSize = () => 50;
9
+ const useVirtualListV3 = (propsFromUser) => {
10
+ const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
11
+ useValidateProps(propsWithDefault, DSVirtualListPropTypes);
12
+ const { children, actionRef } = propsWithDefault;
13
+ const parentRef = React2.useRef(null);
7
14
  const filteredChildren = React2.useMemo(
8
- () => React2.Children.toArray(children).filter((child) => child),
15
+ () => React2.Children.toArray(children).filter((child) => child !== void 0 && child !== null),
9
16
  [children]
10
17
  );
11
- const useVirtualHelpers = useVirtual({
12
- size: filteredChildren.length,
13
- parentRef,
14
- overscan: 15
18
+ const useVirtualHelpers = useVirtualizer({
19
+ count: filteredChildren.length,
20
+ getScrollElement: () => parentRef.current,
21
+ overscan: 15,
22
+ estimateSize
15
23
  });
24
+ const totalSize = useVirtualHelpers.getTotalSize();
16
25
  React2.useEffect(() => {
17
- if (actionRef) {
26
+ if (actionRef && actionRef.current) {
18
27
  actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;
19
28
  }
20
29
  }, [actionRef, useVirtualHelpers]);
21
- return {
22
- parentRef,
23
- virtualItems: useVirtualHelpers.virtualItems,
24
- filteredChildren,
25
- totalSize: useVirtualHelpers.totalSize
26
- };
30
+ const instanceUid = React2.useMemo(() => `ds-virtual-list-${uid(6)}`, []);
31
+ return React2.useMemo(
32
+ () => ({
33
+ parentRef,
34
+ getVirtualItems: useVirtualHelpers.getVirtualItems,
35
+ filteredChildren,
36
+ totalSize,
37
+ instanceUid,
38
+ measureElement: useVirtualHelpers.measureElement
39
+ }),
40
+ [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, filteredChildren, totalSize, instanceUid]
41
+ );
27
42
  };
28
43
  export {
29
- useVirtualList
44
+ useVirtualListV3
30
45
  };
31
46
  //# sourceMappingURL=useVirtualList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useVirtualList.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { VirtualItem } from 'react-virtual';\nimport { useVirtual } from 'react-virtual';\nimport type { DSVirtualListProps } from '../index.d';\n\nexport const useVirtualList = (\n config: DSVirtualListProps,\n): {\n parentRef: React.MutableRefObject<HTMLDivElement>;\n virtualItems: VirtualItem[];\n filteredChildren: React.ReactNode[];\n totalSize: number;\n} => {\n const { children, actionRef } = config;\n const parentRef = React.useRef<HTMLDivElement>();\n const filteredChildren = React.useMemo(\n () => React.Children.toArray(children).filter((child) => child),\n [children],\n ) as React.ReactNode[];\n const useVirtualHelpers = useVirtual({\n size: filteredChildren.length,\n parentRef,\n overscan: 15,\n });\n React.useEffect(() => {\n if (actionRef) {\n actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;\n }\n }, [actionRef, useVirtualHelpers]);\n\n return {\n parentRef,\n virtualItems: useVirtualHelpers.virtualItems,\n filteredChildren,\n totalSize: useVirtualHelpers.totalSize,\n };\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAElB,SAAS,kBAAkB;AAGpB,MAAM,iBAAiB,CAC5B,WAMG;AACH,QAAM,EAAE,UAAU,UAAU,IAAI;AAChC,QAAM,YAAYA,OAAM,OAAuB;AAC/C,QAAM,mBAAmBA,OAAM;AAAA,IAC7B,MAAMA,OAAM,SAAS,QAAQ,QAAQ,EAAE,OAAO,CAAC,UAAU,KAAK;AAAA,IAC9D,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,oBAAoB,WAAW;AAAA,IACnC,MAAM,iBAAiB;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,EAAAA,OAAM,UAAU,MAAM;AACpB,QAAI,WAAW;AACb,gBAAU,QAAQ,WAAW,kBAAkB;AAAA,IACjD;AAAA,EACF,GAAG,CAAC,WAAW,iBAAiB,CAAC;AAEjC,SAAO;AAAA,IACL;AAAA,IACA,cAAc,kBAAkB;AAAA,IAChC;AAAA,IACA,WAAW,kBAAkB;AAAA,EAC/B;AACF;",
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-utilities';\nimport { type DSVirtualListT, DSVirtualListPropTypes, defaultProps } from '../react-desc-prop-types';\nimport { useValidateProps } from './useValidateProps';\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 VirtualListCTX = {\n parentRef: React.MutableRefObject<HTMLDivElement | null>;\n getVirtualItems: () => VirtualItem[];\n filteredChildren: React.ReactNode[];\n totalSize: number;\n instanceUid: string;\n measureElement: MeasureElement;\n};\nexport const useVirtualListV3 = (propsFromUser: DSVirtualListT.Props): VirtualListCTX => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSVirtualListT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSVirtualListPropTypes);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const { children, actionRef } = propsWithDefault;\n const parentRef = React.useRef<HTMLDivElement>(null);\n const filteredChildren = React.useMemo(\n () => React.Children.toArray(children).filter((child) => child !== undefined && child !== null),\n [children],\n ) as React.ReactNode[];\n const useVirtualHelpers = useVirtualizer({\n count: filteredChildren.length,\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-virtual-list-${uid(6)}`, []);\n return React.useMemo(\n () => ({\n parentRef,\n getVirtualItems: useVirtualHelpers.getVirtualItems,\n filteredChildren,\n totalSize,\n instanceUid,\n measureElement: useVirtualHelpers.measureElement,\n }),\n [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, filteredChildren, totalSize, instanceUid],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAC/B,SAAS,oCAAoC;AAC7C,SAA8B,wBAAwB,oBAAoB;AAC1E,SAAS,wBAAwB;AAEjC,MAAM,eAAe,MAAM;AAoBpB,MAAM,mBAAmB,CAAC,kBAAwD;AAIvF,QAAM,mBAAmB,6BAA2D,eAAe,YAAY;AAC/G,mBAAiB,kBAAkB,sBAAsB;AAIzD,QAAM,EAAE,UAAU,UAAU,IAAI;AAChC,QAAM,YAAYA,OAAM,OAAuB,IAAI;AACnD,QAAM,mBAAmBA,OAAM;AAAA,IAC7B,MAAMA,OAAM,SAAS,QAAQ,QAAQ,EAAE,OAAO,CAAC,UAAU,UAAU,UAAa,UAAU,IAAI;AAAA,IAC9F,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,oBAAoB,eAAe;AAAA,IACvC,OAAO,iBAAiB;AAAA,IACxB,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,mBAAmB,IAAI,CAAC,KAAK,CAAC,CAAC;AACvE,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA,iBAAiB,kBAAkB;AAAA,MACnC;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,kBAAkB;AAAA,IACpC;AAAA,IACA,CAAC,kBAAkB,iBAAiB,kBAAkB,gBAAgB,kBAAkB,WAAW,WAAW;AAAA,EAChH;AACF;",
6
6
  "names": ["React"]
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,3 +1,8 @@
1
1
  import * as React from "react";
2
- export * from "./VirtualList";
2
+ import {} from "./react-desc-prop-types";
3
+ import { DSVirtualList, DSVirtualListWithSchema } from "./VirtualList";
4
+ export {
5
+ DSVirtualList,
6
+ DSVirtualListWithSchema
7
+ };
3
8
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './VirtualList';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;",
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 DSVirtualListT } from './react-desc-prop-types';\nexport { DSVirtualList, DSVirtualListWithSchema } from './VirtualList';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACIvB,eAAoC;AACpC,SAAS,eAAe,+BAA+B;",
6
6
  "names": []
7
7
  }
@@ -1,35 +1,59 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import React2 from "react";
4
- import { uid } from "uid";
5
- import { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from "../styled";
6
4
  import { LIST_DATA_TESTID } from "../VirtualListDataTestID";
7
- import { useVirtualList } from "../hooks/useVirtualList";
5
+ import { useVirtualListV3 } from "../hooks/useVirtualList";
8
6
  const List = (props) => {
9
- const { parentRef, virtualItems, filteredChildren, totalSize } = useVirtualList(props);
10
- const [dynamicRerenderWorkaround, setDynamicRerenderWorkaround] = React2.useState(uid(6));
11
- const virtualChildren = React2.useMemo(
12
- () => virtualItems.map((virtualItem) => {
13
- const { index, measureRef, start } = virtualItem;
14
- const style = {
15
- transform: `translateY(${start}px)`
16
- };
17
- return /* @__PURE__ */ jsx(VirtualItemStyled, { ref: measureRef, style, role: "listitem", children: filteredChildren[index] }, `ds-virtual-list-item-${uid(6)}`);
18
- }),
19
- [filteredChildren, virtualItems]
7
+ const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement } = useVirtualListV3(props);
8
+ const virtualItems = getVirtualItems();
9
+ const measureRef = React2.useCallback(
10
+ (node) => measureElement(node),
11
+ [measureElement]
20
12
  );
21
- React2.useEffect(() => {
22
- setDynamicRerenderWorkaround(uid(6));
23
- }, [filteredChildren]);
24
13
  return /* @__PURE__ */ jsx(
25
- StyledContainerContentList,
14
+ "div",
26
15
  {
27
16
  ref: parentRef,
28
17
  "data-testid": LIST_DATA_TESTID.CONTAINER,
29
18
  role: "list",
30
- children: /* @__PURE__ */ jsx(StyledVirtualList, { height: `${totalSize}px`, children: virtualChildren })
19
+ style: {
20
+ width: "100%",
21
+ height: "100%",
22
+ paddingBottom: 0,
23
+ overflow: "auto"
24
+ },
25
+ children: /* @__PURE__ */ jsx(
26
+ "div",
27
+ {
28
+ style: {
29
+ width: "100%",
30
+ height: `${totalSize}px`,
31
+ position: "relative"
32
+ },
33
+ children: virtualItems.map((virtualItem) => {
34
+ const { index, start, key } = virtualItem;
35
+ return /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ ref: measureRef,
39
+ "data-index": index,
40
+ style: {
41
+ position: "absolute",
42
+ top: 0,
43
+ left: 0,
44
+ width: "100%",
45
+ transform: `translateY(${start}px)`
46
+ },
47
+ role: "listitem",
48
+ children: filteredChildren[index]
49
+ },
50
+ `${instanceUid}-item-${key}`
51
+ );
52
+ })
53
+ }
54
+ )
31
55
  },
32
- `ds-virtual-list-${dynamicRerenderWorkaround}`
56
+ instanceUid
33
57
  );
34
58
  };
35
59
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { uid } from 'uid';\nimport { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from '../styled';\n\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID';\n\nimport type { DSVirtualListProps } from '../index.d';\nimport { useVirtualList } from '../hooks/useVirtualList';\n\n/**\n * List component: renders a list of items\n * Accessibility: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/List_role\n *\n * @param {DSVirtualListProps} props\n * @returns JSX\n */\nexport const List: React.FC<DSVirtualListProps> = (props: DSVirtualListProps) => {\n const { parentRef, virtualItems, filteredChildren, totalSize } = useVirtualList(props);\n const [dynamicRerenderWorkaround, setDynamicRerenderWorkaround] = React.useState(uid(6));\n const virtualChildren = React.useMemo(\n () =>\n virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const style = {\n transform: `translateY(${start}px)`,\n };\n return (\n <VirtualItemStyled ref={measureRef} style={style} role=\"listitem\" key={`ds-virtual-list-item-${uid(6)}`}>\n {filteredChildren[index]}\n </VirtualItemStyled>\n );\n }),\n [filteredChildren, virtualItems],\n );\n React.useEffect(() => {\n setDynamicRerenderWorkaround(uid(6));\n }, [filteredChildren]);\n return (\n <StyledContainerContentList\n key={`ds-virtual-list-${dynamicRerenderWorkaround}`}\n ref={parentRef}\n data-testid={LIST_DATA_TESTID.CONTAINER}\n role=\"list\"\n >\n <StyledVirtualList height={`${totalSize}px`}>{virtualChildren}</StyledVirtualList>\n </StyledContainerContentList>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC2Bb;AA3BV,OAAOA,YAAW;AAClB,SAAS,WAAW;AACpB,SAAS,mBAAmB,4BAA4B,yBAAyB;AAEjF,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AASxB,MAAM,OAAqC,CAAC,UAA8B;AAC/E,QAAM,EAAE,WAAW,cAAc,kBAAkB,UAAU,IAAI,eAAe,KAAK;AACrF,QAAM,CAAC,2BAA2B,4BAA4B,IAAIA,OAAM,SAAS,IAAI,CAAC,CAAC;AACvF,QAAM,kBAAkBA,OAAM;AAAA,IAC5B,MACE,aAAa,IAAI,CAAC,gBAAgB;AAChC,YAAM,EAAE,OAAO,YAAY,MAAM,IAAI;AACrC,YAAM,QAAQ;AAAA,QACZ,WAAW,cAAc;AAAA,MAC3B;AACA,aACE,oBAAC,qBAAkB,KAAK,YAAY,OAAc,MAAK,YACpD,2BAAiB,UADmD,wBAAwB,IAAI,CAAC,GAEpG;AAAA,IAEJ,CAAC;AAAA,IACH,CAAC,kBAAkB,YAAY;AAAA,EACjC;AACA,EAAAA,OAAM,UAAU,MAAM;AACpB,iCAA6B,IAAI,CAAC,CAAC;AAAA,EACrC,GAAG,CAAC,gBAAgB,CAAC;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,KAAK;AAAA,MACL,eAAa,iBAAiB;AAAA,MAC9B,MAAK;AAAA,MAEL,8BAAC,qBAAkB,QAAQ,GAAG,eAAgB,2BAAgB;AAAA;AAAA,IALzD,mBAAmB;AAAA,EAM1B;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID';\nimport { useVirtualListV3 } from '../hooks/useVirtualList';\nimport type { DSVirtualListT } from '../react-desc-prop-types';\n\nexport const List = (props: DSVirtualListT.Props) => {\n const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement } =\n useVirtualListV3(props);\n const virtualItems = getVirtualItems();\n const measureRef: React.LegacyRef<HTMLDivElement> = React.useCallback(\n (node: HTMLDivElement) => measureElement(node),\n [measureElement],\n );\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 {filteredChildren[index]}\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACqCX;AArCZ,OAAOA,YAAW;AAClB,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAG1B,MAAM,OAAO,CAAC,UAAgC;AACnD,QAAM,EAAE,WAAW,iBAAiB,kBAAkB,WAAW,aAAa,eAAe,IAC3F,iBAAiB,KAAK;AACxB,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAA8CA,OAAM;AAAA,IACxD,CAAC,SAAyB,eAAe,IAAI;AAAA,IAC7C,CAAC,cAAc;AAAA,EACjB;AAEA,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,gBAGJ,2BAAiB;AAAA;AAAA,cAFb,GAAG,oBAAoB;AAAA,YAG9B;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,IAtCK;AAAA,EAuCP;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "@elliemae/ds-utilities";
3
+ const defaultProps = {};
4
+ const DSVirtualListPropTypes = {
5
+ children: PropTypes.arrayOf(PropTypes.node).description("Children list").isRequired,
6
+ actionRef: PropTypes.shape({
7
+ current: PropTypes.oneOfType([
8
+ PropTypes.oneOf([null]),
9
+ PropTypes.shape({
10
+ scrollTo: PropTypes.func.description("Scroll to a index inside the list").signature(`((index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void)`)
11
+ })
12
+ ])
13
+ }).description(`mutable reference where methods will be stored`)
14
+ };
15
+ export {
16
+ DSVirtualListPropTypes,
17
+ defaultProps
18
+ };
19
+ //# 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 React from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\n\nexport declare namespace DSVirtualListT {\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 children: React.ReactNode;\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n actionRef: React.MutableRefObject<ActionRef>;\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: DSVirtualListT.DefaultProps = {};\n\nexport const DSVirtualListPropTypes = {\n children: PropTypes.arrayOf(PropTypes.node).description('Children list').isRequired,\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} as React.WeakValidationMap<unknown>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AA0BnB,MAAM,eAA4C,CAAC;AAEnD,MAAM,yBAAyB;AAAA,EACpC,UAAU,UAAU,QAAQ,UAAU,IAAI,EAAE,YAAY,eAAe,EAAE;AAAA,EACzE,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;AACjE;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-virtual-list",
3
- "version": "3.14.0-next.1",
3
+ "version": "3.14.0-next.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Virtual List",
6
6
  "files": [
@@ -59,13 +59,17 @@
59
59
  "indent": 4
60
60
  },
61
61
  "dependencies": {
62
- "react-virtual": "~2.10.4",
62
+ "@tanstack/react-virtual": "3.0.0-beta.36",
63
63
  "uid": "^2.0.0",
64
- "@elliemae/ds-system": "3.14.0-next.1",
65
- "@elliemae/ds-utilities": "3.14.0-next.1"
64
+ "@elliemae/ds-system": "3.14.0-next.3",
65
+ "@elliemae/ds-utilities": "3.14.0-next.3"
66
66
  },
67
67
  "devDependencies": {
68
- "styled-components": "~5.3.6"
68
+ "@testing-library/react": "^11.2.6",
69
+ "@testing-library/user-event": "~13.5.0",
70
+ "styled-components": "~5.3.6",
71
+ "styled-system": "~5.1.5",
72
+ "@elliemae/ds-test-utils": "3.14.0-next.3"
69
73
  },
70
74
  "peerDependencies": {
71
75
  "lodash": "^4.17.21",
@@ -1,24 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
- mod
19
- ));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var index_d_exports = {};
22
- module.exports = __toCommonJS(index_d_exports);
23
- var React = __toESM(require("react"));
24
- //# sourceMappingURL=index.d.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.d.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type React from 'react';\n\nexport interface DSVirtualListProps {\n children: React.ReactNode[];\n actionRef: React.MutableRefObject<any>;\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/styled.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { styled } from '@elliemae/ds-system';\n\nexport const StyledContainerContentList = styled.div`\n width: 100%;\n height: 100%;\n padding-bottom: 0;\n overflow-y: auto;\n overflow-x: hidden;\n`;\nexport const StyledVirtualList = styled.div<{ height: string }>`\n width: 100%;\n height: ${(props) => props.height};\n position: relative;\n`;\nexport const VirtualItemStyled = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAEhB,MAAM,6BAA6B,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1C,MAAM,oBAAoB,wBAAO;AAAA;AAAA,YAE5B,CAAC,UAAU,MAAM;AAAA;AAAA;AAGtB,MAAM,oBAAoB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=index.d.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;",
6
- "names": []
7
- }
@@ -1,26 +0,0 @@
1
- import * as React from "react";
2
- import { styled } from "@elliemae/ds-system";
3
- const StyledContainerContentList = styled.div`
4
- width: 100%;
5
- height: 100%;
6
- padding-bottom: 0;
7
- overflow-y: auto;
8
- overflow-x: hidden;
9
- `;
10
- const StyledVirtualList = styled.div`
11
- width: 100%;
12
- height: ${(props) => props.height};
13
- position: relative;
14
- `;
15
- const VirtualItemStyled = styled.div`
16
- position: absolute;
17
- top: 0;
18
- left: 0;
19
- width: 100%;
20
- `;
21
- export {
22
- StyledContainerContentList,
23
- StyledVirtualList,
24
- VirtualItemStyled
25
- };
26
- //# sourceMappingURL=styled.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\n\nexport const StyledContainerContentList = styled.div`\n width: 100%;\n height: 100%;\n padding-bottom: 0;\n overflow-y: auto;\n overflow-x: hidden;\n`;\nexport const StyledVirtualList = styled.div<{ height: string }>`\n width: 100%;\n height: ${(props) => props.height};\n position: relative;\n`;\nexport const VirtualItemStyled = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAEhB,MAAM,6BAA6B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1C,MAAM,oBAAoB,OAAO;AAAA;AAAA,YAE5B,CAAC,UAAU,MAAM;AAAA;AAAA;AAGtB,MAAM,oBAAoB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }