@elliemae/ds-virtual-list 2.2.0-alpha.4 → 3.0.0-next.2

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.
@@ -1,50 +1,36 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.filter.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.filter.js');
8
+ require('core-js/modules/esnext.async-iterator.for-each.js');
9
+ require('core-js/modules/esnext.iterator.for-each.js');
10
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
+ require('react');
12
+ var dsPropsHelpers = require('@elliemae/ds-props-helpers');
13
+ var reactDesc = require('react-desc');
14
+ var List = require('./parts/List.js');
15
+ var props = require('./props.js');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
21
+
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
+
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
+
26
+ const DSVirtualList = props$1 => {
27
+ const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props$1, props.defaultProps);
28
+ dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, props.DSVirtualListSchema);
29
+ return /*#__PURE__*/jsxRuntime.jsx(List.List, _objectSpread({}, propsWithDefault));
11
30
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var VirtualList_exports = {};
29
- __export(VirtualList_exports, {
30
- DSVirtualList: () => DSVirtualList,
31
- DSVirtualListWithSchema: () => DSVirtualListWithSchema
32
- });
33
- var React = __toESM(require("react"));
34
- var import_react = __toESM(require("react"));
35
- var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
36
- var import_react_desc = require("react-desc");
37
- var import_List = require("./parts/List");
38
- var import_props = require("./props");
39
- const DSVirtualList = (props) => {
40
- const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_props.defaultProps);
41
- (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_props.DSVirtualListSchema);
42
- return /* @__PURE__ */ import_react.default.createElement(import_List.List, {
43
- ...propsWithDefault
44
- });
45
- };
46
- DSVirtualList.propTypes = import_props.DSVirtualListSchema;
47
- const DSVirtualListWithSchema = (0, import_react_desc.describe)(DSVirtualList).description("DSVirtualList");
48
- DSVirtualListWithSchema.propTypes = import_props.DSVirtualListSchema;
49
- module.exports = __toCommonJS(VirtualList_exports);
50
- //# sourceMappingURL=VirtualList.js.map
31
+
32
+ const DSVirtualListWithSchema = reactDesc.describe(DSVirtualList).description('DSVirtualList');
33
+ DSVirtualListWithSchema.propTypes = props.DSVirtualListSchema;
34
+
35
+ exports.DSVirtualList = DSVirtualList;
36
+ exports.DSVirtualListWithSchema = DSVirtualListWithSchema;
@@ -1,37 +1,9 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var VirtualListDataTestID_exports = {};
29
- __export(VirtualListDataTestID_exports, {
30
- LIST_DATA_TESTID: () => LIST_DATA_TESTID
31
- });
32
- var React = __toESM(require("react"));
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
33
5
  const LIST_DATA_TESTID = {
34
- CONTAINER: "virtual-list-container"
6
+ CONTAINER: 'virtual-list-container'
35
7
  };
36
- module.exports = __toCommonJS(VirtualListDataTestID_exports);
37
- //# sourceMappingURL=VirtualListDataTestID.js.map
8
+
9
+ exports.LIST_DATA_TESTID = LIST_DATA_TESTID;
@@ -1,47 +1,33 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var useVirtualList_exports = {};
29
- __export(useVirtualList_exports, {
30
- useVirtualList: () => useVirtualList
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = __toESM(require("react"));
34
- var import_react_virtual = require("react-virtual");
35
- const useVirtualList = (config) => {
36
- const { children, actionRef } = config;
37
- const parentRef = import_react.default.useRef();
38
- const filteredChildren = import_react.default.useMemo(() => import_react.default.Children.toArray(children).filter((child) => child), [children]);
39
- const useVirtualHelpers = (0, import_react_virtual.useVirtual)({
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.filter.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.filter.js');
8
+ require('core-js/modules/esnext.async-iterator.constructor.js');
9
+ require('core-js/modules/esnext.async-iterator.to-array.js');
10
+ require('core-js/modules/esnext.iterator.to-array.js');
11
+ var React = require('react');
12
+ var reactVirtual = require('react-virtual');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
+
18
+ const useVirtualList = config => {
19
+ const {
20
+ children,
21
+ actionRef
22
+ } = config;
23
+ const parentRef = React__default["default"].useRef();
24
+ const filteredChildren = React__default["default"].useMemo(() => React__default["default"].Children.toArray(children).filter(child => child), [children]);
25
+ const useVirtualHelpers = reactVirtual.useVirtual({
40
26
  size: filteredChildren.length,
41
27
  parentRef,
42
28
  overscan: 15
43
29
  });
44
- import_react.default.useEffect(() => {
30
+ React__default["default"].useEffect(() => {
45
31
  if (actionRef) {
46
32
  actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;
47
33
  }
@@ -53,5 +39,5 @@ const useVirtualList = (config) => {
53
39
  totalSize: useVirtualHelpers.totalSize
54
40
  };
55
41
  };
56
- module.exports = __toCommonJS(useVirtualList_exports);
57
- //# sourceMappingURL=useVirtualList.js.map
42
+
43
+ exports.useVirtualList = useVirtualList;
package/cjs/index.d.js CHANGED
@@ -1,27 +1,2 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __reExport = (target, module2, copyDefault, desc) => {
9
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
- for (let key of __getOwnPropNames(module2))
11
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
- }
14
- return target;
15
- };
16
- var __toESM = (module2, isNodeMode) => {
17
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
- };
19
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
- return (module2, temp) => {
21
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
- };
23
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
- var index_d_exports = {};
25
- var React = __toESM(require("react"));
26
- module.exports = __toCommonJS(index_d_exports);
27
- //# sourceMappingURL=index.d.js.map
1
+ 'use strict';
2
+
package/cjs/index.js CHANGED
@@ -1,28 +1,10 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __reExport = (target, module2, copyDefault, desc) => {
9
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
- for (let key of __getOwnPropNames(module2))
11
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
- }
14
- return target;
15
- };
16
- var __toESM = (module2, isNodeMode) => {
17
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
- };
19
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
- return (module2, temp) => {
21
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
- };
23
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
- var src_exports = {};
25
- var React = __toESM(require("react"));
26
- __reExport(src_exports, require("./VirtualList"));
27
- module.exports = __toCommonJS(src_exports);
28
- //# sourceMappingURL=index.js.map
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var VirtualList = require('./VirtualList.js');
6
+
7
+
8
+
9
+ exports.DSVirtualList = VirtualList.DSVirtualList;
10
+ exports.DSVirtualListWithSchema = VirtualList.DSVirtualListWithSchema;
package/cjs/parts/List.js CHANGED
@@ -1,59 +1,52 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var List_exports = {};
29
- __export(List_exports, {
30
- List: () => List
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = __toESM(require("react"));
34
- var import_styled = require("../styled");
35
- var import_VirtualListDataTestID = require("../VirtualListDataTestID");
36
- var import_useVirtualList = require("../hooks/useVirtualList");
37
- const List = (props) => {
38
- const { parentRef, virtualItems, filteredChildren, totalSize } = (0, import_useVirtualList.useVirtualList)(props);
39
- const virtualChildren = import_react.default.useMemo(() => virtualItems.map((virtualItem) => {
40
- const { index, measureRef, start } = virtualItem;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _jsx2 = require('@babel/runtime/helpers/jsx');
6
+ require('core-js/modules/esnext.async-iterator.map.js');
7
+ require('core-js/modules/esnext.iterator.map.js');
8
+ var React = require('react');
9
+ var styled = require('../styled.js');
10
+ var VirtualListDataTestID = require('../VirtualListDataTestID.js');
11
+ var useVirtualList = require('../hooks/useVirtualList.js');
12
+ var jsxRuntime = require('react/jsx-runtime');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
17
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
+
19
+ const List = props => {
20
+ const {
21
+ parentRef,
22
+ virtualItems,
23
+ filteredChildren,
24
+ totalSize
25
+ } = useVirtualList.useVirtualList(props);
26
+ const virtualChildren = React__default["default"].useMemo(() => virtualItems.map(virtualItem => {
27
+ const {
28
+ index,
29
+ measureRef,
30
+ start
31
+ } = virtualItem;
41
32
  const style = {
42
- transform: `translateY(${start}px)`
33
+ transform: "translateY(".concat(start, "px)")
43
34
  };
44
- return /* @__PURE__ */ import_react.default.createElement(import_styled.VirtualItemStyled, {
35
+ return /*#__PURE__*/jsxRuntime.jsx(styled.VirtualItemStyled, {
45
36
  ref: measureRef,
46
- style,
47
- role: "listitem"
48
- }, filteredChildren[index]);
37
+ style: style,
38
+ role: "listitem",
39
+ children: filteredChildren[index]
40
+ });
49
41
  }), [filteredChildren, virtualItems]);
50
- return /* @__PURE__ */ import_react.default.createElement(import_styled.StyledContainerContentList, {
42
+ return /*#__PURE__*/jsxRuntime.jsx(styled.StyledContainerContentList, {
51
43
  ref: parentRef,
52
- "data-testid": import_VirtualListDataTestID.LIST_DATA_TESTID.CONTAINER,
53
- role: "list"
54
- }, /* @__PURE__ */ import_react.default.createElement(import_styled.StyledVirtualList, {
55
- height: `${totalSize}px`
56
- }, virtualChildren));
44
+ "data-testid": VirtualListDataTestID.LIST_DATA_TESTID.CONTAINER,
45
+ role: "list",
46
+ children: /*#__PURE__*/_jsx2__default["default"](styled.StyledVirtualList, {
47
+ height: "".concat(totalSize, "px")
48
+ }, void 0, virtualChildren)
49
+ });
57
50
  };
58
- module.exports = __toCommonJS(List_exports);
59
- //# sourceMappingURL=List.js.map
51
+
52
+ exports.List = List;
package/cjs/props.js CHANGED
@@ -1,57 +1,27 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var props_exports = {};
29
- __export(props_exports, {
30
- DSVirtualListSchema: () => DSVirtualListSchema,
31
- defaultProps: () => defaultProps
32
- });
33
- var React = __toESM(require("react"));
34
- var import_lodash = require("lodash");
35
- var import_react_desc = require("react-desc");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var lodash = require('lodash');
6
+ var reactDesc = require('react-desc');
7
+
36
8
  const actionRef = {
37
- scrollTo: import_react_desc.PropTypes.func.description("Scroll to a index inside the list")
9
+ scrollTo: reactDesc.PropTypes.func.description('Scroll to a index inside the list')
38
10
  };
39
11
  const DSVirtualListSchema = {
40
- children: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.node).description("Children list").defaultValue([]),
41
- actionRef: import_react_desc.PropTypes.shape({
42
- current: import_react_desc.PropTypes.shape(actionRef)
43
- }).description(`Action reference
44
-
45
- scrollTo: Function(index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void
46
- `)
12
+ children: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.node).description('Children list').defaultValue([]),
13
+ actionRef: reactDesc.PropTypes.shape({
14
+ current: reactDesc.PropTypes.shape(actionRef)
15
+ }).description("Action reference\n \nscrollTo: Function(index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void\n ")
47
16
  };
48
17
  const defaultProps = {
49
18
  children: [],
50
19
  actionRef: {
51
20
  current: {
52
- scrollTo: import_lodash.noop
21
+ scrollTo: lodash.noop
53
22
  }
54
23
  }
55
24
  };
56
- module.exports = __toCommonJS(props_exports);
57
- //# sourceMappingURL=props.js.map
25
+
26
+ exports.DSVirtualListSchema = DSVirtualListSchema;
27
+ exports.defaultProps = defaultProps;
package/cjs/styled.js CHANGED
@@ -1,55 +1,23 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var styled_exports = {};
29
- __export(styled_exports, {
30
- StyledContainerContentList: () => StyledContainerContentList,
31
- StyledVirtualList: () => StyledVirtualList,
32
- VirtualItemStyled: () => VirtualItemStyled
33
- });
34
- var React = __toESM(require("react"));
35
- var import_styled_components = __toESM(require("styled-components"));
36
- const StyledContainerContentList = import_styled_components.default.div`
37
- width: 100%;
38
- height: 100%;
39
- padding-bottom: 0;
40
- overflow-y: auto;
41
- overflow-x: hidden;
42
- `;
43
- const StyledVirtualList = import_styled_components.default.div`
44
- width: 100%;
45
- height: ${(props) => props.height};
46
- position: relative;
47
- `;
48
- const VirtualItemStyled = import_styled_components.default.div`
49
- position: absolute;
50
- top: 0;
51
- left: 0;
52
- width: 100%;
53
- `;
54
- module.exports = __toCommonJS(styled_exports);
55
- //# sourceMappingURL=styled.js.map
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var styled = require('styled-components');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
+
11
+ const StyledContainerContentList = /*#__PURE__*/styled__default["default"].div.withConfig({
12
+ componentId: "sc-1fdc3np-0"
13
+ })(["width:100%;height:100%;padding-bottom:0;overflow-y:auto;overflow-x:hidden;"]);
14
+ const StyledVirtualList = /*#__PURE__*/styled__default["default"].div.withConfig({
15
+ componentId: "sc-1fdc3np-1"
16
+ })(["width:100%;height:", ";position:relative;"], props => props.height);
17
+ const VirtualItemStyled = /*#__PURE__*/styled__default["default"].div.withConfig({
18
+ componentId: "sc-1fdc3np-2"
19
+ })(["position:absolute;top:0;left:0;width:100%;"]);
20
+
21
+ exports.StyledContainerContentList = StyledContainerContentList;
22
+ exports.StyledVirtualList = StyledVirtualList;
23
+ exports.VirtualItemStyled = VirtualItemStyled;
@@ -1,21 +1,27 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
4
- import { describe } from "react-desc";
5
- import { List } from "./parts/List";
6
- import { DSVirtualListSchema, defaultProps } from "./props";
7
- const DSVirtualList = (props) => {
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.filter.js';
4
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
+ import 'core-js/modules/esnext.iterator.for-each.js';
6
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
+ import 'react';
8
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
9
+ import { describe } from 'react-desc';
10
+ import { List } from './parts/List.js';
11
+ import { DSVirtualListSchema, defaultProps } from './props.js';
12
+ import { jsx } from 'react/jsx-runtime';
13
+
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+
18
+ const DSVirtualList = props => {
8
19
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
9
20
  useValidateTypescriptPropTypes(propsWithDefault, DSVirtualListSchema);
10
- return /* @__PURE__ */ React2.createElement(List, {
11
- ...propsWithDefault
12
- });
21
+ return /*#__PURE__*/jsx(List, _objectSpread({}, propsWithDefault));
13
22
  };
14
- DSVirtualList.propTypes = DSVirtualListSchema;
15
- const DSVirtualListWithSchema = describe(DSVirtualList).description("DSVirtualList");
23
+
24
+ const DSVirtualListWithSchema = describe(DSVirtualList).description('DSVirtualList');
16
25
  DSVirtualListWithSchema.propTypes = DSVirtualListSchema;
17
- export {
18
- DSVirtualList,
19
- DSVirtualListWithSchema
20
- };
21
- //# sourceMappingURL=VirtualList.js.map
26
+
27
+ export { DSVirtualList, DSVirtualListWithSchema };
@@ -1,8 +1,5 @@
1
- import * as React from "react";
2
1
  const LIST_DATA_TESTID = {
3
- CONTAINER: "virtual-list-container"
2
+ CONTAINER: 'virtual-list-container'
4
3
  };
5
- export {
6
- LIST_DATA_TESTID
7
- };
8
- //# sourceMappingURL=VirtualListDataTestID.js.map
4
+
5
+ export { LIST_DATA_TESTID };
@@ -1,16 +1,25 @@
1
- import * as React from "react";
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();
7
- const filteredChildren = React2.useMemo(() => React2.Children.toArray(children).filter((child) => child), [children]);
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.filter.js';
4
+ import 'core-js/modules/esnext.async-iterator.constructor.js';
5
+ import 'core-js/modules/esnext.async-iterator.to-array.js';
6
+ import 'core-js/modules/esnext.iterator.to-array.js';
7
+ import React from 'react';
8
+ import { useVirtual } from 'react-virtual';
9
+
10
+ const useVirtualList = config => {
11
+ const {
12
+ children,
13
+ actionRef
14
+ } = config;
15
+ const parentRef = React.useRef();
16
+ const filteredChildren = React.useMemo(() => React.Children.toArray(children).filter(child => child), [children]);
8
17
  const useVirtualHelpers = useVirtual({
9
18
  size: filteredChildren.length,
10
19
  parentRef,
11
20
  overscan: 15
12
21
  });
13
- React2.useEffect(() => {
22
+ React.useEffect(() => {
14
23
  if (actionRef) {
15
24
  actionRef.current.scrollTo = useVirtualHelpers.scrollToIndex;
16
25
  }
@@ -22,7 +31,5 @@ const useVirtualList = (config) => {
22
31
  totalSize: useVirtualHelpers.totalSize
23
32
  };
24
33
  };
25
- export {
26
- useVirtualList
27
- };
28
- //# sourceMappingURL=useVirtualList.js.map
34
+
35
+ export { useVirtualList };
package/esm/index.d.js CHANGED
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=index.d.js.map
1
+
package/esm/index.js CHANGED
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./VirtualList";
3
- //# sourceMappingURL=index.js.map
1
+ export { DSVirtualList, DSVirtualListWithSchema } from './VirtualList.js';
package/esm/parts/List.js CHANGED
@@ -1,30 +1,43 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from "../styled";
4
- import { LIST_DATA_TESTID } from "../VirtualListDataTestID";
5
- import { useVirtualList } from "../hooks/useVirtualList";
6
- const List = (props) => {
7
- const { parentRef, virtualItems, filteredChildren, totalSize } = useVirtualList(props);
8
- const virtualChildren = React2.useMemo(() => virtualItems.map((virtualItem) => {
9
- const { index, measureRef, start } = virtualItem;
1
+ import _jsx2 from '@babel/runtime/helpers/esm/jsx';
2
+ import 'core-js/modules/esnext.async-iterator.map.js';
3
+ import 'core-js/modules/esnext.iterator.map.js';
4
+ import React from 'react';
5
+ import { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from '../styled.js';
6
+ import { LIST_DATA_TESTID } from '../VirtualListDataTestID.js';
7
+ import { useVirtualList } from '../hooks/useVirtualList.js';
8
+ import { jsx } from 'react/jsx-runtime';
9
+
10
+ const List = props => {
11
+ const {
12
+ parentRef,
13
+ virtualItems,
14
+ filteredChildren,
15
+ totalSize
16
+ } = useVirtualList(props);
17
+ const virtualChildren = React.useMemo(() => virtualItems.map(virtualItem => {
18
+ const {
19
+ index,
20
+ measureRef,
21
+ start
22
+ } = virtualItem;
10
23
  const style = {
11
- transform: `translateY(${start}px)`
24
+ transform: "translateY(".concat(start, "px)")
12
25
  };
13
- return /* @__PURE__ */ React2.createElement(VirtualItemStyled, {
26
+ return /*#__PURE__*/jsx(VirtualItemStyled, {
14
27
  ref: measureRef,
15
- style,
16
- role: "listitem"
17
- }, filteredChildren[index]);
28
+ style: style,
29
+ role: "listitem",
30
+ children: filteredChildren[index]
31
+ });
18
32
  }), [filteredChildren, virtualItems]);
19
- return /* @__PURE__ */ React2.createElement(StyledContainerContentList, {
33
+ return /*#__PURE__*/jsx(StyledContainerContentList, {
20
34
  ref: parentRef,
21
35
  "data-testid": LIST_DATA_TESTID.CONTAINER,
22
- role: "list"
23
- }, /* @__PURE__ */ React2.createElement(StyledVirtualList, {
24
- height: `${totalSize}px`
25
- }, virtualChildren));
36
+ role: "list",
37
+ children: /*#__PURE__*/_jsx2(StyledVirtualList, {
38
+ height: "".concat(totalSize, "px")
39
+ }, void 0, virtualChildren)
40
+ });
26
41
  };
27
- export {
28
- List
29
- };
30
- //# sourceMappingURL=List.js.map
42
+
43
+ export { List };
package/esm/props.js CHANGED
@@ -1,17 +1,14 @@
1
- import * as React from "react";
2
- import { noop } from "lodash";
3
- import { PropTypes } from "react-desc";
1
+ import { noop } from 'lodash';
2
+ import { PropTypes } from 'react-desc';
3
+
4
4
  const actionRef = {
5
- scrollTo: PropTypes.func.description("Scroll to a index inside the list")
5
+ scrollTo: PropTypes.func.description('Scroll to a index inside the list')
6
6
  };
7
7
  const DSVirtualListSchema = {
8
- children: PropTypes.arrayOf(PropTypes.node).description("Children list").defaultValue([]),
8
+ children: PropTypes.arrayOf(PropTypes.node).description('Children list').defaultValue([]),
9
9
  actionRef: PropTypes.shape({
10
10
  current: PropTypes.shape(actionRef)
11
- }).description(`Action reference
12
-
13
- scrollTo: Function(index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void
14
- `)
11
+ }).description("Action reference\n \nscrollTo: Function(index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void\n ")
15
12
  };
16
13
  const defaultProps = {
17
14
  children: [],
@@ -21,8 +18,5 @@ const defaultProps = {
21
18
  }
22
19
  }
23
20
  };
24
- export {
25
- DSVirtualListSchema,
26
- defaultProps
27
- };
28
- //# sourceMappingURL=props.js.map
21
+
22
+ export { DSVirtualListSchema, defaultProps };
package/esm/styled.js CHANGED
@@ -1,26 +1,13 @@
1
- import * as React from "react";
2
- import styled from "styled-components";
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
+ import styled from 'styled-components';
2
+
3
+ const StyledContainerContentList = /*#__PURE__*/styled.div.withConfig({
4
+ componentId: "sc-1fdc3np-0"
5
+ })(["width:100%;height:100%;padding-bottom:0;overflow-y:auto;overflow-x:hidden;"]);
6
+ const StyledVirtualList = /*#__PURE__*/styled.div.withConfig({
7
+ componentId: "sc-1fdc3np-1"
8
+ })(["width:100%;height:", ";position:relative;"], props => props.height);
9
+ const VirtualItemStyled = /*#__PURE__*/styled.div.withConfig({
10
+ componentId: "sc-1fdc3np-2"
11
+ })(["position:absolute;top:0;left:0;width:100%;"]);
12
+
13
+ export { StyledContainerContentList, StyledVirtualList, VirtualItemStyled };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-virtual-list",
3
- "version": "2.2.0-alpha.4",
3
+ "version": "3.0.0-next.2",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Virtual List",
6
6
  "module": "./esm/index.js",
@@ -56,7 +56,7 @@
56
56
  "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w"
57
57
  },
58
58
  "dependencies": {
59
- "@elliemae/ds-props-helpers": "2.2.0-alpha.4",
59
+ "@elliemae/ds-props-helpers": "3.0.0-next.2",
60
60
  "prop-types": "~15.7.2",
61
61
  "react-desc": "~4.1.3",
62
62
  "react-virtual": "~2.3.2"
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/VirtualList.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { describe } from 'react-desc';\nimport { List } from './parts/List';\nimport { DSVirtualListSchema, defaultProps } from './props';\nimport { DSVirtualListProps } from './index.d';\n\n\nconst DSVirtualList: React.ComponentType<DSVirtualListProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSVirtualListSchema);\n\n return <List {...propsWithDefault} />;\n};\n\nDSVirtualList.propTypes = DSVirtualListSchema;\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;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAA6E;AAC7E,wBAAyB;AACzB,kBAAqB;AACrB,mBAAkD;AAIlD,MAAM,gBAAyD,CAAC,UAAU;AACxE,QAAM,mBAAmB,0DAA6B,OAAO;AAC7D,8DAA+B,kBAAkB;AAEjD,SAAO,mDAAC,kBAAD;AAAA,OAAU;AAAA;AAAA;AAGnB,cAAc,YAAY;AAC1B,MAAM,0BAA0B,gCAAS,eAAe,YAAY;AACpE,wBAAwB,YAAY;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/VirtualListDataTestID.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export const LIST_DATA_TESTID = {\n CONTAINER: 'virtual-list-container',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useVirtualList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { useVirtual, VirtualItem } from 'react-virtual';\nimport { 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;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,2BAAwC;AAGjC,MAAM,iBAAiB,CAC5B,WAMG;AACH,QAAM,EAAE,UAAU,cAAc;AAChC,QAAM,YAAY,qBAAM;AACxB,QAAM,mBAAmB,qBAAM,QAC7B,MAAM,qBAAM,SAAS,QAAQ,UAAU,OAAO,CAAC,UAAU,QACzD,CAAC;AAEH,QAAM,oBAAoB,qCAAW;AAAA,IACnC,MAAM,iBAAiB;AAAA,IACvB;AAAA,IACA,UAAU;AAAA;AAEZ,uBAAM,UAAU,MAAM;AACpB,QAAI,WAAW;AACb,gBAAU,QAAQ,WAAW,kBAAkB;AAAA;AAAA,KAEhD,CAAC,WAAW;AAEf,SAAO;AAAA,IACL;AAAA,IACA,cAAc,kBAAkB;AAAA,IAChC;AAAA,IACA,WAAW,kBAAkB;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.d.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import 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;ACAA,YAAuB;",
6
- "names": []
7
- }
package/cjs/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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;ACAA,YAAuB;ADAvB,wBAAc;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/parts/List.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from '../styled';\n\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID';\n\nimport { 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 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\">\n {filteredChildren[index]}\n </VirtualItemStyled>\n );\n }),\n [filteredChildren, virtualItems],\n );\n return (\n <StyledContainerContentList ref={parentRef} data-testid={LIST_DATA_TESTID.CONTAINER} role=\"list\">\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;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,oBAAiF;AAEjF,mCAAiC;AAGjC,4BAA+B;AASxB,MAAM,OAAqC,CAAC,UAA8B;AAC/E,QAAM,EAAE,WAAW,cAAc,kBAAkB,cAAc,0CAAe;AAChF,QAAM,kBAAkB,qBAAM,QAC5B,MACE,aAAa,IAAI,CAAC,gBAAgB;AAChC,UAAM,EAAE,OAAO,YAAY,UAAU;AACrC,UAAM,QAAQ;AAAA,MACZ,WAAW,cAAc;AAAA;AAE3B,WACE,mDAAC,iCAAD;AAAA,MAAmB,KAAK;AAAA,MAAY;AAAA,MAAc,MAAK;AAAA,OACpD,iBAAiB;AAAA,MAI1B,CAAC,kBAAkB;AAErB,SACE,mDAAC,0CAAD;AAAA,IAA4B,KAAK;AAAA,IAAW,eAAa,8CAAiB;AAAA,IAAW,MAAK;AAAA,KACxF,mDAAC,iCAAD;AAAA,IAAmB,QAAQ,GAAG;AAAA,KAAgB;AAAA;",
6
- "names": []
7
- }
package/cjs/props.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/props.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { noop } from 'lodash';\nimport { PropTypes } from 'react-desc';\n\nconst actionRef = {\n scrollTo: PropTypes.func.description('Scroll to a index inside the list'),\n};\nexport const DSVirtualListSchema = {\n children: PropTypes.arrayOf(PropTypes.node).description('Children list').defaultValue([]),\n actionRef: PropTypes.shape({\n current: PropTypes.shape(actionRef),\n }).description(`Action reference\n \nscrollTo: Function(index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void\n `),\n};\n\nexport const defaultProps = {\n children: [],\n actionRef: {\n current: {\n scrollTo: noop,\n },\n },\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAAqB;AACrB,wBAA0B;AAE1B,MAAM,YAAY;AAAA,EAChB,UAAU,4BAAU,KAAK,YAAY;AAAA;AAEhC,MAAM,sBAAsB;AAAA,EACjC,UAAU,4BAAU,QAAQ,4BAAU,MAAM,YAAY,iBAAiB,aAAa;AAAA,EACtF,WAAW,4BAAU,MAAM;AAAA,IACzB,SAAS,4BAAU,MAAM;AAAA,KACxB,YAAY;AAAA;AAAA;AAAA;AAAA;AAMV,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,WAAW;AAAA,IACT,SAAS;AAAA,MACP,UAAU;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
package/cjs/styled.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/styled.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import styled from 'styled-components';\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;ACAA,YAAuB;ADAvB,+BAAmB;AAEZ,MAAM,6BAA6B,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1C,MAAM,oBAAoB,iCAAO;AAAA;AAAA,YAE5B,CAAC,UAAU,MAAM;AAAA;AAAA;AAGtB,MAAM,oBAAoB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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 } from '@elliemae/ds-props-helpers';\nimport { describe } from 'react-desc';\nimport { List } from './parts/List';\nimport { DSVirtualListSchema, defaultProps } from './props';\nimport { DSVirtualListProps } from './index.d';\n\n\nconst DSVirtualList: React.ComponentType<DSVirtualListProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSVirtualListSchema);\n\n return <List {...propsWithDefault} />;\n};\n\nDSVirtualList.propTypes = DSVirtualListSchema;\nconst DSVirtualListWithSchema = describe(DSVirtualList).description('DSVirtualList');\nDSVirtualListWithSchema.propTypes = DSVirtualListSchema;\n\nexport { DSVirtualList, DSVirtualListWithSchema };\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAIA,MAAM,gBAAyD,CAAC,UAAU;AACxE,QAAM,mBAAmB,6BAA6B,OAAO;AAC7D,iCAA+B,kBAAkB;AAEjD,SAAO,qCAAC,MAAD;AAAA,OAAU;AAAA;AAAA;AAGnB,cAAc,YAAY;AAC1B,MAAM,0BAA0B,SAAS,eAAe,YAAY;AACpE,wBAAwB,YAAY;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/VirtualListDataTestID.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const LIST_DATA_TESTID = {\n CONTAINER: 'virtual-list-container',\n};\n"],
5
- "mappings": "AAAA;ACAO,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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 { useVirtual, VirtualItem } from 'react-virtual';\nimport { 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;ACAA;AACA;AAGO,MAAM,iBAAiB,CAC5B,WAMG;AACH,QAAM,EAAE,UAAU,cAAc;AAChC,QAAM,YAAY,OAAM;AACxB,QAAM,mBAAmB,OAAM,QAC7B,MAAM,OAAM,SAAS,QAAQ,UAAU,OAAO,CAAC,UAAU,QACzD,CAAC;AAEH,QAAM,oBAAoB,WAAW;AAAA,IACnC,MAAM,iBAAiB;AAAA,IACvB;AAAA,IACA,UAAU;AAAA;AAEZ,SAAM,UAAU,MAAM;AACpB,QAAI,WAAW;AACb,gBAAU,QAAQ,WAAW,kBAAkB;AAAA;AAAA,KAEhD,CAAC,WAAW;AAEf,SAAO;AAAA,IACL;AAAA,IACA,cAAc,kBAAkB;AAAA,IAChC;AAAA,IACA,WAAW,kBAAkB;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -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;",
6
- "names": []
7
- }
package/esm/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './VirtualList';\n"],
5
- "mappings": "AAAA;ACAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/List.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from '../styled';\n\nimport { LIST_DATA_TESTID } from '../VirtualListDataTestID';\n\nimport { 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 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\">\n {filteredChildren[index]}\n </VirtualItemStyled>\n );\n }),\n [filteredChildren, virtualItems],\n );\n return (\n <StyledContainerContentList ref={parentRef} data-testid={LIST_DATA_TESTID.CONTAINER} role=\"list\">\n <StyledVirtualList height={`${totalSize}px`}>{virtualChildren}</StyledVirtualList>\n </StyledContainerContentList>\n );\n};\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAEA;AAGA;AASO,MAAM,OAAqC,CAAC,UAA8B;AAC/E,QAAM,EAAE,WAAW,cAAc,kBAAkB,cAAc,eAAe;AAChF,QAAM,kBAAkB,OAAM,QAC5B,MACE,aAAa,IAAI,CAAC,gBAAgB;AAChC,UAAM,EAAE,OAAO,YAAY,UAAU;AACrC,UAAM,QAAQ;AAAA,MACZ,WAAW,cAAc;AAAA;AAE3B,WACE,qCAAC,mBAAD;AAAA,MAAmB,KAAK;AAAA,MAAY;AAAA,MAAc,MAAK;AAAA,OACpD,iBAAiB;AAAA,MAI1B,CAAC,kBAAkB;AAErB,SACE,qCAAC,4BAAD;AAAA,IAA4B,KAAK;AAAA,IAAW,eAAa,iBAAiB;AAAA,IAAW,MAAK;AAAA,KACxF,qCAAC,mBAAD;AAAA,IAAmB,QAAQ,GAAG;AAAA,KAAgB;AAAA;",
6
- "names": []
7
- }
package/esm/props.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/props.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { noop } from 'lodash';\nimport { PropTypes } from 'react-desc';\n\nconst actionRef = {\n scrollTo: PropTypes.func.description('Scroll to a index inside the list'),\n};\nexport const DSVirtualListSchema = {\n children: PropTypes.arrayOf(PropTypes.node).description('Children list').defaultValue([]),\n actionRef: PropTypes.shape({\n current: PropTypes.shape(actionRef),\n }).description(`Action reference\n \nscrollTo: Function(index: number, { align: 'start' | 'center' | 'end' | 'auto' }) => void\n `),\n};\n\nexport const defaultProps = {\n children: [],\n actionRef: {\n current: {\n scrollTo: noop,\n },\n },\n};\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAEA,MAAM,YAAY;AAAA,EAChB,UAAU,UAAU,KAAK,YAAY;AAAA;AAEhC,MAAM,sBAAsB;AAAA,EACjC,UAAU,UAAU,QAAQ,UAAU,MAAM,YAAY,iBAAiB,aAAa;AAAA,EACtF,WAAW,UAAU,MAAM;AAAA,IACzB,SAAS,UAAU,MAAM;AAAA,KACxB,YAAY;AAAA;AAAA;AAAA;AAAA;AAMV,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,WAAW;AAAA,IACT,SAAS;AAAA,MACP,UAAU;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
package/esm/styled.js.map DELETED
@@ -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 'styled-components';\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;ACAA;AAEO,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
- }