@elliemae/ds-shared 1.60.0 → 2.0.0-alpha.12

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 +19 -27
  2. package/cjs/Animations/Grow.js +17 -22
  3. package/cjs/Animations/GrowRight.js +17 -23
  4. package/cjs/Animations/GrowVertical.js +3 -2
  5. package/cjs/CheckableGroup.js +40 -46
  6. package/cjs/DeferRenderAfterComputation.js +12 -21
  7. package/cjs/FocusGroup/FocusGrid.js +91 -92
  8. package/cjs/FocusGroup/FocusGroup.js +225 -262
  9. package/cjs/FocusGroup/FocusGroupContext.js +1 -2
  10. package/cjs/FocusGroup/FocusGroupManager.js +88 -126
  11. package/cjs/FocusGroup/focusGroupManagerHoc.js +28 -27
  12. package/cjs/FocusGroup/index.js +14 -28
  13. package/cjs/FocusGroup/useFocusGroupItem.js +27 -24
  14. package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -15
  15. package/cjs/GroupContext/Group.js +81 -103
  16. package/cjs/GroupContext/GroupContext.js +1 -2
  17. package/cjs/GroupContext/GroupItem.js +12 -10
  18. package/cjs/GroupContext/index.js +6 -15
  19. package/cjs/ScrollSync/ScrollSync.js +90 -112
  20. package/cjs/ScrollSync/ScrollSyncPane.js +58 -90
  21. package/cjs/ScrollSync/ScrollSyncProvider.js +36 -26
  22. package/cjs/ScrollSync/index.js +4 -13
  23. package/cjs/ScrollSync/useScrollSync.js +0 -1
  24. package/cjs/constants.js +43 -4
  25. package/cjs/createDataInstance/createInstancePlugin.js +11 -10
  26. package/cjs/createDataInstance/createInstanceRef.js +41 -42
  27. package/cjs/createDataInstance/utils.js +56 -58
  28. package/cjs/defer-render-hoc/index.js +26 -61
  29. package/cjs/dimsum.config.js +7 -0
  30. package/cjs/index.js +10 -20
  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 +65 -77
  35. package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
  36. package/cjs/useDataGrid/index.js +2 -17
  37. package/cjs/useDataGrid/initColumnDefinition.js +46 -47
  38. package/cjs/useDataGrid/useDataGrid.js +104 -144
  39. package/cjs/useDataList/index.js +2 -15
  40. package/cjs/useDataList/recordIterator.js +9 -10
  41. package/cjs/useDataList/useDataList.js +51 -59
  42. package/cjs/utils.js +46 -59
  43. package/cjs/virtualization/AutoHeightList.js +31 -22
  44. package/cjs/virtualization/FluidHeightList.js +26 -12
  45. package/cjs/virtualization/index.js +12 -17
  46. package/esm/Animations/BaseAnimation.js +18 -26
  47. package/esm/Animations/Grow.js +15 -20
  48. package/esm/Animations/GrowRight.js +15 -21
  49. package/esm/Animations/GrowVertical.js +3 -2
  50. package/esm/CheckableGroup.js +38 -42
  51. package/esm/DeferRenderAfterComputation.js +12 -20
  52. package/esm/FocusGroup/FocusGrid.js +87 -89
  53. package/esm/FocusGroup/FocusGroup.js +222 -257
  54. package/esm/FocusGroup/FocusGroupContext.js +0 -1
  55. package/esm/FocusGroup/FocusGroupManager.js +82 -114
  56. package/esm/FocusGroup/focusGroupManagerHoc.js +24 -22
  57. package/esm/FocusGroup/index.js +0 -14
  58. package/esm/FocusGroup/useFocusGroupItem.js +25 -22
  59. package/esm/FocusGroup/utils/getNextCellPosition.js +14 -15
  60. package/esm/GroupContext/Group.js +80 -95
  61. package/esm/GroupContext/GroupContext.js +1 -2
  62. package/esm/GroupContext/GroupItem.js +10 -8
  63. package/esm/GroupContext/index.js +0 -9
  64. package/esm/ScrollSync/ScrollSync.js +88 -105
  65. package/esm/ScrollSync/ScrollSyncPane.js +56 -83
  66. package/esm/ScrollSync/ScrollSyncProvider.js +35 -26
  67. package/esm/ScrollSync/index.js +0 -9
  68. package/esm/ScrollSync/useScrollSync.js +0 -1
  69. package/esm/constants.js +31 -5
  70. package/esm/createDataInstance/createInstancePlugin.js +10 -8
  71. package/esm/createDataInstance/createInstanceRef.js +36 -36
  72. package/esm/createDataInstance/utils.js +55 -57
  73. package/esm/defer-render-hoc/index.js +25 -55
  74. package/esm/dimsum.config.js +5 -0
  75. package/esm/index.js +0 -10
  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 +60 -71
  80. package/esm/useDataGrid/VolatileRowsListener.js +14 -23
  81. package/esm/useDataGrid/index.js +0 -15
  82. package/esm/useDataGrid/initColumnDefinition.js +43 -43
  83. package/esm/useDataGrid/useDataGrid.js +90 -127
  84. package/esm/useDataList/index.js +0 -13
  85. package/esm/useDataList/recordIterator.js +9 -10
  86. package/esm/useDataList/useDataList.js +39 -46
  87. package/esm/utils.js +44 -57
  88. package/esm/virtualization/AutoHeightList.js +28 -18
  89. package/esm/virtualization/FluidHeightList.js +24 -10
  90. package/esm/virtualization/index.js +6 -11
  91. package/package.json +201 -8
  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 +5 -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
@@ -1,133 +1,102 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
3
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
4
- import _inherits from '@babel/runtime/helpers/esm/inherits';
5
- import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
6
- import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
7
- import React, { Component } from 'react';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import { Component } from 'react';
8
3
  import { isFunction } from '@elliemae/ds-utilities';
9
4
  import FocusGroup from './FocusGroup.js';
10
5
  import FocusGroupContext from './FocusGroupContext.js';
11
- import '@babel/runtime/helpers/esm/defineProperty';
12
- import 'hotkeys-js';
13
6
 
14
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
-
16
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7
+ const noop = () => null;
8
+
9
+ class FocusGroupProvider extends Component {
10
+ constructor(props) {
11
+ super(props);
12
+ this.activated = false;
13
+ this.focusGroup = new FocusGroup(props);
14
+ props.onFocusGroupSet(this);
15
+ this.actions = {
16
+ activate: this.activate.bind(this),
17
+ deactivate: this.deactivate.bind(this),
18
+ register: this.focusGroup.register,
19
+ unregister: this.unregister.bind(this),
20
+ focusFirst: this.focusGroup.focusFirst,
21
+ focusLast: this.focusGroup.focusLast,
22
+ focusItemByIndex: this.focusItemByIndex.bind(this),
23
+ focusItemByNode: this.focusItemByNode.bind(this),
24
+ focus: this.focusGroup.focusCurrent,
25
+ isGroupActive: this.focusGroup.isGroupActive,
26
+ focusNext: this.focusGroup.focusNext,
27
+ focusPrevious: this.focusGroup.focusPrevious
28
+ };
29
+ }
17
30
 
18
- var noop = function noop() {
19
- return null;
20
- };
31
+ componentDidMount() {
32
+ const {
33
+ autoFocusOnMount
34
+ } = this.props;
35
+ this.activate();
21
36
 
22
- var FocusGroupProvider = /*#__PURE__*/function (_Component) {
23
- _inherits(FocusGroupProvider, _Component);
37
+ if (autoFocusOnMount) {
38
+ setTimeout(() => {
39
+ this.actions.focusFirst();
40
+ }, 0);
41
+ }
42
+ }
24
43
 
25
- var _super = _createSuper(FocusGroupProvider);
44
+ componentWillUnmount() {
45
+ this.deactivate();
46
+ }
26
47
 
27
- function FocusGroupProvider(props) {
28
- var _this;
48
+ activate() {
49
+ const {
50
+ onActivate
51
+ } = this.props;
52
+ this.focusGroup.activate();
53
+ this.activated = true;
54
+ if (isFunction(onActivate)) onActivate();
55
+ }
29
56
 
30
- _classCallCheck(this, FocusGroupProvider);
57
+ deactivate() {
58
+ const {
59
+ onExitFocusGroup
60
+ } = this.props;
61
+ this.activated = false;
62
+ this.focusGroup.deactivate();
31
63
 
32
- _this = _super.call(this, props);
33
- _this.activated = false;
34
- _this.focusGroup = new FocusGroup(props);
35
- props.onFocusGroupSet(_assertThisInitialized(_this));
36
- _this.actions = {
37
- activate: _this.activate.bind(_assertThisInitialized(_this)),
38
- deactivate: _this.deactivate.bind(_assertThisInitialized(_this)),
39
- register: _this.focusGroup.register,
40
- unregister: _this.unregister.bind(_assertThisInitialized(_this)),
41
- focusFirst: _this.focusGroup.focusFirst,
42
- focusLast: _this.focusGroup.focusLast,
43
- focusItemByIndex: _this.focusItemByIndex.bind(_assertThisInitialized(_this)),
44
- focusItemByNode: _this.focusItemByNode.bind(_assertThisInitialized(_this)),
45
- focus: _this.focusGroup.focusCurrent,
46
- isGroupActive: _this.focusGroup.isGroupActive,
47
- focusNext: _this.focusGroup.focusNext,
48
- focusPrevious: _this.focusGroup.focusPrevious
49
- };
50
- return _this;
64
+ if (isFunction(onExitFocusGroup)) {
65
+ onExitFocusGroup();
66
+ }
51
67
  }
52
68
 
53
- _createClass(FocusGroupProvider, [{
54
- key: "componentDidMount",
55
- value: function componentDidMount() {
56
- var _this2 = this;
57
-
58
- var autoFocusOnMount = this.props.autoFocusOnMount;
59
- this.activate();
69
+ register(item) {
70
+ this.focusGroup.register(item);
71
+ }
60
72
 
61
- if (autoFocusOnMount) {
62
- setTimeout(function () {
63
- _this2.actions.focusFirst();
64
- }, 0);
65
- }
66
- }
67
- }, {
68
- key: "componentWillUnmount",
69
- value: function componentWillUnmount() {
70
- this.deactivate();
71
- }
72
- }, {
73
- key: "activate",
74
- value: function activate() {
75
- var onActivate = this.props.onActivate;
76
- this.focusGroup.activate();
77
- this.activated = true;
78
- if (isFunction(onActivate)) onActivate();
79
- }
80
- }, {
81
- key: "deactivate",
82
- value: function deactivate() {
83
- var onExitFocusGroup = this.props.onExitFocusGroup;
84
- this.activated = false;
85
- this.focusGroup.deactivate();
73
+ unregister(item) {
74
+ this.focusGroup.unregister(item);
75
+ }
86
76
 
87
- if (isFunction(onExitFocusGroup)) {
88
- onExitFocusGroup();
89
- }
90
- }
91
- }, {
92
- key: "register",
93
- value: function register(item) {
94
- this.focusGroup.register(item);
95
- }
96
- }, {
97
- key: "unregister",
98
- value: function unregister(item) {
99
- this.focusGroup.unregister(item);
100
- }
101
- }, {
102
- key: "focusItemByIndex",
103
- value: function focusItemByIndex(index) {
104
- var _this3 = this;
77
+ focusItemByIndex(index) {
78
+ if (!this.activated) this.activate();
79
+ setTimeout(() => {
80
+ this.focusGroup.focusByIndex(index);
81
+ }, 200);
82
+ }
105
83
 
106
- if (!this.activated) this.activate();
107
- setTimeout(function () {
108
- _this3.focusGroup.focusByIndex(index);
109
- }, 200);
110
- }
111
- }, {
112
- key: "focusItemByNode",
113
- value: function focusItemByNode(node) {
114
- if (!this.activated) this.activate();
115
- var index = this.focusGroup.getItemIndexByNode(node);
116
- this.focusItemByIndex(index);
117
- }
118
- }, {
119
- key: "render",
120
- value: function render() {
121
- var children = this.props.children;
122
- return /*#__PURE__*/React.createElement(FocusGroupContext.Provider, {
123
- value: this.actions
124
- }, children);
125
- }
126
- }]);
84
+ focusItemByNode(node) {
85
+ if (!this.activated) this.activate();
86
+ const index = this.focusGroup.getItemIndexByNode(node);
87
+ this.focusItemByIndex(index);
88
+ }
127
89
 
128
- return FocusGroupProvider;
129
- }(Component);
90
+ render() {
91
+ const {
92
+ children
93
+ } = this.props;
94
+ return /*#__PURE__*/_jsx(FocusGroupContext.Provider, {
95
+ value: this.actions
96
+ }, void 0, children);
97
+ }
130
98
 
99
+ }
131
100
  FocusGroupProvider.defaultProps = {
132
101
  exitWhenNoPrevious: false,
133
102
  exitWhenNoNext: false,
@@ -140,4 +109,3 @@ FocusGroupProvider.defaultProps = {
140
109
  };
141
110
 
142
111
  export { FocusGroupProvider as default };
143
- //# sourceMappingURL=FocusGroupManager.js.map
@@ -1,35 +1,37 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
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';
2
7
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
3
- import React from 'react';
8
+ import 'react';
4
9
  import FocusGroupProvider from './FocusGroupManager.js';
5
- import '@babel/runtime/helpers/esm/classCallCheck';
6
- import '@babel/runtime/helpers/esm/createClass';
7
- import '@babel/runtime/helpers/esm/assertThisInitialized';
8
- import '@babel/runtime/helpers/esm/inherits';
9
- import '@babel/runtime/helpers/esm/possibleConstructorReturn';
10
- import '@babel/runtime/helpers/esm/getPrototypeOf';
11
- import '@elliemae/ds-utilities';
12
- import './FocusGroup.js';
13
- import '@babel/runtime/helpers/esm/defineProperty';
14
- import 'hotkeys-js';
15
- import './FocusGroupContext.js';
10
+ import { jsx } from 'react/jsx-runtime';
16
11
 
17
- var _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
12
+ const _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
13
+
14
+ 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; }
15
+
16
+ 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(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
17
  function FocusGroupHoc(WrappedComponent) {
19
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
- return function (_ref) {
21
- var onExitFocusGroup = _ref.onExitFocusGroup,
22
- onFocusPrevGroup = _ref.onFocusPrevGroup,
23
- focusKeyBindings = _ref.focusKeyBindings,
18
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19
+ return _ref => {
20
+ let {
21
+ onExitFocusGroup,
22
+ onFocusPrevGroup,
23
+ focusKeyBindings
24
+ } = _ref,
24
25
  props = _objectWithoutProperties(_ref, _excluded);
25
26
 
26
- return /*#__PURE__*/React.createElement(FocusGroupProvider, _extends({
27
+ return /*#__PURE__*/jsx(FocusGroupProvider, _objectSpread(_objectSpread({
27
28
  keyBindings: focusKeyBindings,
28
29
  onExitFocusGroup: onExitFocusGroup,
29
30
  onFocusPrevGroup: onFocusPrevGroup
30
- }, options), /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, options)));
31
+ }, options), {}, {
32
+ children: /*#__PURE__*/jsx(WrappedComponent, _objectSpread(_objectSpread({}, props), options))
33
+ }));
31
34
  };
32
35
  }
33
36
 
34
37
  export { FocusGroupHoc as default };
35
- //# sourceMappingURL=focusGroupManagerHoc.js.map
@@ -4,17 +4,3 @@ export { default as FocusGroupManager } from './FocusGroupManager.js';
4
4
  export { default as useFocusGroupItem, useFocusGroupWithState } from './useFocusGroupItem.js';
5
5
  export { default as focusGroupManagerHoc } from './focusGroupManagerHoc.js';
6
6
  export { default as FocusGrid, FocusGridContext } from './FocusGrid.js';
7
- import '@babel/runtime/helpers/esm/classCallCheck';
8
- import '@babel/runtime/helpers/esm/createClass';
9
- import '@babel/runtime/helpers/esm/defineProperty';
10
- import '@elliemae/ds-utilities';
11
- import 'hotkeys-js';
12
- import 'react';
13
- import '@babel/runtime/helpers/esm/assertThisInitialized';
14
- import '@babel/runtime/helpers/esm/inherits';
15
- import '@babel/runtime/helpers/esm/possibleConstructorReturn';
16
- import '@babel/runtime/helpers/esm/getPrototypeOf';
17
- import '@babel/runtime/helpers/esm/objectWithoutProperties';
18
- import '@babel/runtime/helpers/esm/extends';
19
- import './utils/getNextCellPosition.js';
20
- //# sourceMappingURL=index.js.map
@@ -2,20 +2,22 @@ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutPr
2
2
  import { useContext, useEffect } from 'react';
3
3
  import FocusGroupContext from './FocusGroupContext.js';
4
4
 
5
- var _excluded = ["register", "unregister"],
6
- _excluded2 = ["register", "unregister"];
5
+ const _excluded = ["register", "unregister"],
6
+ _excluded2 = ["register", "unregister"];
7
7
  function useFocusGroupItem() {
8
- var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- var props = arguments.length > 1 ? arguments[1] : undefined;
8
+ let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
+ let props = arguments.length > 1 ? arguments[1] : undefined;
10
10
 
11
- var _ref = useContext(FocusGroupContext) || {},
12
- register = _ref.register,
13
- unregister = _ref.unregister,
14
- otherActions = _objectWithoutProperties(_ref, _excluded);
11
+ const _ref = useContext(FocusGroupContext) || {},
12
+ {
13
+ register,
14
+ unregister
15
+ } = _ref,
16
+ otherActions = _objectWithoutProperties(_ref, _excluded);
15
17
 
16
- useEffect(function () {
18
+ useEffect(() => {
17
19
  if (ref.current && register) register(ref.current, props);
18
- return function () {
20
+ return () => {
19
21
  if (ref.current && unregister) unregister(ref.current);
20
22
  };
21
23
  }); // if the focus item is not wrapped with the focus provider then return null
@@ -23,18 +25,20 @@ function useFocusGroupItem() {
23
25
  if (!register) return {};
24
26
  return otherActions;
25
27
  }
26
- var useFocusGroupWithState = function useFocusGroupWithState() {
27
- var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
- var props = arguments.length > 1 ? arguments[1] : undefined;
29
-
30
- var _ref2 = useContext(FocusGroupContext) || {},
31
- register = _ref2.register,
32
- unregister = _ref2.unregister,
33
- otherActions = _objectWithoutProperties(_ref2, _excluded2);
34
-
35
- useEffect(function () {
28
+ const useFocusGroupWithState = function () {
29
+ let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
30
+ let props = arguments.length > 1 ? arguments[1] : undefined;
31
+
32
+ const _ref2 = useContext(FocusGroupContext) || {},
33
+ {
34
+ register,
35
+ unregister
36
+ } = _ref2,
37
+ otherActions = _objectWithoutProperties(_ref2, _excluded2);
38
+
39
+ useEffect(() => {
36
40
  if (ref && register) register(ref, props);
37
- return function () {
41
+ return () => {
38
42
  if (ref && unregister) unregister(ref);
39
43
  };
40
44
  }, [ref]); // if the focus item is not wrapped with the focus provider then return null
@@ -44,4 +48,3 @@ var useFocusGroupWithState = function useFocusGroupWithState() {
44
48
  };
45
49
 
46
50
  export { useFocusGroupItem as default, useFocusGroupWithState };
47
- //# sourceMappingURL=useFocusGroupItem.js.map
@@ -1,24 +1,24 @@
1
1
  // eslint-disable-next-line max-statements
2
2
  function getNextCellPosition(_ref) {
3
- var grid = _ref.grid,
4
- _ref$currentRow = _ref.currentRow,
5
- currentRow = _ref$currentRow === void 0 ? 0 : _ref$currentRow,
6
- _ref$currentCell = _ref.currentCell,
7
- currentCell = _ref$currentCell === void 0 ? 0 : _ref$currentCell,
8
- directionY = _ref.directionY,
9
- directionX = _ref.directionX,
10
- shouldWrapCells = _ref.shouldWrapCells,
11
- shouldWrapRows = _ref.shouldWrapRows;
12
- var nextRow = currentRow + directionY;
13
- var nextCell = currentCell + directionX;
14
- var rowCount = grid.length;
15
- var isLeftRight = directionX !== 0;
3
+ let {
4
+ grid,
5
+ currentRow = 0,
6
+ currentCell = 0,
7
+ directionY,
8
+ directionX,
9
+ shouldWrapCells,
10
+ shouldWrapRows
11
+ } = _ref;
12
+ let nextRow = currentRow + directionY;
13
+ let nextCell = currentCell + directionX;
14
+ const rowCount = grid.length;
15
+ const isLeftRight = directionX !== 0;
16
16
 
17
17
  if (!rowCount) {
18
18
  return false;
19
19
  }
20
20
 
21
- var cellsLength = grid[0].length; // moving horizontally
21
+ const cellsLength = grid[0].length; // moving horizontally
22
22
 
23
23
  if (shouldWrapCells && isLeftRight) {
24
24
  // to left
@@ -56,4 +56,3 @@ function getNextCellPosition(_ref) {
56
56
  }
57
57
 
58
58
  export { getNextCellPosition as default };
59
- //# sourceMappingURL=getNextCellPosition.js.map
@@ -1,38 +1,35 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
3
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
4
- import _inherits from '@babel/runtime/helpers/esm/inherits';
5
- import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
6
- import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
7
- import React, { Component } from 'react';
8
- import PropTypes from 'prop-types';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'core-js/modules/web.dom-collections.iterator.js';
3
+ import { Component } from 'react';
9
4
  import { GroupContext } from './GroupContext.js';
10
5
 
11
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
-
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
-
15
- var getValueItem = function getValueItem(e) {
16
- var target = e.target,
17
- currentTarget = e.currentTarget;
6
+ const getValueItem = e => {
7
+ const {
8
+ target,
9
+ currentTarget
10
+ } = e;
18
11
 
19
12
  if (target) {
20
- var value = target.value;
13
+ const {
14
+ value
15
+ } = target;
21
16
  return value;
22
17
  }
23
18
 
24
19
  if (currentTarget) {
25
- var _value = currentTarget.value;
26
- return _value;
20
+ const {
21
+ value
22
+ } = currentTarget;
23
+ return value;
27
24
  }
28
25
 
29
26
  return e;
30
27
  };
31
28
 
32
- var toggleItemValue = function toggleItemValue(array, e) {
33
- var newvalue = getValueItem(e);
34
- var res = array;
35
- var index = array.indexOf(newvalue);
29
+ const toggleItemValue = (array, e) => {
30
+ const newvalue = getValueItem(e);
31
+ const res = array;
32
+ const index = array.indexOf(newvalue);
36
33
 
37
34
  if (index === -1) {
38
35
  res.push(newvalue);
@@ -43,91 +40,79 @@ var toggleItemValue = function toggleItemValue(array, e) {
43
40
  return res;
44
41
  };
45
42
 
46
- var Provider = GroupContext.Provider;
43
+ const {
44
+ Provider
45
+ } = GroupContext;
47
46
  /** deprecated use CheckableGroup instead */
48
47
 
49
- var Group = /*#__PURE__*/function (_Component) {
50
- _inherits(Group, _Component);
51
-
52
- var _super = _createSuper(Group);
53
-
54
- function Group(props) {
55
- var _this;
56
-
57
- _classCallCheck(this, Group);
58
-
59
- _this = _super.call(this, props);
60
- var activeValue = props.activeValue,
61
- disabled = props.disabled;
62
- _this.state = {
63
- activeValue: activeValue,
64
- disabled: disabled,
48
+ class Group extends Component {
49
+ constructor(props) {
50
+ super(props);
51
+ const {
52
+ activeValue,
53
+ disabled
54
+ } = props;
55
+ this.state = {
56
+ activeValue,
57
+ disabled,
65
58
  prevValue: null,
66
- onChange: _this.handleChange.bind(_assertThisInitialized(_this))
59
+ onChange: this.handleChange.bind(this)
67
60
  };
68
- return _this;
69
61
  }
70
62
 
71
- _createClass(Group, [{
72
- key: "handleChange",
73
- value: function handleChange(e) {
74
- var _this$props = this.props,
75
- multiple = _this$props.multiple,
76
- onChange = _this$props.onChange;
77
- var activeValue = this.state.activeValue;
78
- var value = getValueItem(e);
79
- var newValue;
80
-
81
- if (multiple) {
82
- newValue = toggleItemValue(activeValue || [], value);
83
- } else if (activeValue !== value) {
84
- // default behaviour it will be toggle the active value
85
- newValue = value;
86
- }
87
-
88
- this.setState({
89
- activeValue: newValue
90
- });
91
-
92
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
93
- rest[_key - 1] = arguments[_key];
94
- }
95
-
96
- if (onChange) onChange.apply(void 0, [newValue].concat(rest));
97
- }
98
- }, {
99
- key: "render",
100
- value: function render() {
101
- var children = this.props.children;
102
- return /*#__PURE__*/React.createElement(Provider, {
103
- value: this.state
104
- }, children);
63
+ static getDerivedStateFromProps(nextProps, _ref) {
64
+ let {
65
+ prevValue
66
+ } = _ref;
67
+ if (nextProps.activeValue === prevValue) return null;
68
+ return {
69
+ activeValue: nextProps.activeValue,
70
+ prevValue: nextProps.activeValue
71
+ };
72
+ }
73
+
74
+ handleChange(e) {
75
+ const {
76
+ multiple,
77
+ onChange
78
+ } = this.props;
79
+ const {
80
+ activeValue
81
+ } = this.state;
82
+ const value = getValueItem(e);
83
+ let newValue;
84
+
85
+ if (multiple) {
86
+ newValue = toggleItemValue(activeValue || [], value);
87
+ } else if (activeValue !== value) {
88
+ // default behaviour it will be toggle the active value
89
+ newValue = value;
105
90
  }
106
- }], [{
107
- key: "getDerivedStateFromProps",
108
- value: function getDerivedStateFromProps(nextProps, _ref) {
109
- var prevValue = _ref.prevValue;
110
- if (nextProps.activeValue === prevValue) return null;
111
- return {
112
- activeValue: nextProps.activeValue,
113
- prevValue: nextProps.activeValue
114
- };
91
+
92
+ this.setState({
93
+ activeValue: newValue
94
+ });
95
+
96
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
97
+ rest[_key - 1] = arguments[_key];
115
98
  }
116
- }]);
117
99
 
118
- return Group;
119
- }(Component);
100
+ if (onChange) onChange(newValue, ...rest);
101
+ }
102
+
103
+ render() {
104
+ const {
105
+ children
106
+ } = this.props;
107
+ return /*#__PURE__*/_jsx(Provider, {
108
+ value: this.state
109
+ }, void 0, children);
110
+ }
111
+
112
+ }
120
113
 
121
114
  Group.defaultProps = {
122
115
  multiple: false
123
116
  };
124
- Group.propTypes = {
125
- children: PropTypes.array,
126
- multiple: PropTypes.bool,
127
- onChange: PropTypes.func,
128
- activeValue: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
129
- disabled: PropTypes.bool
130
- };
131
117
 
132
118
  export { Group as default };
133
- //# sourceMappingURL=Group.js.map
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- var GroupContext = /*#__PURE__*/React.createContext();
3
+ const GroupContext = /*#__PURE__*/React.createContext();
4
4
 
5
5
  export { GroupContext };
6
- //# sourceMappingURL=GroupContext.js.map
@@ -1,14 +1,16 @@
1
- import React from 'react';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
2
3
  import { GroupContext } from './GroupContext.js';
3
4
 
4
- var Consumer = GroupContext.Consumer;
5
+ const {
6
+ Consumer
7
+ } = GroupContext;
5
8
 
6
- var GroupItem = function GroupItem(_ref) {
7
- var render = _ref.render;
8
- return /*#__PURE__*/React.createElement(Consumer, null, function (context) {
9
- return render(context);
10
- });
9
+ const GroupItem = _ref => {
10
+ let {
11
+ render
12
+ } = _ref;
13
+ return /*#__PURE__*/_jsx(Consumer, {}, void 0, context => render(context));
11
14
  };
12
15
 
13
16
  export { GroupItem as default };
14
- //# sourceMappingURL=GroupItem.js.map