@elliemae/ds-shared 2.0.0-alpha.8 → 2.0.0-next.11

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 (67) hide show
  1. package/cjs/Animations/BaseAnimation.js +24 -20
  2. package/cjs/Animations/Grow.js +30 -26
  3. package/cjs/Animations/GrowRight.js +30 -26
  4. package/cjs/Animations/GrowVertical.js +1 -0
  5. package/cjs/CheckableGroup.js +32 -23
  6. package/cjs/DeferRenderAfterComputation.js +8 -6
  7. package/cjs/FocusGroup/FocusGrid.js +38 -31
  8. package/cjs/FocusGroup/FocusGroup.js +29 -9
  9. package/cjs/FocusGroup/FocusGroupManager.js +3 -3
  10. package/cjs/FocusGroup/focusGroupManagerHoc.js +7 -1
  11. package/cjs/FocusGroup/useFocusGroupItem.js +8 -2
  12. package/cjs/FocusGroup/utils/getNextCellPosition.js +10 -9
  13. package/cjs/GroupContext/Group.js +11 -4
  14. package/cjs/GroupContext/GroupItem.js +6 -3
  15. package/cjs/ScrollSync/ScrollSync.js +5 -0
  16. package/cjs/ScrollSync/ScrollSyncPane.js +11 -2
  17. package/cjs/ScrollSync/ScrollSyncProvider.js +12 -6
  18. package/cjs/createDataInstance/createInstancePlugin.js +6 -0
  19. package/cjs/createDataInstance/createInstanceRef.js +8 -0
  20. package/cjs/createDataInstance/utils.js +57 -25
  21. package/cjs/defer-render-hoc/index.js +8 -2
  22. package/cjs/toolbar/ToolbarProvider.js +31 -21
  23. package/cjs/useDataGrid/VolatileRowsListener.js +5 -2
  24. package/cjs/useDataGrid/initColumnDefinition.js +26 -18
  25. package/cjs/useDataGrid/useDataGrid.js +42 -34
  26. package/cjs/useDataList/recordIterator.js +4 -1
  27. package/cjs/useDataList/useDataList.js +18 -4
  28. package/cjs/utils.js +8 -1
  29. package/cjs/virtualization/AutoHeightList.js +10 -8
  30. package/cjs/virtualization/FluidHeightList.js +15 -7
  31. package/cjs/virtualization/index.js +7 -6
  32. package/esm/Animations/BaseAnimation.js +24 -20
  33. package/esm/Animations/Grow.js +30 -26
  34. package/esm/Animations/GrowRight.js +30 -26
  35. package/esm/Animations/GrowVertical.js +1 -0
  36. package/esm/CheckableGroup.js +29 -19
  37. package/esm/DeferRenderAfterComputation.js +8 -6
  38. package/esm/FocusGroup/FocusGrid.js +27 -19
  39. package/esm/FocusGroup/FocusGroup.js +26 -6
  40. package/esm/FocusGroup/FocusGroupManager.js +1 -1
  41. package/esm/FocusGroup/focusGroupManagerHoc.js +7 -1
  42. package/esm/FocusGroup/useFocusGroupItem.js +8 -2
  43. package/esm/FocusGroup/utils/getNextCellPosition.js +10 -9
  44. package/esm/GroupContext/Group.js +11 -4
  45. package/esm/GroupContext/GroupItem.js +6 -3
  46. package/esm/ScrollSync/ScrollSync.js +5 -0
  47. package/esm/ScrollSync/ScrollSyncPane.js +11 -2
  48. package/esm/ScrollSync/ScrollSyncProvider.js +12 -6
  49. package/esm/createDataInstance/createInstancePlugin.js +6 -0
  50. package/esm/createDataInstance/createInstanceRef.js +8 -0
  51. package/esm/createDataInstance/utils.js +57 -25
  52. package/esm/defer-render-hoc/index.js +8 -2
  53. package/esm/toolbar/ToolbarProvider.js +30 -20
  54. package/esm/useDataGrid/VolatileRowsListener.js +4 -1
  55. package/esm/useDataGrid/initColumnDefinition.js +12 -4
  56. package/esm/useDataGrid/useDataGrid.js +26 -16
  57. package/esm/useDataList/recordIterator.js +4 -1
  58. package/esm/useDataList/useDataList.js +17 -3
  59. package/esm/utils.js +8 -1
  60. package/esm/virtualization/AutoHeightList.js +6 -3
  61. package/esm/virtualization/FluidHeightList.js +14 -6
  62. package/esm/virtualization/index.js +7 -6
  63. package/package.json +8 -4
  64. package/types/toolbar/ToolbarProvider.d.ts +1 -1
  65. package/types/useDataGrid/initColumnDefinition.d.ts +4 -3
  66. package/cjs/package.json +0 -7
  67. package/esm/package.json +0 -7
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _jsx = require('@babel/runtime/helpers/jsx');
4
+ require('core-js/modules/web.dom-collections.iterator.js');
4
5
  require('react');
5
6
  var renderprops = require('react-spring/renderprops');
6
7
 
@@ -8,25 +9,28 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
9
 
9
10
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
10
11
 
11
- const BaseAnimation = ({
12
- keys = undefined,
13
- items = [],
14
- duration = 100,
15
- enter = {},
16
- from = {},
17
- leave = {},
18
- onRest = () => null,
19
- children
20
- }) => /*#__PURE__*/_jsx__default["default"](renderprops.Transition, {
21
- config: {
22
- duration
23
- },
24
- enter: enter,
25
- from: from,
26
- items: items,
27
- keys: keys,
28
- leave: leave,
29
- onRest: onRest
30
- }, void 0, children);
12
+ const BaseAnimation = _ref => {
13
+ let {
14
+ keys = undefined,
15
+ items = [],
16
+ duration = 100,
17
+ enter = {},
18
+ from = {},
19
+ leave = {},
20
+ onRest = () => null,
21
+ children
22
+ } = _ref;
23
+ return /*#__PURE__*/_jsx__default["default"](renderprops.Transition, {
24
+ config: {
25
+ duration
26
+ },
27
+ enter: enter,
28
+ from: from,
29
+ items: items,
30
+ keys: keys,
31
+ leave: leave,
32
+ onRest: onRest
33
+ }, void 0, children);
34
+ };
31
35
 
32
36
  module.exports = BaseAnimation;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _jsx = require('@babel/runtime/helpers/jsx');
4
+ require('core-js/modules/web.dom-collections.iterator.js');
4
5
  require('react');
5
6
  var BaseAnimation = require('./BaseAnimation.js');
6
7
 
@@ -8,31 +9,34 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
9
 
9
10
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
10
11
 
11
- const Grow = ({
12
- keys = undefined,
13
- duration,
14
- items = undefined,
15
- from = 0,
16
- to = 1,
17
- children,
18
- onRest = () => null
19
- }) => /*#__PURE__*/_jsx__default["default"](BaseAnimation, {
20
- duration: duration,
21
- enter: {
22
- opacity: 1,
23
- transform: `scale(${to})`
24
- },
25
- from: {
26
- opacity: 0,
27
- transform: `scale(${from})`
28
- },
29
- items: items,
30
- keys: keys,
31
- leave: {
32
- opacity: 0,
33
- transform: `scale(${from})`
34
- },
35
- onRest: onRest
36
- }, void 0, children);
12
+ const Grow = _ref => {
13
+ let {
14
+ keys = undefined,
15
+ duration,
16
+ items = undefined,
17
+ from = 0,
18
+ to = 1,
19
+ children,
20
+ onRest = () => null
21
+ } = _ref;
22
+ return /*#__PURE__*/_jsx__default["default"](BaseAnimation, {
23
+ duration: duration,
24
+ enter: {
25
+ opacity: 1,
26
+ transform: "scale(".concat(to, ")")
27
+ },
28
+ from: {
29
+ opacity: 0,
30
+ transform: "scale(".concat(from, ")")
31
+ },
32
+ items: items,
33
+ keys: keys,
34
+ leave: {
35
+ opacity: 0,
36
+ transform: "scale(".concat(from, ")")
37
+ },
38
+ onRest: onRest
39
+ }, void 0, children);
40
+ };
37
41
 
38
42
  module.exports = Grow;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _jsx = require('@babel/runtime/helpers/jsx');
4
+ require('core-js/modules/web.dom-collections.iterator.js');
4
5
  require('react');
5
6
  var BaseAnimation = require('./BaseAnimation.js');
6
7
 
@@ -8,31 +9,34 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
9
 
9
10
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
10
11
 
11
- const GrowRight = ({
12
- keys = undefined,
13
- items = undefined,
14
- duration = 200,
15
- from = 0,
16
- to = 1,
17
- children,
18
- onRest = () => null
19
- }) => /*#__PURE__*/_jsx__default["default"](BaseAnimation, {
20
- duration: duration,
21
- enter: {
22
- opacity: `${to}`,
23
- transform: 'translateX(0px)'
24
- },
25
- from: {
26
- opacity: `${from}`,
27
- transform: 'translateX(100%)'
28
- },
29
- items: items,
30
- keys: keys,
31
- leave: {
32
- opacity: `${from}`,
33
- transform: 'translateX(100%)'
34
- },
35
- onRest: onRest
36
- }, void 0, children);
12
+ const GrowRight = _ref => {
13
+ let {
14
+ keys = undefined,
15
+ items = undefined,
16
+ duration = 200,
17
+ from = 0,
18
+ to = 1,
19
+ children,
20
+ onRest = () => null
21
+ } = _ref;
22
+ return /*#__PURE__*/_jsx__default["default"](BaseAnimation, {
23
+ duration: duration,
24
+ enter: {
25
+ opacity: "".concat(to),
26
+ transform: 'translateX(0px)'
27
+ },
28
+ from: {
29
+ opacity: "".concat(from),
30
+ transform: 'translateX(100%)'
31
+ },
32
+ items: items,
33
+ keys: keys,
34
+ leave: {
35
+ opacity: "".concat(from),
36
+ transform: 'translateX(100%)'
37
+ },
38
+ onRest: onRest
39
+ }, void 0, children);
40
+ };
37
41
 
38
42
  module.exports = GrowRight;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('@babel/runtime/helpers/jsx');
4
+ require('core-js/modules/web.dom-collections.iterator.js');
4
5
  require('react');
5
6
  require('react-spring/renderprops');
6
7
 
@@ -3,34 +3,42 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
+ require('core-js/modules/web.dom-collections.iterator.js');
7
+ require('core-js/modules/esnext.async-iterator.map.js');
8
+ require('core-js/modules/esnext.iterator.map.js');
9
+ require('core-js/modules/esnext.async-iterator.filter.js');
10
+ require('core-js/modules/esnext.iterator.constructor.js');
11
+ require('core-js/modules/esnext.iterator.filter.js');
12
+ require('core-js/modules/esnext.async-iterator.for-each.js');
13
+ require('core-js/modules/esnext.iterator.for-each.js');
6
14
  var React = require('react');
7
- var utils = require('@elliemae/ds-utilities/utils');
8
- var useDerivedStateFromProps = require('@elliemae/ds-utilities/hooks/useDerivedStateFromProps');
15
+ var dsUtilities = require('@elliemae/ds-utilities');
9
16
 
10
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
18
 
12
19
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
13
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
- var useDerivedStateFromProps__default = /*#__PURE__*/_interopDefaultLegacy(useDerivedStateFromProps);
15
21
 
16
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
23
 
18
24
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
- function useCheckableGroup({
20
- children,
21
- active: activeProp,
22
- multi,
23
- onCheck = () => null
24
- }) {
25
- const [active, setActive] = useDerivedStateFromProps__default["default"](activeProp);
25
+ function useCheckableGroup(_ref) {
26
+ let {
27
+ children,
28
+ active: activeProp,
29
+ multi,
30
+ onCheck = () => null
31
+ } = _ref;
32
+ const [active, setActive] = dsUtilities.useDerivedStateFromProps(activeProp);
26
33
 
27
- const handleCheck = ({
28
- target: {
29
- value
30
- }
31
- }, item) => {
34
+ const handleCheck = (_ref2, item) => {
35
+ let {
36
+ target: {
37
+ value
38
+ }
39
+ } = _ref2;
32
40
  setActive(prevActive => {
33
- const nextActive = multi ? utils.addOrRemove(prevActive, value) : value;
41
+ const nextActive = multi ? dsUtilities.addOrRemove(prevActive, value) : value;
34
42
  onCheck(nextActive, item);
35
43
  return nextActive;
36
44
  });
@@ -43,17 +51,18 @@ function useCheckableGroup({
43
51
  const checked = Array.isArray(active) ? active.indexOf(props.name) !== -1 : active === props.name;
44
52
  return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, props), {}, {
45
53
  checked,
46
- onClick: utils.runAll(handleCheck, props.onClick)
54
+ onClick: dsUtilities.runAll(handleCheck, props.onClick)
47
55
  }));
48
56
  });
49
57
  }
50
58
 
51
- function CheckableGroup({
52
- active = [],
53
- multi = false,
54
- // checkbox or radio
55
- children
56
- }) {
59
+ function CheckableGroup(_ref3) {
60
+ let {
61
+ active = [],
62
+ multi = false,
63
+ // checkbox or radio
64
+ children
65
+ } = _ref3;
57
66
  return useCheckableGroup({
58
67
  active,
59
68
  multi,
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ require('core-js/modules/web.dom-collections.iterator.js');
3
4
  var React = require('react');
4
5
  var raf = require('raf');
5
6
 
@@ -7,12 +8,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
7
8
 
8
9
  var raf__default = /*#__PURE__*/_interopDefaultLegacy(raf);
9
10
 
10
- function DeferRenderAfterComputation({
11
- children,
12
- resolve,
13
- fallback,
14
- timeout = 2000
15
- }) {
11
+ function DeferRenderAfterComputation(_ref) {
12
+ let {
13
+ children,
14
+ resolve,
15
+ fallback,
16
+ timeout = 2000
17
+ } = _ref;
16
18
  const [shouldRender, setShouldRender] = React.useState(false);
17
19
  React.useEffect(() => {
18
20
  // eslint-disable-next-line max-nested-callbacks
@@ -4,10 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
+ require('core-js/modules/esnext.async-iterator.for-each.js');
8
+ require('core-js/modules/esnext.iterator.constructor.js');
9
+ require('core-js/modules/esnext.iterator.for-each.js');
10
+ require('core-js/modules/esnext.async-iterator.filter.js');
11
+ require('core-js/modules/esnext.iterator.filter.js');
7
12
  var React = require('react');
8
- var utils = require('@elliemae/ds-utilities/utils');
9
- var useHotkeys = require('@elliemae/ds-utilities/hooks/useHotkeys');
10
- var system = require('@elliemae/ds-utilities/system');
13
+ var dsUtilities = require('@elliemae/ds-utilities');
11
14
  var getNextCellPosition = require('./utils/getNextCellPosition.js');
12
15
 
13
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -15,7 +18,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
15
18
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
16
19
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
17
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
- var useHotkeys__default = /*#__PURE__*/_interopDefaultLegacy(useHotkeys);
19
21
 
20
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
21
23
 
@@ -27,16 +29,17 @@ const {
27
29
 
28
30
  const preventDefault = e => e.preventDefault();
29
31
 
30
- function registerHotKeysHooks(hotKeys, {
31
- focusedRow,
32
- focusedCell
33
- }) {
32
+ function registerHotKeysHooks(hotKeys, _ref) {
33
+ let {
34
+ focusedRow,
35
+ focusedCell
36
+ } = _ref;
34
37
  Object.keys(hotKeys).forEach(key => {
35
38
  const {
36
39
  handler,
37
40
  options
38
41
  } = hotKeys[key];
39
- useHotkeys__default["default"]({
42
+ dsUtilities.useHotkeys({
40
43
  keys: key,
41
44
  handler: e => {
42
45
  e.preventDefault();
@@ -51,27 +54,31 @@ function registerHotKeysHooks(hotKeys, {
51
54
  } // eslint-disable-next-line max-statements
52
55
 
53
56
 
54
- function FocusGridProvider({
55
- shouldWrapRows = false,
56
- shouldWrapCells = false,
57
- shouldRefocus = true,
58
- children,
59
- keyBindings,
60
- hotKeys
61
- }) {
57
+ function FocusGridProvider(_ref2) {
58
+ let {
59
+ shouldWrapRows = false,
60
+ shouldWrapCells = false,
61
+ shouldRefocus = true,
62
+ children,
63
+ keyBindings,
64
+ hotKeys
65
+ } = _ref2;
62
66
  const focusedRow = React.useRef();
63
67
  const focusedCell = React.useRef();
64
68
  const grid = React.useRef([]);
65
69
  const containerRef = React.useRef(document);
66
70
  const child = React__default["default"].Children.only(children);
67
71
  const decoratedChild = /*#__PURE__*/React__default["default"].cloneElement(child, {
68
- innerRef: system.mergeRefs(child.props.innerRef, containerRef)
72
+ innerRef: dsUtilities.mergeRefs(child.props.innerRef, containerRef)
69
73
  });
70
74
 
71
- const getNode = ({
72
- rowIndex,
73
- cellIndex
74
- }) => utils.get(grid.current, [rowIndex, cellIndex]);
75
+ const getNode = _ref3 => {
76
+ let {
77
+ rowIndex,
78
+ cellIndex
79
+ } = _ref3;
80
+ return dsUtilities.get(grid.current, [rowIndex, cellIndex]);
81
+ };
75
82
 
76
83
  const register = (node, rowIndex, columnIndex) => {
77
84
  if (!node) return;
@@ -104,7 +111,7 @@ function FocusGridProvider({
104
111
  if (shouldRefocus) {
105
112
  const rowIndex = focusedRow.current;
106
113
  const cellIndex = focusedCell.current;
107
- const node = utils.get(grid.current, [rowIndex, cellIndex]);
114
+ const node = dsUtilities.get(grid.current, [rowIndex, cellIndex]);
108
115
  if (node) node.focus();
109
116
  }
110
117
  });
@@ -140,11 +147,11 @@ function FocusGridProvider({
140
147
  });
141
148
 
142
149
  const defaultKeyBindings = _objectSpread({
143
- ArrowUp: utils.runAll(preventDefault, () => focusNextCell(-1, 0)),
144
- ArrowRight: utils.runAll(preventDefault, () => focusNextCell(0, 1)),
145
- ArrowDown: utils.runAll(preventDefault, () => focusNextCell(1, 0)),
146
- ArrowLeft: utils.runAll(preventDefault, () => focusNextCell(0, -1)),
147
- Home: utils.runAll(preventDefault, e => {
150
+ ArrowUp: dsUtilities.runAll(preventDefault, () => focusNextCell(-1, 0)),
151
+ ArrowRight: dsUtilities.runAll(preventDefault, () => focusNextCell(0, 1)),
152
+ ArrowDown: dsUtilities.runAll(preventDefault, () => focusNextCell(1, 0)),
153
+ ArrowLeft: dsUtilities.runAll(preventDefault, () => focusNextCell(0, -1)),
154
+ Home: dsUtilities.runAll(preventDefault, e => {
148
155
  let rowIndex = focusedRow.current;
149
156
 
150
157
  if (e.ctrlKey) {
@@ -156,7 +163,7 @@ function FocusGridProvider({
156
163
  cellIndex: 0
157
164
  });
158
165
  }),
159
- End: utils.runAll(preventDefault, e => {
166
+ End: dsUtilities.runAll(preventDefault, e => {
160
167
  let rowIndex = focusedRow.current;
161
168
 
162
169
  if (e.ctrlKey) {
@@ -170,7 +177,7 @@ function FocusGridProvider({
170
177
  })
171
178
  }, keyBindings);
172
179
 
173
- const nextKeyBindings = utils.isFunction(keyBindings) ? keyBindings({
180
+ const nextKeyBindings = dsUtilities.isFunction(keyBindings) ? keyBindings({
174
181
  defaultBindings: defaultKeyBindings,
175
182
  rowIndex: focusedRow.current,
176
183
  cellIndex: focusedCell.current
@@ -179,7 +186,7 @@ function FocusGridProvider({
179
186
  const onKeyDown = e => {
180
187
  if (e.target.tagName.toLowerCase() === 'input') return;
181
188
  const action = nextKeyBindings[e.key];
182
- if (utils.isFunction(action)) action(e);
189
+ if (dsUtilities.isFunction(action)) action(e);
183
190
  };
184
191
 
185
192
  const activate = container => {
@@ -1,7 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var utils = require('@elliemae/ds-utilities/utils');
4
+ require('core-js/modules/web.dom-collections.iterator.js');
5
+ require('core-js/modules/esnext.async-iterator.for-each.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.for-each.js');
8
+ require('core-js/modules/esnext.async-iterator.map.js');
9
+ require('core-js/modules/esnext.iterator.map.js');
10
+ require('core-js/modules/esnext.async-iterator.filter.js');
11
+ require('core-js/modules/esnext.iterator.filter.js');
12
+ var dsUtilities = require('@elliemae/ds-utilities');
5
13
  var hotkeys = require('hotkeys-js');
6
14
 
7
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -16,14 +24,22 @@ const defaultOptions = {
16
24
  orientation: 'vertical'
17
25
  };
18
26
 
19
- const safeCallAction = (e, fun, ...args) => {
20
- if (utils.isFunction(fun)) {
27
+ const safeCallAction = function (e, fun) {
28
+ if (dsUtilities.isFunction(fun)) {
21
29
  e.preventDefault();
30
+
31
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
32
+ args[_key - 2] = arguments[_key];
33
+ }
34
+
22
35
  fun(...args);
23
36
  }
24
37
  };
25
38
 
26
- const registerHotkeys = (hotKeys = {}, params, getContainer = () => document) => {
39
+ const registerHotkeys = function () {
40
+ let hotKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
41
+ let params = arguments.length > 1 ? arguments[1] : undefined;
42
+ let getContainer = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => document;
27
43
  Object.keys(hotKeys).forEach(hotkey => {
28
44
  const {
29
45
  options,
@@ -32,7 +48,7 @@ const registerHotkeys = (hotKeys = {}, params, getContainer = () => document) =>
32
48
  } = hotKeys[hotkey];
33
49
 
34
50
  const parameterizedHandler = e => {
35
- const handlerParams = utils.isFunction(params) ? params() : params;
51
+ const handlerParams = dsUtilities.isFunction(params) ? params() : params;
36
52
  if (!allowDocumentHandler && handlerParams.item !== document.activeElement) return;
37
53
  e.preventDefault();
38
54
  handler(handlerParams);
@@ -44,7 +60,8 @@ const registerHotkeys = (hotKeys = {}, params, getContainer = () => document) =>
44
60
  });
45
61
  };
46
62
 
47
- const unregisterHotKeys = (hotKeys = {}) => {
63
+ const unregisterHotKeys = function () {
64
+ let hotKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
48
65
  Object.keys(hotKeys).forEach(hotkey => {
49
66
  hotkeys__default["default"].unbind(hotkey);
50
67
  });
@@ -53,7 +70,9 @@ const unregisterHotKeys = (hotKeys = {}) => {
53
70
  const noop = () => null;
54
71
 
55
72
  class FocusGroup {
56
- constructor(options = {}) {
73
+ constructor() {
74
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
75
+
57
76
  _defineProperty__default["default"](this, "items", []);
58
77
 
59
78
  this.options = _objectSpread(_objectSpread({}, defaultOptions), options);
@@ -97,7 +116,7 @@ class FocusGroup {
97
116
  const item = this.currentFocusedItem;
98
117
  const {
99
118
  index
100
- } = utils.get(item, ['dataset'], {});
119
+ } = dsUtilities.get(item, ['dataset'], {});
101
120
  return {
102
121
  item,
103
122
  index
@@ -127,7 +146,8 @@ class FocusGroup {
127
146
  return actions.map(action => typeof action === 'string' ? safeCallAction(e, this.mapActions[action]) : safeCallAction(e, action));
128
147
  }
129
148
 
130
- register(node, props = {}) {
149
+ register(node) {
150
+ let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
131
151
  const afterIndex = this.items.findIndex(item => item.compareDocumentPosition(node) === Node.DOCUMENT_POSITION_PRECEDING);
132
152
  node.specialOnFocus = props.onFocus || noop;
133
153
  node.specialOnBlur = props.onBlur || noop;
@@ -3,7 +3,7 @@
3
3
  var _jsx = require('@babel/runtime/helpers/jsx');
4
4
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
5
  var React = require('react');
6
- var utils = require('@elliemae/ds-utilities/utils');
6
+ var dsUtilities = require('@elliemae/ds-utilities');
7
7
  var FocusGroup = require('./FocusGroup.js');
8
8
  var FocusGroupContext = require('./FocusGroupContext.js');
9
9
 
@@ -61,7 +61,7 @@ class FocusGroupProvider extends React.Component {
61
61
  } = this.props;
62
62
  this.focusGroup.activate();
63
63
  this.activated = true;
64
- if (utils.isFunction(onActivate)) onActivate();
64
+ if (dsUtilities.isFunction(onActivate)) onActivate();
65
65
  }
66
66
 
67
67
  deactivate() {
@@ -71,7 +71,7 @@ class FocusGroupProvider extends React.Component {
71
71
  this.activated = false;
72
72
  this.focusGroup.deactivate();
73
73
 
74
- if (utils.isFunction(onExitFocusGroup)) {
74
+ if (dsUtilities.isFunction(onExitFocusGroup)) {
75
75
  onExitFocusGroup();
76
76
  }
77
77
  }
@@ -1,5 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ require('core-js/modules/esnext.async-iterator.filter.js');
4
+ require('core-js/modules/esnext.iterator.constructor.js');
5
+ require('core-js/modules/esnext.iterator.filter.js');
6
+ require('core-js/modules/esnext.async-iterator.for-each.js');
7
+ require('core-js/modules/esnext.iterator.for-each.js');
3
8
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
9
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
10
  require('react');
@@ -16,7 +21,8 @@ const _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
16
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
22
 
18
23
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
- function FocusGroupHoc(WrappedComponent, options = {}) {
24
+ function FocusGroupHoc(WrappedComponent) {
25
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
26
  return _ref => {
21
27
  let {
22
28
  onExitFocusGroup,
@@ -12,7 +12,10 @@ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_obje
12
12
 
13
13
  const _excluded = ["register", "unregister"],
14
14
  _excluded2 = ["register", "unregister"];
15
- function useFocusGroupItem(ref = {}, props) {
15
+ function useFocusGroupItem() {
16
+ let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ let props = arguments.length > 1 ? arguments[1] : undefined;
18
+
16
19
  const _ref = React.useContext(FocusGroupContext) || {},
17
20
  {
18
21
  register,
@@ -30,7 +33,10 @@ function useFocusGroupItem(ref = {}, props) {
30
33
  if (!register) return {};
31
34
  return otherActions;
32
35
  }
33
- const useFocusGroupWithState = (ref = {}, props) => {
36
+ const useFocusGroupWithState = function () {
37
+ let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
+ let props = arguments.length > 1 ? arguments[1] : undefined;
39
+
34
40
  const _ref2 = React.useContext(FocusGroupContext) || {},
35
41
  {
36
42
  register,
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  // eslint-disable-next-line max-statements
4
- function getNextCellPosition({
5
- grid,
6
- currentRow = 0,
7
- currentCell = 0,
8
- directionY,
9
- directionX,
10
- shouldWrapCells,
11
- shouldWrapRows
12
- }) {
4
+ function getNextCellPosition(_ref) {
5
+ let {
6
+ grid,
7
+ currentRow = 0,
8
+ currentCell = 0,
9
+ directionY,
10
+ directionX,
11
+ shouldWrapCells,
12
+ shouldWrapRows
13
+ } = _ref;
13
14
  let nextRow = currentRow + directionY;
14
15
  let nextCell = currentCell + directionX;
15
16
  const rowCount = grid.length;