@elliemae/ds-virtual-list 3.27.0-next.2 → 3.27.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.
@@ -28,9 +28,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var DSVirtualListDefinitions_exports = {};
30
30
  __export(DSVirtualListDefinitions_exports, {
31
- DSVirtualListName: () => DSVirtualListName
31
+ DSVirtualListName: () => DSVirtualListName,
32
+ DSVirtualListSlots: () => DSVirtualListSlots
32
33
  });
33
34
  module.exports = __toCommonJS(DSVirtualListDefinitions_exports);
34
35
  var React = __toESM(require("react"));
35
36
  const DSVirtualListName = "DSVirtualList";
37
+ const DSVirtualListSlots = {
38
+ ROOT: "root",
39
+ LIST_WRAPPER: "list-wrapper",
40
+ ITEM_WRAPPER: "item-wrapper"
41
+ };
36
42
  //# sourceMappingURL=DSVirtualListDefinitions.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSVirtualListDefinitions.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export const DSVirtualListName = 'DSVirtualList';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,oBAAoB;",
4
+ "sourcesContent": ["export const DSVirtualListName = 'DSVirtualList';\n\nexport const DSVirtualListSlots = {\n ROOT: 'root',\n LIST_WRAPPER: 'list-wrapper',\n ITEM_WRAPPER: 'item-wrapper',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,oBAAoB;AAE1B,MAAM,qBAAqB;AAAA,EAChC,MAAM;AAAA,EACN,cAAc;AAAA,EACd,cAAc;AAChB;",
6
6
  "names": []
7
7
  }
@@ -68,9 +68,17 @@ const useVirtualListV3 = (propsFromUser) => {
68
68
  filteredChildren,
69
69
  totalSize,
70
70
  instanceUid,
71
- measureElement: useVirtualHelpers.measureElement
71
+ measureElement: useVirtualHelpers.measureElement,
72
+ propsWithDefault
72
73
  }),
73
- [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, filteredChildren, totalSize, instanceUid]
74
+ [
75
+ useVirtualHelpers.getVirtualItems,
76
+ useVirtualHelpers.measureElement,
77
+ filteredChildren,
78
+ totalSize,
79
+ instanceUid,
80
+ propsWithDefault
81
+ ]
74
82
  );
75
83
  };
76
84
  //# 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 { uid } from 'uid';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSVirtualListT, DSVirtualListPropTypes, 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 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,8BAA6C;AAC7C,mCAA0E;AAC1E,8BAAiC;AAEjC,MAAM,eAAe,MAAM;AAoBpB,MAAM,mBAAmB,CAAC,kBAAwD;AAIvF,QAAM,uBAAmB,sDAA2D,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;",
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 DSVirtualListT, DSVirtualListPropTypes, 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 VirtualListCTX = {\n parentRef: React.MutableRefObject<HTMLDivElement | null>;\n getVirtualItems: () => VirtualItem[];\n filteredChildren: React.ReactNode[];\n totalSize: number;\n instanceUid: string;\n measureElement: MeasureElement;\n propsWithDefault: DSVirtualListT.InternalProps;\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 propsWithDefault,\n }),\n [\n useVirtualHelpers.getVirtualItems,\n useVirtualHelpers.measureElement,\n filteredChildren,\n totalSize,\n instanceUid,\n propsWithDefault,\n ],\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,mCAA0E;AAC1E,8BAAiC;AAEjC,MAAM,eAAe,MAAM;AAqBpB,MAAM,mBAAmB,CAAC,kBAAwD;AAIvF,QAAM,uBAAmB,sDAA2D,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,MAClC;AAAA,IACF;AAAA,IACA;AAAA,MACE,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["React"]
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -29,10 +29,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var src_exports = {};
30
30
  __export(src_exports, {
31
31
  DSVirtualList: () => import_VirtualList.DSVirtualList,
32
+ DSVirtualListName: () => import_DSVirtualListDefinitions.DSVirtualListName,
33
+ DSVirtualListSlots: () => import_DSVirtualListDefinitions.DSVirtualListSlots,
32
34
  DSVirtualListWithSchema: () => import_VirtualList.DSVirtualListWithSchema
33
35
  });
34
36
  module.exports = __toCommonJS(src_exports);
35
37
  var React = __toESM(require("react"));
36
38
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
37
39
  var import_VirtualList = require("./VirtualList.js");
40
+ var import_DSVirtualListDefinitions = require("./DSVirtualListDefinitions.js");
38
41
  //# 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": ["// 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.js';\nexport { DSVirtualList, DSVirtualListWithSchema } from './VirtualList.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mCAAoC;AACpC,yBAAuD;",
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.js';\nexport { DSVirtualList, DSVirtualListWithSchema } from './VirtualList.js';\nexport { DSVirtualListName, DSVirtualListSlots } from './DSVirtualListDefinitions.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mCAAoC;AACpC,yBAAuD;AACvD,sCAAsD;",
6
6
  "names": []
7
7
  }
@@ -34,57 +34,40 @@ module.exports = __toCommonJS(List_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = __toESM(require("react"));
37
+ var import_ds_utilities = require("@elliemae/ds-utilities");
37
38
  var import_VirtualListDataTestID = require("../VirtualListDataTestID.js");
38
39
  var import_useVirtualList = require("../hooks/useVirtualList.js");
40
+ var import_styled = require("./styled.js");
39
41
  const List = (props) => {
40
- const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement } = (0, import_useVirtualList.useVirtualListV3)(props);
42
+ const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement, propsWithDefault } = (0, import_useVirtualList.useVirtualListV3)(props);
41
43
  const virtualItems = getVirtualItems();
42
44
  const measureRef = import_react.default.useCallback(
43
45
  (node) => measureElement(node),
44
46
  [measureElement]
45
47
  );
48
+ const ownerPropsConfig = (0, import_ds_utilities.useOwnerProps)(propsWithDefault);
46
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
- "div",
50
+ import_styled.StyledWrapper,
48
51
  {
49
- ref: parentRef,
52
+ innerRef: parentRef,
50
53
  "data-testid": import_VirtualListDataTestID.LIST_DATA_TESTID.CONTAINER,
51
54
  role: "list",
52
- style: {
53
- width: "100%",
54
- height: "100%",
55
- paddingBottom: 0,
56
- overflow: "auto"
57
- },
58
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
- "div",
60
- {
61
- style: {
62
- width: "100%",
63
- height: `${totalSize}px`,
64
- position: "relative"
55
+ ...ownerPropsConfig,
56
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledListWrapper, { height: totalSize, ...ownerPropsConfig, children: virtualItems.map((virtualItem) => {
57
+ const { index, start, key } = virtualItem;
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ import_styled.StyledItemWrapper,
60
+ {
61
+ innerRef: measureRef,
62
+ "data-index": index,
63
+ start,
64
+ role: "listitem",
65
+ ...ownerPropsConfig,
66
+ children: filteredChildren[index]
65
67
  },
66
- children: virtualItems.map((virtualItem) => {
67
- const { index, start, key } = virtualItem;
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
- "div",
70
- {
71
- ref: measureRef,
72
- "data-index": index,
73
- style: {
74
- position: "absolute",
75
- top: 0,
76
- left: 0,
77
- width: "100%",
78
- transform: `translateY(${start}px)`
79
- },
80
- role: "listitem",
81
- children: filteredChildren[index]
82
- },
83
- `${instanceUid}-item-${key}`
84
- );
85
- })
86
- }
87
- )
68
+ `${instanceUid}-item-${key}`
69
+ );
70
+ }) })
88
71
  },
89
72
  instanceUid
90
73
  );
@@ -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 { LIST_DATA_TESTID } from '../VirtualListDataTestID.js';\nimport { useVirtualListV3 } from '../hooks/useVirtualList.js';\nimport type { DSVirtualListT } from '../react-desc-prop-types.js';\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,KAAK;AAAA;AAAA,cAFlB,GAAG,oBAAoB;AAAA,YAG9B;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,IAtCK;AAAA,EAuCP;AAEJ;",
4
+ "sourcesContent": ["import React from 'react';\nimport { useOwnerProps } from '@elliemae/ds-utilities';\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID.js';\nimport { useVirtualListV3 } from '../hooks/useVirtualList.js';\nimport type { DSVirtualListT } from '../react-desc-prop-types.js';\nimport { StyledWrapper, StyledListWrapper, StyledItemWrapper } from './styled.js';\n\nexport const List = (props: DSVirtualListT.Props) => {\n const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement, propsWithDefault } =\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 const ownerPropsConfig = useOwnerProps(propsWithDefault);\n\n return (\n <StyledWrapper\n key={instanceUid}\n innerRef={parentRef}\n data-testid={LIST_DATA_TESTID.CONTAINER}\n role=\"list\"\n {...ownerPropsConfig}\n >\n <StyledListWrapper height={totalSize} {...ownerPropsConfig}>\n {virtualItems.map((virtualItem) => {\n const { index, start, key } = virtualItem;\n return (\n <StyledItemWrapper\n innerRef={measureRef}\n data-index={index}\n start={start}\n role=\"listitem\"\n key={`${instanceUid}-item-${key}`}\n {...ownerPropsConfig}\n >\n {filteredChildren[index]}\n </StyledItemWrapper>\n );\n })}\n </StyledListWrapper>\n </StyledWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8BX;AA9BZ,mBAAkB;AAClB,0BAA8B;AAC9B,mCAAiC;AACjC,4BAAiC;AAEjC,oBAAoE;AAE7D,MAAM,OAAO,CAAC,UAAgC;AACnD,QAAM,EAAE,WAAW,iBAAiB,kBAAkB,WAAW,aAAa,gBAAgB,iBAAiB,QAC7G,wCAAiB,KAAK;AACxB,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAA8C,aAAAA,QAAM;AAAA,IACxD,CAAC,SAAyB,eAAe,IAAI;AAAA,IAC7C,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,uBAAmB,mCAAc,gBAAgB;AAEvD,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,UAAU;AAAA,MACV,eAAa,8CAAiB;AAAA,MAC9B,MAAK;AAAA,MACJ,GAAG;AAAA,MAEJ,sDAAC,mCAAkB,QAAQ,WAAY,GAAG,kBACvC,uBAAa,IAAI,CAAC,gBAAgB;AACjC,cAAM,EAAE,OAAO,OAAO,IAAI,IAAI;AAC9B,eACE;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,cAAY;AAAA,YACZ;AAAA,YACA,MAAK;AAAA,YAEJ,GAAG;AAAA,YAEH,2BAAiB,KAAK;AAAA;AAAA,UAHlB,GAAG,oBAAoB;AAAA,QAI9B;AAAA,MAEJ,CAAC,GACH;AAAA;AAAA,IAtBK;AAAA,EAuBP;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,57 @@
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 styled_exports = {};
30
+ __export(styled_exports, {
31
+ StyledItemWrapper: () => StyledItemWrapper,
32
+ StyledListWrapper: () => StyledListWrapper,
33
+ StyledWrapper: () => StyledWrapper
34
+ });
35
+ module.exports = __toCommonJS(styled_exports);
36
+ var React = __toESM(require("react"));
37
+ var import_ds_system = require("@elliemae/ds-system");
38
+ var import_DSVirtualListDefinitions = require("../DSVirtualListDefinitions.js");
39
+ const StyledWrapper = (0, import_ds_system.styled)("div", { name: import_DSVirtualListDefinitions.DSVirtualListName, slot: import_DSVirtualListDefinitions.DSVirtualListSlots.ROOT })`
40
+ width: 100%;
41
+ height: 100%;
42
+ padding-bottom: 0;
43
+ overflow: auto;
44
+ `;
45
+ const StyledListWrapper = (0, import_ds_system.styled)("div", { name: import_DSVirtualListDefinitions.DSVirtualListName, slot: import_DSVirtualListDefinitions.DSVirtualListSlots.LIST_WRAPPER })`
46
+ width: 100%;
47
+ height: ${({ height }) => `${height}px`};
48
+ position: relative;
49
+ `;
50
+ const StyledItemWrapper = (0, import_ds_system.styled)("div", { name: import_DSVirtualListDefinitions.DSVirtualListName, slot: import_DSVirtualListDefinitions.DSVirtualListSlots.ITEM_WRAPPER })`
51
+ position: absolute;
52
+ top: 0;
53
+ left: 0;
54
+ width: 100%;
55
+ transform: ${({ start }) => `translateY(${start}px)`};
56
+ `;
57
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/parts/styled.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { DSVirtualListName, DSVirtualListSlots } from '../DSVirtualListDefinitions.js';\n\nexport const StyledWrapper = styled('div', { name: DSVirtualListName, slot: DSVirtualListSlots.ROOT })`\n width: 100%;\n height: 100%;\n padding-bottom: 0;\n overflow: auto;\n`;\n\nexport const StyledListWrapper = styled('div', { name: DSVirtualListName, slot: DSVirtualListSlots.LIST_WRAPPER })<{\n height: number;\n}>`\n width: 100%;\n height: ${({ height }) => `${height}px`};\n position: relative;\n`;\n\nexport const StyledItemWrapper = styled('div', { name: DSVirtualListName, slot: DSVirtualListSlots.ITEM_WRAPPER })<{\n start: number;\n}>`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n transform: ${({ start }) => `translateY(${start}px)`};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,sCAAsD;AAE/C,MAAM,oBAAgB,yBAAO,OAAO,EAAE,MAAM,mDAAmB,MAAM,mDAAmB,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9F,MAAM,wBAAoB,yBAAO,OAAO,EAAE,MAAM,mDAAmB,MAAM,mDAAmB,aAAa,CAAC;AAAA;AAAA,YAIrG,CAAC,EAAE,OAAO,MAAM,GAAG;AAAA;AAAA;AAIxB,MAAM,wBAAoB,yBAAO,OAAO,EAAE,MAAM,mDAAmB,MAAM,mDAAmB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,eAOlG,CAAC,EAAE,MAAM,MAAM,cAAc;AAAA;",
6
+ "names": []
7
+ }
@@ -34,8 +34,10 @@ __export(react_desc_prop_types_exports, {
34
34
  module.exports = __toCommonJS(react_desc_prop_types_exports);
35
35
  var React = __toESM(require("react"));
36
36
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
+ var import_DSVirtualListDefinitions = require("./DSVirtualListDefinitions.js");
37
38
  const defaultProps = {};
38
39
  const DSVirtualListPropTypes = {
40
+ ...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_DSVirtualListDefinitions.DSVirtualListName, import_DSVirtualListDefinitions.DSVirtualListSlots),
39
41
  children: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.node).description("Children list").isRequired,
40
42
  actionRef: import_ds_props_helpers.PropTypes.shape({
41
43
  current: import_ds_props_helpers.PropTypes.oneOfType([
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 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,8BAA0B;AA0BnB,MAAM,eAA4C,CAAC;AAEnD,MAAM,yBAAyB;AAAA,EACpC,UAAU,kCAAU,QAAQ,kCAAU,IAAI,EAAE,YAAY,eAAe,EAAE;AAAA,EACzE,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;AACjE;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type React from 'react';\nimport { PropTypes, getPropsPerSlotPropTypes } from '@elliemae/ds-props-helpers';\nimport { DSVirtualListName, DSVirtualListSlots } from './DSVirtualListDefinitions.js';\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 extends PropsForGlobalOnSlots<typeof DSVirtualListName, typeof DSVirtualListSlots> {\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 ...getPropsPerSlotPropTypes(DSVirtualListName, DSVirtualListSlots),\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,8BAAoD;AACpD,sCAAsD;AA0B/C,MAAM,eAA4C,CAAC;AAEnD,MAAM,yBAAyB;AAAA,EACpC,OAAG,kDAAyB,mDAAmB,kDAAkB;AAAA,EACjE,UAAU,kCAAU,QAAQ,kCAAU,IAAI,EAAE,YAAY,eAAe,EAAE;AAAA,EACzE,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;AACjE;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,12 @@
1
1
  import * as React from "react";
2
2
  const DSVirtualListName = "DSVirtualList";
3
+ const DSVirtualListSlots = {
4
+ ROOT: "root",
5
+ LIST_WRAPPER: "list-wrapper",
6
+ ITEM_WRAPPER: "item-wrapper"
7
+ };
3
8
  export {
4
- DSVirtualListName
9
+ DSVirtualListName,
10
+ DSVirtualListSlots
5
11
  };
6
12
  //# sourceMappingURL=DSVirtualListDefinitions.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSVirtualListDefinitions.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSVirtualListName = 'DSVirtualList';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,oBAAoB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSVirtualListName = 'DSVirtualList';\n\nexport const DSVirtualListSlots = {\n ROOT: 'root',\n LIST_WRAPPER: 'list-wrapper',\n ITEM_WRAPPER: 'item-wrapper',\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,oBAAoB;AAE1B,MAAM,qBAAqB;AAAA,EAChC,MAAM;AAAA,EACN,cAAc;AAAA,EACd,cAAc;AAChB;",
6
6
  "names": []
7
7
  }
@@ -35,9 +35,17 @@ const useVirtualListV3 = (propsFromUser) => {
35
35
  filteredChildren,
36
36
  totalSize,
37
37
  instanceUid,
38
- measureElement: useVirtualHelpers.measureElement
38
+ measureElement: useVirtualHelpers.measureElement,
39
+ propsWithDefault
39
40
  }),
40
- [useVirtualHelpers.getVirtualItems, useVirtualHelpers.measureElement, filteredChildren, totalSize, instanceUid]
41
+ [
42
+ useVirtualHelpers.getVirtualItems,
43
+ useVirtualHelpers.measureElement,
44
+ filteredChildren,
45
+ totalSize,
46
+ instanceUid,
47
+ propsWithDefault
48
+ ]
41
49
  );
42
50
  };
43
51
  export {
@@ -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 { uid } from 'uid';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSVirtualListT, DSVirtualListPropTypes, 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 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;",
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 DSVirtualListT, DSVirtualListPropTypes, 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 VirtualListCTX = {\n parentRef: React.MutableRefObject<HTMLDivElement | null>;\n getVirtualItems: () => VirtualItem[];\n filteredChildren: React.ReactNode[];\n totalSize: number;\n instanceUid: string;\n measureElement: MeasureElement;\n propsWithDefault: DSVirtualListT.InternalProps;\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 propsWithDefault,\n }),\n [\n useVirtualHelpers.getVirtualItems,\n useVirtualHelpers.measureElement,\n filteredChildren,\n totalSize,\n instanceUid,\n propsWithDefault,\n ],\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;AAqBpB,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,MAClC;AAAA,IACF;AAAA,IACA;AAAA,MACE,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["React"]
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,8 +1,11 @@
1
1
  import * as React from "react";
2
2
  import {} from "./react-desc-prop-types.js";
3
3
  import { DSVirtualList, DSVirtualListWithSchema } from "./VirtualList.js";
4
+ import { DSVirtualListName, DSVirtualListSlots } from "./DSVirtualListDefinitions.js";
4
5
  export {
5
6
  DSVirtualList,
7
+ DSVirtualListName,
8
+ DSVirtualListSlots,
6
9
  DSVirtualListWithSchema
7
10
  };
8
11
  //# 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", "// 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.js';\nexport { DSVirtualList, DSVirtualListWithSchema } from './VirtualList.js';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACIvB,eAAoC;AACpC,SAAS,eAAe,+BAA+B;",
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.js';\nexport { DSVirtualList, DSVirtualListWithSchema } from './VirtualList.js';\nexport { DSVirtualListName, DSVirtualListSlots } from './DSVirtualListDefinitions.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACIvB,eAAoC;AACpC,SAAS,eAAe,+BAA+B;AACvD,SAAS,mBAAmB,0BAA0B;",
6
6
  "names": []
7
7
  }
@@ -1,57 +1,40 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import React2 from "react";
4
+ import { useOwnerProps } from "@elliemae/ds-utilities";
4
5
  import { LIST_DATA_TESTID } from "../VirtualListDataTestID.js";
5
6
  import { useVirtualListV3 } from "../hooks/useVirtualList.js";
7
+ import { StyledWrapper, StyledListWrapper, StyledItemWrapper } from "./styled.js";
6
8
  const List = (props) => {
7
- const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement } = useVirtualListV3(props);
9
+ const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement, propsWithDefault } = useVirtualListV3(props);
8
10
  const virtualItems = getVirtualItems();
9
11
  const measureRef = React2.useCallback(
10
12
  (node) => measureElement(node),
11
13
  [measureElement]
12
14
  );
15
+ const ownerPropsConfig = useOwnerProps(propsWithDefault);
13
16
  return /* @__PURE__ */ jsx(
14
- "div",
17
+ StyledWrapper,
15
18
  {
16
- ref: parentRef,
19
+ innerRef: parentRef,
17
20
  "data-testid": LIST_DATA_TESTID.CONTAINER,
18
21
  role: "list",
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"
22
+ ...ownerPropsConfig,
23
+ children: /* @__PURE__ */ jsx(StyledListWrapper, { height: totalSize, ...ownerPropsConfig, children: virtualItems.map((virtualItem) => {
24
+ const { index, start, key } = virtualItem;
25
+ return /* @__PURE__ */ jsx(
26
+ StyledItemWrapper,
27
+ {
28
+ innerRef: measureRef,
29
+ "data-index": index,
30
+ start,
31
+ role: "listitem",
32
+ ...ownerPropsConfig,
33
+ children: filteredChildren[index]
32
34
  },
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
- )
35
+ `${instanceUid}-item-${key}`
36
+ );
37
+ }) })
55
38
  },
56
39
  instanceUid
57
40
  );
@@ -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 { LIST_DATA_TESTID } from '../VirtualListDataTestID.js';\nimport { useVirtualListV3 } from '../hooks/useVirtualList.js';\nimport type { DSVirtualListT } from '../react-desc-prop-types.js';\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,KAAK;AAAA;AAAA,cAFlB,GAAG,oBAAoB;AAAA,YAG9B;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,IAtCK;AAAA,EAuCP;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useOwnerProps } from '@elliemae/ds-utilities';\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID.js';\nimport { useVirtualListV3 } from '../hooks/useVirtualList.js';\nimport type { DSVirtualListT } from '../react-desc-prop-types.js';\nimport { StyledWrapper, StyledListWrapper, StyledItemWrapper } from './styled.js';\n\nexport const List = (props: DSVirtualListT.Props) => {\n const { parentRef, getVirtualItems, filteredChildren, totalSize, instanceUid, measureElement, propsWithDefault } =\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 const ownerPropsConfig = useOwnerProps(propsWithDefault);\n\n return (\n <StyledWrapper\n key={instanceUid}\n innerRef={parentRef}\n data-testid={LIST_DATA_TESTID.CONTAINER}\n role=\"list\"\n {...ownerPropsConfig}\n >\n <StyledListWrapper height={totalSize} {...ownerPropsConfig}>\n {virtualItems.map((virtualItem) => {\n const { index, start, key } = virtualItem;\n return (\n <StyledItemWrapper\n innerRef={measureRef}\n data-index={index}\n start={start}\n role=\"listitem\"\n key={`${instanceUid}-item-${key}`}\n {...ownerPropsConfig}\n >\n {filteredChildren[index]}\n </StyledItemWrapper>\n );\n })}\n </StyledListWrapper>\n </StyledWrapper>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC8BX;AA9BZ,OAAOA,YAAW;AAClB,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAEjC,SAAS,eAAe,mBAAmB,yBAAyB;AAE7D,MAAM,OAAO,CAAC,UAAgC;AACnD,QAAM,EAAE,WAAW,iBAAiB,kBAAkB,WAAW,aAAa,gBAAgB,iBAAiB,IAC7G,iBAAiB,KAAK;AACxB,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAA8CA,OAAM;AAAA,IACxD,CAAC,SAAyB,eAAe,IAAI;AAAA,IAC7C,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,mBAAmB,cAAc,gBAAgB;AAEvD,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,UAAU;AAAA,MACV,eAAa,iBAAiB;AAAA,MAC9B,MAAK;AAAA,MACJ,GAAG;AAAA,MAEJ,8BAAC,qBAAkB,QAAQ,WAAY,GAAG,kBACvC,uBAAa,IAAI,CAAC,gBAAgB;AACjC,cAAM,EAAE,OAAO,OAAO,IAAI,IAAI;AAC9B,eACE;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,cAAY;AAAA,YACZ;AAAA,YACA,MAAK;AAAA,YAEJ,GAAG;AAAA,YAEH,2BAAiB,KAAK;AAAA;AAAA,UAHlB,GAAG,oBAAoB;AAAA,QAI9B;AAAA,MAEJ,CAAC,GACH;AAAA;AAAA,IAtBK;AAAA,EAuBP;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import { styled } from "@elliemae/ds-system";
3
+ import { DSVirtualListName, DSVirtualListSlots } from "../DSVirtualListDefinitions.js";
4
+ const StyledWrapper = styled("div", { name: DSVirtualListName, slot: DSVirtualListSlots.ROOT })`
5
+ width: 100%;
6
+ height: 100%;
7
+ padding-bottom: 0;
8
+ overflow: auto;
9
+ `;
10
+ const StyledListWrapper = styled("div", { name: DSVirtualListName, slot: DSVirtualListSlots.LIST_WRAPPER })`
11
+ width: 100%;
12
+ height: ${({ height }) => `${height}px`};
13
+ position: relative;
14
+ `;
15
+ const StyledItemWrapper = styled("div", { name: DSVirtualListName, slot: DSVirtualListSlots.ITEM_WRAPPER })`
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+ width: 100%;
20
+ transform: ${({ start }) => `translateY(${start}px)`};
21
+ `;
22
+ export {
23
+ StyledItemWrapper,
24
+ StyledListWrapper,
25
+ StyledWrapper
26
+ };
27
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/styled.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSVirtualListName, DSVirtualListSlots } from '../DSVirtualListDefinitions.js';\n\nexport const StyledWrapper = styled('div', { name: DSVirtualListName, slot: DSVirtualListSlots.ROOT })`\n width: 100%;\n height: 100%;\n padding-bottom: 0;\n overflow: auto;\n`;\n\nexport const StyledListWrapper = styled('div', { name: DSVirtualListName, slot: DSVirtualListSlots.LIST_WRAPPER })<{\n height: number;\n}>`\n width: 100%;\n height: ${({ height }) => `${height}px`};\n position: relative;\n`;\n\nexport const StyledItemWrapper = styled('div', { name: DSVirtualListName, slot: DSVirtualListSlots.ITEM_WRAPPER })<{\n start: number;\n}>`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n transform: ${({ start }) => `translateY(${start}px)`};\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,mBAAmB,0BAA0B;AAE/C,MAAM,gBAAgB,OAAO,OAAO,EAAE,MAAM,mBAAmB,MAAM,mBAAmB,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9F,MAAM,oBAAoB,OAAO,OAAO,EAAE,MAAM,mBAAmB,MAAM,mBAAmB,aAAa,CAAC;AAAA;AAAA,YAIrG,CAAC,EAAE,OAAO,MAAM,GAAG;AAAA;AAAA;AAIxB,MAAM,oBAAoB,OAAO,OAAO,EAAE,MAAM,mBAAmB,MAAM,mBAAmB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,eAOlG,CAAC,EAAE,MAAM,MAAM,cAAc;AAAA;",
6
+ "names": []
7
+ }
@@ -1,7 +1,9 @@
1
1
  import * as React from "react";
2
- import { PropTypes } from "@elliemae/ds-props-helpers";
2
+ import { PropTypes, getPropsPerSlotPropTypes } from "@elliemae/ds-props-helpers";
3
+ import { DSVirtualListName, DSVirtualListSlots } from "./DSVirtualListDefinitions.js";
3
4
  const defaultProps = {};
4
5
  const DSVirtualListPropTypes = {
6
+ ...getPropsPerSlotPropTypes(DSVirtualListName, DSVirtualListSlots),
5
7
  children: PropTypes.arrayOf(PropTypes.node).description("Children list").isRequired,
6
8
  actionRef: PropTypes.shape({
7
9
  current: PropTypes.oneOfType([
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 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;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type React from 'react';\nimport { PropTypes, getPropsPerSlotPropTypes } from '@elliemae/ds-props-helpers';\nimport { DSVirtualListName, DSVirtualListSlots } from './DSVirtualListDefinitions.js';\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 extends PropsForGlobalOnSlots<typeof DSVirtualListName, typeof DSVirtualListSlots> {\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 ...getPropsPerSlotPropTypes(DSVirtualListName, DSVirtualListSlots),\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,WAAW,gCAAgC;AACpD,SAAS,mBAAmB,0BAA0B;AA0B/C,MAAM,eAA4C,CAAC;AAEnD,MAAM,yBAAyB;AAAA,EACpC,GAAG,yBAAyB,mBAAmB,kBAAkB;AAAA,EACjE,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
6
  "names": []
7
7
  }
@@ -1 +1,6 @@
1
1
  export declare const DSVirtualListName = "DSVirtualList";
2
+ export declare const DSVirtualListSlots: {
3
+ ROOT: string;
4
+ LIST_WRAPPER: string;
5
+ ITEM_WRAPPER: string;
6
+ };
@@ -15,6 +15,7 @@ export type VirtualListCTX = {
15
15
  totalSize: number;
16
16
  instanceUid: string;
17
17
  measureElement: MeasureElement;
18
+ propsWithDefault: DSVirtualListT.InternalProps;
18
19
  };
19
20
  export declare const useVirtualListV3: (propsFromUser: DSVirtualListT.Props) => VirtualListCTX;
20
21
  export {};
@@ -1,2 +1,3 @@
1
1
  export { type DSVirtualListT } from './react-desc-prop-types.js';
2
2
  export { DSVirtualList, DSVirtualListWithSchema } from './VirtualList.js';
3
+ export { DSVirtualListName, DSVirtualListSlots } from './DSVirtualListDefinitions.js';
@@ -0,0 +1,7 @@
1
+ export declare const StyledWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
2
+ export declare const StyledListWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, {
3
+ height: number;
4
+ } & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
5
+ export declare const StyledItemWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, {
6
+ start: number;
7
+ } & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import { DSVirtualListName, DSVirtualListSlots } from './DSVirtualListDefinitions.js';
2
3
  export declare namespace DSVirtualListT {
3
4
  type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';
4
5
  type ScrollToOptions = {
@@ -12,7 +13,7 @@ export declare namespace DSVirtualListT {
12
13
  }
13
14
  interface DefaultProps {
14
15
  }
15
- interface OptionalProps {
16
+ interface OptionalProps extends PropsForGlobalOnSlots<typeof DSVirtualListName, typeof DSVirtualListSlots> {
16
17
  actionRef: React.MutableRefObject<ActionRef>;
17
18
  }
18
19
  interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-virtual-list",
3
- "version": "3.27.0-next.2",
3
+ "version": "3.27.0-next.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Virtual List",
6
6
  "files": [
@@ -63,14 +63,15 @@
63
63
  "@xstyled/system": "3.7.0",
64
64
  "axe-core": "^4.6.3",
65
65
  "uid": "^2.0.1",
66
- "@elliemae/ds-props-helpers": "3.27.0-next.2",
67
- "@elliemae/ds-system": "3.27.0-next.2"
66
+ "@elliemae/ds-props-helpers": "3.27.0-next.3",
67
+ "@elliemae/ds-utilities": "3.27.0-next.3",
68
+ "@elliemae/ds-system": "3.27.0-next.3"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@elliemae/pui-cli": "~9.0.0-next.31",
71
72
  "styled-components": "~5.3.9",
72
- "@elliemae/ds-monorepo-devops": "3.27.0-next.2",
73
- "@elliemae/ds-test-utils": "3.27.0-next.2"
73
+ "@elliemae/ds-monorepo-devops": "3.27.0-next.3",
74
+ "@elliemae/ds-test-utils": "3.27.0-next.3"
74
75
  },
75
76
  "peerDependencies": {
76
77
  "lodash": "^4.17.21",