@elliemae/ds-shared 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.
Files changed (212) hide show
  1. package/cjs/Animations/BaseAnimation.js +35 -55
  2. package/cjs/Animations/Grow.js +41 -54
  3. package/cjs/Animations/GrowRight.js +41 -63
  4. package/cjs/Animations/GrowVertical.js +7 -47
  5. package/cjs/CheckableGroup.js +65 -67
  6. package/cjs/DeferRenderAfterComputation.js +24 -48
  7. package/cjs/FocusGroup/FocusGrid.js +143 -108
  8. package/cjs/FocusGroup/FocusGroup.js +147 -88
  9. package/cjs/FocusGroup/FocusGroupContext.js +11 -38
  10. package/cjs/FocusGroup/FocusGroupManager.js +47 -56
  11. package/cjs/FocusGroup/focusGroupManagerHoc.js +42 -52
  12. package/cjs/FocusGroup/index.js +21 -47
  13. package/cjs/FocusGroup/useFocusGroupItem.js +51 -59
  14. package/cjs/FocusGroup/utils/getNextCellPosition.js +27 -47
  15. package/cjs/GroupContext/Group.js +73 -64
  16. package/cjs/GroupContext/GroupContext.js +13 -36
  17. package/cjs/GroupContext/GroupItem.js +21 -39
  18. package/cjs/GroupContext/index.js +13 -39
  19. package/cjs/ScrollSync/ScrollSync.js +75 -60
  20. package/cjs/ScrollSync/ScrollSyncPane.js +60 -52
  21. package/cjs/ScrollSync/ScrollSyncProvider.js +50 -103
  22. package/cjs/ScrollSync/index.js +11 -37
  23. package/cjs/ScrollSync/useScrollSync.js +7 -38
  24. package/cjs/constants.js +46 -65
  25. package/cjs/createDataInstance/createInstancePlugin.js +29 -41
  26. package/cjs/createDataInstance/createInstanceRef.js +71 -66
  27. package/cjs/createDataInstance/utils.js +100 -76
  28. package/cjs/defer-render-hoc/index.js +41 -48
  29. package/cjs/dimsum.config.js +6 -38
  30. package/cjs/index.js +17 -40
  31. package/cjs/prop-types.js +49 -106
  32. package/cjs/react-spring/index.js +14 -28
  33. package/cjs/react-spring/renderprops.js +14 -28
  34. package/cjs/toolbar/ToolbarProvider.js +94 -82
  35. package/cjs/useDataGrid/VolatileRowsListener.js +13 -38
  36. package/cjs/useDataGrid/index.js +7 -36
  37. package/cjs/useDataGrid/initColumnDefinition.js +110 -105
  38. package/cjs/useDataGrid/useDataGrid.js +148 -122
  39. package/cjs/useDataList/index.js +7 -36
  40. package/cjs/useDataList/recordIterator.js +18 -42
  41. package/cjs/useDataList/useDataList.js +83 -74
  42. package/cjs/utils.js +80 -71
  43. package/cjs/virtualization/AutoHeightList.js +54 -62
  44. package/cjs/virtualization/FluidHeightList.js +48 -42
  45. package/cjs/virtualization/index.js +20 -48
  46. package/esm/Animations/BaseAnimation.js +29 -26
  47. package/esm/Animations/Grow.js +35 -25
  48. package/esm/Animations/GrowRight.js +35 -34
  49. package/esm/Animations/GrowVertical.js +4 -29
  50. package/esm/CheckableGroup.js +52 -35
  51. package/esm/DeferRenderAfterComputation.js +15 -16
  52. package/esm/FocusGroup/FocusGrid.js +117 -64
  53. package/esm/FocusGroup/FocusGroup.js +137 -56
  54. package/esm/FocusGroup/FocusGroupContext.js +5 -9
  55. package/esm/FocusGroup/FocusGroupManager.js +38 -24
  56. package/esm/FocusGroup/focusGroupManagerHoc.js +36 -24
  57. package/esm/FocusGroup/index.js +6 -18
  58. package/esm/FocusGroup/useFocusGroupItem.js +40 -28
  59. package/esm/FocusGroup/utils/getNextCellPosition.js +25 -18
  60. package/esm/GroupContext/Group.js +66 -34
  61. package/esm/GroupContext/GroupContext.js +5 -7
  62. package/esm/GroupContext/GroupItem.js +15 -10
  63. package/esm/GroupContext/index.js +3 -10
  64. package/esm/ScrollSync/ScrollSync.js +64 -30
  65. package/esm/ScrollSync/ScrollSyncPane.js +52 -22
  66. package/esm/ScrollSync/ScrollSyncProvider.js +42 -74
  67. package/esm/ScrollSync/index.js +2 -8
  68. package/esm/ScrollSync/useScrollSync.js +5 -9
  69. package/esm/constants.js +28 -37
  70. package/esm/createDataInstance/createInstancePlugin.js +23 -12
  71. package/esm/createDataInstance/createInstanceRef.js +59 -36
  72. package/esm/createDataInstance/utils.js +85 -48
  73. package/esm/defer-render-hoc/index.js +31 -17
  74. package/esm/dimsum.config.js +4 -9
  75. package/esm/index.js +5 -11
  76. package/esm/prop-types.js +31 -75
  77. package/esm/react-spring/index.js +1 -3
  78. package/esm/react-spring/renderprops.js +1 -3
  79. package/esm/toolbar/ToolbarProvider.js +74 -45
  80. package/esm/useDataGrid/VolatileRowsListener.js +11 -9
  81. package/esm/useDataGrid/index.js +1 -7
  82. package/esm/useDataGrid/initColumnDefinition.js +94 -78
  83. package/esm/useDataGrid/useDataGrid.js +99 -82
  84. package/esm/useDataList/index.js +1 -7
  85. package/esm/useDataList/recordIterator.js +14 -13
  86. package/esm/useDataList/useDataList.js +67 -44
  87. package/esm/utils.js +59 -42
  88. package/esm/virtualization/AutoHeightList.js +40 -28
  89. package/esm/virtualization/FluidHeightList.js +38 -14
  90. package/esm/virtualization/index.js +16 -19
  91. package/package.json +3 -3
  92. package/types/Animations/BaseAnimation.d.ts +0 -1
  93. package/types/Animations/Grow.d.ts +0 -1
  94. package/types/Animations/GrowRight.d.ts +0 -1
  95. package/types/CheckableGroup.d.ts +0 -1
  96. package/types/DeferRenderAfterComputation.d.ts +2 -3
  97. package/types/FocusGroup/FocusGrid.d.ts +3 -5
  98. package/types/FocusGroup/FocusGroup.d.ts +1 -3
  99. package/types/FocusGroup/FocusGroupContext.d.ts +2 -3
  100. package/types/FocusGroup/FocusGroupManager.d.ts +1 -3
  101. package/types/FocusGroup/focusGroupManagerHoc.d.ts +1 -3
  102. package/types/FocusGroup/index.d.ts +6 -6
  103. package/types/FocusGroup/useFocusGroupItem.d.ts +1 -3
  104. package/types/FocusGroup/utils/getNextCellPosition.d.ts +1 -3
  105. package/types/GroupContext/Group.d.ts +0 -1
  106. package/types/GroupContext/GroupItem.d.ts +0 -1
  107. package/types/GroupContext/index.d.ts +3 -3
  108. package/types/ScrollSync/ScrollSync.d.ts +2 -4
  109. package/types/ScrollSync/ScrollSyncPane.d.ts +2 -2
  110. package/types/ScrollSync/index.d.ts +2 -2
  111. package/types/ScrollSync/useScrollSync.d.ts +5 -6
  112. package/types/createDataInstance/createInstancePlugin.d.ts +1 -2
  113. package/types/createDataInstance/createInstanceRef.d.ts +1 -3
  114. package/types/dimsum.config.d.ts +2 -3
  115. package/types/index.d.ts +2 -2
  116. package/types/toolbar/ToolbarProvider.d.ts +8 -3
  117. package/types/useDataGrid/VolatileRowsListener.d.ts +1 -3
  118. package/types/useDataGrid/index.d.ts +1 -1
  119. package/types/useDataGrid/initColumnDefinition.d.ts +1 -2
  120. package/types/useDataGrid/useDataGrid.d.ts +2 -3
  121. package/types/useDataList/index.d.ts +1 -1
  122. package/types/useDataList/useDataList.d.ts +2 -3
  123. package/cjs/Animations/BaseAnimation.js.map +0 -7
  124. package/cjs/Animations/Grow.js.map +0 -7
  125. package/cjs/Animations/GrowRight.js.map +0 -7
  126. package/cjs/Animations/GrowVertical.js.map +0 -7
  127. package/cjs/CheckableGroup.js.map +0 -7
  128. package/cjs/DeferRenderAfterComputation.js.map +0 -7
  129. package/cjs/FocusGroup/FocusGrid.js.map +0 -7
  130. package/cjs/FocusGroup/FocusGroup.js.map +0 -7
  131. package/cjs/FocusGroup/FocusGroupContext.js.map +0 -7
  132. package/cjs/FocusGroup/FocusGroupManager.js.map +0 -7
  133. package/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -7
  134. package/cjs/FocusGroup/index.js.map +0 -7
  135. package/cjs/FocusGroup/useFocusGroupItem.js.map +0 -7
  136. package/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -7
  137. package/cjs/GroupContext/Group.js.map +0 -7
  138. package/cjs/GroupContext/GroupContext.js.map +0 -7
  139. package/cjs/GroupContext/GroupItem.js.map +0 -7
  140. package/cjs/GroupContext/index.js.map +0 -7
  141. package/cjs/ScrollSync/ScrollSync.js.map +0 -7
  142. package/cjs/ScrollSync/ScrollSyncPane.js.map +0 -7
  143. package/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -7
  144. package/cjs/ScrollSync/index.js.map +0 -7
  145. package/cjs/ScrollSync/useScrollSync.js.map +0 -7
  146. package/cjs/constants.js.map +0 -7
  147. package/cjs/createDataInstance/createInstancePlugin.js.map +0 -7
  148. package/cjs/createDataInstance/createInstanceRef.js.map +0 -7
  149. package/cjs/createDataInstance/utils.js.map +0 -7
  150. package/cjs/defer-render-hoc/index.js.map +0 -7
  151. package/cjs/dimsum.config.js.map +0 -7
  152. package/cjs/index.js.map +0 -7
  153. package/cjs/prop-types.js.map +0 -7
  154. package/cjs/react-spring/index.js.map +0 -7
  155. package/cjs/react-spring/renderprops.js.map +0 -7
  156. package/cjs/toolbar/ToolbarProvider.js.map +0 -7
  157. package/cjs/useDataGrid/VolatileRowsListener.js.map +0 -7
  158. package/cjs/useDataGrid/index.js.map +0 -7
  159. package/cjs/useDataGrid/initColumnDefinition.js.map +0 -7
  160. package/cjs/useDataGrid/useDataGrid.js.map +0 -7
  161. package/cjs/useDataList/index.js.map +0 -7
  162. package/cjs/useDataList/recordIterator.js.map +0 -7
  163. package/cjs/useDataList/useDataList.js.map +0 -7
  164. package/cjs/utils.js.map +0 -7
  165. package/cjs/virtualization/AutoHeightList.js.map +0 -7
  166. package/cjs/virtualization/FluidHeightList.js.map +0 -7
  167. package/cjs/virtualization/index.js.map +0 -7
  168. package/esm/Animations/BaseAnimation.js.map +0 -7
  169. package/esm/Animations/Grow.js.map +0 -7
  170. package/esm/Animations/GrowRight.js.map +0 -7
  171. package/esm/Animations/GrowVertical.js.map +0 -7
  172. package/esm/CheckableGroup.js.map +0 -7
  173. package/esm/DeferRenderAfterComputation.js.map +0 -7
  174. package/esm/FocusGroup/FocusGrid.js.map +0 -7
  175. package/esm/FocusGroup/FocusGroup.js.map +0 -7
  176. package/esm/FocusGroup/FocusGroupContext.js.map +0 -7
  177. package/esm/FocusGroup/FocusGroupManager.js.map +0 -7
  178. package/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -7
  179. package/esm/FocusGroup/index.js.map +0 -7
  180. package/esm/FocusGroup/useFocusGroupItem.js.map +0 -7
  181. package/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -7
  182. package/esm/GroupContext/Group.js.map +0 -7
  183. package/esm/GroupContext/GroupContext.js.map +0 -7
  184. package/esm/GroupContext/GroupItem.js.map +0 -7
  185. package/esm/GroupContext/index.js.map +0 -7
  186. package/esm/ScrollSync/ScrollSync.js.map +0 -7
  187. package/esm/ScrollSync/ScrollSyncPane.js.map +0 -7
  188. package/esm/ScrollSync/ScrollSyncProvider.js.map +0 -7
  189. package/esm/ScrollSync/index.js.map +0 -7
  190. package/esm/ScrollSync/useScrollSync.js.map +0 -7
  191. package/esm/constants.js.map +0 -7
  192. package/esm/createDataInstance/createInstancePlugin.js.map +0 -7
  193. package/esm/createDataInstance/createInstanceRef.js.map +0 -7
  194. package/esm/createDataInstance/utils.js.map +0 -7
  195. package/esm/defer-render-hoc/index.js.map +0 -7
  196. package/esm/dimsum.config.js.map +0 -7
  197. package/esm/index.js.map +0 -7
  198. package/esm/prop-types.js.map +0 -7
  199. package/esm/react-spring/index.js.map +0 -7
  200. package/esm/react-spring/renderprops.js.map +0 -7
  201. package/esm/toolbar/ToolbarProvider.js.map +0 -7
  202. package/esm/useDataGrid/VolatileRowsListener.js.map +0 -7
  203. package/esm/useDataGrid/index.js.map +0 -7
  204. package/esm/useDataGrid/initColumnDefinition.js.map +0 -7
  205. package/esm/useDataGrid/useDataGrid.js.map +0 -7
  206. package/esm/useDataList/index.js.map +0 -7
  207. package/esm/useDataList/recordIterator.js.map +0 -7
  208. package/esm/useDataList/useDataList.js.map +0 -7
  209. package/esm/utils.js.map +0 -7
  210. package/esm/virtualization/AutoHeightList.js.map +0 -7
  211. package/esm/virtualization/FluidHeightList.js.map +0 -7
  212. package/esm/virtualization/index.js.map +0 -7
@@ -1,7 +1 @@
1
- import * as React from "react";
2
- import { default as default2, default as default3 } from "./useDataList";
3
- export {
4
- default2 as default,
5
- default3 as useDataList
6
- };
7
- //# sourceMappingURL=index.js.map
1
+ export { default } from './useDataList.js';
@@ -1,26 +1,27 @@
1
- import * as React from "react";
2
1
  const defaultStrategy = () => {
3
- throw Error("Implement an iterator strategy for record iterator");
2
+ throw Error('Implement an iterator strategy for record iterator');
4
3
  };
5
- function recordIterator(records, strategy = defaultStrategy, decorators = [], instance) {
4
+
5
+ function recordIterator(records) {
6
+ let strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
7
+ let decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
8
+ let instance = arguments.length > 3 ? arguments[3] : undefined;
6
9
  const nextRows = [];
7
10
  strategy({
8
11
  data: records,
9
- cb: (row) => {
10
- let nextRow = row;
12
+ cb: row => {
13
+ let nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
14
+
11
15
  for (let i = 0; i < decorators.length; i++) {
12
16
  nextRow = decorators[i](nextRow, instance);
13
- if (!nextRow)
14
- break;
17
+ if (!nextRow) break;
15
18
  }
16
- if (nextRow)
17
- nextRows.push(nextRow);
19
+
20
+ if (nextRow) nextRows.push(nextRow);
18
21
  },
19
22
  instance
20
23
  });
21
24
  return nextRows;
22
25
  }
23
- export {
24
- recordIterator
25
- };
26
- //# sourceMappingURL=recordIterator.js.map
26
+
27
+ export { recordIterator };
@@ -1,67 +1,90 @@
1
- import * as React from "react";
2
- import { useMemo, useRef } from "react";
3
- import { setRef } from "@elliemae/ds-utilities";
4
- import get from "lodash/get";
5
- import {
6
- composeFormatters,
7
- reducePropsGetter
8
- } from "../createDataInstance/utils";
9
- import { recordIterator } from "./recordIterator";
10
- import { createDataInstanceRef } from "../createDataInstance/createInstanceRef";
11
- const getItemLabel = (record, nameKey = "name") => get(record, ["data", nameKey]);
12
- const getItemChildren = (record, childrenKey = "children") => get(record, ["data", childrenKey]);
13
- const listRenderers = {
14
- list: "ul",
15
- item: "li"
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
3
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
4
+ import 'core-js/modules/esnext.iterator.for-each.js';
5
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
6
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
7
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
9
+ import 'core-js/modules/esnext.iterator.constructor.js';
10
+ import 'core-js/modules/esnext.iterator.reduce.js';
11
+ import { useRef, useMemo } from 'react';
12
+ import { setRef } from '@elliemae/ds-utilities';
13
+ import get from 'lodash/get';
14
+ import { reducePropsGetter, composeFormatters } from '../createDataInstance/utils.js';
15
+ import { recordIterator } from './recordIterator.js';
16
+ import createDataInstanceRef from '../createDataInstance/createInstanceRef.js';
17
+
18
+ const _excluded = ["data", "plugins", "renderers", "itemRenderer", "customDecorators"];
19
+
20
+ 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; }
21
+
22
+ 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; }
23
+ const getItemLabel = function (record) {
24
+ let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
25
+ return get(record, ['data', nameKey]);
26
+ };
27
+ const getItemChildren = function (record) {
28
+ let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
29
+ return get(record, ['data', childrenKey]);
16
30
  };
17
- const useDataList = ({
18
- data = [],
19
- plugins = [],
20
- renderers = listRenderers,
21
- itemRenderer = [],
22
- customDecorators,
23
- ...props
24
- }) => {
31
+ const listRenderers = {
32
+ list: 'ul',
33
+ item: 'li'
34
+ }; // todo: check if a plugin is a LIST plugin rather than GRID
35
+
36
+ function useDataList(_ref) {
37
+ let {
38
+ data = [],
39
+ plugins = [],
40
+ renderers = listRenderers,
41
+ itemRenderer = [],
42
+ customDecorators
43
+ } = _ref,
44
+ props = _objectWithoutProperties(_ref, _excluded);
45
+
25
46
  const listRef = useRef();
26
- const { instance, decorators } = createDataInstanceRef({
47
+ const {
48
+ instance,
49
+ decorators
50
+ } = createDataInstanceRef(_objectSpread({
27
51
  data,
28
52
  renderers,
29
53
  plugins,
30
- customDecorators: {
31
- ...customDecorators,
54
+ customDecorators: _objectSpread(_objectSpread({}, customDecorators), {}, {
32
55
  recordIterator,
33
56
  getListProps: [],
34
57
  getItemProps: [],
35
58
  itemRenderer: [...itemRenderer],
59
+ // components reduce to compose item content
36
60
  record: [],
37
61
  records: []
38
- },
39
- ...props
40
- });
62
+ })
63
+ }, props));
64
+
41
65
  instance.current.getListRef = () => listRef;
42
- instance.current.setListRef = (ref) => {
66
+
67
+ instance.current.setListRef = ref => {
43
68
  listRef.current = ref;
44
69
  };
45
- instance.current.getItemLabel = (record) => getItemLabel(record, props.nameKey);
46
- instance.current.getItemChildren = (record) => getItemChildren(record, props.childrenKey);
70
+
71
+ instance.current.getItemLabel = record => getItemLabel(record, props.nameKey);
72
+
73
+ instance.current.getItemChildren = record => getItemChildren(record, props.childrenKey);
74
+
47
75
  instance.current.decorators = decorators;
48
76
  instance.current.getListProps = reducePropsGetter(decorators.getListProps, instance.current);
49
77
  instance.current.getItemProps = reducePropsGetter(decorators.getItemProps, instance.current);
50
78
  instance.current.itemRenderer = composeFormatters(instance.current.decorators.itemRenderer, instance.current);
51
79
  instance.current.records = useMemo(() => {
52
- let nextRecords = recordIterator(data, instance.current.decorators.recordIterator, decorators.record, instance.current);
80
+ // record iterator TREE / Simple
81
+ let nextRecords = recordIterator(data, instance.current.decorators.recordIterator, decorators.record, instance.current); // compose all records
82
+
53
83
  nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
54
84
  return nextRecords;
55
85
  });
56
- if (props.instanceRef)
57
- setRef(props.instanceRef, instance.current);
86
+ if (props.instanceRef) setRef(props.instanceRef, instance.current);
58
87
  return instance.current;
59
- };
60
- var useDataList_default = useDataList;
61
- export {
62
- useDataList_default as default,
63
- getItemChildren,
64
- getItemLabel,
65
- useDataList
66
- };
67
- //# sourceMappingURL=useDataList.js.map
88
+ }
89
+
90
+ export { useDataList as default, getItemChildren, getItemLabel };
package/esm/utils.js CHANGED
@@ -1,51 +1,81 @@
1
- import * as React from "react";
2
- const objectType = (obj) => Object.prototype.toString.call(obj).slice(8, -1);
3
- const isDefined = (param) => typeof param !== "undefined";
4
- const isUndefined = (param) => typeof param === "undefined";
5
- const isFunction = (param) => typeof param === "function";
6
- const isNumber = (param) => typeof param === "number" && !isNaN(param);
7
- const isString = (str) => objectType(str) === "String";
8
- const isArray = (arr) => objectType(arr) === "Array";
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.for-each.js';
3
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/esnext.async-iterator.map.js';
5
+ import 'core-js/modules/esnext.iterator.map.js';
6
+ import 'core-js/modules/esnext.async-iterator.filter.js';
7
+ import 'core-js/modules/esnext.iterator.constructor.js';
8
+ import 'core-js/modules/esnext.iterator.filter.js';
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+
14
+ /* eslint-disable no-cond-assign */
15
+ const objectType = obj => Object.prototype.toString.call(obj).slice(8, -1);
16
+ const isDefined = param => typeof param !== 'undefined';
17
+ const isUndefined = param => typeof param === 'undefined';
18
+ const isFunction = param => typeof param === 'function';
19
+ const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line
20
+
21
+ const isString = str => objectType(str) === 'String';
22
+ const isArray = arr => objectType(arr) === 'Array';
9
23
  const closest = (target, selector) => {
24
+ // closest(e.target, '.field')
10
25
  while (target) {
11
- if (target.matches && target.matches(selector))
12
- return target;
13
- if (target.msMatchesSelector && target.msMatchesSelector(selector))
14
- return target;
26
+ // eslint-disable-line
27
+ if (target.matches && target.matches(selector)) return target;
28
+ if (target.msMatchesSelector && target.msMatchesSelector(selector)) return target; // eslint-disable-next-line no-param-reassign
29
+
15
30
  target = target.parentNode;
16
31
  }
32
+
17
33
  return null;
18
34
  };
19
- const getOffsetRect = (elem) => {
35
+ const getOffsetRect = elem => {
36
+ // (1)
20
37
  const box = elem.getBoundingClientRect();
21
- const { body, documentElement } = document;
38
+ const {
39
+ body,
40
+ documentElement
41
+ } = document; // (2)
42
+
22
43
  const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
23
- const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;
44
+ const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft; // (3)
45
+
24
46
  const clientTop = documentElement.clientTop || body.clientTop || 0;
25
- const clientLeft = documentElement.clientLeft || body.clientLeft || 0;
47
+ const clientLeft = documentElement.clientLeft || body.clientLeft || 0; // (4)
48
+
26
49
  const top = box.top + scrollTop - clientTop;
27
50
  const left = box.left + scrollLeft - clientLeft;
28
- return { top: Math.round(top), left: Math.round(left) };
51
+ return {
52
+ top: Math.round(top),
53
+ left: Math.round(left)
54
+ };
29
55
  };
30
- const getTotalScroll = (elem) => {
56
+ const getTotalScroll = elem => {
31
57
  let top = 0;
32
- let left = 0;
58
+ let left = 0; // eslint-disable-next-line no-param-reassign
59
+
33
60
  while (elem = elem.parentNode) {
34
61
  top += elem.scrollTop || 0;
35
62
  left += elem.scrollLeft || 0;
36
63
  }
37
- return { top, left };
64
+
65
+ return {
66
+ top,
67
+ left
68
+ };
38
69
  };
39
70
  const getTransformProps = (x, y) => ({
40
- transform: `translate(${x}px, ${y}px)`
71
+ transform: "translate(".concat(x, "px, ").concat(y, "px)")
41
72
  });
42
- const listWithChildren = (list, childrenProp) => list.map((item) => ({
43
- ...item,
73
+ const listWithChildren = (list, childrenProp) => list.map(item => _objectSpread(_objectSpread({}, item), {}, {
44
74
  [childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
45
75
  }));
46
76
  const getAllNonEmptyNodesIds = (items, childrenProp) => {
47
77
  let childrenIds = [];
48
- const ids = items.filter((item) => item[childrenProp].length).map((item) => {
78
+ const ids = items.filter(item => item[childrenProp].length).map(item => {
49
79
  childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
50
80
  return item.id;
51
81
  });
@@ -53,26 +83,13 @@ const getAllNonEmptyNodesIds = (items, childrenProp) => {
53
83
  };
54
84
  const isInternetExplorer = () => {
55
85
  const ua = window.navigator.userAgent;
56
- const msie = ua.indexOf("MSIE ");
86
+ const msie = ua.indexOf('MSIE '); // If Internet Explorer, return version number
87
+
57
88
  if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./)) {
58
89
  return true;
59
90
  }
91
+
60
92
  return false;
61
93
  };
62
- export {
63
- closest,
64
- getAllNonEmptyNodesIds,
65
- getOffsetRect,
66
- getTotalScroll,
67
- getTransformProps,
68
- isArray,
69
- isDefined,
70
- isFunction,
71
- isInternetExplorer,
72
- isNumber,
73
- isString,
74
- isUndefined,
75
- listWithChildren,
76
- objectType
77
- };
78
- //# sourceMappingURL=utils.js.map
94
+
95
+ export { closest, getAllNonEmptyNodesIds, getOffsetRect, getTotalScroll, getTransformProps, isArray, isDefined, isFunction, isInternetExplorer, isNumber, isString, isUndefined, listWithChildren, objectType };
@@ -1,40 +1,52 @@
1
- import * as React from "react";
2
- import React2, { forwardRef, useRef } from "react";
3
- import { FixedSizeList as List } from "react-window";
4
- import { cx, useWindowScrollerList, mergeRefs } from "@elliemae/ds-utilities";
5
- const AutoHeightList = forwardRef(({
6
- itemCount,
7
- className,
8
- innerRef,
9
- itemData,
10
- itemKey,
11
- itemSize,
12
- outerRef,
13
- component: ListComponent = List,
14
- ...otherProps
15
- }, ref) => {
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 _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
8
+ import { forwardRef, useRef } from 'react';
9
+ import { FixedSizeList } from 'react-window';
10
+ import { useWindowScrollerList, mergeRefs, cx } from '@elliemae/ds-utilities';
11
+ import { jsx } from 'react/jsx-runtime';
12
+
13
+ const _excluded = ["itemCount", "className", "innerRef", "itemData", "itemKey", "itemSize", "outerRef", "component"];
14
+
15
+ 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; }
16
+
17
+ 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; }
18
+ const AutoHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
19
+ let {
20
+ itemCount,
21
+ className,
22
+ innerRef,
23
+ itemData,
24
+ itemKey,
25
+ itemSize,
26
+ outerRef,
27
+ component: ListComponent = FixedSizeList
28
+ } = _ref,
29
+ otherProps = _objectWithoutProperties(_ref, _excluded);
30
+
16
31
  const listRef = useRef();
17
32
  const outerListRef = useRef();
18
33
  useWindowScrollerList({
19
34
  listInstance: listRef,
20
35
  outerListRef
21
36
  });
22
- return /* @__PURE__ */ React2.createElement(ListComponent, {
23
- ...otherProps,
37
+ return /*#__PURE__*/jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
24
38
  ref: mergeRefs(ref, listRef),
25
- className: cx(className, "window-scroller-override"),
39
+ className: cx(className, 'window-scroller-override'),
26
40
  height: window.innerHeight,
27
- innerRef,
28
- itemCount,
29
- itemData,
30
- itemKey,
31
- itemSize,
41
+ innerRef: innerRef,
42
+ itemCount: itemCount,
43
+ itemData: itemData,
44
+ itemKey: itemKey,
45
+ itemSize: itemSize,
32
46
  outerRef: mergeRefs(outerListRef, outerRef),
33
47
  overscanCount: 10,
34
48
  useIsScrolling: true
35
- });
49
+ }));
36
50
  });
37
- export {
38
- AutoHeightList
39
- };
40
- //# sourceMappingURL=AutoHeightList.js.map
51
+
52
+ export { AutoHeightList };
@@ -1,14 +1,38 @@
1
- import * as React from "react";
2
- import React2, { forwardRef } from "react";
3
- import AutoSizer from "react-virtualized-auto-sizer";
4
- const FluidHeightList = forwardRef(({ component: Component, ...props }, ref) => /* @__PURE__ */ React2.createElement(AutoSizer, {
5
- disableWidth: true
6
- }, ({ height: fluidHeight }) => /* @__PURE__ */ React2.createElement(Component, {
7
- ...props,
8
- ref,
9
- height: fluidHeight - 32
10
- })));
11
- export {
12
- FluidHeightList
13
- };
14
- //# sourceMappingURL=FluidHeightList.js.map
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 _jsx from '@babel/runtime/helpers/esm/jsx';
7
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
+ import { forwardRef } from 'react';
10
+ import AutoSizer from 'react-virtualized-auto-sizer';
11
+ import { jsx } from 'react/jsx-runtime';
12
+
13
+ const _excluded = ["component"];
14
+
15
+ 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; }
16
+
17
+ 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; }
18
+ const FluidHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
19
+ let {
20
+ component: Component
21
+ } = _ref,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+
24
+ return /*#__PURE__*/_jsx(AutoSizer, {
25
+ disableWidth: true
26
+ }, void 0, _ref2 => {
27
+ let {
28
+ height: fluidHeight
29
+ } = _ref2;
30
+ return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
31
+ ref: ref,
32
+ height: fluidHeight - 32 // taking in count the margins of the list
33
+
34
+ }));
35
+ });
36
+ });
37
+
38
+ export { FluidHeightList };
@@ -1,21 +1,18 @@
1
- import * as React from "react";
2
- import { FluidHeightList } from "./FluidHeightList";
3
- import { AutoHeightList } from "./AutoHeightList";
4
- function getVirtualListComponent({
5
- component: Component,
6
- fluid,
7
- height,
8
- autoHeight
9
- }) {
10
- if (autoHeight)
11
- return AutoHeightList;
12
- if (fluid)
13
- return FluidHeightList;
1
+ import { FluidHeightList } from './FluidHeightList.js';
2
+ export { FluidHeightList } from './FluidHeightList.js';
3
+ import { AutoHeightList } from './AutoHeightList.js';
4
+ export { AutoHeightList } from './AutoHeightList.js';
5
+
6
+ function getVirtualListComponent(_ref) {
7
+ let {
8
+ component: Component,
9
+ fluid,
10
+ height,
11
+ autoHeight
12
+ } = _ref;
13
+ if (autoHeight) return AutoHeightList;
14
+ if (fluid) return FluidHeightList;
14
15
  return Component;
15
16
  }
16
- export {
17
- AutoHeightList,
18
- FluidHeightList,
19
- getVirtualListComponent
20
- };
21
- //# sourceMappingURL=index.js.map
17
+
18
+ export { getVirtualListComponent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-shared",
3
- "version": "2.2.0-alpha.4",
3
+ "version": "3.0.0-next.2",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Shared components and utilities",
6
6
  "module": "./esm/index.js",
@@ -213,8 +213,8 @@
213
213
  "generateSubmodules": true
214
214
  },
215
215
  "dependencies": {
216
- "@elliemae/ds-popper": "2.2.0-alpha.4",
217
- "@elliemae/ds-utilities": "2.2.0-alpha.4",
216
+ "@elliemae/ds-popper": "3.0.0-next.2",
217
+ "@elliemae/ds-utilities": "3.0.0-next.2",
218
218
  "hoist-non-react-statics": "~3.3.2",
219
219
  "hotkeys-js": "~3.8.2",
220
220
  "prop-types": "~15.7.2",
@@ -9,5 +9,4 @@ declare const BaseAnimation: ({ keys, items, duration, enter, from, leave, onRes
9
9
  onRest?: (() => null) | undefined;
10
10
  children: any;
11
11
  }) => JSX.Element;
12
- export { BaseAnimation };
13
12
  export default BaseAnimation;
@@ -8,5 +8,4 @@ declare const Grow: ({ keys, duration, items, from, to, children, onRest, }: {
8
8
  children: any;
9
9
  onRest?: (() => null) | undefined;
10
10
  }) => JSX.Element;
11
- export { Grow };
12
11
  export default Grow;
@@ -8,5 +8,4 @@ declare const GrowRight: ({ keys, items, duration, from, to, children, onRest, }
8
8
  children: any;
9
9
  onRest?: (() => null) | undefined;
10
10
  }) => JSX.Element;
11
- export { GrowRight };
12
11
  export default GrowRight;
@@ -17,5 +17,4 @@ declare namespace CheckableGroup {
17
17
  onCheck: any;
18
18
  };
19
19
  }
20
- export { CheckableGroup };
21
20
  export default CheckableGroup;
@@ -1,7 +1,6 @@
1
- export declare const DeferRenderAfterComputation: ({ children, resolve, fallback, timeout, }: {
1
+ export default function DeferRenderAfterComputation({ children, resolve, fallback, timeout, }: {
2
2
  children: any;
3
3
  resolve: any;
4
4
  fallback: any;
5
5
  timeout?: number | undefined;
6
- }) => any;
7
- export default DeferRenderAfterComputation;
6
+ }): any;
@@ -1,12 +1,10 @@
1
1
  import React from 'react';
2
- declare const FocusGridContext: React.Context<unknown>;
3
- declare const FocusGridProvider: ({ shouldWrapRows, shouldWrapCells, shouldRefocus, children, keyBindings, hotKeys, }: {
2
+ export declare const FocusGridContext: React.Context<unknown>;
3
+ export default function FocusGridProvider({ shouldWrapRows, shouldWrapCells, shouldRefocus, children, keyBindings, hotKeys, }: {
4
4
  shouldWrapRows?: boolean | undefined;
5
5
  shouldWrapCells?: boolean | undefined;
6
6
  shouldRefocus?: boolean | undefined;
7
7
  children: any;
8
8
  keyBindings: any;
9
9
  hotKeys: any;
10
- }) => JSX.Element;
11
- export { FocusGridProvider, FocusGridProvider as FocusGrid, FocusGridContext };
12
- export default FocusGridProvider;
10
+ }): JSX.Element;
@@ -1,4 +1,4 @@
1
- declare class FocusGroup {
1
+ export default class FocusGroup {
2
2
  items: never[];
3
3
  constructor(options?: {});
4
4
  getHotKeysParams(): {
@@ -34,5 +34,3 @@ declare class FocusGroup {
34
34
  getFirstItem(): false;
35
35
  getLastItem(): false;
36
36
  }
37
- export { FocusGroup };
38
- export default FocusGroup;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- declare const FocusGroupContext: React.Context<unknown>;
3
- export { FocusGroupContext };
4
- export default FocusGroupContext;
2
+ declare const _default: React.Context<unknown>;
3
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- declare class FocusGroupProvider extends Component {
2
+ export default class FocusGroupProvider extends Component {
3
3
  activated: boolean;
4
4
  static defaultProps: {
5
5
  exitWhenNoPrevious: boolean;
@@ -22,5 +22,3 @@ declare class FocusGroupProvider extends Component {
22
22
  focusItemByNode(node: any): void;
23
23
  render(): JSX.Element;
24
24
  }
25
- export { FocusGroupProvider, FocusGroupProvider as FocusGroupManager };
26
- export default FocusGroupProvider;
@@ -1,9 +1,7 @@
1
1
  /// <reference types="react" />
2
- declare function FocusGroupHoc(WrappedComponent: any, options?: {}): ({ onExitFocusGroup, onFocusPrevGroup, focusKeyBindings, ...props }: {
2
+ export default function FocusGroupHoc(WrappedComponent: any, options?: {}): ({ onExitFocusGroup, onFocusPrevGroup, focusKeyBindings, ...props }: {
3
3
  [x: string]: any;
4
4
  onExitFocusGroup: any;
5
5
  onFocusPrevGroup: any;
6
6
  focusKeyBindings: any;
7
7
  }) => JSX.Element;
8
- export { FocusGroupHoc };
9
- export default FocusGroupHoc;
@@ -1,6 +1,6 @@
1
- export { FocusGroup } from './FocusGroup';
2
- export { FocusGroupContext } from './FocusGroupContext';
3
- export { FocusGroupManager } from './FocusGroupManager';
4
- export { useFocusGroupItem, useFocusGroupWithState } from './useFocusGroupItem';
5
- export { FocusGroupHoc as focusGroupManagerHoc } from './focusGroupManagerHoc';
6
- export { FocusGridProvider as FocusGrid, FocusGridContext } from './FocusGrid';
1
+ export { default as FocusGroup } from './FocusGroup';
2
+ export { default as FocusGroupContext } from './FocusGroupContext';
3
+ export { default as FocusGroupManager } from './FocusGroupManager';
4
+ export { default as useFocusGroupItem, useFocusGroupWithState, } from './useFocusGroupItem';
5
+ export { default as focusGroupManagerHoc } from './focusGroupManagerHoc';
6
+ export { default as FocusGrid, FocusGridContext } from './FocusGrid';
@@ -1,4 +1,2 @@
1
- declare function useFocusGroupItem(ref: {} | undefined, props: any): any;
1
+ export default function useFocusGroupItem(ref: {} | undefined, props: any): any;
2
2
  export declare const useFocusGroupWithState: (ref: {} | undefined, props: any) => any;
3
- export { useFocusGroupItem };
4
- export default useFocusGroupItem;