@elliemae/ds-shared 1.57.1-rc.0 → 2.0.0-alpha.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 (264) hide show
  1. package/cjs/Animations/BaseAnimation.js +25 -36
  2. package/cjs/Animations/Grow.js +31 -39
  3. package/cjs/Animations/GrowRight.js +31 -40
  4. package/cjs/Animations/GrowVertical.js +3 -2
  5. package/cjs/CheckableGroup.js +36 -50
  6. package/cjs/DeferRenderAfterComputation.js +12 -22
  7. package/cjs/FocusGroup/FocusGrid.js +94 -102
  8. package/cjs/FocusGroup/FocusGroup.js +215 -270
  9. package/cjs/FocusGroup/FocusGroupContext.js +1 -2
  10. package/cjs/FocusGroup/FocusGroupManager.js +88 -124
  11. package/cjs/FocusGroup/focusGroupManagerHoc.js +24 -29
  12. package/cjs/FocusGroup/index.js +14 -28
  13. package/cjs/FocusGroup/useFocusGroupItem.js +24 -27
  14. package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -16
  15. package/cjs/GroupContext/Group.js +76 -104
  16. package/cjs/GroupContext/GroupContext.js +1 -2
  17. package/cjs/GroupContext/GroupItem.js +10 -11
  18. package/cjs/GroupContext/index.js +6 -15
  19. package/cjs/ScrollSync/ScrollSync.js +86 -112
  20. package/cjs/ScrollSync/ScrollSyncPane.js +49 -92
  21. package/cjs/ScrollSync/ScrollSyncProvider.js +32 -28
  22. package/cjs/ScrollSync/index.js +4 -14
  23. package/cjs/ScrollSync/useScrollSync.js +0 -1
  24. package/cjs/constants.js +43 -4
  25. package/cjs/createDataInstance/createInstancePlugin.js +6 -10
  26. package/cjs/createDataInstance/createInstanceRef.js +34 -42
  27. package/cjs/createDataInstance/utils.js +42 -76
  28. package/cjs/defer-render-hoc/index.js +19 -64
  29. package/cjs/dimsum.config.js +7 -0
  30. package/cjs/index.js +10 -21
  31. package/cjs/prop-types.js +59 -0
  32. package/cjs/react-spring/index.js +3 -6
  33. package/cjs/react-spring/renderprops.js +3 -6
  34. package/cjs/toolbar/ToolbarProvider.js +60 -81
  35. package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
  36. package/cjs/useDataGrid/index.js +2 -17
  37. package/cjs/useDataGrid/initColumnDefinition.js +45 -53
  38. package/cjs/useDataGrid/useDataGrid.js +105 -152
  39. package/cjs/useDataList/index.js +2 -15
  40. package/cjs/useDataList/recordIterator.js +7 -11
  41. package/cjs/useDataList/useDataList.js +42 -63
  42. package/cjs/utils.js +39 -59
  43. package/cjs/virtualization/AutoHeightList.js +34 -27
  44. package/cjs/virtualization/FluidHeightList.js +23 -17
  45. package/cjs/virtualization/index.js +12 -18
  46. package/esm/Animations/BaseAnimation.js +24 -35
  47. package/esm/Animations/Grow.js +29 -37
  48. package/esm/Animations/GrowRight.js +29 -38
  49. package/esm/Animations/GrowVertical.js +3 -2
  50. package/esm/CheckableGroup.js +33 -46
  51. package/esm/DeferRenderAfterComputation.js +12 -21
  52. package/esm/FocusGroup/FocusGrid.js +86 -96
  53. package/esm/FocusGroup/FocusGroup.js +210 -263
  54. package/esm/FocusGroup/FocusGroupContext.js +0 -1
  55. package/esm/FocusGroup/FocusGroupManager.js +85 -115
  56. package/esm/FocusGroup/focusGroupManagerHoc.js +19 -23
  57. package/esm/FocusGroup/index.js +0 -14
  58. package/esm/FocusGroup/useFocusGroupItem.js +22 -25
  59. package/esm/FocusGroup/utils/getNextCellPosition.js +14 -16
  60. package/esm/GroupContext/Group.js +75 -96
  61. package/esm/GroupContext/GroupContext.js +1 -2
  62. package/esm/GroupContext/GroupItem.js +8 -9
  63. package/esm/GroupContext/index.js +0 -9
  64. package/esm/ScrollSync/ScrollSync.js +83 -104
  65. package/esm/ScrollSync/ScrollSyncPane.js +47 -83
  66. package/esm/ScrollSync/ScrollSyncProvider.js +31 -28
  67. package/esm/ScrollSync/index.js +0 -10
  68. package/esm/ScrollSync/useScrollSync.js +0 -1
  69. package/esm/constants.js +31 -5
  70. package/esm/createDataInstance/createInstancePlugin.js +5 -8
  71. package/esm/createDataInstance/createInstanceRef.js +29 -36
  72. package/esm/createDataInstance/utils.js +40 -74
  73. package/esm/defer-render-hoc/index.js +19 -57
  74. package/esm/dimsum.config.js +5 -0
  75. package/esm/index.js +0 -11
  76. package/esm/prop-types.js +43 -0
  77. package/esm/react-spring/index.js +1 -2
  78. package/esm/react-spring/renderprops.js +1 -2
  79. package/esm/toolbar/ToolbarProvider.js +55 -75
  80. package/esm/useDataGrid/VolatileRowsListener.js +12 -24
  81. package/esm/useDataGrid/index.js +0 -15
  82. package/esm/useDataGrid/initColumnDefinition.js +38 -45
  83. package/esm/useDataGrid/useDataGrid.js +85 -131
  84. package/esm/useDataList/index.js +0 -13
  85. package/esm/useDataList/recordIterator.js +7 -11
  86. package/esm/useDataList/useDataList.js +31 -51
  87. package/esm/utils.js +37 -57
  88. package/esm/virtualization/AutoHeightList.js +26 -19
  89. package/esm/virtualization/FluidHeightList.js +20 -14
  90. package/esm/virtualization/index.js +6 -12
  91. package/package.json +202 -13
  92. package/types/Animations/BaseAnimation.d.ts +12 -0
  93. package/types/Animations/Grow.d.ts +11 -0
  94. package/types/Animations/GrowRight.d.ts +11 -0
  95. package/types/Animations/GrowVertical.d.ts +1 -0
  96. package/types/CheckableGroup.d.ts +20 -0
  97. package/types/DeferRenderAfterComputation.d.ts +6 -0
  98. package/types/FocusGroup/FocusGrid.d.ts +10 -0
  99. package/types/FocusGroup/FocusGroup.d.ts +36 -0
  100. package/types/FocusGroup/FocusGroupContext.d.ts +3 -0
  101. package/types/FocusGroup/FocusGroupManager.d.ts +24 -0
  102. package/types/FocusGroup/focusGroupManagerHoc.d.ts +7 -0
  103. package/types/FocusGroup/index.d.ts +6 -0
  104. package/types/FocusGroup/useFocusGroupItem.d.ts +2 -0
  105. package/types/FocusGroup/utils/getNextCellPosition.d.ts +12 -0
  106. package/types/GroupContext/Group.d.ts +14 -0
  107. package/types/GroupContext/GroupContext.d.ts +2 -0
  108. package/types/GroupContext/GroupItem.d.ts +5 -0
  109. package/types/GroupContext/index.d.ts +3 -0
  110. package/types/ScrollSync/ScrollSync.d.ts +21 -0
  111. package/types/ScrollSync/ScrollSyncPane.d.ts +3 -0
  112. package/types/ScrollSync/ScrollSyncProvider.d.ts +12 -0
  113. package/types/ScrollSync/index.d.ts +2 -0
  114. package/types/ScrollSync/useScrollSync.d.ts +6 -0
  115. package/types/constants.d.ts +30 -0
  116. package/types/createDataInstance/createInstancePlugin.d.ts +1 -0
  117. package/types/createDataInstance/createInstanceRef.d.ts +12 -0
  118. package/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
  119. package/types/createDataInstance/utils.d.ts +9 -0
  120. package/types/dimsum.config.d.ts +4 -0
  121. package/types/index.d.ts +2 -0
  122. package/types/prop-types.d.ts +41 -0
  123. package/types/react-spring/index.d.ts +1 -0
  124. package/types/react-spring/renderprops.d.ts +1 -0
  125. package/types/toolbar/ToolbarProvider.d.ts +10 -0
  126. package/types/useDataGrid/VolatileRowsListener.d.ts +5 -0
  127. package/types/useDataGrid/index.d.ts +1 -0
  128. package/types/useDataGrid/initColumnDefinition.d.ts +4 -0
  129. package/types/useDataGrid/useDataGrid.d.ts +8 -0
  130. package/types/useDataList/index.d.ts +1 -0
  131. package/types/useDataList/recordIterator.d.ts +1 -0
  132. package/types/useDataList/useDataList.d.ts +13 -0
  133. package/types/utils.d.ts +22 -0
  134. package/types/virtualization/AutoHeightList.d.ts +2 -0
  135. package/types/virtualization/FluidHeightList.d.ts +2 -0
  136. package/types/virtualization/index.d.ts +9 -0
  137. package/Animations/BaseAnimation/package.json +0 -10
  138. package/Animations/Grow/package.json +0 -10
  139. package/Animations/GrowRight/package.json +0 -10
  140. package/Animations/GrowVertical/package.json +0 -10
  141. package/CheckableGroup/package.json +0 -10
  142. package/DeferRenderAfterComputation/package.json +0 -10
  143. package/FocusGroup/FocusGrid/package.json +0 -10
  144. package/FocusGroup/FocusGroup/package.json +0 -10
  145. package/FocusGroup/FocusGroupContext/package.json +0 -10
  146. package/FocusGroup/FocusGroupManager/package.json +0 -10
  147. package/FocusGroup/focusGroupManagerHoc/package.json +0 -10
  148. package/FocusGroup/package.json +0 -10
  149. package/FocusGroup/useFocusGroupItem/package.json +0 -10
  150. package/FocusGroup/utils/getNextCellPosition/package.json +0 -10
  151. package/GroupContext/Group/package.json +0 -10
  152. package/GroupContext/GroupContext/package.json +0 -10
  153. package/GroupContext/GroupItem/package.json +0 -10
  154. package/GroupContext/package.json +0 -10
  155. package/ScrollSync/ScrollSync/package.json +0 -10
  156. package/ScrollSync/ScrollSyncPane/package.json +0 -10
  157. package/ScrollSync/ScrollSyncProvider/package.json +0 -10
  158. package/ScrollSync/package.json +0 -10
  159. package/ScrollSync/useScrollSync/package.json +0 -10
  160. package/cjs/Animations/BaseAnimation.js.map +0 -1
  161. package/cjs/Animations/Grow.js.map +0 -1
  162. package/cjs/Animations/GrowRight.js.map +0 -1
  163. package/cjs/Animations/GrowVertical.js.map +0 -1
  164. package/cjs/CheckableGroup.js.map +0 -1
  165. package/cjs/DeferRenderAfterComputation.js.map +0 -1
  166. package/cjs/FocusGroup/FocusGrid.js.map +0 -1
  167. package/cjs/FocusGroup/FocusGroup.js.map +0 -1
  168. package/cjs/FocusGroup/FocusGroupContext.js.map +0 -1
  169. package/cjs/FocusGroup/FocusGroupManager.js.map +0 -1
  170. package/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -1
  171. package/cjs/FocusGroup/index.js.map +0 -1
  172. package/cjs/FocusGroup/useFocusGroupItem.js.map +0 -1
  173. package/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -1
  174. package/cjs/GroupContext/Group.js.map +0 -1
  175. package/cjs/GroupContext/GroupContext.js.map +0 -1
  176. package/cjs/GroupContext/GroupItem.js.map +0 -1
  177. package/cjs/GroupContext/index.js.map +0 -1
  178. package/cjs/ScrollSync/ScrollSync.js.map +0 -1
  179. package/cjs/ScrollSync/ScrollSyncPane.js.map +0 -1
  180. package/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -1
  181. package/cjs/ScrollSync/index.js.map +0 -1
  182. package/cjs/ScrollSync/useScrollSync.js.map +0 -1
  183. package/cjs/constants.js.map +0 -1
  184. package/cjs/createDataInstance/createInstancePlugin.js.map +0 -1
  185. package/cjs/createDataInstance/createInstanceRef.js.map +0 -1
  186. package/cjs/createDataInstance/utils.js.map +0 -1
  187. package/cjs/defer-render-hoc/index.js.map +0 -1
  188. package/cjs/index.js.map +0 -1
  189. package/cjs/react-spring/index.js.map +0 -1
  190. package/cjs/react-spring/renderprops.js.map +0 -1
  191. package/cjs/toolbar/ToolbarProvider.js.map +0 -1
  192. package/cjs/useDataGrid/VolatileRowsListener.js.map +0 -1
  193. package/cjs/useDataGrid/index.js.map +0 -1
  194. package/cjs/useDataGrid/initColumnDefinition.js.map +0 -1
  195. package/cjs/useDataGrid/useDataGrid.js.map +0 -1
  196. package/cjs/useDataList/index.js.map +0 -1
  197. package/cjs/useDataList/recordIterator.js.map +0 -1
  198. package/cjs/useDataList/useDataList.js.map +0 -1
  199. package/cjs/utils.js.map +0 -1
  200. package/cjs/virtualization/AutoHeightList.js.map +0 -1
  201. package/cjs/virtualization/FluidHeightList.js.map +0 -1
  202. package/cjs/virtualization/index.js.map +0 -1
  203. package/constants/package.json +0 -10
  204. package/createDataInstance/createInstancePlugin/package.json +0 -10
  205. package/createDataInstance/createInstanceRef/package.json +0 -10
  206. package/createDataInstance/utils/package.json +0 -10
  207. package/defer-render-hoc/package.json +0 -10
  208. package/esm/Animations/BaseAnimation.js.map +0 -1
  209. package/esm/Animations/Grow.js.map +0 -1
  210. package/esm/Animations/GrowRight.js.map +0 -1
  211. package/esm/Animations/GrowVertical.js.map +0 -1
  212. package/esm/CheckableGroup.js.map +0 -1
  213. package/esm/DeferRenderAfterComputation.js.map +0 -1
  214. package/esm/FocusGroup/FocusGrid.js.map +0 -1
  215. package/esm/FocusGroup/FocusGroup.js.map +0 -1
  216. package/esm/FocusGroup/FocusGroupContext.js.map +0 -1
  217. package/esm/FocusGroup/FocusGroupManager.js.map +0 -1
  218. package/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -1
  219. package/esm/FocusGroup/index.js.map +0 -1
  220. package/esm/FocusGroup/useFocusGroupItem.js.map +0 -1
  221. package/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -1
  222. package/esm/GroupContext/Group.js.map +0 -1
  223. package/esm/GroupContext/GroupContext.js.map +0 -1
  224. package/esm/GroupContext/GroupItem.js.map +0 -1
  225. package/esm/GroupContext/index.js.map +0 -1
  226. package/esm/ScrollSync/ScrollSync.js.map +0 -1
  227. package/esm/ScrollSync/ScrollSyncPane.js.map +0 -1
  228. package/esm/ScrollSync/ScrollSyncProvider.js.map +0 -1
  229. package/esm/ScrollSync/index.js.map +0 -1
  230. package/esm/ScrollSync/useScrollSync.js.map +0 -1
  231. package/esm/constants.js.map +0 -1
  232. package/esm/createDataInstance/createInstancePlugin.js.map +0 -1
  233. package/esm/createDataInstance/createInstanceRef.js.map +0 -1
  234. package/esm/createDataInstance/utils.js.map +0 -1
  235. package/esm/defer-render-hoc/index.js.map +0 -1
  236. package/esm/index.js.map +0 -1
  237. package/esm/react-spring/index.js.map +0 -1
  238. package/esm/react-spring/renderprops.js.map +0 -1
  239. package/esm/toolbar/ToolbarProvider.js.map +0 -1
  240. package/esm/useDataGrid/VolatileRowsListener.js.map +0 -1
  241. package/esm/useDataGrid/index.js.map +0 -1
  242. package/esm/useDataGrid/initColumnDefinition.js.map +0 -1
  243. package/esm/useDataGrid/useDataGrid.js.map +0 -1
  244. package/esm/useDataList/index.js.map +0 -1
  245. package/esm/useDataList/recordIterator.js.map +0 -1
  246. package/esm/useDataList/useDataList.js.map +0 -1
  247. package/esm/utils.js.map +0 -1
  248. package/esm/virtualization/AutoHeightList.js.map +0 -1
  249. package/esm/virtualization/FluidHeightList.js.map +0 -1
  250. package/esm/virtualization/index.js.map +0 -1
  251. package/react-spring/package.json +0 -10
  252. package/react-spring/renderprops/package.json +0 -10
  253. package/toolbar/ToolbarProvider/package.json +0 -10
  254. package/useDataGrid/VolatileRowsListener/package.json +0 -10
  255. package/useDataGrid/initColumnDefinition/package.json +0 -10
  256. package/useDataGrid/package.json +0 -10
  257. package/useDataGrid/useDataGrid/package.json +0 -10
  258. package/useDataList/package.json +0 -10
  259. package/useDataList/recordIterator/package.json +0 -10
  260. package/useDataList/useDataList/package.json +0 -10
  261. package/utils/package.json +0 -10
  262. package/virtualization/AutoHeightList/package.json +0 -10
  263. package/virtualization/FluidHeightList/package.json +0 -10
  264. package/virtualization/package.json +0 -10
@@ -2,75 +2,78 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _jsx = require('@babel/runtime/helpers/jsx');
5
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
7
  var React = require('react');
7
- var dsUtilities = require('@elliemae/ds-utilities');
8
- var FocusGroup_utils_getNextCellPosition = require('./utils/getNextCellPosition.js');
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');
11
+ var getNextCellPosition = require('./utils/getNextCellPosition.js');
9
12
 
10
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
14
 
15
+ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
12
16
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
13
17
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
+ var useHotkeys__default = /*#__PURE__*/_interopDefaultLegacy(useHotkeys);
14
19
 
15
20
  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; }
16
21
 
17
- 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; }
18
- var FocusGridContext = /*#__PURE__*/React.createContext();
19
- var Provider = FocusGridContext.Provider;
20
-
21
- var preventDefault = function preventDefault(e) {
22
- return e.preventDefault();
23
- };
24
-
25
- function registerHotKeysHooks(hotKeys, _ref) {
26
- var focusedRow = _ref.focusedRow,
27
- focusedCell = _ref.focusedCell;
28
- Object.keys(hotKeys).forEach(function (key) {
29
- var _hotKeys$key = hotKeys[key],
30
- _handler = _hotKeys$key.handler,
31
- options = _hotKeys$key.options;
32
- dsUtilities.useHotkeys({
22
+ 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; }
23
+ const FocusGridContext = /*#__PURE__*/React.createContext();
24
+ const {
25
+ Provider
26
+ } = FocusGridContext;
27
+
28
+ const preventDefault = e => e.preventDefault();
29
+
30
+ function registerHotKeysHooks(hotKeys, {
31
+ focusedRow,
32
+ focusedCell
33
+ }) {
34
+ Object.keys(hotKeys).forEach(key => {
35
+ const {
36
+ handler,
37
+ options
38
+ } = hotKeys[key];
39
+ useHotkeys__default["default"]({
33
40
  keys: key,
34
- handler: function handler(e) {
41
+ handler: e => {
35
42
  e.preventDefault();
36
-
37
- _handler({
43
+ handler({
38
44
  rowIndex: focusedRow.current,
39
45
  cellIndex: focusedCell.current
40
46
  });
41
47
  },
42
- options: options
48
+ options
43
49
  });
44
50
  });
45
51
  } // eslint-disable-next-line max-statements
46
52
 
47
53
 
48
- function FocusGridProvider(_ref2) {
49
- var _ref2$shouldWrapRows = _ref2.shouldWrapRows,
50
- shouldWrapRows = _ref2$shouldWrapRows === void 0 ? false : _ref2$shouldWrapRows,
51
- _ref2$shouldWrapCells = _ref2.shouldWrapCells,
52
- shouldWrapCells = _ref2$shouldWrapCells === void 0 ? false : _ref2$shouldWrapCells,
53
- _ref2$shouldRefocus = _ref2.shouldRefocus,
54
- shouldRefocus = _ref2$shouldRefocus === void 0 ? true : _ref2$shouldRefocus,
55
- children = _ref2.children,
56
- keyBindings = _ref2.keyBindings,
57
- hotKeys = _ref2.hotKeys;
58
- var focusedRow = React.useRef();
59
- var focusedCell = React.useRef();
60
- var grid = React.useRef([]);
61
- var containerRef = React.useRef(document);
62
- var child = React__default['default'].Children.only(children);
63
- var decoratedChild = /*#__PURE__*/React__default['default'].cloneElement(child, {
64
- innerRef: dsUtilities.mergeRefs(child.props.innerRef, containerRef)
54
+ function FocusGridProvider({
55
+ shouldWrapRows = false,
56
+ shouldWrapCells = false,
57
+ shouldRefocus = true,
58
+ children,
59
+ keyBindings,
60
+ hotKeys
61
+ }) {
62
+ const focusedRow = React.useRef();
63
+ const focusedCell = React.useRef();
64
+ const grid = React.useRef([]);
65
+ const containerRef = React.useRef(document);
66
+ const child = React__default["default"].Children.only(children);
67
+ const decoratedChild = /*#__PURE__*/React__default["default"].cloneElement(child, {
68
+ innerRef: system.mergeRefs(child.props.innerRef, containerRef)
65
69
  });
66
70
 
67
- var getNode = function getNode(_ref3) {
68
- var rowIndex = _ref3.rowIndex,
69
- cellIndex = _ref3.cellIndex;
70
- return dsUtilities.get(grid.current, [rowIndex, cellIndex]);
71
- };
71
+ const getNode = ({
72
+ rowIndex,
73
+ cellIndex
74
+ }) => utils.get(grid.current, [rowIndex, cellIndex]);
72
75
 
73
- var register = function register(node, rowIndex, columnIndex) {
76
+ const register = (node, rowIndex, columnIndex) => {
74
77
  if (!node) return;
75
78
 
76
79
  if (!Array.isArray(grid.current[rowIndex])) {
@@ -83,8 +86,8 @@ function FocusGridProvider(_ref2) {
83
86
  node.setAttribute('tabindex', -1);
84
87
  }
85
88
 
86
- node.onfocus = function () {
87
- var prevNode = getNode({
89
+ node.onfocus = () => {
90
+ const prevNode = getNode({
88
91
  rowIndex: focusedRow.current,
89
92
  cellIndex: focusedCell.current
90
93
  });
@@ -97,31 +100,31 @@ function FocusGridProvider(_ref2) {
97
100
  grid.current[rowIndex][columnIndex] = node;
98
101
  };
99
102
 
100
- React.useEffect(function () {
103
+ React.useEffect(() => {
101
104
  if (shouldRefocus) {
102
- var rowIndex = focusedRow.current;
103
- var cellIndex = focusedCell.current;
104
- var node = dsUtilities.get(grid.current, [rowIndex, cellIndex]);
105
+ const rowIndex = focusedRow.current;
106
+ const cellIndex = focusedCell.current;
107
+ const node = utils.get(grid.current, [rowIndex, cellIndex]);
105
108
  if (node) node.focus();
106
109
  }
107
110
  });
108
111
 
109
- var focusNextCell = function focusNextCell(directionY, directionX, position) {
110
- var _ref4 = position || FocusGroup_utils_getNextCellPosition({
112
+ const focusNextCell = (directionY, directionX, position) => {
113
+ const {
114
+ rowIndex,
115
+ cellIndex
116
+ } = position || getNextCellPosition({
111
117
  grid: grid.current,
112
118
  currentCell: focusedCell.current,
113
119
  currentRow: focusedRow.current,
114
- directionX: directionX,
115
- directionY: directionY,
116
- shouldWrapCells: shouldWrapCells,
117
- shouldWrapRows: shouldWrapRows
118
- }),
119
- rowIndex = _ref4.rowIndex,
120
- cellIndex = _ref4.cellIndex;
121
-
122
- var node = getNode({
123
- rowIndex: rowIndex,
124
- cellIndex: cellIndex
120
+ directionX,
121
+ directionY,
122
+ shouldWrapCells,
123
+ shouldWrapRows
124
+ });
125
+ const node = getNode({
126
+ rowIndex,
127
+ cellIndex
125
128
  }); // can focus
126
129
 
127
130
  if (node) {
@@ -132,85 +135,74 @@ function FocusGridProvider(_ref2) {
132
135
  };
133
136
 
134
137
  registerHotKeysHooks(hotKeys, {
135
- focusedCell: focusedCell,
136
- focusedRow: focusedRow
138
+ focusedCell,
139
+ focusedRow
137
140
  });
138
141
 
139
- var defaultKeyBindings = _objectSpread({
140
- ArrowUp: dsUtilities.runAll(preventDefault, function () {
141
- return focusNextCell(-1, 0);
142
- }),
143
- ArrowRight: dsUtilities.runAll(preventDefault, function () {
144
- return focusNextCell(0, 1);
145
- }),
146
- ArrowDown: dsUtilities.runAll(preventDefault, function () {
147
- return focusNextCell(1, 0);
148
- }),
149
- ArrowLeft: dsUtilities.runAll(preventDefault, function () {
150
- return focusNextCell(0, -1);
151
- }),
152
- Home: dsUtilities.runAll(preventDefault, function (e) {
153
- var rowIndex = focusedRow.current;
142
+ 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 => {
148
+ let rowIndex = focusedRow.current;
154
149
 
155
150
  if (e.ctrlKey) {
156
151
  rowIndex = 0;
157
152
  }
158
153
 
159
154
  focusNextCell(0, 0, {
160
- rowIndex: rowIndex,
155
+ rowIndex,
161
156
  cellIndex: 0
162
157
  });
163
158
  }),
164
- End: dsUtilities.runAll(preventDefault, function (e) {
165
- var rowIndex = focusedRow.current;
159
+ End: utils.runAll(preventDefault, e => {
160
+ let rowIndex = focusedRow.current;
166
161
 
167
162
  if (e.ctrlKey) {
168
163
  rowIndex = grid.current.length - 1;
169
164
  }
170
165
 
171
166
  focusNextCell(0, 0, {
172
- rowIndex: rowIndex,
167
+ rowIndex,
173
168
  cellIndex: grid.current[0].length - 1
174
169
  });
175
170
  })
176
171
  }, keyBindings);
177
172
 
178
- var nextKeyBindings = dsUtilities.isFunction(keyBindings) ? keyBindings({
173
+ const nextKeyBindings = utils.isFunction(keyBindings) ? keyBindings({
179
174
  defaultBindings: defaultKeyBindings,
180
175
  rowIndex: focusedRow.current,
181
176
  cellIndex: focusedCell.current
182
177
  }) : _objectSpread(_objectSpread({}, defaultKeyBindings), keyBindings);
183
178
 
184
- var onKeyDown = function onKeyDown(e) {
179
+ const onKeyDown = e => {
185
180
  if (e.target.tagName.toLowerCase() === 'input') return;
186
- var action = nextKeyBindings[e.key];
187
- if (dsUtilities.isFunction(action)) action(e);
181
+ const action = nextKeyBindings[e.key];
182
+ if (utils.isFunction(action)) action(e);
188
183
  };
189
184
 
190
- var activate = function activate(container) {
185
+ const activate = container => {
191
186
  container.addEventListener('keydown', onKeyDown, true);
192
187
  };
193
188
 
194
- var deactivate = function deactivate(container) {
189
+ const deactivate = container => {
195
190
  container.removeEventListener('keydown', onKeyDown, true);
196
191
  };
197
192
 
198
- React.useEffect(function () {
193
+ React.useEffect(() => {
199
194
  activate(containerRef.current);
200
- return function () {
195
+ return () => {
201
196
  deactivate(containerRef.current);
202
197
  };
203
198
  }, []);
204
- var valueProvider = React.useMemo(function () {
205
- return {
206
- register: register
207
- };
208
- }, []);
209
- return /*#__PURE__*/React__default['default'].createElement(Provider, {
199
+ const valueProvider = React.useMemo(() => ({
200
+ register
201
+ }), []);
202
+ return /*#__PURE__*/_jsx__default["default"](Provider, {
210
203
  value: valueProvider
211
- }, decoratedChild);
204
+ }, void 0, decoratedChild);
212
205
  }
213
206
 
214
207
  exports.FocusGridContext = FocusGridContext;
215
- exports['default'] = FocusGridProvider;
216
- //# sourceMappingURL=FocusGrid.js.map
208
+ exports["default"] = FocusGridProvider;