@bigbinary/neetoui 6.5.10 → 6.5.11-beta

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 (371) hide show
  1. package/dist/Accordion.js +152 -0
  2. package/dist/Accordion.js.map +1 -0
  3. package/dist/ActionDropdown.js +75 -0
  4. package/dist/ActionDropdown.js.map +1 -0
  5. package/dist/Alert.js +112 -0
  6. package/dist/Alert.js.map +1 -0
  7. package/dist/Avatar.js +97 -0
  8. package/dist/Avatar.js.map +1 -0
  9. package/dist/Button.js +219 -0
  10. package/dist/Button.js.map +1 -0
  11. package/dist/Callout.js +39 -0
  12. package/dist/Callout.js.map +1 -0
  13. package/dist/Checkbox.js +65 -0
  14. package/dist/Checkbox.js.map +1 -0
  15. package/dist/ColorPicker.js +1408 -0
  16. package/dist/ColorPicker.js.map +1 -0
  17. package/dist/DatePicker.js +290 -0
  18. package/dist/DatePicker.js.map +1 -0
  19. package/dist/DateTimePicker.js +163 -0
  20. package/dist/DateTimePicker.js.map +1 -0
  21. package/dist/Dropdown.js +303 -0
  22. package/dist/Dropdown.js.map +1 -0
  23. package/dist/Input.js +158 -0
  24. package/dist/Input.js.map +1 -0
  25. package/dist/Kbd.js +24 -0
  26. package/dist/Kbd.js.map +1 -0
  27. package/dist/Label.js +46 -0
  28. package/dist/Label.js.map +1 -0
  29. package/dist/Modal.js +166 -0
  30. package/dist/Modal.js.map +1 -0
  31. package/dist/MultiEmailInput.js +307 -0
  32. package/dist/MultiEmailInput.js.map +1 -0
  33. package/dist/NoData.js +81 -0
  34. package/dist/NoData.js.map +1 -0
  35. package/dist/Pagination.js +178 -0
  36. package/dist/Pagination.js.map +1 -0
  37. package/dist/Pane.js +160 -0
  38. package/dist/Pane.js.map +1 -0
  39. package/dist/Popover.js +44 -0
  40. package/dist/Popover.js.map +1 -0
  41. package/dist/Radio.js +100 -0
  42. package/dist/Radio.js.map +1 -0
  43. package/dist/Select.js +281 -0
  44. package/dist/Select.js.map +1 -0
  45. package/dist/Sidebar.js +378 -0
  46. package/dist/Sidebar.js.map +1 -0
  47. package/dist/Slider.js +110 -0
  48. package/dist/Slider.js.map +1 -0
  49. package/dist/Spinner.js +36 -0
  50. package/dist/Spinner.js.map +1 -0
  51. package/dist/Stepper.js +35 -0
  52. package/dist/Stepper.js.map +1 -0
  53. package/dist/Switch.js +84 -0
  54. package/dist/Switch.js.map +1 -0
  55. package/dist/Tab.js +74 -0
  56. package/dist/Tab.js.map +1 -0
  57. package/dist/Table.js +887 -0
  58. package/dist/Table.js.map +1 -0
  59. package/dist/Tag.js +89 -0
  60. package/dist/Tag.js.map +1 -0
  61. package/dist/Textarea.js +143 -0
  62. package/dist/Textarea.js.map +1 -0
  63. package/dist/TimePicker.js +174 -0
  64. package/dist/TimePicker.js.map +1 -0
  65. package/dist/TimePickerInput.js +25 -0
  66. package/dist/TimePickerInput.js.map +1 -0
  67. package/dist/Toastr.js +393 -0
  68. package/dist/Toastr.js.map +1 -0
  69. package/dist/Tooltip.js +8 -0
  70. package/dist/Tooltip.js.map +1 -0
  71. package/dist/Tree.js +48 -0
  72. package/dist/Tree.js.map +1 -0
  73. package/dist/TreeSelect.js +108 -0
  74. package/dist/TreeSelect.js.map +1 -0
  75. package/dist/Typography.js +142 -0
  76. package/dist/Typography.js.map +1 -0
  77. package/dist/cjs/Accordion.js +158 -0
  78. package/dist/cjs/Accordion.js.map +1 -0
  79. package/dist/cjs/ActionDropdown.js +81 -0
  80. package/dist/cjs/ActionDropdown.js.map +1 -0
  81. package/dist/cjs/Alert.js +118 -0
  82. package/dist/cjs/Alert.js.map +1 -0
  83. package/dist/cjs/Avatar.js +104 -0
  84. package/dist/cjs/Avatar.js.map +1 -0
  85. package/dist/cjs/Button.js +225 -0
  86. package/dist/cjs/Button.js.map +1 -0
  87. package/dist/cjs/Callout.js +45 -0
  88. package/dist/cjs/Callout.js.map +1 -0
  89. package/dist/cjs/Checkbox.js +71 -0
  90. package/dist/cjs/Checkbox.js.map +1 -0
  91. package/dist/cjs/ColorPicker.js +1414 -0
  92. package/dist/cjs/ColorPicker.js.map +1 -0
  93. package/dist/cjs/DatePicker.js +298 -0
  94. package/dist/cjs/DatePicker.js.map +1 -0
  95. package/dist/cjs/DateTimePicker.js +169 -0
  96. package/dist/cjs/DateTimePicker.js.map +1 -0
  97. package/dist/cjs/Dropdown.js +309 -0
  98. package/dist/cjs/Dropdown.js.map +1 -0
  99. package/dist/cjs/Input.js +164 -0
  100. package/dist/cjs/Input.js.map +1 -0
  101. package/dist/cjs/Kbd.js +30 -0
  102. package/dist/cjs/Kbd.js.map +1 -0
  103. package/dist/cjs/Label.js +52 -0
  104. package/dist/cjs/Label.js.map +1 -0
  105. package/dist/cjs/Modal.js +172 -0
  106. package/dist/cjs/Modal.js.map +1 -0
  107. package/dist/cjs/MultiEmailInput.js +314 -0
  108. package/dist/cjs/MultiEmailInput.js.map +1 -0
  109. package/dist/cjs/NoData.js +87 -0
  110. package/dist/cjs/NoData.js.map +1 -0
  111. package/dist/cjs/Pagination.js +184 -0
  112. package/dist/cjs/Pagination.js.map +1 -0
  113. package/dist/cjs/Pane.js +166 -0
  114. package/dist/cjs/Pane.js.map +1 -0
  115. package/dist/cjs/Popover.js +50 -0
  116. package/dist/cjs/Popover.js.map +1 -0
  117. package/dist/cjs/Radio.js +106 -0
  118. package/dist/cjs/Radio.js.map +1 -0
  119. package/dist/cjs/Select.js +291 -0
  120. package/dist/cjs/Select.js.map +1 -0
  121. package/dist/cjs/Sidebar.js +384 -0
  122. package/dist/cjs/Sidebar.js.map +1 -0
  123. package/dist/cjs/Slider.js +118 -0
  124. package/dist/cjs/Slider.js.map +1 -0
  125. package/dist/cjs/Spinner.js +42 -0
  126. package/dist/cjs/Spinner.js.map +1 -0
  127. package/dist/cjs/Stepper.js +41 -0
  128. package/dist/cjs/Stepper.js.map +1 -0
  129. package/dist/cjs/Switch.js +90 -0
  130. package/dist/cjs/Switch.js.map +1 -0
  131. package/dist/cjs/Tab.js +80 -0
  132. package/dist/cjs/Tab.js.map +1 -0
  133. package/dist/cjs/Table.js +896 -0
  134. package/dist/cjs/Table.js.map +1 -0
  135. package/dist/cjs/Tag.js +95 -0
  136. package/dist/cjs/Tag.js.map +1 -0
  137. package/dist/cjs/Textarea.js +149 -0
  138. package/dist/cjs/Textarea.js.map +1 -0
  139. package/dist/cjs/TimePicker.js +182 -0
  140. package/dist/cjs/TimePicker.js.map +1 -0
  141. package/dist/cjs/TimePickerInput.js +31 -0
  142. package/dist/cjs/TimePickerInput.js.map +1 -0
  143. package/dist/cjs/Toastr.js +417 -0
  144. package/dist/cjs/Toastr.js.map +1 -0
  145. package/dist/cjs/Tooltip.js +14 -0
  146. package/dist/cjs/Tooltip.js.map +1 -0
  147. package/dist/cjs/Tree.js +56 -0
  148. package/dist/cjs/Tree.js.map +1 -0
  149. package/dist/cjs/TreeSelect.js +116 -0
  150. package/dist/cjs/TreeSelect.js.map +1 -0
  151. package/dist/cjs/Typography.js +148 -0
  152. package/dist/cjs/Typography.js.map +1 -0
  153. package/dist/cjs/createClass-80e17c6a.js +31 -0
  154. package/dist/cjs/createClass-80e17c6a.js.map +1 -0
  155. package/dist/cjs/defineProperty-ee86604b.js +21 -0
  156. package/dist/cjs/defineProperty-ee86604b.js.map +1 -0
  157. package/dist/cjs/extends-1b35a664.js +19 -0
  158. package/dist/cjs/extends-1b35a664.js.map +1 -0
  159. package/dist/cjs/formik/ActionBlock.js +58 -0
  160. package/dist/cjs/formik/ActionBlock.js.map +1 -0
  161. package/dist/cjs/formik/BlockNavigation.js +127 -0
  162. package/dist/cjs/formik/BlockNavigation.js.map +1 -0
  163. package/dist/cjs/formik/Button.js +44 -0
  164. package/dist/cjs/formik/Button.js.map +1 -0
  165. package/dist/cjs/formik/Checkbox.js +61 -0
  166. package/dist/cjs/formik/Checkbox.js.map +1 -0
  167. package/dist/cjs/formik/Form.js +197 -0
  168. package/dist/cjs/formik/Form.js.map +1 -0
  169. package/dist/cjs/formik/Input.js +59 -0
  170. package/dist/cjs/formik/Input.js.map +1 -0
  171. package/dist/cjs/formik/MultiEmailInput.js +58 -0
  172. package/dist/cjs/formik/MultiEmailInput.js.map +1 -0
  173. package/dist/cjs/formik/Radio.js +61 -0
  174. package/dist/cjs/formik/Radio.js.map +1 -0
  175. package/dist/cjs/formik/Select.js +106 -0
  176. package/dist/cjs/formik/Select.js.map +1 -0
  177. package/dist/cjs/formik/Slider.js +64 -0
  178. package/dist/cjs/formik/Slider.js.map +1 -0
  179. package/dist/cjs/formik/Switch.js +52 -0
  180. package/dist/cjs/formik/Switch.js.map +1 -0
  181. package/dist/cjs/formik/Textarea.js +60 -0
  182. package/dist/cjs/formik/Textarea.js.map +1 -0
  183. package/dist/cjs/formik/TreeSelect.js +56 -0
  184. package/dist/cjs/formik/TreeSelect.js.map +1 -0
  185. package/dist/cjs/formik/index.js +84 -0
  186. package/dist/cjs/formik/index.js.map +1 -0
  187. package/dist/cjs/index-302c3d37.js +58 -0
  188. package/dist/cjs/index-302c3d37.js.map +1 -0
  189. package/dist/cjs/index-5d74cfeb.js +375 -0
  190. package/dist/cjs/index-5d74cfeb.js.map +1 -0
  191. package/dist/cjs/index-63580e68.js +92 -0
  192. package/dist/cjs/index-63580e68.js.map +1 -0
  193. package/dist/cjs/index-6e09c7bc.js +2211 -0
  194. package/dist/cjs/index-6e09c7bc.js.map +1 -0
  195. package/dist/cjs/index-773961dd.js +453 -0
  196. package/dist/cjs/index-773961dd.js.map +1 -0
  197. package/dist/cjs/index-a8cc581e.js +2383 -0
  198. package/dist/cjs/index-a8cc581e.js.map +1 -0
  199. package/dist/cjs/index-b1ac86d6.js +258 -0
  200. package/dist/cjs/index-b1ac86d6.js.map +1 -0
  201. package/dist/cjs/index.js +99 -13808
  202. package/dist/cjs/index.js.map +1 -1
  203. package/dist/cjs/layouts.js +19 -363
  204. package/dist/cjs/layouts.js.map +1 -1
  205. package/dist/cjs/managers.js +3 -2
  206. package/dist/cjs/managers.js.map +1 -1
  207. package/dist/cjs/objectWithoutProperties-2fed2d7d.js +33 -0
  208. package/dist/cjs/objectWithoutProperties-2fed2d7d.js.map +1 -0
  209. package/dist/cjs/{overlayManager-a0827ae7.js → overlayManager.js} +5 -2
  210. package/dist/cjs/overlayManager.js.map +1 -0
  211. package/dist/cjs/slicedToArray-732a2048.js +63 -0
  212. package/dist/cjs/slicedToArray-732a2048.js.map +1 -0
  213. package/dist/cjs/toConsumableArray-418424fc.js +23 -0
  214. package/dist/cjs/toConsumableArray-418424fc.js.map +1 -0
  215. package/dist/cjs/{createClass-ca103cfb.js → toPropertyKey-bfa2e465.js} +1 -27
  216. package/dist/cjs/toPropertyKey-bfa2e465.js.map +1 -0
  217. package/dist/cjs/useId-4e3deb5c.js +11 -0
  218. package/dist/cjs/useId-4e3deb5c.js.map +1 -0
  219. package/dist/cjs/useOverlayManager-359ed795.js +1602 -0
  220. package/dist/cjs/useOverlayManager-359ed795.js.map +1 -0
  221. package/dist/cjs/useQueryParams-14f054b3.js +18 -0
  222. package/dist/cjs/useQueryParams-14f054b3.js.map +1 -0
  223. package/dist/cjs/useSyncedRef-9c3dcd03.js +19 -0
  224. package/dist/cjs/useSyncedRef-9c3dcd03.js.map +1 -0
  225. package/dist/createClass-601a36b2.js +28 -0
  226. package/dist/createClass-601a36b2.js.map +1 -0
  227. package/dist/defineProperty-e5245270.js +19 -0
  228. package/dist/defineProperty-e5245270.js.map +1 -0
  229. package/dist/extends-093996c9.js +17 -0
  230. package/dist/extends-093996c9.js.map +1 -0
  231. package/dist/formik/ActionBlock.js +52 -0
  232. package/dist/formik/ActionBlock.js.map +1 -0
  233. package/dist/formik/BlockNavigation.js +121 -0
  234. package/dist/formik/BlockNavigation.js.map +1 -0
  235. package/dist/formik/Button.js +38 -0
  236. package/dist/formik/Button.js.map +1 -0
  237. package/dist/formik/Checkbox.js +55 -0
  238. package/dist/formik/Checkbox.js.map +1 -0
  239. package/dist/formik/Form.js +191 -0
  240. package/dist/formik/Form.js.map +1 -0
  241. package/dist/formik/Input.js +53 -0
  242. package/dist/formik/Input.js.map +1 -0
  243. package/dist/formik/MultiEmailInput.js +52 -0
  244. package/dist/formik/MultiEmailInput.js.map +1 -0
  245. package/dist/formik/Radio.js +55 -0
  246. package/dist/formik/Radio.js.map +1 -0
  247. package/dist/formik/Select.js +100 -0
  248. package/dist/formik/Select.js.map +1 -0
  249. package/dist/formik/Slider.js +58 -0
  250. package/dist/formik/Slider.js.map +1 -0
  251. package/dist/formik/Switch.js +46 -0
  252. package/dist/formik/Switch.js.map +1 -0
  253. package/dist/formik/Textarea.js +54 -0
  254. package/dist/formik/Textarea.js.map +1 -0
  255. package/dist/formik/TreeSelect.js +50 -0
  256. package/dist/formik/TreeSelect.js.map +1 -0
  257. package/dist/formik/index.js +64 -0
  258. package/dist/formik/index.js.map +1 -0
  259. package/dist/index-283bc6a6.js +90 -0
  260. package/dist/index-283bc6a6.js.map +1 -0
  261. package/dist/index-34956d66.js +372 -0
  262. package/dist/index-34956d66.js.map +1 -0
  263. package/dist/index-3659771d.js +56 -0
  264. package/dist/index-3659771d.js.map +1 -0
  265. package/dist/index-7fae3611.js +2381 -0
  266. package/dist/index-7fae3611.js.map +1 -0
  267. package/dist/index-b3a8dd29.js +249 -0
  268. package/dist/index-b3a8dd29.js.map +1 -0
  269. package/dist/index-c442518b.js +445 -0
  270. package/dist/index-c442518b.js.map +1 -0
  271. package/dist/index-c8d9113c.js +2193 -0
  272. package/dist/index-c8d9113c.js.map +1 -0
  273. package/dist/index.js +79 -13767
  274. package/dist/index.js.map +1 -1
  275. package/dist/layouts.js +19 -363
  276. package/dist/layouts.js.map +1 -1
  277. package/dist/managers.js +3 -2
  278. package/dist/managers.js.map +1 -1
  279. package/dist/objectWithoutProperties-a0edb288.js +31 -0
  280. package/dist/objectWithoutProperties-a0edb288.js.map +1 -0
  281. package/dist/{overlayManager-4d5be56b.js → overlayManager.js} +4 -3
  282. package/dist/overlayManager.js.map +1 -0
  283. package/dist/slicedToArray-45fa766e.js +57 -0
  284. package/dist/slicedToArray-45fa766e.js.map +1 -0
  285. package/dist/toConsumableArray-1186e144.js +20 -0
  286. package/dist/toConsumableArray-1186e144.js.map +1 -0
  287. package/dist/toPropertyKey-bdc24cb9.js +28 -0
  288. package/dist/toPropertyKey-bdc24cb9.js.map +1 -0
  289. package/dist/useId-c1d20bba.js +9 -0
  290. package/dist/useId-c1d20bba.js.map +1 -0
  291. package/dist/useOverlayManager-95a474d5.js +1591 -0
  292. package/dist/useOverlayManager-95a474d5.js.map +1 -0
  293. package/dist/useQueryParams-4e7ddcf8.js +16 -0
  294. package/dist/useQueryParams-4e7ddcf8.js.map +1 -0
  295. package/dist/useSyncedRef-226a3dbc.js +17 -0
  296. package/dist/useSyncedRef-226a3dbc.js.map +1 -0
  297. package/formik.d.ts +26 -51
  298. package/index.d.ts +75 -834
  299. package/package.json +26 -4
  300. package/types/Accordion.d.ts +26 -0
  301. package/types/ActionDropdown.d.ts +21 -0
  302. package/types/Alert.d.ts +23 -0
  303. package/types/Avatar.d.ts +17 -0
  304. package/types/Button.d.ts +32 -0
  305. package/types/Callout.d.ts +13 -0
  306. package/types/Checkbox.d.ts +18 -0
  307. package/types/ColorPicker.d.ts +21 -0
  308. package/types/DatePicker.d.ts +30 -0
  309. package/types/DateTimePicker.d.ts +26 -0
  310. package/types/Dropdown.d.ts +77 -0
  311. package/types/Input.d.ts +27 -0
  312. package/types/Kbd.d.ts +11 -0
  313. package/types/Label.d.ts +19 -0
  314. package/types/Modal.d.ts +10 -0
  315. package/types/MultiEmailInput.d.ts +25 -0
  316. package/types/NoData.d.ts +14 -0
  317. package/types/Pagination.d.ts +11 -0
  318. package/types/Pane.d.ts +11 -0
  319. package/types/Popover.d.ts +32 -0
  320. package/types/Popup.d.ts +17 -0
  321. package/types/Radio.d.ts +24 -0
  322. package/types/Select.d.ts +27 -0
  323. package/types/Slider.d.ts +12 -0
  324. package/types/Spinner.d.ts +9 -0
  325. package/types/Stepper.d.ts +10 -0
  326. package/types/Switch.d.ts +20 -0
  327. package/types/Tab.d.ts +24 -0
  328. package/types/Table.d.ts +41 -0
  329. package/types/Tag.d.ts +27 -0
  330. package/types/Textarea.d.ts +22 -0
  331. package/types/TimePicker.d.ts +28 -0
  332. package/types/TimePickerInput.d.ts +22 -0
  333. package/types/Toastr.d.ts +20 -0
  334. package/types/Tooltip.d.ts +31 -0
  335. package/types/Tree.d.ts +62 -0
  336. package/types/TreeSelect.d.ts +40 -0
  337. package/types/Typography.d.ts +64 -0
  338. package/types/formik/ActionBlock.d.ts +11 -0
  339. package/types/formik/BlockNavigation.d.ts +9 -0
  340. package/types/formik/Button.d.ts +1 -0
  341. package/types/formik/Checkbox.d.ts +1 -0
  342. package/types/formik/Form.d.ts +13 -0
  343. package/types/formik/Input.d.ts +1 -0
  344. package/types/formik/MultiEmailInput.d.ts +1 -0
  345. package/types/formik/Radio.d.ts +1 -0
  346. package/types/formik/Select.d.ts +1 -0
  347. package/types/formik/Slider.d.ts +1 -0
  348. package/types/formik/Switch.d.ts +1 -0
  349. package/types/formik/Textarea.d.ts +1 -0
  350. package/types/formik/TreeSelect.d.ts +1 -0
  351. package/dist/TreeSelect-54c59138.js +0 -22106
  352. package/dist/TreeSelect-54c59138.js.map +0 -1
  353. package/dist/Typography-6b2170d4.js +0 -6439
  354. package/dist/Typography-6b2170d4.js.map +0 -1
  355. package/dist/cjs/TreeSelect-40898804.js +0 -22161
  356. package/dist/cjs/TreeSelect-40898804.js.map +0 -1
  357. package/dist/cjs/Typography-3f90f925.js +0 -6472
  358. package/dist/cjs/Typography-3f90f925.js.map +0 -1
  359. package/dist/cjs/createClass-ca103cfb.js.map +0 -1
  360. package/dist/cjs/formik.js +0 -624
  361. package/dist/cjs/formik.js.map +0 -1
  362. package/dist/cjs/index-099304bb.js +0 -104
  363. package/dist/cjs/index-099304bb.js.map +0 -1
  364. package/dist/cjs/overlayManager-a0827ae7.js.map +0 -1
  365. package/dist/createClass-27bd48bc.js +0 -52
  366. package/dist/createClass-27bd48bc.js.map +0 -1
  367. package/dist/formik.js +0 -604
  368. package/dist/formik.js.map +0 -1
  369. package/dist/index-ed90c85d.js +0 -98
  370. package/dist/index-ed90c85d.js.map +0 -1
  371. package/dist/overlayManager-4d5be56b.js.map +0 -1
@@ -0,0 +1,1591 @@
1
+ import './index-283bc6a6.js';
2
+ import React__default, { Children, isValidElement, cloneElement, forwardRef, useRef, useEffect, useCallback, useSyncExternalStore } from 'react';
3
+ import ReactDOM, { createPortal } from 'react-dom';
4
+ import { _ as _extends$1 } from './extends-093996c9.js';
5
+ import { _ as _objectWithoutProperties } from './objectWithoutProperties-a0edb288.js';
6
+ import { isEmpty } from 'ramda';
7
+ import { u as useHotKeys } from './index-7fae3611.js';
8
+ import { manager } from './overlayManager.js';
9
+ import { t as trapFocusOnFocusableElements, e as hideScrollAndAddMargin, s as showScrollAndRemoveMargin, f as focusFirstFocusableElement, n as noop$1 } from './index-c8d9113c.js';
10
+
11
+ function _extends() {
12
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
13
+ for (var i = 1; i < arguments.length; i++) {
14
+ var source = arguments[i];
15
+ for (var key in source) {
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
19
+ }
20
+ }
21
+ return target;
22
+ };
23
+ return _extends.apply(this, arguments);
24
+ }
25
+
26
+ function _objectWithoutPropertiesLoose(source, excluded) {
27
+ if (source == null) return {};
28
+ var target = {};
29
+ var sourceKeys = Object.keys(source);
30
+ var key, i;
31
+ for (i = 0; i < sourceKeys.length; i++) {
32
+ key = sourceKeys[i];
33
+ if (excluded.indexOf(key) >= 0) continue;
34
+ target[key] = source[key];
35
+ }
36
+ return target;
37
+ }
38
+
39
+ function _setPrototypeOf(o, p) {
40
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
41
+ o.__proto__ = p;
42
+ return o;
43
+ };
44
+ return _setPrototypeOf(o, p);
45
+ }
46
+
47
+ function _inheritsLoose(subClass, superClass) {
48
+ subClass.prototype = Object.create(superClass.prototype);
49
+ subClass.prototype.constructor = subClass;
50
+ _setPrototypeOf(subClass, superClass);
51
+ }
52
+
53
+ /**
54
+ * Checks if a given element has a CSS class.
55
+ *
56
+ * @param element the element
57
+ * @param className the CSS class name
58
+ */
59
+ function hasClass(element, className) {
60
+ if (element.classList) return !!className && element.classList.contains(className);
61
+ return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
62
+ }
63
+
64
+ /**
65
+ * Adds a CSS class to a given element.
66
+ *
67
+ * @param element the element
68
+ * @param className the CSS class name
69
+ */
70
+
71
+ function addClass(element, className) {
72
+ if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
73
+ }
74
+
75
+ function replaceClassName(origClass, classToRemove) {
76
+ return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
77
+ }
78
+ /**
79
+ * Removes a CSS class from a given element.
80
+ *
81
+ * @param element the element
82
+ * @param className the CSS class name
83
+ */
84
+
85
+
86
+ function removeClass$1(element, className) {
87
+ if (element.classList) {
88
+ element.classList.remove(className);
89
+ } else if (typeof element.className === 'string') {
90
+ element.className = replaceClassName(element.className, className);
91
+ } else {
92
+ element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
93
+ }
94
+ }
95
+
96
+ var config = {
97
+ disabled: false
98
+ };
99
+
100
+ var TransitionGroupContext = React__default.createContext(null);
101
+
102
+ var forceReflow = function forceReflow(node) {
103
+ return node.scrollTop;
104
+ };
105
+
106
+ var UNMOUNTED = 'unmounted';
107
+ var EXITED = 'exited';
108
+ var ENTERING = 'entering';
109
+ var ENTERED = 'entered';
110
+ var EXITING = 'exiting';
111
+ /**
112
+ * The Transition component lets you describe a transition from one component
113
+ * state to another _over time_ with a simple declarative API. Most commonly
114
+ * it's used to animate the mounting and unmounting of a component, but can also
115
+ * be used to describe in-place transition states as well.
116
+ *
117
+ * ---
118
+ *
119
+ * **Note**: `Transition` is a platform-agnostic base component. If you're using
120
+ * transitions in CSS, you'll probably want to use
121
+ * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
122
+ * instead. It inherits all the features of `Transition`, but contains
123
+ * additional features necessary to play nice with CSS transitions (hence the
124
+ * name of the component).
125
+ *
126
+ * ---
127
+ *
128
+ * By default the `Transition` component does not alter the behavior of the
129
+ * component it renders, it only tracks "enter" and "exit" states for the
130
+ * components. It's up to you to give meaning and effect to those states. For
131
+ * example we can add styles to a component when it enters or exits:
132
+ *
133
+ * ```jsx
134
+ * import { Transition } from 'react-transition-group';
135
+ *
136
+ * const duration = 300;
137
+ *
138
+ * const defaultStyle = {
139
+ * transition: `opacity ${duration}ms ease-in-out`,
140
+ * opacity: 0,
141
+ * }
142
+ *
143
+ * const transitionStyles = {
144
+ * entering: { opacity: 1 },
145
+ * entered: { opacity: 1 },
146
+ * exiting: { opacity: 0 },
147
+ * exited: { opacity: 0 },
148
+ * };
149
+ *
150
+ * const Fade = ({ in: inProp }) => (
151
+ * <Transition in={inProp} timeout={duration}>
152
+ * {state => (
153
+ * <div style={{
154
+ * ...defaultStyle,
155
+ * ...transitionStyles[state]
156
+ * }}>
157
+ * I'm a fade Transition!
158
+ * </div>
159
+ * )}
160
+ * </Transition>
161
+ * );
162
+ * ```
163
+ *
164
+ * There are 4 main states a Transition can be in:
165
+ * - `'entering'`
166
+ * - `'entered'`
167
+ * - `'exiting'`
168
+ * - `'exited'`
169
+ *
170
+ * Transition state is toggled via the `in` prop. When `true` the component
171
+ * begins the "Enter" stage. During this stage, the component will shift from
172
+ * its current transition state, to `'entering'` for the duration of the
173
+ * transition and then to the `'entered'` stage once it's complete. Let's take
174
+ * the following example (we'll use the
175
+ * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
176
+ *
177
+ * ```jsx
178
+ * function App() {
179
+ * const [inProp, setInProp] = useState(false);
180
+ * return (
181
+ * <div>
182
+ * <Transition in={inProp} timeout={500}>
183
+ * {state => (
184
+ * // ...
185
+ * )}
186
+ * </Transition>
187
+ * <button onClick={() => setInProp(true)}>
188
+ * Click to Enter
189
+ * </button>
190
+ * </div>
191
+ * );
192
+ * }
193
+ * ```
194
+ *
195
+ * When the button is clicked the component will shift to the `'entering'` state
196
+ * and stay there for 500ms (the value of `timeout`) before it finally switches
197
+ * to `'entered'`.
198
+ *
199
+ * When `in` is `false` the same thing happens except the state moves from
200
+ * `'exiting'` to `'exited'`.
201
+ */
202
+
203
+ var Transition = /*#__PURE__*/function (_React$Component) {
204
+ _inheritsLoose(Transition, _React$Component);
205
+
206
+ function Transition(props, context) {
207
+ var _this;
208
+
209
+ _this = _React$Component.call(this, props, context) || this;
210
+ var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
211
+
212
+ var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
213
+ var initialStatus;
214
+ _this.appearStatus = null;
215
+
216
+ if (props.in) {
217
+ if (appear) {
218
+ initialStatus = EXITED;
219
+ _this.appearStatus = ENTERING;
220
+ } else {
221
+ initialStatus = ENTERED;
222
+ }
223
+ } else {
224
+ if (props.unmountOnExit || props.mountOnEnter) {
225
+ initialStatus = UNMOUNTED;
226
+ } else {
227
+ initialStatus = EXITED;
228
+ }
229
+ }
230
+
231
+ _this.state = {
232
+ status: initialStatus
233
+ };
234
+ _this.nextCallback = null;
235
+ return _this;
236
+ }
237
+
238
+ Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
239
+ var nextIn = _ref.in;
240
+
241
+ if (nextIn && prevState.status === UNMOUNTED) {
242
+ return {
243
+ status: EXITED
244
+ };
245
+ }
246
+
247
+ return null;
248
+ } // getSnapshotBeforeUpdate(prevProps) {
249
+ // let nextStatus = null
250
+ // if (prevProps !== this.props) {
251
+ // const { status } = this.state
252
+ // if (this.props.in) {
253
+ // if (status !== ENTERING && status !== ENTERED) {
254
+ // nextStatus = ENTERING
255
+ // }
256
+ // } else {
257
+ // if (status === ENTERING || status === ENTERED) {
258
+ // nextStatus = EXITING
259
+ // }
260
+ // }
261
+ // }
262
+ // return { nextStatus }
263
+ // }
264
+ ;
265
+
266
+ var _proto = Transition.prototype;
267
+
268
+ _proto.componentDidMount = function componentDidMount() {
269
+ this.updateStatus(true, this.appearStatus);
270
+ };
271
+
272
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
273
+ var nextStatus = null;
274
+
275
+ if (prevProps !== this.props) {
276
+ var status = this.state.status;
277
+
278
+ if (this.props.in) {
279
+ if (status !== ENTERING && status !== ENTERED) {
280
+ nextStatus = ENTERING;
281
+ }
282
+ } else {
283
+ if (status === ENTERING || status === ENTERED) {
284
+ nextStatus = EXITING;
285
+ }
286
+ }
287
+ }
288
+
289
+ this.updateStatus(false, nextStatus);
290
+ };
291
+
292
+ _proto.componentWillUnmount = function componentWillUnmount() {
293
+ this.cancelNextCallback();
294
+ };
295
+
296
+ _proto.getTimeouts = function getTimeouts() {
297
+ var timeout = this.props.timeout;
298
+ var exit, enter, appear;
299
+ exit = enter = appear = timeout;
300
+
301
+ if (timeout != null && typeof timeout !== 'number') {
302
+ exit = timeout.exit;
303
+ enter = timeout.enter; // TODO: remove fallback for next major
304
+
305
+ appear = timeout.appear !== undefined ? timeout.appear : enter;
306
+ }
307
+
308
+ return {
309
+ exit: exit,
310
+ enter: enter,
311
+ appear: appear
312
+ };
313
+ };
314
+
315
+ _proto.updateStatus = function updateStatus(mounting, nextStatus) {
316
+ if (mounting === void 0) {
317
+ mounting = false;
318
+ }
319
+
320
+ if (nextStatus !== null) {
321
+ // nextStatus will always be ENTERING or EXITING.
322
+ this.cancelNextCallback();
323
+
324
+ if (nextStatus === ENTERING) {
325
+ if (this.props.unmountOnExit || this.props.mountOnEnter) {
326
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
327
+ // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
328
+ // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
329
+
330
+ if (node) forceReflow(node);
331
+ }
332
+
333
+ this.performEnter(mounting);
334
+ } else {
335
+ this.performExit();
336
+ }
337
+ } else if (this.props.unmountOnExit && this.state.status === EXITED) {
338
+ this.setState({
339
+ status: UNMOUNTED
340
+ });
341
+ }
342
+ };
343
+
344
+ _proto.performEnter = function performEnter(mounting) {
345
+ var _this2 = this;
346
+
347
+ var enter = this.props.enter;
348
+ var appearing = this.context ? this.context.isMounting : mounting;
349
+
350
+ var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],
351
+ maybeNode = _ref2[0],
352
+ maybeAppearing = _ref2[1];
353
+
354
+ var timeouts = this.getTimeouts();
355
+ var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
356
+ // if we are mounting and running this it means appear _must_ be set
357
+
358
+ if (!mounting && !enter || config.disabled) {
359
+ this.safeSetState({
360
+ status: ENTERED
361
+ }, function () {
362
+ _this2.props.onEntered(maybeNode);
363
+ });
364
+ return;
365
+ }
366
+
367
+ this.props.onEnter(maybeNode, maybeAppearing);
368
+ this.safeSetState({
369
+ status: ENTERING
370
+ }, function () {
371
+ _this2.props.onEntering(maybeNode, maybeAppearing);
372
+
373
+ _this2.onTransitionEnd(enterTimeout, function () {
374
+ _this2.safeSetState({
375
+ status: ENTERED
376
+ }, function () {
377
+ _this2.props.onEntered(maybeNode, maybeAppearing);
378
+ });
379
+ });
380
+ });
381
+ };
382
+
383
+ _proto.performExit = function performExit() {
384
+ var _this3 = this;
385
+
386
+ var exit = this.props.exit;
387
+ var timeouts = this.getTimeouts();
388
+ var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED
389
+
390
+ if (!exit || config.disabled) {
391
+ this.safeSetState({
392
+ status: EXITED
393
+ }, function () {
394
+ _this3.props.onExited(maybeNode);
395
+ });
396
+ return;
397
+ }
398
+
399
+ this.props.onExit(maybeNode);
400
+ this.safeSetState({
401
+ status: EXITING
402
+ }, function () {
403
+ _this3.props.onExiting(maybeNode);
404
+
405
+ _this3.onTransitionEnd(timeouts.exit, function () {
406
+ _this3.safeSetState({
407
+ status: EXITED
408
+ }, function () {
409
+ _this3.props.onExited(maybeNode);
410
+ });
411
+ });
412
+ });
413
+ };
414
+
415
+ _proto.cancelNextCallback = function cancelNextCallback() {
416
+ if (this.nextCallback !== null) {
417
+ this.nextCallback.cancel();
418
+ this.nextCallback = null;
419
+ }
420
+ };
421
+
422
+ _proto.safeSetState = function safeSetState(nextState, callback) {
423
+ // This shouldn't be necessary, but there are weird race conditions with
424
+ // setState callbacks and unmounting in testing, so always make sure that
425
+ // we can cancel any pending setState callbacks after we unmount.
426
+ callback = this.setNextCallback(callback);
427
+ this.setState(nextState, callback);
428
+ };
429
+
430
+ _proto.setNextCallback = function setNextCallback(callback) {
431
+ var _this4 = this;
432
+
433
+ var active = true;
434
+
435
+ this.nextCallback = function (event) {
436
+ if (active) {
437
+ active = false;
438
+ _this4.nextCallback = null;
439
+ callback(event);
440
+ }
441
+ };
442
+
443
+ this.nextCallback.cancel = function () {
444
+ active = false;
445
+ };
446
+
447
+ return this.nextCallback;
448
+ };
449
+
450
+ _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
451
+ this.setNextCallback(handler);
452
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
453
+ var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
454
+
455
+ if (!node || doesNotHaveTimeoutOrListener) {
456
+ setTimeout(this.nextCallback, 0);
457
+ return;
458
+ }
459
+
460
+ if (this.props.addEndListener) {
461
+ var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
462
+ maybeNode = _ref3[0],
463
+ maybeNextCallback = _ref3[1];
464
+
465
+ this.props.addEndListener(maybeNode, maybeNextCallback);
466
+ }
467
+
468
+ if (timeout != null) {
469
+ setTimeout(this.nextCallback, timeout);
470
+ }
471
+ };
472
+
473
+ _proto.render = function render() {
474
+ var status = this.state.status;
475
+
476
+ if (status === UNMOUNTED) {
477
+ return null;
478
+ }
479
+
480
+ var _this$props = this.props,
481
+ children = _this$props.children;
482
+ _this$props.in;
483
+ _this$props.mountOnEnter;
484
+ _this$props.unmountOnExit;
485
+ _this$props.appear;
486
+ _this$props.enter;
487
+ _this$props.exit;
488
+ _this$props.timeout;
489
+ _this$props.addEndListener;
490
+ _this$props.onEnter;
491
+ _this$props.onEntering;
492
+ _this$props.onEntered;
493
+ _this$props.onExit;
494
+ _this$props.onExiting;
495
+ _this$props.onExited;
496
+ _this$props.nodeRef;
497
+ var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
498
+
499
+ return (
500
+ /*#__PURE__*/
501
+ // allows for nested Transitions
502
+ React__default.createElement(TransitionGroupContext.Provider, {
503
+ value: null
504
+ }, typeof children === 'function' ? children(status, childProps) : React__default.cloneElement(React__default.Children.only(children), childProps))
505
+ );
506
+ };
507
+
508
+ return Transition;
509
+ }(React__default.Component);
510
+
511
+ Transition.contextType = TransitionGroupContext;
512
+ Transition.propTypes = {}; // Name the function so it is clearer in the documentation
513
+
514
+ function noop() {}
515
+
516
+ Transition.defaultProps = {
517
+ in: false,
518
+ mountOnEnter: false,
519
+ unmountOnExit: false,
520
+ appear: false,
521
+ enter: true,
522
+ exit: true,
523
+ onEnter: noop,
524
+ onEntering: noop,
525
+ onEntered: noop,
526
+ onExit: noop,
527
+ onExiting: noop,
528
+ onExited: noop
529
+ };
530
+ Transition.UNMOUNTED = UNMOUNTED;
531
+ Transition.EXITED = EXITED;
532
+ Transition.ENTERING = ENTERING;
533
+ Transition.ENTERED = ENTERED;
534
+ Transition.EXITING = EXITING;
535
+
536
+ var _addClass = function addClass$1(node, classes) {
537
+ return node && classes && classes.split(' ').forEach(function (c) {
538
+ return addClass(node, c);
539
+ });
540
+ };
541
+
542
+ var removeClass = function removeClass(node, classes) {
543
+ return node && classes && classes.split(' ').forEach(function (c) {
544
+ return removeClass$1(node, c);
545
+ });
546
+ };
547
+ /**
548
+ * A transition component inspired by the excellent
549
+ * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
550
+ * use it if you're using CSS transitions or animations. It's built upon the
551
+ * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
552
+ * component, so it inherits all of its props.
553
+ *
554
+ * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
555
+ * and `exit` states of the transition. The first class is applied and then a
556
+ * second `*-active` class in order to activate the CSS transition. After the
557
+ * transition, matching `*-done` class names are applied to persist the
558
+ * transition state.
559
+ *
560
+ * ```jsx
561
+ * function App() {
562
+ * const [inProp, setInProp] = useState(false);
563
+ * return (
564
+ * <div>
565
+ * <CSSTransition in={inProp} timeout={200} classNames="my-node">
566
+ * <div>
567
+ * {"I'll receive my-node-* classes"}
568
+ * </div>
569
+ * </CSSTransition>
570
+ * <button type="button" onClick={() => setInProp(true)}>
571
+ * Click to Enter
572
+ * </button>
573
+ * </div>
574
+ * );
575
+ * }
576
+ * ```
577
+ *
578
+ * When the `in` prop is set to `true`, the child component will first receive
579
+ * the class `example-enter`, then the `example-enter-active` will be added in
580
+ * the next tick. `CSSTransition` [forces a
581
+ * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
582
+ * between before adding the `example-enter-active`. This is an important trick
583
+ * because it allows us to transition between `example-enter` and
584
+ * `example-enter-active` even though they were added immediately one after
585
+ * another. Most notably, this is what makes it possible for us to animate
586
+ * _appearance_.
587
+ *
588
+ * ```css
589
+ * .my-node-enter {
590
+ * opacity: 0;
591
+ * }
592
+ * .my-node-enter-active {
593
+ * opacity: 1;
594
+ * transition: opacity 200ms;
595
+ * }
596
+ * .my-node-exit {
597
+ * opacity: 1;
598
+ * }
599
+ * .my-node-exit-active {
600
+ * opacity: 0;
601
+ * transition: opacity 200ms;
602
+ * }
603
+ * ```
604
+ *
605
+ * `*-active` classes represent which styles you want to animate **to**, so it's
606
+ * important to add `transition` declaration only to them, otherwise transitions
607
+ * might not behave as intended! This might not be obvious when the transitions
608
+ * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
609
+ * the example above (minus `transition`), but it becomes apparent in more
610
+ * complex transitions.
611
+ *
612
+ * **Note**: If you're using the
613
+ * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
614
+ * prop, make sure to define styles for `.appear-*` classes as well.
615
+ */
616
+
617
+
618
+ var CSSTransition = /*#__PURE__*/function (_React$Component) {
619
+ _inheritsLoose(CSSTransition, _React$Component);
620
+
621
+ function CSSTransition() {
622
+ var _this;
623
+
624
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
625
+ args[_key] = arguments[_key];
626
+ }
627
+
628
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
629
+ _this.appliedClasses = {
630
+ appear: {},
631
+ enter: {},
632
+ exit: {}
633
+ };
634
+
635
+ _this.onEnter = function (maybeNode, maybeAppearing) {
636
+ var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
637
+ node = _this$resolveArgument[0],
638
+ appearing = _this$resolveArgument[1];
639
+
640
+ _this.removeClasses(node, 'exit');
641
+
642
+ _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
643
+
644
+ if (_this.props.onEnter) {
645
+ _this.props.onEnter(maybeNode, maybeAppearing);
646
+ }
647
+ };
648
+
649
+ _this.onEntering = function (maybeNode, maybeAppearing) {
650
+ var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
651
+ node = _this$resolveArgument2[0],
652
+ appearing = _this$resolveArgument2[1];
653
+
654
+ var type = appearing ? 'appear' : 'enter';
655
+
656
+ _this.addClass(node, type, 'active');
657
+
658
+ if (_this.props.onEntering) {
659
+ _this.props.onEntering(maybeNode, maybeAppearing);
660
+ }
661
+ };
662
+
663
+ _this.onEntered = function (maybeNode, maybeAppearing) {
664
+ var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
665
+ node = _this$resolveArgument3[0],
666
+ appearing = _this$resolveArgument3[1];
667
+
668
+ var type = appearing ? 'appear' : 'enter';
669
+
670
+ _this.removeClasses(node, type);
671
+
672
+ _this.addClass(node, type, 'done');
673
+
674
+ if (_this.props.onEntered) {
675
+ _this.props.onEntered(maybeNode, maybeAppearing);
676
+ }
677
+ };
678
+
679
+ _this.onExit = function (maybeNode) {
680
+ var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
681
+ node = _this$resolveArgument4[0];
682
+
683
+ _this.removeClasses(node, 'appear');
684
+
685
+ _this.removeClasses(node, 'enter');
686
+
687
+ _this.addClass(node, 'exit', 'base');
688
+
689
+ if (_this.props.onExit) {
690
+ _this.props.onExit(maybeNode);
691
+ }
692
+ };
693
+
694
+ _this.onExiting = function (maybeNode) {
695
+ var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
696
+ node = _this$resolveArgument5[0];
697
+
698
+ _this.addClass(node, 'exit', 'active');
699
+
700
+ if (_this.props.onExiting) {
701
+ _this.props.onExiting(maybeNode);
702
+ }
703
+ };
704
+
705
+ _this.onExited = function (maybeNode) {
706
+ var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
707
+ node = _this$resolveArgument6[0];
708
+
709
+ _this.removeClasses(node, 'exit');
710
+
711
+ _this.addClass(node, 'exit', 'done');
712
+
713
+ if (_this.props.onExited) {
714
+ _this.props.onExited(maybeNode);
715
+ }
716
+ };
717
+
718
+ _this.resolveArguments = function (maybeNode, maybeAppearing) {
719
+ return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
720
+ : [maybeNode, maybeAppearing];
721
+ };
722
+
723
+ _this.getClassNames = function (type) {
724
+ var classNames = _this.props.classNames;
725
+ var isStringClassNames = typeof classNames === 'string';
726
+ var prefix = isStringClassNames && classNames ? classNames + "-" : '';
727
+ var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
728
+ var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
729
+ var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
730
+ return {
731
+ baseClassName: baseClassName,
732
+ activeClassName: activeClassName,
733
+ doneClassName: doneClassName
734
+ };
735
+ };
736
+
737
+ return _this;
738
+ }
739
+
740
+ var _proto = CSSTransition.prototype;
741
+
742
+ _proto.addClass = function addClass(node, type, phase) {
743
+ var className = this.getClassNames(type)[phase + "ClassName"];
744
+
745
+ var _this$getClassNames = this.getClassNames('enter'),
746
+ doneClassName = _this$getClassNames.doneClassName;
747
+
748
+ if (type === 'appear' && phase === 'done' && doneClassName) {
749
+ className += " " + doneClassName;
750
+ } // This is to force a repaint,
751
+ // which is necessary in order to transition styles when adding a class name.
752
+
753
+
754
+ if (phase === 'active') {
755
+ if (node) forceReflow(node);
756
+ }
757
+
758
+ if (className) {
759
+ this.appliedClasses[type][phase] = className;
760
+
761
+ _addClass(node, className);
762
+ }
763
+ };
764
+
765
+ _proto.removeClasses = function removeClasses(node, type) {
766
+ var _this$appliedClasses$ = this.appliedClasses[type],
767
+ baseClassName = _this$appliedClasses$.base,
768
+ activeClassName = _this$appliedClasses$.active,
769
+ doneClassName = _this$appliedClasses$.done;
770
+ this.appliedClasses[type] = {};
771
+
772
+ if (baseClassName) {
773
+ removeClass(node, baseClassName);
774
+ }
775
+
776
+ if (activeClassName) {
777
+ removeClass(node, activeClassName);
778
+ }
779
+
780
+ if (doneClassName) {
781
+ removeClass(node, doneClassName);
782
+ }
783
+ };
784
+
785
+ _proto.render = function render() {
786
+ var _this$props = this.props;
787
+ _this$props.classNames;
788
+ var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
789
+
790
+ return /*#__PURE__*/React__default.createElement(Transition, _extends({}, props, {
791
+ onEnter: this.onEnter,
792
+ onEntered: this.onEntered,
793
+ onEntering: this.onEntering,
794
+ onExit: this.onExit,
795
+ onExiting: this.onExiting,
796
+ onExited: this.onExited
797
+ }));
798
+ };
799
+
800
+ return CSSTransition;
801
+ }(React__default.Component);
802
+
803
+ CSSTransition.defaultProps = {
804
+ classNames: ''
805
+ };
806
+ CSSTransition.propTypes = {};
807
+
808
+ function _assertThisInitialized(self) {
809
+ if (self === void 0) {
810
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
811
+ }
812
+ return self;
813
+ }
814
+
815
+ /**
816
+ * Given `this.props.children`, return an object mapping key to child.
817
+ *
818
+ * @param {*} children `this.props.children`
819
+ * @return {object} Mapping of key to child
820
+ */
821
+
822
+ function getChildMapping(children, mapFn) {
823
+ var mapper = function mapper(child) {
824
+ return mapFn && isValidElement(child) ? mapFn(child) : child;
825
+ };
826
+
827
+ var result = Object.create(null);
828
+ if (children) Children.map(children, function (c) {
829
+ return c;
830
+ }).forEach(function (child) {
831
+ // run the map function here instead so that the key is the computed one
832
+ result[child.key] = mapper(child);
833
+ });
834
+ return result;
835
+ }
836
+ /**
837
+ * When you're adding or removing children some may be added or removed in the
838
+ * same render pass. We want to show *both* since we want to simultaneously
839
+ * animate elements in and out. This function takes a previous set of keys
840
+ * and a new set of keys and merges them with its best guess of the correct
841
+ * ordering. In the future we may expose some of the utilities in
842
+ * ReactMultiChild to make this easy, but for now React itself does not
843
+ * directly have this concept of the union of prevChildren and nextChildren
844
+ * so we implement it here.
845
+ *
846
+ * @param {object} prev prev children as returned from
847
+ * `ReactTransitionChildMapping.getChildMapping()`.
848
+ * @param {object} next next children as returned from
849
+ * `ReactTransitionChildMapping.getChildMapping()`.
850
+ * @return {object} a key set that contains all keys in `prev` and all keys
851
+ * in `next` in a reasonable order.
852
+ */
853
+
854
+ function mergeChildMappings(prev, next) {
855
+ prev = prev || {};
856
+ next = next || {};
857
+
858
+ function getValueForKey(key) {
859
+ return key in next ? next[key] : prev[key];
860
+ } // For each key of `next`, the list of keys to insert before that key in
861
+ // the combined list
862
+
863
+
864
+ var nextKeysPending = Object.create(null);
865
+ var pendingKeys = [];
866
+
867
+ for (var prevKey in prev) {
868
+ if (prevKey in next) {
869
+ if (pendingKeys.length) {
870
+ nextKeysPending[prevKey] = pendingKeys;
871
+ pendingKeys = [];
872
+ }
873
+ } else {
874
+ pendingKeys.push(prevKey);
875
+ }
876
+ }
877
+
878
+ var i;
879
+ var childMapping = {};
880
+
881
+ for (var nextKey in next) {
882
+ if (nextKeysPending[nextKey]) {
883
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
884
+ var pendingNextKey = nextKeysPending[nextKey][i];
885
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
886
+ }
887
+ }
888
+
889
+ childMapping[nextKey] = getValueForKey(nextKey);
890
+ } // Finally, add the keys which didn't appear before any key in `next`
891
+
892
+
893
+ for (i = 0; i < pendingKeys.length; i++) {
894
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
895
+ }
896
+
897
+ return childMapping;
898
+ }
899
+
900
+ function getProp(child, prop, props) {
901
+ return props[prop] != null ? props[prop] : child.props[prop];
902
+ }
903
+
904
+ function getInitialChildMapping(props, onExited) {
905
+ return getChildMapping(props.children, function (child) {
906
+ return cloneElement(child, {
907
+ onExited: onExited.bind(null, child),
908
+ in: true,
909
+ appear: getProp(child, 'appear', props),
910
+ enter: getProp(child, 'enter', props),
911
+ exit: getProp(child, 'exit', props)
912
+ });
913
+ });
914
+ }
915
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
916
+ var nextChildMapping = getChildMapping(nextProps.children);
917
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
918
+ Object.keys(children).forEach(function (key) {
919
+ var child = children[key];
920
+ if (!isValidElement(child)) return;
921
+ var hasPrev = (key in prevChildMapping);
922
+ var hasNext = (key in nextChildMapping);
923
+ var prevChild = prevChildMapping[key];
924
+ var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
925
+
926
+ if (hasNext && (!hasPrev || isLeaving)) {
927
+ // console.log('entering', key)
928
+ children[key] = cloneElement(child, {
929
+ onExited: onExited.bind(null, child),
930
+ in: true,
931
+ exit: getProp(child, 'exit', nextProps),
932
+ enter: getProp(child, 'enter', nextProps)
933
+ });
934
+ } else if (!hasNext && hasPrev && !isLeaving) {
935
+ // item is old (exiting)
936
+ // console.log('leaving', key)
937
+ children[key] = cloneElement(child, {
938
+ in: false
939
+ });
940
+ } else if (hasNext && hasPrev && isValidElement(prevChild)) {
941
+ // item hasn't changed transition states
942
+ // copy over the last transition props;
943
+ // console.log('unchanged', key)
944
+ children[key] = cloneElement(child, {
945
+ onExited: onExited.bind(null, child),
946
+ in: prevChild.props.in,
947
+ exit: getProp(child, 'exit', nextProps),
948
+ enter: getProp(child, 'enter', nextProps)
949
+ });
950
+ }
951
+ });
952
+ return children;
953
+ }
954
+
955
+ var values = Object.values || function (obj) {
956
+ return Object.keys(obj).map(function (k) {
957
+ return obj[k];
958
+ });
959
+ };
960
+
961
+ var defaultProps = {
962
+ component: 'div',
963
+ childFactory: function childFactory(child) {
964
+ return child;
965
+ }
966
+ };
967
+ /**
968
+ * The `<TransitionGroup>` component manages a set of transition components
969
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
970
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
971
+ * and unmounting of components over time.
972
+ *
973
+ * Consider the example below. As items are removed or added to the TodoList the
974
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
975
+ *
976
+ * Note that `<TransitionGroup>` does not define any animation behavior!
977
+ * Exactly _how_ a list item animates is up to the individual transition
978
+ * component. This means you can mix and match animations across different list
979
+ * items.
980
+ */
981
+
982
+ var TransitionGroup = /*#__PURE__*/function (_React$Component) {
983
+ _inheritsLoose(TransitionGroup, _React$Component);
984
+
985
+ function TransitionGroup(props, context) {
986
+ var _this;
987
+
988
+ _this = _React$Component.call(this, props, context) || this;
989
+
990
+ var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
991
+
992
+
993
+ _this.state = {
994
+ contextValue: {
995
+ isMounting: true
996
+ },
997
+ handleExited: handleExited,
998
+ firstRender: true
999
+ };
1000
+ return _this;
1001
+ }
1002
+
1003
+ var _proto = TransitionGroup.prototype;
1004
+
1005
+ _proto.componentDidMount = function componentDidMount() {
1006
+ this.mounted = true;
1007
+ this.setState({
1008
+ contextValue: {
1009
+ isMounting: false
1010
+ }
1011
+ });
1012
+ };
1013
+
1014
+ _proto.componentWillUnmount = function componentWillUnmount() {
1015
+ this.mounted = false;
1016
+ };
1017
+
1018
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
1019
+ var prevChildMapping = _ref.children,
1020
+ handleExited = _ref.handleExited,
1021
+ firstRender = _ref.firstRender;
1022
+ return {
1023
+ children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
1024
+ firstRender: false
1025
+ };
1026
+ } // node is `undefined` when user provided `nodeRef` prop
1027
+ ;
1028
+
1029
+ _proto.handleExited = function handleExited(child, node) {
1030
+ var currentChildMapping = getChildMapping(this.props.children);
1031
+ if (child.key in currentChildMapping) return;
1032
+
1033
+ if (child.props.onExited) {
1034
+ child.props.onExited(node);
1035
+ }
1036
+
1037
+ if (this.mounted) {
1038
+ this.setState(function (state) {
1039
+ var children = _extends({}, state.children);
1040
+
1041
+ delete children[child.key];
1042
+ return {
1043
+ children: children
1044
+ };
1045
+ });
1046
+ }
1047
+ };
1048
+
1049
+ _proto.render = function render() {
1050
+ var _this$props = this.props,
1051
+ Component = _this$props.component,
1052
+ childFactory = _this$props.childFactory,
1053
+ props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
1054
+
1055
+ var contextValue = this.state.contextValue;
1056
+ var children = values(this.state.children).map(childFactory);
1057
+ delete props.appear;
1058
+ delete props.enter;
1059
+ delete props.exit;
1060
+
1061
+ if (Component === null) {
1062
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
1063
+ value: contextValue
1064
+ }, children);
1065
+ }
1066
+
1067
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
1068
+ value: contextValue
1069
+ }, /*#__PURE__*/React__default.createElement(Component, props, children));
1070
+ };
1071
+
1072
+ return TransitionGroup;
1073
+ }(React__default.Component);
1074
+
1075
+ TransitionGroup.propTypes = {};
1076
+ TransitionGroup.defaultProps = defaultProps;
1077
+
1078
+ /**
1079
+ * The `<ReplaceTransition>` component is a specialized `Transition` component
1080
+ * that animates between two children.
1081
+ *
1082
+ * ```jsx
1083
+ * <ReplaceTransition in>
1084
+ * <Fade><div>I appear first</div></Fade>
1085
+ * <Fade><div>I replace the above</div></Fade>
1086
+ * </ReplaceTransition>
1087
+ * ```
1088
+ */
1089
+
1090
+ var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
1091
+ _inheritsLoose(ReplaceTransition, _React$Component);
1092
+
1093
+ function ReplaceTransition() {
1094
+ var _this;
1095
+
1096
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
1097
+ _args[_key] = arguments[_key];
1098
+ }
1099
+
1100
+ _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
1101
+
1102
+ _this.handleEnter = function () {
1103
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1104
+ args[_key2] = arguments[_key2];
1105
+ }
1106
+
1107
+ return _this.handleLifecycle('onEnter', 0, args);
1108
+ };
1109
+
1110
+ _this.handleEntering = function () {
1111
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1112
+ args[_key3] = arguments[_key3];
1113
+ }
1114
+
1115
+ return _this.handleLifecycle('onEntering', 0, args);
1116
+ };
1117
+
1118
+ _this.handleEntered = function () {
1119
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1120
+ args[_key4] = arguments[_key4];
1121
+ }
1122
+
1123
+ return _this.handleLifecycle('onEntered', 0, args);
1124
+ };
1125
+
1126
+ _this.handleExit = function () {
1127
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1128
+ args[_key5] = arguments[_key5];
1129
+ }
1130
+
1131
+ return _this.handleLifecycle('onExit', 1, args);
1132
+ };
1133
+
1134
+ _this.handleExiting = function () {
1135
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1136
+ args[_key6] = arguments[_key6];
1137
+ }
1138
+
1139
+ return _this.handleLifecycle('onExiting', 1, args);
1140
+ };
1141
+
1142
+ _this.handleExited = function () {
1143
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1144
+ args[_key7] = arguments[_key7];
1145
+ }
1146
+
1147
+ return _this.handleLifecycle('onExited', 1, args);
1148
+ };
1149
+
1150
+ return _this;
1151
+ }
1152
+
1153
+ var _proto = ReplaceTransition.prototype;
1154
+
1155
+ _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
1156
+ var _child$props;
1157
+
1158
+ var children = this.props.children;
1159
+ var child = React__default.Children.toArray(children)[idx];
1160
+ if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
1161
+
1162
+ if (this.props[handler]) {
1163
+ var maybeNode = child.props.nodeRef ? undefined : ReactDOM.findDOMNode(this);
1164
+ this.props[handler](maybeNode);
1165
+ }
1166
+ };
1167
+
1168
+ _proto.render = function render() {
1169
+ var _this$props = this.props,
1170
+ children = _this$props.children,
1171
+ inProp = _this$props.in,
1172
+ props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
1173
+
1174
+ var _React$Children$toArr = React__default.Children.toArray(children),
1175
+ first = _React$Children$toArr[0],
1176
+ second = _React$Children$toArr[1];
1177
+
1178
+ delete props.onEnter;
1179
+ delete props.onEntering;
1180
+ delete props.onEntered;
1181
+ delete props.onExit;
1182
+ delete props.onExiting;
1183
+ delete props.onExited;
1184
+ return /*#__PURE__*/React__default.createElement(TransitionGroup, props, inProp ? React__default.cloneElement(first, {
1185
+ key: 'first',
1186
+ onEnter: this.handleEnter,
1187
+ onEntering: this.handleEntering,
1188
+ onEntered: this.handleEntered
1189
+ }) : React__default.cloneElement(second, {
1190
+ key: 'second',
1191
+ onEnter: this.handleExit,
1192
+ onEntering: this.handleExiting,
1193
+ onEntered: this.handleExited
1194
+ }));
1195
+ };
1196
+
1197
+ return ReplaceTransition;
1198
+ }(React__default.Component);
1199
+
1200
+ ReplaceTransition.propTypes = {};
1201
+
1202
+ var _leaveRenders, _enterRenders;
1203
+
1204
+ function areChildrenDifferent(oldChildren, newChildren) {
1205
+ if (oldChildren === newChildren) return false;
1206
+
1207
+ if (React__default.isValidElement(oldChildren) && React__default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
1208
+ return false;
1209
+ }
1210
+
1211
+ return true;
1212
+ }
1213
+ /**
1214
+ * Enum of modes for SwitchTransition component
1215
+ * @enum { string }
1216
+ */
1217
+
1218
+
1219
+ var modes = {
1220
+ out: 'out-in',
1221
+ in: 'in-out'
1222
+ };
1223
+
1224
+ var callHook = function callHook(element, name, cb) {
1225
+ return function () {
1226
+ var _element$props;
1227
+
1228
+ element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
1229
+ cb();
1230
+ };
1231
+ };
1232
+
1233
+ var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
1234
+ var current = _ref.current,
1235
+ changeState = _ref.changeState;
1236
+ return React__default.cloneElement(current, {
1237
+ in: false,
1238
+ onExited: callHook(current, 'onExited', function () {
1239
+ changeState(ENTERING, null);
1240
+ })
1241
+ });
1242
+ }, _leaveRenders[modes.in] = function (_ref2) {
1243
+ var current = _ref2.current,
1244
+ changeState = _ref2.changeState,
1245
+ children = _ref2.children;
1246
+ return [current, React__default.cloneElement(children, {
1247
+ in: true,
1248
+ onEntered: callHook(children, 'onEntered', function () {
1249
+ changeState(ENTERING);
1250
+ })
1251
+ })];
1252
+ }, _leaveRenders);
1253
+ var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
1254
+ var children = _ref3.children,
1255
+ changeState = _ref3.changeState;
1256
+ return React__default.cloneElement(children, {
1257
+ in: true,
1258
+ onEntered: callHook(children, 'onEntered', function () {
1259
+ changeState(ENTERED, React__default.cloneElement(children, {
1260
+ in: true
1261
+ }));
1262
+ })
1263
+ });
1264
+ }, _enterRenders[modes.in] = function (_ref4) {
1265
+ var current = _ref4.current,
1266
+ children = _ref4.children,
1267
+ changeState = _ref4.changeState;
1268
+ return [React__default.cloneElement(current, {
1269
+ in: false,
1270
+ onExited: callHook(current, 'onExited', function () {
1271
+ changeState(ENTERED, React__default.cloneElement(children, {
1272
+ in: true
1273
+ }));
1274
+ })
1275
+ }), React__default.cloneElement(children, {
1276
+ in: true
1277
+ })];
1278
+ }, _enterRenders);
1279
+ /**
1280
+ * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
1281
+ * You can use it when you want to control the render between state transitions.
1282
+ * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them.
1283
+ *
1284
+ * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
1285
+ * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child.
1286
+ *
1287
+ * **Note**: If you want the animation to happen simultaneously
1288
+ * (that is, to have the old child removed and a new child inserted **at the same time**),
1289
+ * you should use
1290
+ * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
1291
+ * instead.
1292
+ *
1293
+ * ```jsx
1294
+ * function App() {
1295
+ * const [state, setState] = useState(false);
1296
+ * return (
1297
+ * <SwitchTransition>
1298
+ * <CSSTransition
1299
+ * key={state ? "Goodbye, world!" : "Hello, world!"}
1300
+ * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
1301
+ * classNames='fade'
1302
+ * >
1303
+ * <button onClick={() => setState(state => !state)}>
1304
+ * {state ? "Goodbye, world!" : "Hello, world!"}
1305
+ * </button>
1306
+ * </CSSTransition>
1307
+ * </SwitchTransition>
1308
+ * );
1309
+ * }
1310
+ * ```
1311
+ *
1312
+ * ```css
1313
+ * .fade-enter{
1314
+ * opacity: 0;
1315
+ * }
1316
+ * .fade-exit{
1317
+ * opacity: 1;
1318
+ * }
1319
+ * .fade-enter-active{
1320
+ * opacity: 1;
1321
+ * }
1322
+ * .fade-exit-active{
1323
+ * opacity: 0;
1324
+ * }
1325
+ * .fade-enter-active,
1326
+ * .fade-exit-active{
1327
+ * transition: opacity 500ms;
1328
+ * }
1329
+ * ```
1330
+ */
1331
+
1332
+ var SwitchTransition = /*#__PURE__*/function (_React$Component) {
1333
+ _inheritsLoose(SwitchTransition, _React$Component);
1334
+
1335
+ function SwitchTransition() {
1336
+ var _this;
1337
+
1338
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1339
+ args[_key] = arguments[_key];
1340
+ }
1341
+
1342
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
1343
+ _this.state = {
1344
+ status: ENTERED,
1345
+ current: null
1346
+ };
1347
+ _this.appeared = false;
1348
+
1349
+ _this.changeState = function (status, current) {
1350
+ if (current === void 0) {
1351
+ current = _this.state.current;
1352
+ }
1353
+
1354
+ _this.setState({
1355
+ status: status,
1356
+ current: current
1357
+ });
1358
+ };
1359
+
1360
+ return _this;
1361
+ }
1362
+
1363
+ var _proto = SwitchTransition.prototype;
1364
+
1365
+ _proto.componentDidMount = function componentDidMount() {
1366
+ this.appeared = true;
1367
+ };
1368
+
1369
+ SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
1370
+ if (props.children == null) {
1371
+ return {
1372
+ current: null
1373
+ };
1374
+ }
1375
+
1376
+ if (state.status === ENTERING && props.mode === modes.in) {
1377
+ return {
1378
+ status: ENTERING
1379
+ };
1380
+ }
1381
+
1382
+ if (state.current && areChildrenDifferent(state.current, props.children)) {
1383
+ return {
1384
+ status: EXITING
1385
+ };
1386
+ }
1387
+
1388
+ return {
1389
+ current: React__default.cloneElement(props.children, {
1390
+ in: true
1391
+ })
1392
+ };
1393
+ };
1394
+
1395
+ _proto.render = function render() {
1396
+ var _this$props = this.props,
1397
+ children = _this$props.children,
1398
+ mode = _this$props.mode,
1399
+ _this$state = this.state,
1400
+ status = _this$state.status,
1401
+ current = _this$state.current;
1402
+ var data = {
1403
+ children: children,
1404
+ current: current,
1405
+ changeState: this.changeState,
1406
+ status: status
1407
+ };
1408
+ var component;
1409
+
1410
+ switch (status) {
1411
+ case ENTERING:
1412
+ component = enterRenders[mode](data);
1413
+ break;
1414
+
1415
+ case EXITING:
1416
+ component = leaveRenders[mode](data);
1417
+ break;
1418
+
1419
+ case ENTERED:
1420
+ component = current;
1421
+ }
1422
+
1423
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
1424
+ value: {
1425
+ isMounting: !this.appeared
1426
+ }
1427
+ }, component);
1428
+ };
1429
+
1430
+ return SwitchTransition;
1431
+ }(React__default.Component);
1432
+
1433
+ SwitchTransition.propTypes = {};
1434
+ SwitchTransition.defaultProps = {
1435
+ mode: modes.out
1436
+ };
1437
+
1438
+ var _excluded = ["children"];
1439
+ var Portal$1 = function Portal(_ref, ref) {
1440
+ var children = _ref.children,
1441
+ otherProps = _objectWithoutProperties(_ref, _excluded);
1442
+ return /*#__PURE__*/React__default.createElement("div", _extends$1({
1443
+ "data-cy": "neeto-backdrop",
1444
+ "data-testid": "neeto-backdrop",
1445
+ ref: ref
1446
+ }, otherProps), children);
1447
+ };
1448
+ var Backdrop = /*#__PURE__*/forwardRef(Portal$1);
1449
+
1450
+ var Portal = function Portal(_ref) {
1451
+ var children = _ref.children,
1452
+ _ref$rootId = _ref.rootId,
1453
+ rootId = _ref$rootId === void 0 ? "root-portal" : _ref$rootId,
1454
+ _ref$el = _ref.el,
1455
+ el = _ref$el === void 0 ? "div" : _ref$el;
1456
+ var target = useRef(null);
1457
+ useEffect(function () {
1458
+ var container = document.getElementById(rootId);
1459
+ if (!container) {
1460
+ container = document.createElement(el);
1461
+ container.setAttribute("id", rootId);
1462
+ document.body.appendChild(container);
1463
+ }
1464
+ container.appendChild(target.current);
1465
+ return function () {
1466
+ target.current.remove();
1467
+ if (isEmpty(container.childNodes)) {
1468
+ container.remove();
1469
+ }
1470
+ };
1471
+ }, [rootId]);
1472
+ if (!target.current) {
1473
+ target.current = document.createElement(el);
1474
+ }
1475
+ return /*#__PURE__*/createPortal(children, target.current);
1476
+ };
1477
+
1478
+ var useOnClickOutside = function useOnClickOutside(insideRef, outsideRef, handler) {
1479
+ useEffect(function () {
1480
+ var listener = function listener(event) {
1481
+ // Do nothing if clicking ref's element or descendent elements
1482
+ if (!insideRef.current || insideRef.current.contains(event.target)) {
1483
+ return;
1484
+ }
1485
+ if (outsideRef.current) {
1486
+ // If Outside ref exists, trigger the handler if it contains the event target.
1487
+ if (outsideRef.current.contains(event.target)) {
1488
+ handler(event);
1489
+ }
1490
+ return;
1491
+ }
1492
+ handler(event);
1493
+ };
1494
+ document.addEventListener("mousedown", listener);
1495
+ document.addEventListener("touchstart", listener);
1496
+ return function () {
1497
+ document.removeEventListener("mousedown", listener);
1498
+ document.removeEventListener("touchstart", listener);
1499
+ };
1500
+ }, [insideRef, outsideRef, handler]);
1501
+ };
1502
+
1503
+ var useOverlay = function useOverlay(_ref) {
1504
+ var isOpen = _ref.isOpen,
1505
+ initialFocusRef = _ref.initialFocusRef,
1506
+ finalFocusRef = _ref.finalFocusRef,
1507
+ overlayWrapper = _ref.overlayWrapper,
1508
+ onClose = _ref.onClose,
1509
+ backdropRef = _ref.backdropRef,
1510
+ closeOnOutsideClick = _ref.closeOnOutsideClick,
1511
+ closeOnEsc = _ref.closeOnEsc,
1512
+ blockScrollOnMount = _ref.blockScrollOnMount,
1513
+ hasTransitionCompleted = _ref.hasTransitionCompleted;
1514
+ var elementToFocusRef = useRef(null);
1515
+ var bodyHeight = document.body.offsetHeight;
1516
+ var windowHeight = window.innerHeight;
1517
+ var hasScroll = bodyHeight > windowHeight;
1518
+ var shouldHideScrollAndAddMargin = hasScroll && blockScrollOnMount && manager.hasOverlays();
1519
+ var returnFocusToPreviousActiveElement = function returnFocusToPreviousActiveElement() {
1520
+ elementToFocusRef.current = manager.getFinalFocusInOverlay();
1521
+ if (!(finalFocusRef !== null && finalFocusRef !== void 0 && finalFocusRef.current)) {
1522
+ var _elementToFocusRef$cu;
1523
+ elementToFocusRef === null || elementToFocusRef === void 0 || (_elementToFocusRef$cu = elementToFocusRef.current) === null || _elementToFocusRef$cu === void 0 || _elementToFocusRef$cu.focus();
1524
+ } else {
1525
+ finalFocusRef.current.focus();
1526
+ }
1527
+ };
1528
+ var focusRequiredElementInOverlay = function focusRequiredElementInOverlay() {
1529
+ var _initialFocusRef;
1530
+ if (!hasTransitionCompleted) return;
1531
+ if ((_initialFocusRef = initialFocusRef) !== null && _initialFocusRef !== void 0 && _initialFocusRef.current) {
1532
+ var _initialFocusRef2;
1533
+ (_initialFocusRef2 = initialFocusRef) === null || _initialFocusRef2 === void 0 || (_initialFocusRef2 = _initialFocusRef2.current) === null || _initialFocusRef2 === void 0 || _initialFocusRef2.focus();
1534
+ } else {
1535
+ focusFirstFocusableElement(overlayWrapper);
1536
+ }
1537
+ };
1538
+ var handleOverlayClose = useCallback(function () {
1539
+ if (!manager.isTopOverlay(overlayWrapper)) return;
1540
+ returnFocusToPreviousActiveElement();
1541
+ onClose === null || onClose === void 0 || onClose();
1542
+ }, [onClose]);
1543
+ useOnClickOutside(overlayWrapper, backdropRef, closeOnOutsideClick ? handleOverlayClose : noop$1);
1544
+ var isTopOverlay = useSyncExternalStore(manager.subscribe, function () {
1545
+ return manager.isTopOverlay(overlayWrapper);
1546
+ });
1547
+ useHotKeys("escape", handleOverlayClose, {
1548
+ enabled: closeOnEsc
1549
+ });
1550
+ useEffect(function () {
1551
+ var cleanUp = noop$1;
1552
+ if (isOpen) {
1553
+ if (hasTransitionCompleted && isTopOverlay) {
1554
+ focusRequiredElementInOverlay();
1555
+ // Enable focus trap only for the topmost overlay
1556
+ cleanUp = trapFocusOnFocusableElements(overlayWrapper);
1557
+ }
1558
+ if (shouldHideScrollAndAddMargin) hideScrollAndAddMargin();
1559
+ }
1560
+ return function () {
1561
+ if (!manager.hasOverlays()) showScrollAndRemoveMargin();
1562
+ cleanUp();
1563
+ };
1564
+ }, [isOpen, hasTransitionCompleted, isTopOverlay]);
1565
+ var setFocusField = function setFocusField(fieldRef) {
1566
+ if (!fieldRef) return;
1567
+ initialFocusRef = {
1568
+ current: fieldRef
1569
+ };
1570
+ if (hasTransitionCompleted) focusRequiredElementInOverlay();
1571
+ };
1572
+ return {
1573
+ handleOverlayClose: handleOverlayClose,
1574
+ setFocusField: setFocusField
1575
+ };
1576
+ };
1577
+
1578
+ var useOverlayManager = function useOverlayManager(ref, isOpen) {
1579
+ var elementToFocus = document.activeElement;
1580
+ useEffect(function () {
1581
+ if (isOpen) {
1582
+ manager.add(ref, elementToFocus);
1583
+ }
1584
+ return function () {
1585
+ manager.remove(ref, elementToFocus);
1586
+ };
1587
+ }, [isOpen, ref]);
1588
+ };
1589
+
1590
+ export { Backdrop as B, CSSTransition as C, Portal as P, useOverlay as a, useOverlayManager as u };
1591
+ //# sourceMappingURL=useOverlayManager-95a474d5.js.map