@elliemae/ds-shared 2.2.0-next.4 → 2.3.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/cjs/Animations/BaseAnimation.js +55 -35
  2. package/cjs/Animations/BaseAnimation.js.map +7 -0
  3. package/cjs/Animations/Grow.js +54 -41
  4. package/cjs/Animations/Grow.js.map +7 -0
  5. package/cjs/Animations/GrowRight.js +63 -41
  6. package/cjs/Animations/GrowRight.js.map +7 -0
  7. package/cjs/Animations/GrowVertical.js +47 -7
  8. package/cjs/Animations/GrowVertical.js.map +7 -0
  9. package/cjs/CheckableGroup.js +67 -65
  10. package/cjs/CheckableGroup.js.map +7 -0
  11. package/cjs/DeferRenderAfterComputation.js +48 -24
  12. package/cjs/DeferRenderAfterComputation.js.map +7 -0
  13. package/cjs/FocusGroup/FocusGrid.js +108 -143
  14. package/cjs/FocusGroup/FocusGrid.js.map +7 -0
  15. package/cjs/FocusGroup/FocusGroup.js +88 -147
  16. package/cjs/FocusGroup/FocusGroup.js.map +7 -0
  17. package/cjs/FocusGroup/FocusGroupContext.js +38 -11
  18. package/cjs/FocusGroup/FocusGroupContext.js.map +7 -0
  19. package/cjs/FocusGroup/FocusGroupManager.js +56 -47
  20. package/cjs/FocusGroup/FocusGroupManager.js.map +7 -0
  21. package/cjs/FocusGroup/focusGroupManagerHoc.js +52 -42
  22. package/cjs/FocusGroup/focusGroupManagerHoc.js.map +7 -0
  23. package/cjs/FocusGroup/index.js +47 -21
  24. package/cjs/FocusGroup/index.js.map +7 -0
  25. package/cjs/FocusGroup/useFocusGroupItem.js +59 -51
  26. package/cjs/FocusGroup/useFocusGroupItem.js.map +7 -0
  27. package/cjs/FocusGroup/utils/getNextCellPosition.js +47 -27
  28. package/cjs/FocusGroup/utils/getNextCellPosition.js.map +7 -0
  29. package/cjs/GroupContext/Group.js +64 -73
  30. package/cjs/GroupContext/Group.js.map +7 -0
  31. package/cjs/GroupContext/GroupContext.js +36 -13
  32. package/cjs/GroupContext/GroupContext.js.map +7 -0
  33. package/cjs/GroupContext/GroupItem.js +39 -21
  34. package/cjs/GroupContext/GroupItem.js.map +7 -0
  35. package/cjs/GroupContext/index.js +39 -13
  36. package/cjs/GroupContext/index.js.map +7 -0
  37. package/cjs/ScrollSync/ScrollSync.js +60 -75
  38. package/cjs/ScrollSync/ScrollSync.js.map +7 -0
  39. package/cjs/ScrollSync/ScrollSyncPane.js +52 -60
  40. package/cjs/ScrollSync/ScrollSyncPane.js.map +7 -0
  41. package/cjs/ScrollSync/ScrollSyncProvider.js +103 -50
  42. package/cjs/ScrollSync/ScrollSyncProvider.js.map +7 -0
  43. package/cjs/ScrollSync/index.js +37 -11
  44. package/cjs/ScrollSync/index.js.map +7 -0
  45. package/cjs/ScrollSync/useScrollSync.js +38 -7
  46. package/cjs/ScrollSync/useScrollSync.js.map +7 -0
  47. package/cjs/constants.js +65 -46
  48. package/cjs/constants.js.map +7 -0
  49. package/cjs/createDataInstance/createInstancePlugin.js +41 -29
  50. package/cjs/createDataInstance/createInstancePlugin.js.map +7 -0
  51. package/cjs/createDataInstance/createInstanceRef.js +66 -71
  52. package/cjs/createDataInstance/createInstanceRef.js.map +7 -0
  53. package/cjs/createDataInstance/utils.js +76 -100
  54. package/cjs/createDataInstance/utils.js.map +7 -0
  55. package/cjs/defer-render-hoc/index.js +48 -41
  56. package/cjs/defer-render-hoc/index.js.map +7 -0
  57. package/cjs/dimsum.config.js +38 -6
  58. package/cjs/dimsum.config.js.map +7 -0
  59. package/cjs/index.js +40 -17
  60. package/cjs/index.js.map +7 -0
  61. package/cjs/prop-types.js +106 -49
  62. package/cjs/prop-types.js.map +7 -0
  63. package/cjs/react-spring/index.js +28 -14
  64. package/cjs/react-spring/index.js.map +7 -0
  65. package/cjs/react-spring/renderprops.js +28 -14
  66. package/cjs/react-spring/renderprops.js.map +7 -0
  67. package/cjs/toolbar/ToolbarProvider.js +82 -94
  68. package/cjs/toolbar/ToolbarProvider.js.map +7 -0
  69. package/cjs/useDataGrid/VolatileRowsListener.js +38 -13
  70. package/cjs/useDataGrid/VolatileRowsListener.js.map +7 -0
  71. package/cjs/useDataGrid/index.js +36 -7
  72. package/cjs/useDataGrid/index.js.map +7 -0
  73. package/cjs/useDataGrid/initColumnDefinition.js +105 -110
  74. package/cjs/useDataGrid/initColumnDefinition.js.map +7 -0
  75. package/cjs/useDataGrid/useDataGrid.js +122 -148
  76. package/cjs/useDataGrid/useDataGrid.js.map +7 -0
  77. package/cjs/useDataList/index.js +36 -7
  78. package/cjs/useDataList/index.js.map +7 -0
  79. package/cjs/useDataList/recordIterator.js +42 -18
  80. package/cjs/useDataList/recordIterator.js.map +7 -0
  81. package/cjs/useDataList/useDataList.js +74 -83
  82. package/cjs/useDataList/useDataList.js.map +7 -0
  83. package/cjs/utils.js +71 -80
  84. package/cjs/utils.js.map +7 -0
  85. package/cjs/virtualization/AutoHeightList.js +62 -54
  86. package/cjs/virtualization/AutoHeightList.js.map +7 -0
  87. package/cjs/virtualization/FluidHeightList.js +42 -48
  88. package/cjs/virtualization/FluidHeightList.js.map +7 -0
  89. package/cjs/virtualization/index.js +48 -20
  90. package/cjs/virtualization/index.js.map +7 -0
  91. package/esm/Animations/BaseAnimation.js +26 -29
  92. package/esm/Animations/BaseAnimation.js.map +7 -0
  93. package/esm/Animations/Grow.js +25 -35
  94. package/esm/Animations/Grow.js.map +7 -0
  95. package/esm/Animations/GrowRight.js +34 -35
  96. package/esm/Animations/GrowRight.js.map +7 -0
  97. package/esm/Animations/GrowVertical.js +29 -4
  98. package/esm/Animations/GrowVertical.js.map +7 -0
  99. package/esm/CheckableGroup.js +35 -52
  100. package/esm/CheckableGroup.js.map +7 -0
  101. package/esm/DeferRenderAfterComputation.js +16 -15
  102. package/esm/DeferRenderAfterComputation.js.map +7 -0
  103. package/esm/FocusGroup/FocusGrid.js +64 -117
  104. package/esm/FocusGroup/FocusGrid.js.map +7 -0
  105. package/esm/FocusGroup/FocusGroup.js +56 -137
  106. package/esm/FocusGroup/FocusGroup.js.map +7 -0
  107. package/esm/FocusGroup/FocusGroupContext.js +9 -5
  108. package/esm/FocusGroup/FocusGroupContext.js.map +7 -0
  109. package/esm/FocusGroup/FocusGroupManager.js +24 -38
  110. package/esm/FocusGroup/FocusGroupManager.js.map +7 -0
  111. package/esm/FocusGroup/focusGroupManagerHoc.js +24 -36
  112. package/esm/FocusGroup/focusGroupManagerHoc.js.map +7 -0
  113. package/esm/FocusGroup/index.js +18 -6
  114. package/esm/FocusGroup/index.js.map +7 -0
  115. package/esm/FocusGroup/useFocusGroupItem.js +28 -40
  116. package/esm/FocusGroup/useFocusGroupItem.js.map +7 -0
  117. package/esm/FocusGroup/utils/getNextCellPosition.js +18 -25
  118. package/esm/FocusGroup/utils/getNextCellPosition.js.map +7 -0
  119. package/esm/GroupContext/Group.js +34 -66
  120. package/esm/GroupContext/Group.js.map +7 -0
  121. package/esm/GroupContext/GroupContext.js +7 -5
  122. package/esm/GroupContext/GroupContext.js.map +7 -0
  123. package/esm/GroupContext/GroupItem.js +10 -15
  124. package/esm/GroupContext/GroupItem.js.map +7 -0
  125. package/esm/GroupContext/index.js +10 -3
  126. package/esm/GroupContext/index.js.map +7 -0
  127. package/esm/ScrollSync/ScrollSync.js +30 -64
  128. package/esm/ScrollSync/ScrollSync.js.map +7 -0
  129. package/esm/ScrollSync/ScrollSyncPane.js +22 -52
  130. package/esm/ScrollSync/ScrollSyncPane.js.map +7 -0
  131. package/esm/ScrollSync/ScrollSyncProvider.js +74 -42
  132. package/esm/ScrollSync/ScrollSyncProvider.js.map +7 -0
  133. package/esm/ScrollSync/index.js +8 -2
  134. package/esm/ScrollSync/index.js.map +7 -0
  135. package/esm/ScrollSync/useScrollSync.js +9 -5
  136. package/esm/ScrollSync/useScrollSync.js.map +7 -0
  137. package/esm/constants.js +37 -28
  138. package/esm/constants.js.map +7 -0
  139. package/esm/createDataInstance/createInstancePlugin.js +12 -23
  140. package/esm/createDataInstance/createInstancePlugin.js.map +7 -0
  141. package/esm/createDataInstance/createInstanceRef.js +36 -59
  142. package/esm/createDataInstance/createInstanceRef.js.map +7 -0
  143. package/esm/createDataInstance/utils.js +48 -85
  144. package/esm/createDataInstance/utils.js.map +7 -0
  145. package/esm/defer-render-hoc/index.js +17 -31
  146. package/esm/defer-render-hoc/index.js.map +7 -0
  147. package/esm/dimsum.config.js +9 -4
  148. package/esm/dimsum.config.js.map +7 -0
  149. package/esm/index.js +11 -5
  150. package/esm/index.js.map +7 -0
  151. package/esm/prop-types.js +75 -31
  152. package/esm/prop-types.js.map +7 -0
  153. package/esm/react-spring/index.js +3 -1
  154. package/esm/react-spring/index.js.map +7 -0
  155. package/esm/react-spring/renderprops.js +3 -1
  156. package/esm/react-spring/renderprops.js.map +7 -0
  157. package/esm/toolbar/ToolbarProvider.js +45 -74
  158. package/esm/toolbar/ToolbarProvider.js.map +7 -0
  159. package/esm/useDataGrid/VolatileRowsListener.js +9 -11
  160. package/esm/useDataGrid/VolatileRowsListener.js.map +7 -0
  161. package/esm/useDataGrid/index.js +7 -1
  162. package/esm/useDataGrid/index.js.map +7 -0
  163. package/esm/useDataGrid/initColumnDefinition.js +78 -94
  164. package/esm/useDataGrid/initColumnDefinition.js.map +7 -0
  165. package/esm/useDataGrid/useDataGrid.js +82 -99
  166. package/esm/useDataGrid/useDataGrid.js.map +7 -0
  167. package/esm/useDataList/index.js +7 -1
  168. package/esm/useDataList/index.js.map +7 -0
  169. package/esm/useDataList/recordIterator.js +13 -14
  170. package/esm/useDataList/recordIterator.js.map +7 -0
  171. package/esm/useDataList/useDataList.js +44 -67
  172. package/esm/useDataList/useDataList.js.map +7 -0
  173. package/esm/utils.js +42 -59
  174. package/esm/utils.js.map +7 -0
  175. package/esm/virtualization/AutoHeightList.js +28 -40
  176. package/esm/virtualization/AutoHeightList.js.map +7 -0
  177. package/esm/virtualization/FluidHeightList.js +14 -38
  178. package/esm/virtualization/FluidHeightList.js.map +7 -0
  179. package/esm/virtualization/index.js +19 -16
  180. package/esm/virtualization/index.js.map +7 -0
  181. package/package.json +3 -3
  182. package/types/Animations/BaseAnimation.d.ts +1 -0
  183. package/types/Animations/Grow.d.ts +1 -0
  184. package/types/Animations/GrowRight.d.ts +1 -0
  185. package/types/CheckableGroup.d.ts +1 -0
  186. package/types/DeferRenderAfterComputation.d.ts +3 -2
  187. package/types/FocusGroup/FocusGrid.d.ts +5 -3
  188. package/types/FocusGroup/FocusGroup.d.ts +3 -1
  189. package/types/FocusGroup/FocusGroupContext.d.ts +3 -2
  190. package/types/FocusGroup/FocusGroupManager.d.ts +3 -1
  191. package/types/FocusGroup/focusGroupManagerHoc.d.ts +3 -1
  192. package/types/FocusGroup/index.d.ts +6 -6
  193. package/types/FocusGroup/useFocusGroupItem.d.ts +3 -1
  194. package/types/FocusGroup/utils/getNextCellPosition.d.ts +3 -1
  195. package/types/GroupContext/Group.d.ts +1 -0
  196. package/types/GroupContext/GroupItem.d.ts +1 -0
  197. package/types/GroupContext/index.d.ts +3 -3
  198. package/types/ScrollSync/ScrollSync.d.ts +4 -2
  199. package/types/ScrollSync/ScrollSyncPane.d.ts +2 -2
  200. package/types/ScrollSync/index.d.ts +2 -2
  201. package/types/ScrollSync/useScrollSync.d.ts +6 -5
  202. package/types/createDataInstance/createInstancePlugin.d.ts +2 -1
  203. package/types/createDataInstance/createInstanceRef.d.ts +3 -1
  204. package/types/dimsum.config.d.ts +3 -2
  205. package/types/index.d.ts +2 -2
  206. package/types/toolbar/ToolbarProvider.d.ts +3 -8
  207. package/types/useDataGrid/VolatileRowsListener.d.ts +3 -1
  208. package/types/useDataGrid/index.d.ts +1 -1
  209. package/types/useDataGrid/initColumnDefinition.d.ts +2 -1
  210. package/types/useDataGrid/useDataGrid.d.ts +3 -2
  211. package/types/useDataList/index.d.ts +1 -1
  212. package/types/useDataList/useDataList.d.ts +3 -2
@@ -1,5 +1,9 @@
1
- import React from 'react';
2
-
3
- var FocusGroupContext = /*#__PURE__*/React.createContext();
4
-
5
- export { FocusGroupContext as default };
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ const FocusGroupContext = React2.createContext();
4
+ var FocusGroupContext_default = FocusGroupContext;
5
+ export {
6
+ FocusGroupContext,
7
+ FocusGroupContext_default as default
8
+ };
9
+ //# sourceMappingURL=FocusGroupContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/FocusGroupContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nconst FocusGroupContext = React.createContext();\nexport { FocusGroupContext };\nexport default FocusGroupContext;\n"],
5
+ "mappings": "AAAA;ACAA;AAEA,MAAM,oBAAoB,OAAM;AAEhC,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -1,11 +1,9 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { Component } from 'react';
3
- import { isFunction } from '@elliemae/ds-utilities';
4
- import FocusGroup from './FocusGroup.js';
5
- import FocusGroupContext from './FocusGroupContext.js';
6
-
1
+ import * as React from "react";
2
+ import React2, { Component } from "react";
3
+ import { isFunction } from "@elliemae/ds-utilities";
4
+ import { FocusGroup } from "./FocusGroup";
5
+ import { FocusGroupContext } from "./FocusGroupContext";
7
6
  const noop = () => null;
8
-
9
7
  class FocusGroupProvider extends Component {
10
8
  constructor(props) {
11
9
  super(props);
@@ -27,75 +25,58 @@ class FocusGroupProvider extends Component {
27
25
  focusPrevious: this.focusGroup.focusPrevious
28
26
  };
29
27
  }
30
-
31
28
  componentDidMount() {
32
- const {
33
- autoFocusOnMount
34
- } = this.props;
29
+ const { autoFocusOnMount } = this.props;
35
30
  this.activate();
36
-
37
31
  if (autoFocusOnMount) {
38
32
  setTimeout(() => {
39
33
  this.actions.focusFirst();
40
34
  }, 0);
41
35
  }
42
36
  }
43
-
44
37
  componentWillUnmount() {
45
38
  this.deactivate();
46
39
  }
47
-
48
40
  activate() {
49
- const {
50
- onActivate
51
- } = this.props;
41
+ const { onActivate } = this.props;
52
42
  this.focusGroup.activate();
53
43
  this.activated = true;
54
- if (isFunction(onActivate)) onActivate();
44
+ if (isFunction(onActivate))
45
+ onActivate();
55
46
  }
56
-
57
47
  deactivate() {
58
- const {
59
- onExitFocusGroup
60
- } = this.props;
48
+ const { onExitFocusGroup } = this.props;
61
49
  this.activated = false;
62
50
  this.focusGroup.deactivate();
63
-
64
51
  if (isFunction(onExitFocusGroup)) {
65
52
  onExitFocusGroup();
66
53
  }
67
54
  }
68
-
69
55
  register(item) {
70
56
  this.focusGroup.register(item);
71
57
  }
72
-
73
58
  unregister(item) {
74
59
  this.focusGroup.unregister(item);
75
60
  }
76
-
77
61
  focusItemByIndex(index) {
78
- if (!this.activated) this.activate();
62
+ if (!this.activated)
63
+ this.activate();
79
64
  setTimeout(() => {
80
65
  this.focusGroup.focusByIndex(index);
81
66
  }, 200);
82
67
  }
83
-
84
68
  focusItemByNode(node) {
85
- if (!this.activated) this.activate();
69
+ if (!this.activated)
70
+ this.activate();
86
71
  const index = this.focusGroup.getItemIndexByNode(node);
87
72
  this.focusItemByIndex(index);
88
73
  }
89
-
90
74
  render() {
91
- const {
92
- children
93
- } = this.props;
94
- return /*#__PURE__*/_jsx(FocusGroupContext.Provider, {
75
+ const { children } = this.props;
76
+ return /* @__PURE__ */ React2.createElement(FocusGroupContext.Provider, {
95
77
  value: this.actions
96
- }, void 0, children);
78
+ }, children);
97
79
  }
98
-
99
80
  }
100
81
  FocusGroupProvider.defaultProps = {
101
82
  exitWhenNoPrevious: false,
@@ -107,5 +88,10 @@ FocusGroupProvider.defaultProps = {
107
88
  onFocusNextGroup: noop,
108
89
  onFocusGroupSet: noop
109
90
  };
110
-
111
- export { FocusGroupProvider as default };
91
+ var FocusGroupManager_default = FocusGroupProvider;
92
+ export {
93
+ FocusGroupProvider as FocusGroupManager,
94
+ FocusGroupProvider,
95
+ FocusGroupManager_default as default
96
+ };
97
+ //# sourceMappingURL=FocusGroupManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/FocusGroupManager.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { Component, useEffect } from 'react';\nimport { isFunction } from '@elliemae/ds-utilities';\nimport { FocusGroup } from './FocusGroup';\nimport { FocusGroupContext } from './FocusGroupContext';\n\nconst noop = () => null;\n\nclass FocusGroupProvider extends Component {\n activated = false;\n\n static defaultProps = {\n exitWhenNoPrevious: false,\n exitWhenNoNext: false,\n keyBindings: {},\n onFocus: noop,\n onExitFocusGroup: noop,\n onFocusPreviousGroup: noop,\n onFocusNextGroup: noop,\n onFocusGroupSet: noop,\n };\n\n constructor(props) {\n super(props);\n\n this.focusGroup = new FocusGroup(props);\n\n props.onFocusGroupSet(this);\n\n this.actions = {\n activate: this.activate.bind(this),\n deactivate: this.deactivate.bind(this),\n register: this.focusGroup.register,\n unregister: this.unregister.bind(this),\n focusFirst: this.focusGroup.focusFirst,\n focusLast: this.focusGroup.focusLast,\n focusItemByIndex: this.focusItemByIndex.bind(this),\n focusItemByNode: this.focusItemByNode.bind(this),\n focus: this.focusGroup.focusCurrent,\n isGroupActive: this.focusGroup.isGroupActive,\n focusNext: this.focusGroup.focusNext,\n focusPrevious: this.focusGroup.focusPrevious,\n };\n }\n\n componentDidMount() {\n const { autoFocusOnMount } = this.props;\n\n this.activate();\n\n if (autoFocusOnMount) {\n setTimeout(() => {\n this.actions.focusFirst();\n }, 0);\n }\n }\n\n componentWillUnmount() {\n this.deactivate();\n }\n\n activate() {\n const { onActivate } = this.props;\n this.focusGroup.activate();\n this.activated = true;\n if (isFunction(onActivate)) onActivate();\n }\n\n deactivate() {\n const { onExitFocusGroup } = this.props;\n this.activated = false;\n this.focusGroup.deactivate();\n if (isFunction(onExitFocusGroup)) {\n onExitFocusGroup();\n }\n }\n\n register(item) {\n this.focusGroup.register(item);\n }\n\n unregister(item) {\n this.focusGroup.unregister(item);\n }\n\n focusItemByIndex(index) {\n if (!this.activated) this.activate();\n setTimeout(() => {\n this.focusGroup.focusByIndex(index);\n }, 200);\n }\n\n focusItemByNode(node) {\n if (!this.activated) this.activate();\n const index = this.focusGroup.getItemIndexByNode(node);\n this.focusItemByIndex(index);\n }\n\n render() {\n const { children } = this.props;\n return (\n <FocusGroupContext.Provider value={this.actions}>\n {children}\n </FocusGroupContext.Provider>\n );\n }\n}\n\nexport { FocusGroupProvider, FocusGroupProvider as FocusGroupManager };\nexport default FocusGroupProvider;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,OAAO,MAAM;AAEnB,iCAAiC,UAAU;AAAA,EAczC,YAAY,OAAO;AACjB,UAAM;AAdR,qBAAY;AAgBV,SAAK,aAAa,IAAI,WAAW;AAEjC,UAAM,gBAAgB;AAEtB,SAAK,UAAU;AAAA,MACb,UAAU,KAAK,SAAS,KAAK;AAAA,MAC7B,YAAY,KAAK,WAAW,KAAK;AAAA,MACjC,UAAU,KAAK,WAAW;AAAA,MAC1B,YAAY,KAAK,WAAW,KAAK;AAAA,MACjC,YAAY,KAAK,WAAW;AAAA,MAC5B,WAAW,KAAK,WAAW;AAAA,MAC3B,kBAAkB,KAAK,iBAAiB,KAAK;AAAA,MAC7C,iBAAiB,KAAK,gBAAgB,KAAK;AAAA,MAC3C,OAAO,KAAK,WAAW;AAAA,MACvB,eAAe,KAAK,WAAW;AAAA,MAC/B,WAAW,KAAK,WAAW;AAAA,MAC3B,eAAe,KAAK,WAAW;AAAA;AAAA;AAAA,EAInC,oBAAoB;AAClB,UAAM,EAAE,qBAAqB,KAAK;AAElC,SAAK;AAEL,QAAI,kBAAkB;AACpB,iBAAW,MAAM;AACf,aAAK,QAAQ;AAAA,SACZ;AAAA;AAAA;AAAA,EAIP,uBAAuB;AACrB,SAAK;AAAA;AAAA,EAGP,WAAW;AACT,UAAM,EAAE,eAAe,KAAK;AAC5B,SAAK,WAAW;AAChB,SAAK,YAAY;AACjB,QAAI,WAAW;AAAa;AAAA;AAAA,EAG9B,aAAa;AACX,UAAM,EAAE,qBAAqB,KAAK;AAClC,SAAK,YAAY;AACjB,SAAK,WAAW;AAChB,QAAI,WAAW,mBAAmB;AAChC;AAAA;AAAA;AAAA,EAIJ,SAAS,MAAM;AACb,SAAK,WAAW,SAAS;AAAA;AAAA,EAG3B,WAAW,MAAM;AACf,SAAK,WAAW,WAAW;AAAA;AAAA,EAG7B,iBAAiB,OAAO;AACtB,QAAI,CAAC,KAAK;AAAW,WAAK;AAC1B,eAAW,MAAM;AACf,WAAK,WAAW,aAAa;AAAA,OAC5B;AAAA;AAAA,EAGL,gBAAgB,MAAM;AACpB,QAAI,CAAC,KAAK;AAAW,WAAK;AAC1B,UAAM,QAAQ,KAAK,WAAW,mBAAmB;AACjD,SAAK,iBAAiB;AAAA;AAAA,EAGxB,SAAS;AACP,UAAM,EAAE,aAAa,KAAK;AAC1B,WACE,qCAAC,kBAAkB,UAAnB;AAAA,MAA4B,OAAO,KAAK;AAAA,OACrC;AAAA;AAAA;AA3FA,AAHT,mBAGS,eAAe;AAAA,EACpB,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA;AA0FrB,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -1,37 +1,25 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
8
- import 'react';
9
- import FocusGroupProvider from './FocusGroupManager.js';
10
- import { jsx } from 'react/jsx-runtime';
11
-
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); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
- function FocusGroupHoc(WrappedComponent) {
18
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19
- return _ref => {
20
- let {
21
- onExitFocusGroup,
22
- onFocusPrevGroup,
23
- focusKeyBindings
24
- } = _ref,
25
- props = _objectWithoutProperties(_ref, _excluded);
26
-
27
- return /*#__PURE__*/jsx(FocusGroupProvider, _objectSpread(_objectSpread({
28
- keyBindings: focusKeyBindings,
29
- onExitFocusGroup: onExitFocusGroup,
30
- onFocusPrevGroup: onFocusPrevGroup
31
- }, options), {}, {
32
- children: /*#__PURE__*/jsx(WrappedComponent, _objectSpread(_objectSpread({}, props), options))
33
- }));
34
- };
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { FocusGroupProvider } from "./FocusGroupManager";
4
+ function FocusGroupHoc(WrappedComponent, options = {}) {
5
+ return ({
6
+ onExitFocusGroup,
7
+ onFocusPrevGroup,
8
+ focusKeyBindings,
9
+ ...props
10
+ }) => /* @__PURE__ */ React2.createElement(FocusGroupProvider, {
11
+ keyBindings: focusKeyBindings,
12
+ onExitFocusGroup,
13
+ onFocusPrevGroup,
14
+ ...options
15
+ }, /* @__PURE__ */ React2.createElement(WrappedComponent, {
16
+ ...props,
17
+ ...options
18
+ }));
35
19
  }
36
-
37
- export { FocusGroupHoc as default };
20
+ var focusGroupManagerHoc_default = FocusGroupHoc;
21
+ export {
22
+ FocusGroupHoc,
23
+ focusGroupManagerHoc_default as default
24
+ };
25
+ //# sourceMappingURL=focusGroupManagerHoc.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/focusGroupManagerHoc.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/display-name */\nimport React from 'react';\nimport { FocusGroupProvider } from './FocusGroupManager';\n\nfunction FocusGroupHoc(WrappedComponent, options = {}) {\n return ({\n onExitFocusGroup,\n onFocusPrevGroup,\n focusKeyBindings,\n ...props\n }) => (\n <FocusGroupProvider\n keyBindings={focusKeyBindings}\n onExitFocusGroup={onExitFocusGroup}\n onFocusPrevGroup={onFocusPrevGroup}\n {...options}\n >\n <WrappedComponent {...props} {...options} />\n </FocusGroupProvider>\n );\n}\n\nexport { FocusGroupHoc };\nexport default FocusGroupHoc;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AAEA,uBAAuB,kBAAkB,UAAU,IAAI;AACrD,SAAO,CAAC;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA,QAEH,qCAAC,oBAAD;AAAA,IACE,aAAa;AAAA,IACb;AAAA,IACA;AAAA,OACI;AAAA,KAEJ,qCAAC,kBAAD;AAAA,OAAsB;AAAA,OAAW;AAAA;AAAA;AAMvC,IAAO,+BAAQ;",
6
+ "names": []
7
+ }
@@ -1,6 +1,18 @@
1
- export { default as FocusGroup } from './FocusGroup.js';
2
- export { default as FocusGroupContext } from './FocusGroupContext.js';
3
- export { default as FocusGroupManager } from './FocusGroupManager.js';
4
- export { default as useFocusGroupItem, useFocusGroupWithState } from './useFocusGroupItem.js';
5
- export { default as focusGroupManagerHoc } from './focusGroupManagerHoc.js';
6
- export { default as FocusGrid, FocusGridContext } from './FocusGrid.js';
1
+ import * as React from "react";
2
+ import { FocusGroup } from "./FocusGroup";
3
+ import { FocusGroupContext } from "./FocusGroupContext";
4
+ import { FocusGroupManager } from "./FocusGroupManager";
5
+ import { useFocusGroupItem, useFocusGroupWithState } from "./useFocusGroupItem";
6
+ import { FocusGroupHoc } from "./focusGroupManagerHoc";
7
+ import { FocusGridProvider, FocusGridContext } from "./FocusGrid";
8
+ export {
9
+ FocusGridProvider as FocusGrid,
10
+ FocusGridContext,
11
+ FocusGroup,
12
+ FocusGroupContext,
13
+ FocusGroupManager,
14
+ FocusGroupHoc as focusGroupManagerHoc,
15
+ useFocusGroupItem,
16
+ useFocusGroupWithState
17
+ };
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { FocusGroup } from './FocusGroup';\nexport { FocusGroupContext } from './FocusGroupContext';\nexport { FocusGroupManager } from './FocusGroupManager';\nexport { useFocusGroupItem, useFocusGroupWithState } from './useFocusGroupItem';\nexport { FocusGroupHoc as focusGroupManagerHoc } from './focusGroupManagerHoc';\nexport { FocusGridProvider as FocusGrid, FocusGridContext } from './FocusGrid';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
@@ -1,50 +1,38 @@
1
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
2
- import { useContext, useEffect } from 'react';
3
- import FocusGroupContext from './FocusGroupContext.js';
4
-
5
- const _excluded = ["register", "unregister"],
6
- _excluded2 = ["register", "unregister"];
7
- function useFocusGroupItem() {
8
- let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- let props = arguments.length > 1 ? arguments[1] : undefined;
10
-
11
- const _ref = useContext(FocusGroupContext) || {},
12
- {
13
- register,
14
- unregister
15
- } = _ref,
16
- otherActions = _objectWithoutProperties(_ref, _excluded);
17
-
1
+ import * as React from "react";
2
+ import { useContext, useEffect } from "react";
3
+ import { FocusGroupContext } from "./FocusGroupContext";
4
+ function useFocusGroupItem(ref = {}, props) {
5
+ const { register, unregister, ...otherActions } = useContext(FocusGroupContext) || {};
18
6
  useEffect(() => {
19
- if (ref.current && register) register(ref.current, props);
7
+ if (ref.current && register)
8
+ register(ref.current, props);
20
9
  return () => {
21
- if (ref.current && unregister) unregister(ref.current);
10
+ if (ref.current && unregister)
11
+ unregister(ref.current);
22
12
  };
23
- }); // if the focus item is not wrapped with the focus provider then return null
24
-
25
- if (!register) return {};
13
+ });
14
+ if (!register)
15
+ return {};
26
16
  return otherActions;
27
17
  }
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
-
18
+ const useFocusGroupWithState = (ref = {}, props) => {
19
+ const { register, unregister, ...otherActions } = useContext(FocusGroupContext) || {};
39
20
  useEffect(() => {
40
- if (ref && register) register(ref, props);
21
+ if (ref && register)
22
+ register(ref, props);
41
23
  return () => {
42
- if (ref && unregister) unregister(ref);
24
+ if (ref && unregister)
25
+ unregister(ref);
43
26
  };
44
- }, [ref]); // if the focus item is not wrapped with the focus provider then return null
45
-
46
- if (!register) return {};
27
+ }, [ref]);
28
+ if (!register)
29
+ return {};
47
30
  return otherActions;
48
31
  };
49
-
50
- export { useFocusGroupItem as default, useFocusGroupWithState };
32
+ var useFocusGroupItem_default = useFocusGroupItem;
33
+ export {
34
+ useFocusGroupItem_default as default,
35
+ useFocusGroupItem,
36
+ useFocusGroupWithState
37
+ };
38
+ //# sourceMappingURL=useFocusGroupItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/useFocusGroupItem.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useContext, useEffect } from 'react';\nimport { FocusGroupContext } from './FocusGroupContext';\n\nfunction useFocusGroupItem(ref = {}, props) {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref.current && register) register(ref.current, props);\n return () => {\n if (ref.current && unregister) unregister(ref.current);\n };\n });\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n}\n\nexport const useFocusGroupWithState = (ref = {}, props) => {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref && register) register(ref, props);\n return () => {\n if (ref && unregister) unregister(ref);\n };\n }, [ref]);\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n};\n\nexport { useFocusGroupItem };\nexport default useFocusGroupItem;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA,2BAA2B,MAAM,IAAI,OAAO;AAC1C,QAAM,EAAE,UAAU,eAAe,iBAC/B,WAAW,sBAAsB;AAEnC,YAAU,MAAM;AACd,QAAI,IAAI,WAAW;AAAU,eAAS,IAAI,SAAS;AACnD,WAAO,MAAM;AACX,UAAI,IAAI,WAAW;AAAY,mBAAW,IAAI;AAAA;AAAA;AAKlD,MAAI,CAAC;AAAU,WAAO;AACtB,SAAO;AAAA;AAGF,MAAM,yBAAyB,CAAC,MAAM,IAAI,UAAU;AACzD,QAAM,EAAE,UAAU,eAAe,iBAC/B,WAAW,sBAAsB;AAEnC,YAAU,MAAM;AACd,QAAI,OAAO;AAAU,eAAS,KAAK;AACnC,WAAO,MAAM;AACX,UAAI,OAAO;AAAY,mBAAW;AAAA;AAAA,KAEnC,CAAC;AAGJ,MAAI,CAAC;AAAU,WAAO;AACtB,SAAO;AAAA;AAIT,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -1,45 +1,35 @@
1
- // eslint-disable-next-line max-statements
2
- function getNextCellPosition(_ref) {
3
- let {
4
- grid,
5
- currentRow = 0,
6
- currentCell = 0,
7
- directionY,
8
- directionX,
9
- shouldWrapCells,
10
- shouldWrapRows
11
- } = _ref;
1
+ import * as React from "react";
2
+ function getNextCellPosition({
3
+ grid,
4
+ currentRow = 0,
5
+ currentCell = 0,
6
+ directionY,
7
+ directionX,
8
+ shouldWrapCells,
9
+ shouldWrapRows
10
+ }) {
12
11
  let nextRow = currentRow + directionY;
13
12
  let nextCell = currentCell + directionX;
14
13
  const rowCount = grid.length;
15
14
  const isLeftRight = directionX !== 0;
16
-
17
15
  if (!rowCount) {
18
16
  return false;
19
17
  }
20
-
21
- const cellsLength = grid[0].length; // moving horizontally
22
-
18
+ const cellsLength = grid[0].length;
23
19
  if (shouldWrapCells && isLeftRight) {
24
- // to left
25
20
  if (nextCell < 0) {
26
21
  nextCell = cellsLength - 1;
27
22
  nextRow -= 1;
28
23
  }
29
-
30
24
  if (nextCell >= cellsLength) {
31
25
  nextCell = 0;
32
26
  nextRow += 1;
33
27
  }
34
- } // moving vertically
35
-
36
-
28
+ }
37
29
  if (shouldWrapRows && !isLeftRight) {
38
- // to top
39
30
  if (nextRow < 0) {
40
31
  nextCell -= 1;
41
32
  nextRow = rowCount - 1;
42
-
43
33
  if (grid[nextRow] && nextCell >= 0 && !grid[nextRow][nextCell]) {
44
34
  nextRow -= 1;
45
35
  }
@@ -48,11 +38,14 @@ function getNextCellPosition(_ref) {
48
38
  nextCell += 1;
49
39
  }
50
40
  }
51
-
52
41
  return {
53
42
  cellIndex: nextCell,
54
43
  rowIndex: nextRow
55
44
  };
56
45
  }
57
-
58
- export { getNextCellPosition as default };
46
+ var getNextCellPosition_default = getNextCellPosition;
47
+ export {
48
+ getNextCellPosition_default as default,
49
+ getNextCellPosition
50
+ };
51
+ //# sourceMappingURL=getNextCellPosition.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/FocusGroup/utils/getNextCellPosition.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// eslint-disable-next-line max-statements\nfunction getNextCellPosition({\n grid,\n currentRow = 0,\n currentCell = 0,\n directionY,\n directionX,\n shouldWrapCells,\n shouldWrapRows,\n}) {\n let nextRow = currentRow + directionY;\n let nextCell = currentCell + directionX;\n const rowCount = grid.length;\n const isLeftRight = directionX !== 0;\n\n if (!rowCount) {\n return false;\n }\n\n const cellsLength = grid[0].length;\n\n // moving horizontally\n if (shouldWrapCells && isLeftRight) {\n // to left\n if (nextCell < 0) {\n nextCell = cellsLength - 1;\n nextRow -= 1;\n }\n\n if (nextCell >= cellsLength) {\n nextCell = 0;\n nextRow += 1;\n }\n }\n\n // moving vertically\n if (shouldWrapRows && !isLeftRight) {\n // to top\n if (nextRow < 0) {\n nextCell -= 1;\n nextRow = rowCount - 1;\n if (grid[nextRow] && nextCell >= 0 && !grid[nextRow][nextCell]) {\n nextRow -= 1;\n }\n } else if (nextRow >= rowCount || !grid[nextRow][nextCell]) {\n nextRow = 0;\n nextCell += 1;\n }\n }\n\n return {\n cellIndex: nextCell,\n rowIndex: nextRow,\n };\n}\n\nexport { getNextCellPosition };\nexport default getNextCellPosition;"],
5
+ "mappings": "AAAA;ACCA,6BAA6B;AAAA,EAC3B;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACC;AACD,MAAI,UAAU,aAAa;AAC3B,MAAI,WAAW,cAAc;AAC7B,QAAM,WAAW,KAAK;AACtB,QAAM,cAAc,eAAe;AAEnC,MAAI,CAAC,UAAU;AACb,WAAO;AAAA;AAGT,QAAM,cAAc,KAAK,GAAG;AAG5B,MAAI,mBAAmB,aAAa;AAElC,QAAI,WAAW,GAAG;AAChB,iBAAW,cAAc;AACzB,iBAAW;AAAA;AAGb,QAAI,YAAY,aAAa;AAC3B,iBAAW;AACX,iBAAW;AAAA;AAAA;AAKf,MAAI,kBAAkB,CAAC,aAAa;AAElC,QAAI,UAAU,GAAG;AACf,kBAAY;AACZ,gBAAU,WAAW;AACrB,UAAI,KAAK,YAAY,YAAY,KAAK,CAAC,KAAK,SAAS,WAAW;AAC9D,mBAAW;AAAA;AAAA,eAEJ,WAAW,YAAY,CAAC,KAAK,SAAS,WAAW;AAC1D,gBAAU;AACV,kBAAY;AAAA;AAAA;AAIhB,SAAO;AAAA,IACL,WAAW;AAAA,IACX,UAAU;AAAA;AAAA;AAKd,IAAO,8BAAQ;",
6
+ "names": []
7
+ }
@@ -1,57 +1,35 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
- import { Component } from 'react';
4
- import { GroupContext } from './GroupContext.js';
5
-
6
- const getValueItem = e => {
7
- const {
8
- target,
9
- currentTarget
10
- } = e;
11
-
1
+ import * as React from "react";
2
+ import React2, { Component } from "react";
3
+ import PropTypes from "prop-types";
4
+ import { GroupContext } from "./GroupContext";
5
+ const getValueItem = (e) => {
6
+ const { target, currentTarget } = e;
12
7
  if (target) {
13
- const {
14
- value
15
- } = target;
8
+ const { value } = target;
16
9
  return value;
17
10
  }
18
-
19
11
  if (currentTarget) {
20
- const {
21
- value
22
- } = currentTarget;
12
+ const { value } = currentTarget;
23
13
  return value;
24
14
  }
25
-
26
15
  return e;
27
16
  };
28
-
29
17
  const toggleItemValue = (array, e) => {
30
18
  const newvalue = getValueItem(e);
31
19
  const res = array;
32
20
  const index = array.indexOf(newvalue);
33
-
34
21
  if (index === -1) {
35
22
  res.push(newvalue);
36
23
  } else {
37
24
  res.splice(index, 1);
38
25
  }
39
-
40
26
  return res;
41
27
  };
42
-
43
- const {
44
- Provider
45
- } = GroupContext;
46
- /** deprecated use CheckableGroup instead */
47
-
28
+ const { Provider } = GroupContext;
48
29
  class Group extends Component {
49
30
  constructor(props) {
50
31
  super(props);
51
- const {
52
- activeValue,
53
- disabled
54
- } = props;
32
+ const { activeValue, disabled } = props;
55
33
  this.state = {
56
34
  activeValue,
57
35
  disabled,
@@ -59,60 +37,50 @@ class Group extends Component {
59
37
  onChange: this.handleChange.bind(this)
60
38
  };
61
39
  }
62
-
63
- static getDerivedStateFromProps(nextProps, _ref) {
64
- let {
65
- prevValue
66
- } = _ref;
67
- if (nextProps.activeValue === prevValue) return null;
40
+ static getDerivedStateFromProps(nextProps, { prevValue }) {
41
+ if (nextProps.activeValue === prevValue)
42
+ return null;
68
43
  return {
69
44
  activeValue: nextProps.activeValue,
70
45
  prevValue: nextProps.activeValue
71
46
  };
72
47
  }
73
-
74
- handleChange(e) {
75
- const {
76
- multiple,
77
- onChange
78
- } = this.props;
79
- const {
80
- activeValue
81
- } = this.state;
48
+ handleChange(e, ...rest) {
49
+ const { multiple, onChange } = this.props;
50
+ const { activeValue } = this.state;
82
51
  const value = getValueItem(e);
83
52
  let newValue;
84
-
85
53
  if (multiple) {
86
54
  newValue = toggleItemValue(activeValue || [], value);
87
55
  } else if (activeValue !== value) {
88
- // default behaviour it will be toggle the active value
89
56
  newValue = value;
90
57
  }
91
-
92
58
  this.setState({
93
59
  activeValue: newValue
94
60
  });
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];
98
- }
99
-
100
- if (onChange) onChange(newValue, ...rest);
61
+ if (onChange)
62
+ onChange(newValue, ...rest);
101
63
  }
102
-
103
64
  render() {
104
- const {
105
- children
106
- } = this.props;
107
- return /*#__PURE__*/_jsx(Provider, {
65
+ const { children } = this.props;
66
+ return /* @__PURE__ */ React2.createElement(Provider, {
108
67
  value: this.state
109
- }, void 0, children);
68
+ }, children);
110
69
  }
111
-
112
70
  }
113
-
114
71
  Group.defaultProps = {
115
72
  multiple: false
116
73
  };
117
-
118
- export { Group as default };
74
+ Group.propTypes = {
75
+ children: PropTypes.array,
76
+ multiple: PropTypes.bool,
77
+ onChange: PropTypes.func,
78
+ activeValue: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
79
+ disabled: PropTypes.bool
80
+ };
81
+ var Group_default = Group;
82
+ export {
83
+ Group,
84
+ Group_default as default
85
+ };
86
+ //# sourceMappingURL=Group.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/GroupContext/Group.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/no-unused-state */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { GroupContext } from './GroupContext';\n\nconst getValueItem = (e) => {\n const { target, currentTarget } = e;\n if (target) {\n const { value } = target;\n return value;\n }\n if (currentTarget) {\n const { value } = currentTarget;\n return value;\n }\n return e;\n};\n\nconst toggleItemValue = (array, e) => {\n const newvalue = getValueItem(e);\n const res = array;\n const index = array.indexOf(newvalue);\n\n if (index === -1) {\n res.push(newvalue);\n } else {\n res.splice(index, 1);\n }\n\n return res;\n};\n\nconst { Provider } = GroupContext;\n/** deprecated use CheckableGroup instead */\nclass Group extends Component {\n constructor(props) {\n super(props);\n const { activeValue, disabled } = props;\n this.state = {\n activeValue,\n disabled,\n prevValue: null,\n onChange: this.handleChange.bind(this),\n };\n }\n\n static getDerivedStateFromProps(nextProps, { prevValue }) {\n if (nextProps.activeValue === prevValue) return null;\n return {\n activeValue: nextProps.activeValue,\n prevValue: nextProps.activeValue,\n };\n }\n\n handleChange(e, ...rest) {\n const { multiple, onChange } = this.props;\n const { activeValue } = this.state;\n const value = getValueItem(e);\n let newValue;\n if (multiple) {\n newValue = toggleItemValue(activeValue || [], value);\n } else if (activeValue !== value) {\n // default behaviour it will be toggle the active value\n newValue = value;\n }\n\n this.setState({\n activeValue: newValue,\n });\n\n if (onChange) onChange(newValue, ...rest);\n }\n\n render() {\n const { children } = this.props;\n return <Provider value={this.state}>{children}</Provider>;\n }\n}\n\nGroup.defaultProps = {\n multiple: false,\n};\n\nGroup.propTypes = {\n children: PropTypes.array,\n multiple: PropTypes.bool,\n onChange: PropTypes.func,\n activeValue: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),\n disabled: PropTypes.bool,\n};\n\nexport { Group };\nexport default Group;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AAEA,MAAM,eAAe,CAAC,MAAM;AAC1B,QAAM,EAAE,QAAQ,kBAAkB;AAClC,MAAI,QAAQ;AACV,UAAM,EAAE,UAAU;AAClB,WAAO;AAAA;AAET,MAAI,eAAe;AACjB,UAAM,EAAE,UAAU;AAClB,WAAO;AAAA;AAET,SAAO;AAAA;AAGT,MAAM,kBAAkB,CAAC,OAAO,MAAM;AACpC,QAAM,WAAW,aAAa;AAC9B,QAAM,MAAM;AACZ,QAAM,QAAQ,MAAM,QAAQ;AAE5B,MAAI,UAAU,IAAI;AAChB,QAAI,KAAK;AAAA,SACJ;AACL,QAAI,OAAO,OAAO;AAAA;AAGpB,SAAO;AAAA;AAGT,MAAM,EAAE,aAAa;AAErB,oBAAoB,UAAU;AAAA,EAC5B,YAAY,OAAO;AACjB,UAAM;AACN,UAAM,EAAE,aAAa,aAAa;AAClC,SAAK,QAAQ;AAAA,MACX;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,UAAU,KAAK,aAAa,KAAK;AAAA;AAAA;AAAA,SAI9B,yBAAyB,WAAW,EAAE,aAAa;AACxD,QAAI,UAAU,gBAAgB;AAAW,aAAO;AAChD,WAAO;AAAA,MACL,aAAa,UAAU;AAAA,MACvB,WAAW,UAAU;AAAA;AAAA;AAAA,EAIzB,aAAa,MAAM,MAAM;AACvB,UAAM,EAAE,UAAU,aAAa,KAAK;AACpC,UAAM,EAAE,gBAAgB,KAAK;AAC7B,UAAM,QAAQ,aAAa;AAC3B,QAAI;AACJ,QAAI,UAAU;AACZ,iBAAW,gBAAgB,eAAe,IAAI;AAAA,eACrC,gBAAgB,OAAO;AAEhC,iBAAW;AAAA;AAGb,SAAK,SAAS;AAAA,MACZ,aAAa;AAAA;AAGf,QAAI;AAAU,eAAS,UAAU,GAAG;AAAA;AAAA,EAGtC,SAAS;AACP,UAAM,EAAE,aAAa,KAAK;AAC1B,WAAO,qCAAC,UAAD;AAAA,MAAU,OAAO,KAAK;AAAA,OAAQ;AAAA;AAAA;AAIzC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA;AAGZ,MAAM,YAAY;AAAA,EAChB,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU;AAAA,EACpB,aAAa,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU;AAAA,EAC7D,UAAU,UAAU;AAAA;AAItB,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
@@ -1,5 +1,7 @@
1
- import React from 'react';
2
-
3
- const GroupContext = /*#__PURE__*/React.createContext();
4
-
5
- export { GroupContext };
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ const GroupContext = React2.createContext();
4
+ export {
5
+ GroupContext
6
+ };
7
+ //# sourceMappingURL=GroupContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/GroupContext/GroupContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nexport const GroupContext = React.createContext();\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,eAAe,OAAM;",
6
+ "names": []
7
+ }