@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
@@ -1,134 +1,105 @@
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';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
7
2
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import React, { Component } from 'react';
9
- import { isFunction } from '@elliemae/ds-utilities';
3
+ import { Component } from 'react';
4
+ import { isFunction } from '@elliemae/ds-utilities/utils';
10
5
  import FocusGroup from './FocusGroup.js';
11
6
  import FocusGroupContext from './FocusGroupContext.js';
12
- import 'hotkeys-js';
13
7
 
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; } }
8
+ const noop = () => null;
9
+
10
+ class FocusGroupProvider extends Component {
11
+ constructor(props) {
12
+ super(props);
13
+
14
+ _defineProperty(this, "activated", false);
15
+
16
+ this.focusGroup = new FocusGroup(props);
17
+ props.onFocusGroupSet(this);
18
+ this.actions = {
19
+ activate: this.activate.bind(this),
20
+ deactivate: this.deactivate.bind(this),
21
+ register: this.focusGroup.register,
22
+ unregister: this.unregister.bind(this),
23
+ focusFirst: this.focusGroup.focusFirst,
24
+ focusLast: this.focusGroup.focusLast,
25
+ focusItemByIndex: this.focusItemByIndex.bind(this),
26
+ focusItemByNode: this.focusItemByNode.bind(this),
27
+ focus: this.focusGroup.focusCurrent,
28
+ isGroupActive: this.focusGroup.isGroupActive,
29
+ focusNext: this.focusGroup.focusNext,
30
+ focusPrevious: this.focusGroup.focusPrevious
31
+ };
32
+ }
17
33
 
18
- var noop = function noop() {
19
- return null;
20
- };
34
+ componentDidMount() {
35
+ const {
36
+ autoFocusOnMount
37
+ } = this.props;
38
+ this.activate();
21
39
 
22
- var FocusGroupProvider = /*#__PURE__*/function (_Component) {
23
- _inherits(FocusGroupProvider, _Component);
40
+ if (autoFocusOnMount) {
41
+ setTimeout(() => {
42
+ this.actions.focusFirst();
43
+ }, 0);
44
+ }
45
+ }
24
46
 
25
- var _super = _createSuper(FocusGroupProvider);
47
+ componentWillUnmount() {
48
+ this.deactivate();
49
+ }
26
50
 
27
- function FocusGroupProvider(props) {
28
- var _this;
51
+ activate() {
52
+ const {
53
+ onActivate
54
+ } = this.props;
55
+ this.focusGroup.activate();
56
+ this.activated = true;
57
+ if (isFunction(onActivate)) onActivate();
58
+ }
29
59
 
30
- _classCallCheck(this, FocusGroupProvider);
60
+ deactivate() {
61
+ const {
62
+ onExitFocusGroup
63
+ } = this.props;
64
+ this.activated = false;
65
+ this.focusGroup.deactivate();
31
66
 
32
- _this = _super.call(this, props);
67
+ if (isFunction(onExitFocusGroup)) {
68
+ onExitFocusGroup();
69
+ }
70
+ }
33
71
 
34
- _defineProperty(_assertThisInitialized(_this), "activated", false);
72
+ register(item) {
73
+ this.focusGroup.register(item);
74
+ }
35
75
 
36
- _this.focusGroup = new FocusGroup(props);
37
- props.onFocusGroupSet(_assertThisInitialized(_this));
38
- _this.actions = {
39
- activate: _this.activate.bind(_assertThisInitialized(_this)),
40
- deactivate: _this.deactivate.bind(_assertThisInitialized(_this)),
41
- register: _this.focusGroup.register,
42
- unregister: _this.unregister.bind(_assertThisInitialized(_this)),
43
- focusFirst: _this.focusGroup.focusFirst,
44
- focusLast: _this.focusGroup.focusLast,
45
- focusItemByIndex: _this.focusItemByIndex.bind(_assertThisInitialized(_this)),
46
- focusItemByNode: _this.focusItemByNode.bind(_assertThisInitialized(_this)),
47
- focus: _this.focusGroup.focusCurrent,
48
- isGroupActive: _this.focusGroup.isGroupActive,
49
- focusNext: _this.focusGroup.focusNext,
50
- focusPrevious: _this.focusGroup.focusPrevious
51
- };
52
- return _this;
76
+ unregister(item) {
77
+ this.focusGroup.unregister(item);
53
78
  }
54
79
 
55
- _createClass(FocusGroupProvider, [{
56
- key: "componentDidMount",
57
- value: function componentDidMount() {
58
- var _this2 = this;
80
+ focusItemByIndex(index) {
81
+ if (!this.activated) this.activate();
82
+ setTimeout(() => {
83
+ this.focusGroup.focusByIndex(index);
84
+ }, 200);
85
+ }
59
86
 
60
- var autoFocusOnMount = this.props.autoFocusOnMount;
61
- this.activate();
87
+ focusItemByNode(node) {
88
+ if (!this.activated) this.activate();
89
+ const index = this.focusGroup.getItemIndexByNode(node);
90
+ this.focusItemByIndex(index);
91
+ }
62
92
 
63
- if (autoFocusOnMount) {
64
- setTimeout(function () {
65
- _this2.actions.focusFirst();
66
- }, 0);
67
- }
68
- }
69
- }, {
70
- key: "componentWillUnmount",
71
- value: function componentWillUnmount() {
72
- this.deactivate();
73
- }
74
- }, {
75
- key: "activate",
76
- value: function activate() {
77
- var onActivate = this.props.onActivate;
78
- this.focusGroup.activate();
79
- this.activated = true;
80
- if (isFunction(onActivate)) onActivate();
81
- }
82
- }, {
83
- key: "deactivate",
84
- value: function deactivate() {
85
- var onExitFocusGroup = this.props.onExitFocusGroup;
86
- this.activated = false;
87
- this.focusGroup.deactivate();
88
-
89
- if (isFunction(onExitFocusGroup)) {
90
- onExitFocusGroup();
91
- }
92
- }
93
- }, {
94
- key: "register",
95
- value: function register(item) {
96
- this.focusGroup.register(item);
97
- }
98
- }, {
99
- key: "unregister",
100
- value: function unregister(item) {
101
- this.focusGroup.unregister(item);
102
- }
103
- }, {
104
- key: "focusItemByIndex",
105
- value: function focusItemByIndex(index) {
106
- var _this3 = this;
107
-
108
- if (!this.activated) this.activate();
109
- setTimeout(function () {
110
- _this3.focusGroup.focusByIndex(index);
111
- }, 200);
112
- }
113
- }, {
114
- key: "focusItemByNode",
115
- value: function focusItemByNode(node) {
116
- if (!this.activated) this.activate();
117
- var index = this.focusGroup.getItemIndexByNode(node);
118
- this.focusItemByIndex(index);
119
- }
120
- }, {
121
- key: "render",
122
- value: function render() {
123
- var children = this.props.children;
124
- return /*#__PURE__*/React.createElement(FocusGroupContext.Provider, {
125
- value: this.actions
126
- }, children);
127
- }
128
- }]);
93
+ render() {
94
+ const {
95
+ children
96
+ } = this.props;
97
+ return /*#__PURE__*/_jsx(FocusGroupContext.Provider, {
98
+ value: this.actions
99
+ }, void 0, children);
100
+ }
129
101
 
130
- return FocusGroupProvider;
131
- }(Component);
102
+ }
132
103
 
133
104
  _defineProperty(FocusGroupProvider, "defaultProps", {
134
105
  exitWhenNoPrevious: false,
@@ -142,4 +113,3 @@ _defineProperty(FocusGroupProvider, "defaultProps", {
142
113
  });
143
114
 
144
115
  export { FocusGroupProvider as default };
145
- //# sourceMappingURL=FocusGroupManager.js.map
@@ -1,35 +1,31 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
3
- import React from 'react';
3
+ import 'react';
4
4
  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 '@babel/runtime/helpers/esm/defineProperty';
12
- import '@elliemae/ds-utilities';
13
- import './FocusGroup.js';
14
- import 'hotkeys-js';
15
- import './FocusGroupContext.js';
5
+ import { jsx } from 'react/jsx-runtime';
16
6
 
17
- var _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
18
- 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,
7
+ const _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+ function FocusGroupHoc(WrappedComponent, options = {}) {
13
+ return _ref => {
14
+ let {
15
+ onExitFocusGroup,
16
+ onFocusPrevGroup,
17
+ focusKeyBindings
18
+ } = _ref,
24
19
  props = _objectWithoutProperties(_ref, _excluded);
25
20
 
26
- return /*#__PURE__*/React.createElement(FocusGroupProvider, _extends({
21
+ return /*#__PURE__*/jsx(FocusGroupProvider, _objectSpread(_objectSpread({
27
22
  keyBindings: focusKeyBindings,
28
23
  onExitFocusGroup: onExitFocusGroup,
29
24
  onFocusPrevGroup: onFocusPrevGroup
30
- }, options), /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, options)));
25
+ }, options), {}, {
26
+ children: /*#__PURE__*/jsx(WrappedComponent, _objectSpread(_objectSpread({}, props), options))
27
+ }));
31
28
  };
32
29
  }
33
30
 
34
31
  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,19 @@ 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"];
7
- function useFocusGroupItem() {
8
- var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- var props = arguments.length > 1 ? arguments[1] : undefined;
10
-
11
- var _ref = useContext(FocusGroupContext) || {},
12
- register = _ref.register,
13
- unregister = _ref.unregister,
14
- otherActions = _objectWithoutProperties(_ref, _excluded);
15
-
16
- useEffect(function () {
5
+ const _excluded = ["register", "unregister"],
6
+ _excluded2 = ["register", "unregister"];
7
+ function useFocusGroupItem(ref = {}, props) {
8
+ const _ref = useContext(FocusGroupContext) || {},
9
+ {
10
+ register,
11
+ unregister
12
+ } = _ref,
13
+ otherActions = _objectWithoutProperties(_ref, _excluded);
14
+
15
+ useEffect(() => {
17
16
  if (ref.current && register) register(ref.current, props);
18
- return function () {
17
+ return () => {
19
18
  if (ref.current && unregister) unregister(ref.current);
20
19
  };
21
20
  }); // if the focus item is not wrapped with the focus provider then return null
@@ -23,18 +22,17 @@ function useFocusGroupItem() {
23
22
  if (!register) return {};
24
23
  return otherActions;
25
24
  }
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 () {
25
+ const useFocusGroupWithState = (ref = {}, props) => {
26
+ const _ref2 = useContext(FocusGroupContext) || {},
27
+ {
28
+ register,
29
+ unregister
30
+ } = _ref2,
31
+ otherActions = _objectWithoutProperties(_ref2, _excluded2);
32
+
33
+ useEffect(() => {
36
34
  if (ref && register) register(ref, props);
37
- return function () {
35
+ return () => {
38
36
  if (ref && unregister) unregister(ref);
39
37
  };
40
38
  }, [ref]); // if the focus item is not wrapped with the focus provider then return null
@@ -44,4 +42,3 @@ var useFocusGroupWithState = function useFocusGroupWithState() {
44
42
  };
45
43
 
46
44
  export { useFocusGroupItem as default, useFocusGroupWithState };
47
- //# sourceMappingURL=useFocusGroupItem.js.map
@@ -1,24 +1,23 @@
1
1
  // eslint-disable-next-line max-statements
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;
2
+ function getNextCellPosition({
3
+ grid,
4
+ currentRow = 0,
5
+ currentCell = 0,
6
+ directionY,
7
+ directionX,
8
+ shouldWrapCells,
9
+ shouldWrapRows
10
+ }) {
11
+ let nextRow = currentRow + directionY;
12
+ let nextCell = currentCell + directionX;
13
+ const rowCount = grid.length;
14
+ const isLeftRight = directionX !== 0;
16
15
 
17
16
  if (!rowCount) {
18
17
  return false;
19
18
  }
20
19
 
21
- var cellsLength = grid[0].length; // moving horizontally
20
+ const cellsLength = grid[0].length; // moving horizontally
22
21
 
23
22
  if (shouldWrapCells && isLeftRight) {
24
23
  // to left
@@ -56,4 +55,3 @@ function getNextCellPosition(_ref) {
56
55
  }
57
56
 
58
57
  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,73 @@ 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);
105
- }
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
- };
63
+ static getDerivedStateFromProps(nextProps, {
64
+ prevValue
65
+ }) {
66
+ if (nextProps.activeValue === prevValue) return null;
67
+ return {
68
+ activeValue: nextProps.activeValue,
69
+ prevValue: nextProps.activeValue
70
+ };
71
+ }
72
+
73
+ handleChange(e, ...rest) {
74
+ const {
75
+ multiple,
76
+ onChange
77
+ } = this.props;
78
+ const {
79
+ activeValue
80
+ } = this.state;
81
+ const value = getValueItem(e);
82
+ let newValue;
83
+
84
+ if (multiple) {
85
+ newValue = toggleItemValue(activeValue || [], value);
86
+ } else if (activeValue !== value) {
87
+ // default behaviour it will be toggle the active value
88
+ newValue = value;
115
89
  }
116
- }]);
117
90
 
118
- return Group;
119
- }(Component);
91
+ this.setState({
92
+ activeValue: newValue
93
+ });
94
+ if (onChange) onChange(newValue, ...rest);
95
+ }
96
+
97
+ render() {
98
+ const {
99
+ children
100
+ } = this.props;
101
+ return /*#__PURE__*/_jsx(Provider, {
102
+ value: this.state
103
+ }, void 0, children);
104
+ }
105
+
106
+ }
120
107
 
121
108
  Group.defaultProps = {
122
109
  multiple: false
123
110
  };
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
111
 
132
112
  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,13 @@
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
- });
11
- };
9
+ const GroupItem = ({
10
+ render
11
+ }) => /*#__PURE__*/_jsx(Consumer, {}, void 0, context => render(context));
12
12
 
13
13
  export { GroupItem as default };
14
- //# sourceMappingURL=GroupItem.js.map
@@ -1,12 +1,3 @@
1
1
  export { default as Group } from './Group.js';
2
2
  export { GroupContext } from './GroupContext.js';
3
3
  export { default as GroupItem } from './GroupItem.js';
4
- import '@babel/runtime/helpers/esm/classCallCheck';
5
- import '@babel/runtime/helpers/esm/createClass';
6
- import '@babel/runtime/helpers/esm/assertThisInitialized';
7
- import '@babel/runtime/helpers/esm/inherits';
8
- import '@babel/runtime/helpers/esm/possibleConstructorReturn';
9
- import '@babel/runtime/helpers/esm/getPrototypeOf';
10
- import 'react';
11
- import 'prop-types';
12
- //# sourceMappingURL=index.js.map