@bigbinary/neeto-molecules 5.1.18 → 5.1.20

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 (263) hide show
  1. package/dist/EmailForm.js +2 -0
  2. package/dist/EmailForm.js.map +1 -1
  3. package/dist/EmailPreview.js +1 -20
  4. package/dist/EmailPreview.js.map +1 -1
  5. package/dist/GoogleFontPicker.js +1 -449
  6. package/dist/GoogleFontPicker.js.map +1 -1
  7. package/dist/IconPicker.js +6 -914
  8. package/dist/IconPicker.js.map +1 -1
  9. package/dist/IpRestriction.js +2 -3175
  10. package/dist/IpRestriction.js.map +1 -1
  11. package/dist/MadeWith.js +3 -74
  12. package/dist/MadeWith.js.map +1 -1
  13. package/dist/NeetoWidget.js +3 -1958
  14. package/dist/NeetoWidget.js.map +1 -1
  15. package/dist/Onboarding.js +3 -400
  16. package/dist/Onboarding.js.map +1 -1
  17. package/dist/SendToFields.js +3 -1943
  18. package/dist/SendToFields.js.map +1 -1
  19. package/dist/ShareViaEmail.js +2 -0
  20. package/dist/ShareViaEmail.js.map +1 -1
  21. package/dist/avatar-placeholder-DEjUhVlU.js +23 -0
  22. package/dist/avatar-placeholder-DEjUhVlU.js.map +1 -0
  23. package/dist/chevron-up-B2_LTx_h.js +15 -0
  24. package/dist/chevron-up-B2_LTx_h.js.map +1 -0
  25. package/dist/cjs/EmailForm.js +2 -0
  26. package/dist/cjs/EmailForm.js.map +1 -1
  27. package/dist/cjs/EmailPreview.js +2 -39
  28. package/dist/cjs/EmailPreview.js.map +1 -1
  29. package/dist/cjs/GoogleFontPicker.js +9 -457
  30. package/dist/cjs/GoogleFontPicker.js.map +1 -1
  31. package/dist/cjs/IconPicker.js +6 -914
  32. package/dist/cjs/IconPicker.js.map +1 -1
  33. package/dist/cjs/IpRestriction.js +21 -3194
  34. package/dist/cjs/IpRestriction.js.map +1 -1
  35. package/dist/cjs/MadeWith.js +17 -88
  36. package/dist/cjs/MadeWith.js.map +1 -1
  37. package/dist/cjs/NeetoWidget.js +4 -1959
  38. package/dist/cjs/NeetoWidget.js.map +1 -1
  39. package/dist/cjs/Onboarding.js +3 -400
  40. package/dist/cjs/Onboarding.js.map +1 -1
  41. package/dist/cjs/SendToFields.js +4 -1944
  42. package/dist/cjs/SendToFields.js.map +1 -1
  43. package/dist/cjs/ShareViaEmail.js +2 -0
  44. package/dist/cjs/ShareViaEmail.js.map +1 -1
  45. package/dist/cjs/avatar-placeholder-CSJpe1V0.js +44 -0
  46. package/dist/cjs/avatar-placeholder-CSJpe1V0.js.map +1 -0
  47. package/dist/cjs/chevron-up-CpzhFWzM.js +17 -0
  48. package/dist/cjs/chevron-up-CpzhFWzM.js.map +1 -0
  49. package/dist/cjs/copy-CerjTcLL.js +20 -0
  50. package/dist/cjs/copy-CerjTcLL.js.map +1 -0
  51. package/dist/cjs/download-B53zeKGa.js +21 -0
  52. package/dist/cjs/download-B53zeKGa.js.map +1 -0
  53. package/dist/cjs/globe-DawgK2Dx.js +21 -0
  54. package/dist/cjs/globe-DawgK2Dx.js.map +1 -0
  55. package/dist/cjs/index-ARGXqXxG.js +78 -0
  56. package/dist/cjs/index-ARGXqXxG.js.map +1 -0
  57. package/dist/cjs/index-BeqE2JWC.js +3180 -0
  58. package/dist/cjs/index-BeqE2JWC.js.map +1 -0
  59. package/dist/cjs/index.es-Bcx0v5Pd.js +454 -0
  60. package/dist/cjs/index.es-Bcx0v5Pd.js.map +1 -0
  61. package/dist/cjs/index.esm-Bb1Vtlp2.js +919 -0
  62. package/dist/cjs/index.esm-Bb1Vtlp2.js.map +1 -0
  63. package/dist/cjs/panel-left-close-CLoRPBWH.js +21 -0
  64. package/dist/cjs/panel-left-close-CLoRPBWH.js.map +1 -0
  65. package/dist/cjs/papaparse-B5u_uWB3.js +1948 -0
  66. package/dist/cjs/papaparse-B5u_uWB3.js.map +1 -0
  67. package/dist/cjs/phone-number-Bza7WGZm.js +315 -0
  68. package/dist/cjs/phone-number-Bza7WGZm.js.map +1 -0
  69. package/dist/cjs/prism-tomorrow-BMFuJ5o1.js +1963 -0
  70. package/dist/cjs/prism-tomorrow-BMFuJ5o1.js.map +1 -0
  71. package/dist/cjs/react-confetti-DdGoyZ0y.js +405 -0
  72. package/dist/cjs/react-confetti-DdGoyZ0y.js.map +1 -0
  73. package/dist/cjs/smartphone-ChvEvl-o.js +36 -0
  74. package/dist/cjs/smartphone-ChvEvl-o.js.map +1 -0
  75. package/dist/cjs/trash-2-CotPjU5n.js +23 -0
  76. package/dist/cjs/trash-2-CotPjU5n.js.map +1 -0
  77. package/dist/cjs/triangle-alert-De-qkUXK.js +27 -0
  78. package/dist/cjs/triangle-alert-De-qkUXK.js.map +1 -0
  79. package/dist/cjs/upload-C5ZnN-d5.js +21 -0
  80. package/dist/cjs/upload-C5ZnN-d5.js.map +1 -0
  81. package/dist/cjs/v2/AuditLogs.js +4 -18
  82. package/dist/cjs/v2/AuditLogs.js.map +1 -1
  83. package/dist/cjs/v2/Builder.js +4 -18
  84. package/dist/cjs/v2/Builder.js.map +1 -1
  85. package/dist/cjs/v2/CalendarView.js +1 -0
  86. package/dist/cjs/v2/CalendarView.js.map +1 -1
  87. package/dist/cjs/v2/Codeblock.js +1 -0
  88. package/dist/cjs/v2/Codeblock.js.map +1 -1
  89. package/dist/cjs/v2/CopyToClipboardButton.js +3 -16
  90. package/dist/cjs/v2/CopyToClipboardButton.js.map +1 -1
  91. package/dist/cjs/v2/DeleteArchiveModal.js +91 -0
  92. package/dist/cjs/v2/DeleteArchiveModal.js.map +1 -0
  93. package/dist/cjs/v2/DownloadMobileAppCallout.js +43 -0
  94. package/dist/cjs/v2/DownloadMobileAppCallout.js.map +1 -0
  95. package/dist/cjs/v2/EmailForm.js +622 -0
  96. package/dist/cjs/v2/EmailForm.js.map +1 -0
  97. package/dist/cjs/v2/EmailPreview.js +138 -0
  98. package/dist/cjs/v2/EmailPreview.js.map +1 -0
  99. package/dist/cjs/v2/EmojiReactions.js +82 -0
  100. package/dist/cjs/v2/EmojiReactions.js.map +1 -0
  101. package/dist/cjs/v2/FileUpload.js +5 -19
  102. package/dist/cjs/v2/FileUpload.js.map +1 -1
  103. package/dist/cjs/v2/FinderModal.js +3 -13
  104. package/dist/cjs/v2/FinderModal.js.map +1 -1
  105. package/dist/cjs/v2/FloatingActionMenu.js +1 -0
  106. package/dist/cjs/v2/FloatingActionMenu.js.map +1 -1
  107. package/dist/cjs/v2/GoogleFontPicker.js +130 -0
  108. package/dist/cjs/v2/GoogleFontPicker.js.map +1 -0
  109. package/dist/cjs/v2/IconPicker.js +274 -0
  110. package/dist/cjs/v2/IconPicker.js.map +1 -0
  111. package/dist/cjs/v2/Insights.js +344 -0
  112. package/dist/cjs/v2/Insights.js.map +1 -0
  113. package/dist/cjs/v2/IntegrationCard.js +222 -0
  114. package/dist/cjs/v2/IntegrationCard.js.map +1 -0
  115. package/dist/cjs/v2/IpRestriction.js +525 -0
  116. package/dist/cjs/v2/IpRestriction.js.map +1 -0
  117. package/dist/cjs/v2/MadeWith.js +73 -0
  118. package/dist/cjs/v2/MadeWith.js.map +1 -0
  119. package/dist/cjs/v2/Metadata.js +215 -0
  120. package/dist/cjs/v2/Metadata.js.map +1 -0
  121. package/dist/cjs/v2/NavigationHeader.js +1 -0
  122. package/dist/cjs/v2/NavigationHeader.js.map +1 -1
  123. package/dist/cjs/v2/NeetoWidget.js +855 -0
  124. package/dist/cjs/v2/NeetoWidget.js.map +1 -0
  125. package/dist/cjs/v2/Onboarding.js +323 -0
  126. package/dist/cjs/v2/Onboarding.js.map +1 -0
  127. package/dist/cjs/v2/OptionFields.js +1291 -0
  128. package/dist/cjs/v2/OptionFields.js.map +1 -0
  129. package/dist/cjs/v2/PhoneNumber.js +20 -307
  130. package/dist/cjs/v2/PhoneNumber.js.map +1 -1
  131. package/dist/cjs/v2/ProductEmbed.js +1870 -0
  132. package/dist/cjs/v2/ProductEmbed.js.map +1 -0
  133. package/dist/cjs/v2/PublishBlock.js +6 -22
  134. package/dist/cjs/v2/PublishBlock.js.map +1 -1
  135. package/dist/cjs/v2/PublishYourItem.js +60 -0
  136. package/dist/cjs/v2/PublishYourItem.js.map +1 -0
  137. package/dist/cjs/v2/ResponsiveDevicePicker.js +88 -0
  138. package/dist/cjs/v2/ResponsiveDevicePicker.js.map +1 -0
  139. package/dist/cjs/v2/SendToFields.js +313 -0
  140. package/dist/cjs/v2/SendToFields.js.map +1 -0
  141. package/dist/cjs/v2/SessionEnvironment.js +479 -0
  142. package/dist/cjs/v2/SessionEnvironment.js.map +1 -0
  143. package/dist/cjs/v2/SubHeader.js +4 -18
  144. package/dist/cjs/v2/SubHeader.js.map +1 -1
  145. package/dist/copy-DhbOoOav.js +18 -0
  146. package/dist/copy-DhbOoOav.js.map +1 -0
  147. package/dist/download-CZ7Q6k7-.js +19 -0
  148. package/dist/download-CZ7Q6k7-.js.map +1 -0
  149. package/dist/globe-rBiI1CjO.js +19 -0
  150. package/dist/globe-rBiI1CjO.js.map +1 -0
  151. package/dist/index-0jnA7dx6.js +3178 -0
  152. package/dist/index-0jnA7dx6.js.map +1 -0
  153. package/dist/index-DF5MKxql.js +76 -0
  154. package/dist/index-DF5MKxql.js.map +1 -0
  155. package/dist/index.es-BQ-dr8y1.js +451 -0
  156. package/dist/index.es-BQ-dr8y1.js.map +1 -0
  157. package/dist/index.esm-DLni3-hz.js +917 -0
  158. package/dist/index.esm-DLni3-hz.js.map +1 -0
  159. package/dist/panel-left-close-37jik3GB.js +19 -0
  160. package/dist/panel-left-close-37jik3GB.js.map +1 -0
  161. package/dist/papaparse-p7fkGgWo.js +1946 -0
  162. package/dist/papaparse-p7fkGgWo.js.map +1 -0
  163. package/dist/phone-number-CGZtDB_n.js +291 -0
  164. package/dist/phone-number-CGZtDB_n.js.map +1 -0
  165. package/dist/prism-tomorrow-ZUb2Ikm9.js +1961 -0
  166. package/dist/prism-tomorrow-ZUb2Ikm9.js.map +1 -0
  167. package/dist/react-confetti-BnGq_LBE.js +403 -0
  168. package/dist/react-confetti-BnGq_LBE.js.map +1 -0
  169. package/dist/smartphone-B-jv1y8j.js +33 -0
  170. package/dist/smartphone-B-jv1y8j.js.map +1 -0
  171. package/dist/trash-2-N0F6K63L.js +21 -0
  172. package/dist/trash-2-N0F6K63L.js.map +1 -0
  173. package/dist/triangle-alert-Pkh6pc42.js +25 -0
  174. package/dist/triangle-alert-Pkh6pc42.js.map +1 -0
  175. package/dist/upload-BNvlRoRJ.js +19 -0
  176. package/dist/upload-BNvlRoRJ.js.map +1 -0
  177. package/dist/v2/AuditLogs.js +3 -17
  178. package/dist/v2/AuditLogs.js.map +1 -1
  179. package/dist/v2/Builder.js +3 -17
  180. package/dist/v2/Builder.js.map +1 -1
  181. package/dist/v2/CalendarView.js +1 -0
  182. package/dist/v2/CalendarView.js.map +1 -1
  183. package/dist/v2/Codeblock.js +1 -0
  184. package/dist/v2/Codeblock.js.map +1 -1
  185. package/dist/v2/CopyToClipboardButton.js +2 -15
  186. package/dist/v2/CopyToClipboardButton.js.map +1 -1
  187. package/dist/v2/DeleteArchiveModal.js +89 -0
  188. package/dist/v2/DeleteArchiveModal.js.map +1 -0
  189. package/dist/v2/DownloadMobileAppCallout.js +41 -0
  190. package/dist/v2/DownloadMobileAppCallout.js.map +1 -0
  191. package/dist/v2/EmailForm.js +596 -0
  192. package/dist/v2/EmailForm.js.map +1 -0
  193. package/dist/v2/EmailPreview.js +136 -0
  194. package/dist/v2/EmailPreview.js.map +1 -0
  195. package/dist/v2/EmojiReactions.js +80 -0
  196. package/dist/v2/EmojiReactions.js.map +1 -0
  197. package/dist/v2/FileUpload.js +4 -18
  198. package/dist/v2/FileUpload.js.map +1 -1
  199. package/dist/v2/FinderModal.js +2 -12
  200. package/dist/v2/FinderModal.js.map +1 -1
  201. package/dist/v2/FloatingActionMenu.js +1 -0
  202. package/dist/v2/FloatingActionMenu.js.map +1 -1
  203. package/dist/v2/GoogleFontPicker.js +128 -0
  204. package/dist/v2/GoogleFontPicker.js.map +1 -0
  205. package/dist/v2/IconPicker.js +272 -0
  206. package/dist/v2/IconPicker.js.map +1 -0
  207. package/dist/v2/Insights.js +342 -0
  208. package/dist/v2/Insights.js.map +1 -0
  209. package/dist/v2/IntegrationCard.js +220 -0
  210. package/dist/v2/IntegrationCard.js.map +1 -0
  211. package/dist/v2/IpRestriction.js +504 -0
  212. package/dist/v2/IpRestriction.js.map +1 -0
  213. package/dist/v2/MadeWith.js +52 -0
  214. package/dist/v2/MadeWith.js.map +1 -0
  215. package/dist/v2/Metadata.js +213 -0
  216. package/dist/v2/Metadata.js.map +1 -0
  217. package/dist/v2/NavigationHeader.js +1 -0
  218. package/dist/v2/NavigationHeader.js.map +1 -1
  219. package/dist/v2/NeetoWidget.js +834 -0
  220. package/dist/v2/NeetoWidget.js.map +1 -0
  221. package/dist/v2/Onboarding.js +321 -0
  222. package/dist/v2/Onboarding.js.map +1 -0
  223. package/dist/v2/OptionFields.js +1289 -0
  224. package/dist/v2/OptionFields.js.map +1 -0
  225. package/dist/v2/PhoneNumber.js +20 -287
  226. package/dist/v2/PhoneNumber.js.map +1 -1
  227. package/dist/v2/ProductEmbed.js +1868 -0
  228. package/dist/v2/ProductEmbed.js.map +1 -0
  229. package/dist/v2/PublishBlock.js +5 -21
  230. package/dist/v2/PublishBlock.js.map +1 -1
  231. package/dist/v2/PublishYourItem.js +58 -0
  232. package/dist/v2/PublishYourItem.js.map +1 -0
  233. package/dist/v2/ResponsiveDevicePicker.js +86 -0
  234. package/dist/v2/ResponsiveDevicePicker.js.map +1 -0
  235. package/dist/v2/SendToFields.js +311 -0
  236. package/dist/v2/SendToFields.js.map +1 -0
  237. package/dist/v2/SessionEnvironment.js +477 -0
  238. package/dist/v2/SessionEnvironment.js.map +1 -0
  239. package/dist/v2/SubHeader.js +3 -17
  240. package/dist/v2/SubHeader.js.map +1 -1
  241. package/package.json +5 -5
  242. package/types/v2/DeleteArchiveModal.d.ts +16 -0
  243. package/types/v2/DownloadMobileAppCallout.d.ts +7 -0
  244. package/types/v2/EmailForm.d.ts +88 -0
  245. package/types/v2/EmailFormProvider.d.ts +29 -0
  246. package/types/v2/EmailPreview.d.ts +16 -0
  247. package/types/v2/EmojiReactions.d.ts +22 -0
  248. package/types/v2/GoogleFontPicker.d.ts +19 -0
  249. package/types/v2/IconPicker.d.ts +11 -0
  250. package/types/v2/Insights.d.ts +69 -0
  251. package/types/v2/IntegrationCard.d.ts +30 -0
  252. package/types/v2/IpRestriction.d.ts +5 -0
  253. package/types/v2/MadeWith.d.ts +8 -0
  254. package/types/v2/Metadata.d.ts +26 -0
  255. package/types/v2/MobilePreviewHeader.d.ts +8 -0
  256. package/types/v2/NeetoWidget.d.ts +19 -0
  257. package/types/v2/Onboarding.d.ts +22 -0
  258. package/types/v2/OptionFields.d.ts +55 -0
  259. package/types/v2/ProductEmbed.d.ts +90 -0
  260. package/types/v2/PublishYourItem.d.ts +8 -0
  261. package/types/v2/ResponsiveDevicePicker.d.ts +11 -0
  262. package/types/v2/SendToFields.d.ts +25 -0
  263. package/types/v2/SessionEnvironment.d.ts +34 -0
@@ -0,0 +1,917 @@
1
+ import _extends from '@babel/runtime/helpers/esm/extends';
2
+ import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
3
+ import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
4
+ import { createElement, PureComponent } from 'react';
5
+ import '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';
6
+
7
+ var safeIsNaN = Number.isNaN ||
8
+ function ponyfill(value) {
9
+ return typeof value === 'number' && value !== value;
10
+ };
11
+ function isEqual(first, second) {
12
+ if (first === second) {
13
+ return true;
14
+ }
15
+ if (safeIsNaN(first) && safeIsNaN(second)) {
16
+ return true;
17
+ }
18
+ return false;
19
+ }
20
+ function areInputsEqual(newInputs, lastInputs) {
21
+ if (newInputs.length !== lastInputs.length) {
22
+ return false;
23
+ }
24
+ for (var i = 0; i < newInputs.length; i++) {
25
+ if (!isEqual(newInputs[i], lastInputs[i])) {
26
+ return false;
27
+ }
28
+ }
29
+ return true;
30
+ }
31
+
32
+ function memoizeOne(resultFn, isEqual) {
33
+ if (isEqual === void 0) { isEqual = areInputsEqual; }
34
+ var lastThis;
35
+ var lastArgs = [];
36
+ var lastResult;
37
+ var calledOnce = false;
38
+ function memoized() {
39
+ var newArgs = [];
40
+ for (var _i = 0; _i < arguments.length; _i++) {
41
+ newArgs[_i] = arguments[_i];
42
+ }
43
+ if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
44
+ return lastResult;
45
+ }
46
+ lastResult = resultFn.apply(this, newArgs);
47
+ calledOnce = true;
48
+ lastThis = this;
49
+ lastArgs = newArgs;
50
+ return lastResult;
51
+ }
52
+ return memoized;
53
+ }
54
+
55
+ // Animation frame based implementation of setTimeout.
56
+ // Inspired by Joe Lambert, https://gist.github.com/joelambert/1002116#file-requesttimeout-js
57
+ var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
58
+ var now = hasNativePerformanceNow ? function () {
59
+ return performance.now();
60
+ } : function () {
61
+ return Date.now();
62
+ };
63
+ function cancelTimeout(timeoutID) {
64
+ cancelAnimationFrame(timeoutID.id);
65
+ }
66
+ function requestTimeout(callback, delay) {
67
+ var start = now();
68
+
69
+ function tick() {
70
+ if (now() - start >= delay) {
71
+ callback.call(null);
72
+ } else {
73
+ timeoutID.id = requestAnimationFrame(tick);
74
+ }
75
+ }
76
+
77
+ var timeoutID = {
78
+ id: requestAnimationFrame(tick)
79
+ };
80
+ return timeoutID;
81
+ }
82
+
83
+ var size = -1; // This utility copied from "dom-helpers" package.
84
+
85
+ function getScrollbarSize(recalculate) {
86
+ if (recalculate === void 0) {
87
+ recalculate = false;
88
+ }
89
+
90
+ if (size === -1 || recalculate) {
91
+ var div = document.createElement('div');
92
+ var style = div.style;
93
+ style.width = '50px';
94
+ style.height = '50px';
95
+ style.overflow = 'scroll';
96
+ document.body.appendChild(div);
97
+ size = div.offsetWidth - div.clientWidth;
98
+ document.body.removeChild(div);
99
+ }
100
+
101
+ return size;
102
+ }
103
+ var cachedRTLResult = null; // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
104
+ // Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).
105
+ // Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.
106
+ // The safest way to check this is to intentionally set a negative offset,
107
+ // and then verify that the subsequent "scroll" event matches the negative offset.
108
+ // If it does not match, then we can assume a non-standard RTL scroll implementation.
109
+
110
+ function getRTLOffsetType(recalculate) {
111
+ if (recalculate === void 0) {
112
+ recalculate = false;
113
+ }
114
+
115
+ if (cachedRTLResult === null || recalculate) {
116
+ var outerDiv = document.createElement('div');
117
+ var outerStyle = outerDiv.style;
118
+ outerStyle.width = '50px';
119
+ outerStyle.height = '50px';
120
+ outerStyle.overflow = 'scroll';
121
+ outerStyle.direction = 'rtl';
122
+ var innerDiv = document.createElement('div');
123
+ var innerStyle = innerDiv.style;
124
+ innerStyle.width = '100px';
125
+ innerStyle.height = '100px';
126
+ outerDiv.appendChild(innerDiv);
127
+ document.body.appendChild(outerDiv);
128
+
129
+ if (outerDiv.scrollLeft > 0) {
130
+ cachedRTLResult = 'positive-descending';
131
+ } else {
132
+ outerDiv.scrollLeft = 1;
133
+
134
+ if (outerDiv.scrollLeft === 0) {
135
+ cachedRTLResult = 'negative';
136
+ } else {
137
+ cachedRTLResult = 'positive-ascending';
138
+ }
139
+ }
140
+
141
+ document.body.removeChild(outerDiv);
142
+ return cachedRTLResult;
143
+ }
144
+
145
+ return cachedRTLResult;
146
+ }
147
+
148
+ var IS_SCROLLING_DEBOUNCE_INTERVAL = 150;
149
+
150
+ var defaultItemKey = function defaultItemKey(_ref) {
151
+ var columnIndex = _ref.columnIndex;
152
+ _ref.data;
153
+ var rowIndex = _ref.rowIndex;
154
+ return rowIndex + ":" + columnIndex;
155
+ }; // In DEV mode, this Set helps us only log a warning once per component instance.
156
+ // This avoids spamming the console every time a render happens.
157
+
158
+
159
+ var devWarningsOverscanCount = null;
160
+ var devWarningsOverscanRowsColumnsCount = null;
161
+ var devWarningsTagName = null;
162
+
163
+ if (process.env.NODE_ENV !== 'production') {
164
+ if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
165
+ devWarningsOverscanCount = /*#__PURE__*/new WeakSet();
166
+ devWarningsOverscanRowsColumnsCount = /*#__PURE__*/new WeakSet();
167
+ devWarningsTagName = /*#__PURE__*/new WeakSet();
168
+ }
169
+ }
170
+
171
+ function createGridComponent(_ref2) {
172
+ var _class;
173
+
174
+ var getColumnOffset = _ref2.getColumnOffset,
175
+ getColumnStartIndexForOffset = _ref2.getColumnStartIndexForOffset,
176
+ getColumnStopIndexForStartIndex = _ref2.getColumnStopIndexForStartIndex,
177
+ getColumnWidth = _ref2.getColumnWidth,
178
+ getEstimatedTotalHeight = _ref2.getEstimatedTotalHeight,
179
+ getEstimatedTotalWidth = _ref2.getEstimatedTotalWidth,
180
+ getOffsetForColumnAndAlignment = _ref2.getOffsetForColumnAndAlignment,
181
+ getOffsetForRowAndAlignment = _ref2.getOffsetForRowAndAlignment,
182
+ getRowHeight = _ref2.getRowHeight,
183
+ getRowOffset = _ref2.getRowOffset,
184
+ getRowStartIndexForOffset = _ref2.getRowStartIndexForOffset,
185
+ getRowStopIndexForStartIndex = _ref2.getRowStopIndexForStartIndex,
186
+ initInstanceProps = _ref2.initInstanceProps,
187
+ shouldResetStyleCacheOnItemSizeChange = _ref2.shouldResetStyleCacheOnItemSizeChange,
188
+ validateProps = _ref2.validateProps;
189
+ return _class = /*#__PURE__*/function (_PureComponent) {
190
+ _inheritsLoose(Grid, _PureComponent);
191
+
192
+ // Always use explicit constructor for React components.
193
+ // It produces less code after transpilation. (#26)
194
+ // eslint-disable-next-line no-useless-constructor
195
+ function Grid(props) {
196
+ var _this;
197
+
198
+ _this = _PureComponent.call(this, props) || this;
199
+ _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
200
+ _this._resetIsScrollingTimeoutId = null;
201
+ _this._outerRef = void 0;
202
+ _this.state = {
203
+ instance: _assertThisInitialized(_this),
204
+ isScrolling: false,
205
+ horizontalScrollDirection: 'forward',
206
+ scrollLeft: typeof _this.props.initialScrollLeft === 'number' ? _this.props.initialScrollLeft : 0,
207
+ scrollTop: typeof _this.props.initialScrollTop === 'number' ? _this.props.initialScrollTop : 0,
208
+ scrollUpdateWasRequested: false,
209
+ verticalScrollDirection: 'forward'
210
+ };
211
+ _this._callOnItemsRendered = void 0;
212
+ _this._callOnItemsRendered = memoizeOne(function (overscanColumnStartIndex, overscanColumnStopIndex, overscanRowStartIndex, overscanRowStopIndex, visibleColumnStartIndex, visibleColumnStopIndex, visibleRowStartIndex, visibleRowStopIndex) {
213
+ return _this.props.onItemsRendered({
214
+ overscanColumnStartIndex: overscanColumnStartIndex,
215
+ overscanColumnStopIndex: overscanColumnStopIndex,
216
+ overscanRowStartIndex: overscanRowStartIndex,
217
+ overscanRowStopIndex: overscanRowStopIndex,
218
+ visibleColumnStartIndex: visibleColumnStartIndex,
219
+ visibleColumnStopIndex: visibleColumnStopIndex,
220
+ visibleRowStartIndex: visibleRowStartIndex,
221
+ visibleRowStopIndex: visibleRowStopIndex
222
+ });
223
+ });
224
+ _this._callOnScroll = void 0;
225
+ _this._callOnScroll = memoizeOne(function (scrollLeft, scrollTop, horizontalScrollDirection, verticalScrollDirection, scrollUpdateWasRequested) {
226
+ return _this.props.onScroll({
227
+ horizontalScrollDirection: horizontalScrollDirection,
228
+ scrollLeft: scrollLeft,
229
+ scrollTop: scrollTop,
230
+ verticalScrollDirection: verticalScrollDirection,
231
+ scrollUpdateWasRequested: scrollUpdateWasRequested
232
+ });
233
+ });
234
+ _this._getItemStyle = void 0;
235
+
236
+ _this._getItemStyle = function (rowIndex, columnIndex) {
237
+ var _this$props = _this.props,
238
+ columnWidth = _this$props.columnWidth,
239
+ direction = _this$props.direction,
240
+ rowHeight = _this$props.rowHeight;
241
+
242
+ var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && columnWidth, shouldResetStyleCacheOnItemSizeChange && direction, shouldResetStyleCacheOnItemSizeChange && rowHeight);
243
+
244
+ var key = rowIndex + ":" + columnIndex;
245
+ var style;
246
+
247
+ if (itemStyleCache.hasOwnProperty(key)) {
248
+ style = itemStyleCache[key];
249
+ } else {
250
+ var _offset = getColumnOffset(_this.props, columnIndex, _this._instanceProps);
251
+
252
+ var isRtl = direction === 'rtl';
253
+ itemStyleCache[key] = style = {
254
+ position: 'absolute',
255
+ left: isRtl ? undefined : _offset,
256
+ right: isRtl ? _offset : undefined,
257
+ top: getRowOffset(_this.props, rowIndex, _this._instanceProps),
258
+ height: getRowHeight(_this.props, rowIndex, _this._instanceProps),
259
+ width: getColumnWidth(_this.props, columnIndex, _this._instanceProps)
260
+ };
261
+ }
262
+
263
+ return style;
264
+ };
265
+
266
+ _this._getItemStyleCache = void 0;
267
+ _this._getItemStyleCache = memoizeOne(function (_, __, ___) {
268
+ return {};
269
+ });
270
+
271
+ _this._onScroll = function (event) {
272
+ var _event$currentTarget = event.currentTarget,
273
+ clientHeight = _event$currentTarget.clientHeight,
274
+ clientWidth = _event$currentTarget.clientWidth,
275
+ scrollLeft = _event$currentTarget.scrollLeft,
276
+ scrollTop = _event$currentTarget.scrollTop,
277
+ scrollHeight = _event$currentTarget.scrollHeight,
278
+ scrollWidth = _event$currentTarget.scrollWidth;
279
+
280
+ _this.setState(function (prevState) {
281
+ if (prevState.scrollLeft === scrollLeft && prevState.scrollTop === scrollTop) {
282
+ // Scroll position may have been updated by cDM/cDU,
283
+ // In which case we don't need to trigger another render,
284
+ // And we don't want to update state.isScrolling.
285
+ return null;
286
+ }
287
+
288
+ var direction = _this.props.direction; // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
289
+ // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
290
+ // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
291
+ // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
292
+
293
+ var calculatedScrollLeft = scrollLeft;
294
+
295
+ if (direction === 'rtl') {
296
+ switch (getRTLOffsetType()) {
297
+ case 'negative':
298
+ calculatedScrollLeft = -scrollLeft;
299
+ break;
300
+
301
+ case 'positive-descending':
302
+ calculatedScrollLeft = scrollWidth - clientWidth - scrollLeft;
303
+ break;
304
+ }
305
+ } // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
306
+
307
+
308
+ calculatedScrollLeft = Math.max(0, Math.min(calculatedScrollLeft, scrollWidth - clientWidth));
309
+ var calculatedScrollTop = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
310
+ return {
311
+ isScrolling: true,
312
+ horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
313
+ scrollLeft: calculatedScrollLeft,
314
+ scrollTop: calculatedScrollTop,
315
+ verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward',
316
+ scrollUpdateWasRequested: false
317
+ };
318
+ }, _this._resetIsScrollingDebounced);
319
+ };
320
+
321
+ _this._outerRefSetter = function (ref) {
322
+ var outerRef = _this.props.outerRef;
323
+ _this._outerRef = ref;
324
+
325
+ if (typeof outerRef === 'function') {
326
+ outerRef(ref);
327
+ } else if (outerRef != null && typeof outerRef === 'object' && outerRef.hasOwnProperty('current')) {
328
+ outerRef.current = ref;
329
+ }
330
+ };
331
+
332
+ _this._resetIsScrollingDebounced = function () {
333
+ if (_this._resetIsScrollingTimeoutId !== null) {
334
+ cancelTimeout(_this._resetIsScrollingTimeoutId);
335
+ }
336
+
337
+ _this._resetIsScrollingTimeoutId = requestTimeout(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL);
338
+ };
339
+
340
+ _this._resetIsScrolling = function () {
341
+ _this._resetIsScrollingTimeoutId = null;
342
+
343
+ _this.setState({
344
+ isScrolling: false
345
+ }, function () {
346
+ // Clear style cache after state update has been committed.
347
+ // This way we don't break pure sCU for items that don't use isScrolling param.
348
+ _this._getItemStyleCache(-1);
349
+ });
350
+ };
351
+
352
+ return _this;
353
+ }
354
+
355
+ Grid.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
356
+ validateSharedProps(nextProps, prevState);
357
+ validateProps(nextProps);
358
+ return null;
359
+ };
360
+
361
+ var _proto = Grid.prototype;
362
+
363
+ _proto.scrollTo = function scrollTo(_ref3) {
364
+ var scrollLeft = _ref3.scrollLeft,
365
+ scrollTop = _ref3.scrollTop;
366
+
367
+ if (scrollLeft !== undefined) {
368
+ scrollLeft = Math.max(0, scrollLeft);
369
+ }
370
+
371
+ if (scrollTop !== undefined) {
372
+ scrollTop = Math.max(0, scrollTop);
373
+ }
374
+
375
+ this.setState(function (prevState) {
376
+ if (scrollLeft === undefined) {
377
+ scrollLeft = prevState.scrollLeft;
378
+ }
379
+
380
+ if (scrollTop === undefined) {
381
+ scrollTop = prevState.scrollTop;
382
+ }
383
+
384
+ if (prevState.scrollLeft === scrollLeft && prevState.scrollTop === scrollTop) {
385
+ return null;
386
+ }
387
+
388
+ return {
389
+ horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
390
+ scrollLeft: scrollLeft,
391
+ scrollTop: scrollTop,
392
+ scrollUpdateWasRequested: true,
393
+ verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward'
394
+ };
395
+ }, this._resetIsScrollingDebounced);
396
+ };
397
+
398
+ _proto.scrollToItem = function scrollToItem(_ref4) {
399
+ var _ref4$align = _ref4.align,
400
+ align = _ref4$align === void 0 ? 'auto' : _ref4$align,
401
+ columnIndex = _ref4.columnIndex,
402
+ rowIndex = _ref4.rowIndex;
403
+ var _this$props2 = this.props,
404
+ columnCount = _this$props2.columnCount,
405
+ height = _this$props2.height,
406
+ rowCount = _this$props2.rowCount,
407
+ width = _this$props2.width;
408
+ var _this$state = this.state,
409
+ scrollLeft = _this$state.scrollLeft,
410
+ scrollTop = _this$state.scrollTop;
411
+ var scrollbarSize = getScrollbarSize();
412
+
413
+ if (columnIndex !== undefined) {
414
+ columnIndex = Math.max(0, Math.min(columnIndex, columnCount - 1));
415
+ }
416
+
417
+ if (rowIndex !== undefined) {
418
+ rowIndex = Math.max(0, Math.min(rowIndex, rowCount - 1));
419
+ }
420
+
421
+ var estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
422
+ var estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps); // The scrollbar size should be considered when scrolling an item into view,
423
+ // to ensure it's fully visible.
424
+ // But we only need to account for its size when it's actually visible.
425
+
426
+ var horizontalScrollbarSize = estimatedTotalWidth > width ? scrollbarSize : 0;
427
+ var verticalScrollbarSize = estimatedTotalHeight > height ? scrollbarSize : 0;
428
+ this.scrollTo({
429
+ scrollLeft: columnIndex !== undefined ? getOffsetForColumnAndAlignment(this.props, columnIndex, align, scrollLeft, this._instanceProps, verticalScrollbarSize) : scrollLeft,
430
+ scrollTop: rowIndex !== undefined ? getOffsetForRowAndAlignment(this.props, rowIndex, align, scrollTop, this._instanceProps, horizontalScrollbarSize) : scrollTop
431
+ });
432
+ };
433
+
434
+ _proto.componentDidMount = function componentDidMount() {
435
+ var _this$props3 = this.props,
436
+ initialScrollLeft = _this$props3.initialScrollLeft,
437
+ initialScrollTop = _this$props3.initialScrollTop;
438
+
439
+ if (this._outerRef != null) {
440
+ var outerRef = this._outerRef;
441
+
442
+ if (typeof initialScrollLeft === 'number') {
443
+ outerRef.scrollLeft = initialScrollLeft;
444
+ }
445
+
446
+ if (typeof initialScrollTop === 'number') {
447
+ outerRef.scrollTop = initialScrollTop;
448
+ }
449
+ }
450
+
451
+ this._callPropsCallbacks();
452
+ };
453
+
454
+ _proto.componentDidUpdate = function componentDidUpdate() {
455
+ var direction = this.props.direction;
456
+ var _this$state2 = this.state,
457
+ scrollLeft = _this$state2.scrollLeft,
458
+ scrollTop = _this$state2.scrollTop,
459
+ scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested;
460
+
461
+ if (scrollUpdateWasRequested && this._outerRef != null) {
462
+ // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
463
+ // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
464
+ // So we need to determine which browser behavior we're dealing with, and mimic it.
465
+ var outerRef = this._outerRef;
466
+
467
+ if (direction === 'rtl') {
468
+ switch (getRTLOffsetType()) {
469
+ case 'negative':
470
+ outerRef.scrollLeft = -scrollLeft;
471
+ break;
472
+
473
+ case 'positive-ascending':
474
+ outerRef.scrollLeft = scrollLeft;
475
+ break;
476
+
477
+ default:
478
+ var clientWidth = outerRef.clientWidth,
479
+ scrollWidth = outerRef.scrollWidth;
480
+ outerRef.scrollLeft = scrollWidth - clientWidth - scrollLeft;
481
+ break;
482
+ }
483
+ } else {
484
+ outerRef.scrollLeft = Math.max(0, scrollLeft);
485
+ }
486
+
487
+ outerRef.scrollTop = Math.max(0, scrollTop);
488
+ }
489
+
490
+ this._callPropsCallbacks();
491
+ };
492
+
493
+ _proto.componentWillUnmount = function componentWillUnmount() {
494
+ if (this._resetIsScrollingTimeoutId !== null) {
495
+ cancelTimeout(this._resetIsScrollingTimeoutId);
496
+ }
497
+ };
498
+
499
+ _proto.render = function render() {
500
+ var _this$props4 = this.props,
501
+ children = _this$props4.children,
502
+ className = _this$props4.className,
503
+ columnCount = _this$props4.columnCount,
504
+ direction = _this$props4.direction,
505
+ height = _this$props4.height,
506
+ innerRef = _this$props4.innerRef,
507
+ innerElementType = _this$props4.innerElementType,
508
+ innerTagName = _this$props4.innerTagName,
509
+ itemData = _this$props4.itemData,
510
+ _this$props4$itemKey = _this$props4.itemKey,
511
+ itemKey = _this$props4$itemKey === void 0 ? defaultItemKey : _this$props4$itemKey,
512
+ outerElementType = _this$props4.outerElementType,
513
+ outerTagName = _this$props4.outerTagName,
514
+ rowCount = _this$props4.rowCount,
515
+ style = _this$props4.style,
516
+ useIsScrolling = _this$props4.useIsScrolling,
517
+ width = _this$props4.width;
518
+ var isScrolling = this.state.isScrolling;
519
+
520
+ var _this$_getHorizontalR = this._getHorizontalRangeToRender(),
521
+ columnStartIndex = _this$_getHorizontalR[0],
522
+ columnStopIndex = _this$_getHorizontalR[1];
523
+
524
+ var _this$_getVerticalRan = this._getVerticalRangeToRender(),
525
+ rowStartIndex = _this$_getVerticalRan[0],
526
+ rowStopIndex = _this$_getVerticalRan[1];
527
+
528
+ var items = [];
529
+
530
+ if (columnCount > 0 && rowCount) {
531
+ for (var _rowIndex = rowStartIndex; _rowIndex <= rowStopIndex; _rowIndex++) {
532
+ for (var _columnIndex = columnStartIndex; _columnIndex <= columnStopIndex; _columnIndex++) {
533
+ items.push(createElement(children, {
534
+ columnIndex: _columnIndex,
535
+ data: itemData,
536
+ isScrolling: useIsScrolling ? isScrolling : undefined,
537
+ key: itemKey({
538
+ columnIndex: _columnIndex,
539
+ data: itemData,
540
+ rowIndex: _rowIndex
541
+ }),
542
+ rowIndex: _rowIndex,
543
+ style: this._getItemStyle(_rowIndex, _columnIndex)
544
+ }));
545
+ }
546
+ }
547
+ } // Read this value AFTER items have been created,
548
+ // So their actual sizes (if variable) are taken into consideration.
549
+
550
+
551
+ var estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
552
+ var estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps);
553
+ return createElement(outerElementType || outerTagName || 'div', {
554
+ className: className,
555
+ onScroll: this._onScroll,
556
+ ref: this._outerRefSetter,
557
+ style: _extends({
558
+ position: 'relative',
559
+ height: height,
560
+ width: width,
561
+ overflow: 'auto',
562
+ WebkitOverflowScrolling: 'touch',
563
+ willChange: 'transform',
564
+ direction: direction
565
+ }, style)
566
+ }, createElement(innerElementType || innerTagName || 'div', {
567
+ children: items,
568
+ ref: innerRef,
569
+ style: {
570
+ height: estimatedTotalHeight,
571
+ pointerEvents: isScrolling ? 'none' : undefined,
572
+ width: estimatedTotalWidth
573
+ }
574
+ }));
575
+ };
576
+
577
+ _proto._callPropsCallbacks = function _callPropsCallbacks() {
578
+ var _this$props5 = this.props,
579
+ columnCount = _this$props5.columnCount,
580
+ onItemsRendered = _this$props5.onItemsRendered,
581
+ onScroll = _this$props5.onScroll,
582
+ rowCount = _this$props5.rowCount;
583
+
584
+ if (typeof onItemsRendered === 'function') {
585
+ if (columnCount > 0 && rowCount > 0) {
586
+ var _this$_getHorizontalR2 = this._getHorizontalRangeToRender(),
587
+ _overscanColumnStartIndex = _this$_getHorizontalR2[0],
588
+ _overscanColumnStopIndex = _this$_getHorizontalR2[1],
589
+ _visibleColumnStartIndex = _this$_getHorizontalR2[2],
590
+ _visibleColumnStopIndex = _this$_getHorizontalR2[3];
591
+
592
+ var _this$_getVerticalRan2 = this._getVerticalRangeToRender(),
593
+ _overscanRowStartIndex = _this$_getVerticalRan2[0],
594
+ _overscanRowStopIndex = _this$_getVerticalRan2[1],
595
+ _visibleRowStartIndex = _this$_getVerticalRan2[2],
596
+ _visibleRowStopIndex = _this$_getVerticalRan2[3];
597
+
598
+ this._callOnItemsRendered(_overscanColumnStartIndex, _overscanColumnStopIndex, _overscanRowStartIndex, _overscanRowStopIndex, _visibleColumnStartIndex, _visibleColumnStopIndex, _visibleRowStartIndex, _visibleRowStopIndex);
599
+ }
600
+ }
601
+
602
+ if (typeof onScroll === 'function') {
603
+ var _this$state3 = this.state,
604
+ _horizontalScrollDirection = _this$state3.horizontalScrollDirection,
605
+ _scrollLeft = _this$state3.scrollLeft,
606
+ _scrollTop = _this$state3.scrollTop,
607
+ _scrollUpdateWasRequested = _this$state3.scrollUpdateWasRequested,
608
+ _verticalScrollDirection = _this$state3.verticalScrollDirection;
609
+
610
+ this._callOnScroll(_scrollLeft, _scrollTop, _horizontalScrollDirection, _verticalScrollDirection, _scrollUpdateWasRequested);
611
+ }
612
+ } // Lazily create and cache item styles while scrolling,
613
+ // So that pure component sCU will prevent re-renders.
614
+ // We maintain this cache, and pass a style prop rather than index,
615
+ // So that List can clear cached styles and force item re-render if necessary.
616
+ ;
617
+
618
+ _proto._getHorizontalRangeToRender = function _getHorizontalRangeToRender() {
619
+ var _this$props6 = this.props,
620
+ columnCount = _this$props6.columnCount,
621
+ overscanColumnCount = _this$props6.overscanColumnCount,
622
+ overscanColumnsCount = _this$props6.overscanColumnsCount,
623
+ overscanCount = _this$props6.overscanCount,
624
+ rowCount = _this$props6.rowCount;
625
+ var _this$state4 = this.state,
626
+ horizontalScrollDirection = _this$state4.horizontalScrollDirection,
627
+ isScrolling = _this$state4.isScrolling,
628
+ scrollLeft = _this$state4.scrollLeft;
629
+ var overscanCountResolved = overscanColumnCount || overscanColumnsCount || overscanCount || 1;
630
+
631
+ if (columnCount === 0 || rowCount === 0) {
632
+ return [0, 0, 0, 0];
633
+ }
634
+
635
+ var startIndex = getColumnStartIndexForOffset(this.props, scrollLeft, this._instanceProps);
636
+ var stopIndex = getColumnStopIndexForStartIndex(this.props, startIndex, scrollLeft, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
637
+ // If there isn't at least one extra item, tab loops back around.
638
+
639
+ var overscanBackward = !isScrolling || horizontalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
640
+ var overscanForward = !isScrolling || horizontalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;
641
+ return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(columnCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
642
+ };
643
+
644
+ _proto._getVerticalRangeToRender = function _getVerticalRangeToRender() {
645
+ var _this$props7 = this.props,
646
+ columnCount = _this$props7.columnCount,
647
+ overscanCount = _this$props7.overscanCount,
648
+ overscanRowCount = _this$props7.overscanRowCount,
649
+ overscanRowsCount = _this$props7.overscanRowsCount,
650
+ rowCount = _this$props7.rowCount;
651
+ var _this$state5 = this.state,
652
+ isScrolling = _this$state5.isScrolling,
653
+ verticalScrollDirection = _this$state5.verticalScrollDirection,
654
+ scrollTop = _this$state5.scrollTop;
655
+ var overscanCountResolved = overscanRowCount || overscanRowsCount || overscanCount || 1;
656
+
657
+ if (columnCount === 0 || rowCount === 0) {
658
+ return [0, 0, 0, 0];
659
+ }
660
+
661
+ var startIndex = getRowStartIndexForOffset(this.props, scrollTop, this._instanceProps);
662
+ var stopIndex = getRowStopIndexForStartIndex(this.props, startIndex, scrollTop, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
663
+ // If there isn't at least one extra item, tab loops back around.
664
+
665
+ var overscanBackward = !isScrolling || verticalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
666
+ var overscanForward = !isScrolling || verticalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;
667
+ return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(rowCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
668
+ };
669
+
670
+ return Grid;
671
+ }(PureComponent), _class.defaultProps = {
672
+ direction: 'ltr',
673
+ itemData: undefined,
674
+ useIsScrolling: false
675
+ }, _class;
676
+ }
677
+
678
+ var validateSharedProps = function validateSharedProps(_ref5, _ref6) {
679
+ var children = _ref5.children,
680
+ direction = _ref5.direction,
681
+ height = _ref5.height,
682
+ innerTagName = _ref5.innerTagName,
683
+ outerTagName = _ref5.outerTagName,
684
+ overscanColumnsCount = _ref5.overscanColumnsCount,
685
+ overscanCount = _ref5.overscanCount,
686
+ overscanRowsCount = _ref5.overscanRowsCount,
687
+ width = _ref5.width;
688
+ var instance = _ref6.instance;
689
+
690
+ if (process.env.NODE_ENV !== 'production') {
691
+ if (typeof overscanCount === 'number') {
692
+ if (devWarningsOverscanCount && !devWarningsOverscanCount.has(instance)) {
693
+ devWarningsOverscanCount.add(instance);
694
+ console.warn('The overscanCount prop has been deprecated. ' + 'Please use the overscanColumnCount and overscanRowCount props instead.');
695
+ }
696
+ }
697
+
698
+ if (typeof overscanColumnsCount === 'number' || typeof overscanRowsCount === 'number') {
699
+ if (devWarningsOverscanRowsColumnsCount && !devWarningsOverscanRowsColumnsCount.has(instance)) {
700
+ devWarningsOverscanRowsColumnsCount.add(instance);
701
+ console.warn('The overscanColumnsCount and overscanRowsCount props have been deprecated. ' + 'Please use the overscanColumnCount and overscanRowCount props instead.');
702
+ }
703
+ }
704
+
705
+ if (innerTagName != null || outerTagName != null) {
706
+ if (devWarningsTagName && !devWarningsTagName.has(instance)) {
707
+ devWarningsTagName.add(instance);
708
+ console.warn('The innerTagName and outerTagName props have been deprecated. ' + 'Please use the innerElementType and outerElementType props instead.');
709
+ }
710
+ }
711
+
712
+ if (children == null) {
713
+ throw Error('An invalid "children" prop has been specified. ' + 'Value should be a React component. ' + ("\"" + (children === null ? 'null' : typeof children) + "\" was specified."));
714
+ }
715
+
716
+ switch (direction) {
717
+ case 'ltr':
718
+ case 'rtl':
719
+ // Valid values
720
+ break;
721
+
722
+ default:
723
+ throw Error('An invalid "direction" prop has been specified. ' + 'Value should be either "ltr" or "rtl". ' + ("\"" + direction + "\" was specified."));
724
+ }
725
+
726
+ if (typeof width !== 'number') {
727
+ throw Error('An invalid "width" prop has been specified. ' + 'Grids must specify a number for width. ' + ("\"" + (width === null ? 'null' : typeof width) + "\" was specified."));
728
+ }
729
+
730
+ if (typeof height !== 'number') {
731
+ throw Error('An invalid "height" prop has been specified. ' + 'Grids must specify a number for height. ' + ("\"" + (height === null ? 'null' : typeof height) + "\" was specified."));
732
+ }
733
+ }
734
+ };
735
+
736
+ if (process.env.NODE_ENV !== 'production') ;
737
+
738
+ var FixedSizeGrid = /*#__PURE__*/createGridComponent({
739
+ getColumnOffset: function getColumnOffset(_ref, index) {
740
+ var columnWidth = _ref.columnWidth;
741
+ return index * columnWidth;
742
+ },
743
+ getColumnWidth: function getColumnWidth(_ref2, index) {
744
+ var columnWidth = _ref2.columnWidth;
745
+ return columnWidth;
746
+ },
747
+ getRowOffset: function getRowOffset(_ref3, index) {
748
+ var rowHeight = _ref3.rowHeight;
749
+ return index * rowHeight;
750
+ },
751
+ getRowHeight: function getRowHeight(_ref4, index) {
752
+ var rowHeight = _ref4.rowHeight;
753
+ return rowHeight;
754
+ },
755
+ getEstimatedTotalHeight: function getEstimatedTotalHeight(_ref5) {
756
+ var rowCount = _ref5.rowCount,
757
+ rowHeight = _ref5.rowHeight;
758
+ return rowHeight * rowCount;
759
+ },
760
+ getEstimatedTotalWidth: function getEstimatedTotalWidth(_ref6) {
761
+ var columnCount = _ref6.columnCount,
762
+ columnWidth = _ref6.columnWidth;
763
+ return columnWidth * columnCount;
764
+ },
765
+ getOffsetForColumnAndAlignment: function getOffsetForColumnAndAlignment(_ref7, columnIndex, align, scrollLeft, instanceProps, scrollbarSize) {
766
+ var columnCount = _ref7.columnCount,
767
+ columnWidth = _ref7.columnWidth,
768
+ width = _ref7.width;
769
+ var lastColumnOffset = Math.max(0, columnCount * columnWidth - width);
770
+ var maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
771
+ var minOffset = Math.max(0, columnIndex * columnWidth - width + scrollbarSize + columnWidth);
772
+
773
+ if (align === 'smart') {
774
+ if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
775
+ align = 'auto';
776
+ } else {
777
+ align = 'center';
778
+ }
779
+ }
780
+
781
+ switch (align) {
782
+ case 'start':
783
+ return maxOffset;
784
+
785
+ case 'end':
786
+ return minOffset;
787
+
788
+ case 'center':
789
+ // "Centered" offset is usually the average of the min and max.
790
+ // But near the edges of the list, this doesn't hold true.
791
+ var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
792
+
793
+ if (middleOffset < Math.ceil(width / 2)) {
794
+ return 0; // near the beginning
795
+ } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
796
+ return lastColumnOffset; // near the end
797
+ } else {
798
+ return middleOffset;
799
+ }
800
+
801
+ case 'auto':
802
+ default:
803
+ if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
804
+ return scrollLeft;
805
+ } else if (minOffset > maxOffset) {
806
+ // Because we only take into account the scrollbar size when calculating minOffset
807
+ // this value can be larger than maxOffset when at the end of the list
808
+ return minOffset;
809
+ } else if (scrollLeft < minOffset) {
810
+ return minOffset;
811
+ } else {
812
+ return maxOffset;
813
+ }
814
+
815
+ }
816
+ },
817
+ getOffsetForRowAndAlignment: function getOffsetForRowAndAlignment(_ref8, rowIndex, align, scrollTop, instanceProps, scrollbarSize) {
818
+ var rowHeight = _ref8.rowHeight,
819
+ height = _ref8.height,
820
+ rowCount = _ref8.rowCount;
821
+ var lastRowOffset = Math.max(0, rowCount * rowHeight - height);
822
+ var maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
823
+ var minOffset = Math.max(0, rowIndex * rowHeight - height + scrollbarSize + rowHeight);
824
+
825
+ if (align === 'smart') {
826
+ if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
827
+ align = 'auto';
828
+ } else {
829
+ align = 'center';
830
+ }
831
+ }
832
+
833
+ switch (align) {
834
+ case 'start':
835
+ return maxOffset;
836
+
837
+ case 'end':
838
+ return minOffset;
839
+
840
+ case 'center':
841
+ // "Centered" offset is usually the average of the min and max.
842
+ // But near the edges of the list, this doesn't hold true.
843
+ var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
844
+
845
+ if (middleOffset < Math.ceil(height / 2)) {
846
+ return 0; // near the beginning
847
+ } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
848
+ return lastRowOffset; // near the end
849
+ } else {
850
+ return middleOffset;
851
+ }
852
+
853
+ case 'auto':
854
+ default:
855
+ if (scrollTop >= minOffset && scrollTop <= maxOffset) {
856
+ return scrollTop;
857
+ } else if (minOffset > maxOffset) {
858
+ // Because we only take into account the scrollbar size when calculating minOffset
859
+ // this value can be larger than maxOffset when at the end of the list
860
+ return minOffset;
861
+ } else if (scrollTop < minOffset) {
862
+ return minOffset;
863
+ } else {
864
+ return maxOffset;
865
+ }
866
+
867
+ }
868
+ },
869
+ getColumnStartIndexForOffset: function getColumnStartIndexForOffset(_ref9, scrollLeft) {
870
+ var columnWidth = _ref9.columnWidth,
871
+ columnCount = _ref9.columnCount;
872
+ return Math.max(0, Math.min(columnCount - 1, Math.floor(scrollLeft / columnWidth)));
873
+ },
874
+ getColumnStopIndexForStartIndex: function getColumnStopIndexForStartIndex(_ref10, startIndex, scrollLeft) {
875
+ var columnWidth = _ref10.columnWidth,
876
+ columnCount = _ref10.columnCount,
877
+ width = _ref10.width;
878
+ var left = startIndex * columnWidth;
879
+ var numVisibleColumns = Math.ceil((width + scrollLeft - left) / columnWidth);
880
+ return Math.max(0, Math.min(columnCount - 1, startIndex + numVisibleColumns - 1 // -1 is because stop index is inclusive
881
+ ));
882
+ },
883
+ getRowStartIndexForOffset: function getRowStartIndexForOffset(_ref11, scrollTop) {
884
+ var rowHeight = _ref11.rowHeight,
885
+ rowCount = _ref11.rowCount;
886
+ return Math.max(0, Math.min(rowCount - 1, Math.floor(scrollTop / rowHeight)));
887
+ },
888
+ getRowStopIndexForStartIndex: function getRowStopIndexForStartIndex(_ref12, startIndex, scrollTop) {
889
+ var rowHeight = _ref12.rowHeight,
890
+ rowCount = _ref12.rowCount,
891
+ height = _ref12.height;
892
+ var top = startIndex * rowHeight;
893
+ var numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
894
+ return Math.max(0, Math.min(rowCount - 1, startIndex + numVisibleRows - 1 // -1 is because stop index is inclusive
895
+ ));
896
+ },
897
+ initInstanceProps: function initInstanceProps(props) {// Noop
898
+ },
899
+ shouldResetStyleCacheOnItemSizeChange: true,
900
+ validateProps: function validateProps(_ref13) {
901
+ var columnWidth = _ref13.columnWidth,
902
+ rowHeight = _ref13.rowHeight;
903
+
904
+ if (process.env.NODE_ENV !== 'production') {
905
+ if (typeof columnWidth !== 'number') {
906
+ throw Error('An invalid "columnWidth" prop has been specified. ' + 'Value should be a number. ' + ("\"" + (columnWidth === null ? 'null' : typeof columnWidth) + "\" was specified."));
907
+ }
908
+
909
+ if (typeof rowHeight !== 'number') {
910
+ throw Error('An invalid "rowHeight" prop has been specified. ' + 'Value should be a number. ' + ("\"" + (rowHeight === null ? 'null' : typeof rowHeight) + "\" was specified."));
911
+ }
912
+ }
913
+ }
914
+ });
915
+
916
+ export { FixedSizeGrid as F };
917
+ //# sourceMappingURL=index.esm-DLni3-hz.js.map