@gravity-ui/navigation 2.33.0 → 3.0.0-beta-lunory.0

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 (278) hide show
  1. package/README.md +1 -1
  2. package/build/cjs/components/ActionBar/ActionBar.d.ts +3 -3
  3. package/build/cjs/components/ActionBar/__stories__/ActionBar.stories.d.ts +17 -0
  4. package/build/cjs/components/ActionBar/__stories__/ActionBarShowcase.d.ts +2 -0
  5. package/build/cjs/components/ActionBar/__stories__/ActionBarSingleSection.d.ts +2 -0
  6. package/build/cjs/components/ActionBar/__tests__/helpersPlaywright.d.ts +1 -1
  7. package/build/cjs/components/ActionBar/types.d.ts +1 -1
  8. package/build/cjs/components/AllPagesPanel/i18n/index.d.ts +5 -1
  9. package/build/cjs/components/AsideHeader/AsideHeaderContext.d.ts +1 -1
  10. package/build/cjs/components/AsideHeader/__stories__/AsideHeader.stories.d.ts +18 -0
  11. package/build/cjs/components/AsideHeader/__stories__/AsideHeaderShowcase.d.ts +14 -0
  12. package/build/cjs/components/AsideHeader/__stories__/getAsideHeaderWrapper.d.ts +3 -0
  13. package/build/cjs/components/AsideHeader/__stories__/moc.d.ts +6 -0
  14. package/build/cjs/components/AsideHeader/__tests__/helpersPlaywright.d.ts +1 -1
  15. package/build/cjs/components/AsideHeader/components/index.d.ts +0 -1
  16. package/build/cjs/components/AsideHeader/i18n/index.d.ts +5 -1
  17. package/build/cjs/components/AsideHeader/types.d.ts +3 -4
  18. package/build/cjs/components/CompositeBar/CompositeBar.d.ts +1 -1
  19. package/build/cjs/components/CompositeBar/HighlightedItem/HighlightedItem.d.ts +1 -1
  20. package/build/cjs/components/CompositeBar/Item/Item.d.ts +15 -2
  21. package/build/cjs/components/Drawer/Drawer.d.ts +0 -5
  22. package/build/cjs/components/Drawer/__stories__/DisablePortal.d.ts +3 -0
  23. package/build/cjs/components/Drawer/__stories__/Drawer.stories.d.ts +7 -0
  24. package/build/cjs/components/Drawer/__stories__/DrawerShowcase.d.ts +3 -0
  25. package/build/cjs/components/Drawer/__stories__/HideVeil.d.ts +3 -0
  26. package/build/cjs/components/Drawer/__stories__/ResizableItem.d.ts +3 -0
  27. package/build/cjs/components/Drawer/__stories__/moc.d.ts +2 -0
  28. package/build/cjs/components/Drawer/__tests__/helpersPlaywright.d.ts +1 -1
  29. package/build/cjs/components/Drawer/utils.d.ts +2 -3
  30. package/build/cjs/components/Footer/desktop/__stories__/Footer.stories.d.ts +8 -0
  31. package/build/cjs/components/Footer/desktop/__stories__/FooterShowcase.d.ts +4 -0
  32. package/build/cjs/components/Footer/desktop/__stories__/moc.d.ts +3 -0
  33. package/build/cjs/components/Footer/desktop/__tests__/helpersPlaywright.d.ts +1 -1
  34. package/build/cjs/components/Footer/mobile/__stories__/MobileFooter.stories.d.ts +8 -0
  35. package/build/cjs/components/Footer/mobile/__stories__/MobileFooterShowcase.d.ts +4 -0
  36. package/build/cjs/components/Footer/mobile/__stories__/moc.d.ts +3 -0
  37. package/build/cjs/components/Footer/mobile/__tests__/helpersPlaywright.d.ts +1 -1
  38. package/build/cjs/components/FooterItem/__stories__/FooterItem.stories.d.ts +6 -0
  39. package/build/cjs/components/FooterItem/__tests__/helpersPlaywright.d.ts +1 -1
  40. package/build/cjs/components/HotkeysPanel/HotkeysPanel.d.ts +1 -3
  41. package/build/cjs/components/HotkeysPanel/__stories__/HotkeysPanel.stories.d.ts +5 -0
  42. package/build/cjs/components/HotkeysPanel/__stories__/HotkeysPanelShowcase.d.ts +6 -0
  43. package/build/cjs/components/HotkeysPanel/__stories__/moc.d.ts +2 -0
  44. package/build/cjs/components/HotkeysPanel/__tests__/helpersPlaywright.d.ts +1 -1
  45. package/build/cjs/components/Logo/Logo.d.ts +1 -1
  46. package/build/cjs/components/Logo/__stories__/Logo.stories.d.ts +6 -0
  47. package/build/cjs/components/Logo/__tests__/helpersPlaywright.d.ts +1 -1
  48. package/build/cjs/components/MobileHeader/BurgerMenu/__stories__/BurgerMenu.stories.d.ts +6 -0
  49. package/build/cjs/components/MobileHeader/BurgerMenu/__stories__/moc.d.ts +2 -0
  50. package/build/cjs/components/MobileHeader/BurgerMenu/__tests__/helpersPlaywright.d.ts +1 -1
  51. package/build/cjs/components/MobileHeader/MobileHeader.d.ts +2 -1
  52. package/build/cjs/components/MobileHeader/OverlapPanel/__stories__/OverlapPanel.stories.d.ts +6 -0
  53. package/build/cjs/components/MobileHeader/OverlapPanel/__stories__/moc.d.ts +2 -0
  54. package/build/cjs/components/MobileHeader/OverlapPanel/__tests__/helpersPlaywright.d.ts +1 -1
  55. package/build/cjs/components/MobileHeader/__stories__/MobileHeader.stories.d.ts +4 -0
  56. package/build/cjs/components/MobileHeader/__stories__/MobileHeaderShowcase.d.ts +3 -0
  57. package/build/cjs/components/MobileHeader/__stories__/moc.d.ts +1 -0
  58. package/build/cjs/components/MobileHeader/__tests__/helpersPlaywright.d.ts +1 -1
  59. package/build/cjs/components/MobileHeader/i18n/index.d.ts +5 -1
  60. package/build/cjs/components/MobileHeader/types.d.ts +0 -1
  61. package/build/cjs/components/MobileLogo/__stories__/MobileLogo.stories.d.ts +6 -0
  62. package/build/cjs/components/MobileLogo/__tests__/helpersPlaywright.d.ts +1 -1
  63. package/build/cjs/components/Settings/Settings.d.ts +1 -3
  64. package/build/cjs/components/Settings/__stories__/Settings.stories.d.ts +5 -0
  65. package/build/cjs/components/Settings/__stories__/SettingsDemo.d.ts +14 -0
  66. package/build/cjs/components/Settings/__stories__/SettingsMobileDemo.d.ts +8 -0
  67. package/build/cjs/components/Settings/__tests__/helpersPlaywright.d.ts +1 -1
  68. package/build/cjs/components/Settings/collect-settings.d.ts +0 -2
  69. package/build/cjs/components/Settings/i18n/index.d.ts +5 -1
  70. package/build/cjs/components/Title/i18n/index.d.ts +5 -1
  71. package/build/cjs/components/TopAlert/TopAlert.d.ts +10 -0
  72. package/build/cjs/components/TopAlert/index.d.ts +1 -0
  73. package/build/cjs/components/TopAlert/useTopAlertHeight.d.ts +10 -0
  74. package/build/cjs/components/types.d.ts +9 -5
  75. package/build/cjs/hooks/useForwardRef.d.ts +1 -1
  76. package/build/cjs/index-HbnaVyaN.js +69 -0
  77. package/build/cjs/index-HbnaVyaN.js.map +1 -0
  78. package/build/cjs/index-j1vouNtm.js +5734 -0
  79. package/build/cjs/index-j1vouNtm.js.map +1 -0
  80. package/build/cjs/index.js +32 -194
  81. package/build/cjs/index.js.map +1 -1
  82. package/build/esm/components/ActionBar/ActionBar.d.ts +3 -3
  83. package/build/esm/components/ActionBar/__stories__/ActionBar.stories.d.ts +17 -0
  84. package/build/esm/components/ActionBar/__stories__/ActionBarShowcase.d.ts +2 -0
  85. package/build/esm/components/ActionBar/__stories__/ActionBarSingleSection.d.ts +2 -0
  86. package/build/esm/components/ActionBar/__tests__/helpersPlaywright.d.ts +1 -1
  87. package/build/esm/components/ActionBar/types.d.ts +1 -1
  88. package/build/esm/components/AllPagesPanel/i18n/index.d.ts +5 -1
  89. package/build/esm/components/AsideHeader/AsideHeaderContext.d.ts +1 -1
  90. package/build/esm/components/AsideHeader/__stories__/AsideHeader.stories.d.ts +18 -0
  91. package/build/esm/components/AsideHeader/__stories__/AsideHeaderShowcase.d.ts +14 -0
  92. package/build/esm/components/AsideHeader/__stories__/getAsideHeaderWrapper.d.ts +3 -0
  93. package/build/esm/components/AsideHeader/__stories__/moc.d.ts +6 -0
  94. package/build/esm/components/AsideHeader/__tests__/helpersPlaywright.d.ts +1 -1
  95. package/build/esm/components/AsideHeader/components/index.d.ts +0 -1
  96. package/build/esm/components/AsideHeader/i18n/index.d.ts +5 -1
  97. package/build/esm/components/AsideHeader/types.d.ts +3 -4
  98. package/build/esm/components/CompositeBar/CompositeBar.d.ts +1 -1
  99. package/build/esm/components/CompositeBar/HighlightedItem/HighlightedItem.d.ts +1 -1
  100. package/build/esm/components/CompositeBar/Item/Item.d.ts +15 -2
  101. package/build/esm/components/Drawer/Drawer.d.ts +0 -5
  102. package/build/esm/components/Drawer/__stories__/DisablePortal.d.ts +3 -0
  103. package/build/esm/components/Drawer/__stories__/Drawer.stories.d.ts +7 -0
  104. package/build/esm/components/Drawer/__stories__/DrawerShowcase.d.ts +3 -0
  105. package/build/esm/components/Drawer/__stories__/HideVeil.d.ts +3 -0
  106. package/build/esm/components/Drawer/__stories__/ResizableItem.d.ts +3 -0
  107. package/build/esm/components/Drawer/__stories__/moc.d.ts +2 -0
  108. package/build/esm/components/Drawer/__tests__/helpersPlaywright.d.ts +1 -1
  109. package/build/esm/components/Drawer/utils.d.ts +2 -3
  110. package/build/esm/components/Footer/desktop/__stories__/Footer.stories.d.ts +8 -0
  111. package/build/esm/components/Footer/desktop/__stories__/FooterShowcase.d.ts +4 -0
  112. package/build/esm/components/Footer/desktop/__stories__/moc.d.ts +3 -0
  113. package/build/esm/components/Footer/desktop/__tests__/helpersPlaywright.d.ts +1 -1
  114. package/build/esm/components/Footer/mobile/__stories__/MobileFooter.stories.d.ts +8 -0
  115. package/build/esm/components/Footer/mobile/__stories__/MobileFooterShowcase.d.ts +4 -0
  116. package/build/esm/components/Footer/mobile/__stories__/moc.d.ts +3 -0
  117. package/build/esm/components/Footer/mobile/__tests__/helpersPlaywright.d.ts +1 -1
  118. package/build/esm/components/FooterItem/__stories__/FooterItem.stories.d.ts +6 -0
  119. package/build/esm/components/FooterItem/__tests__/helpersPlaywright.d.ts +1 -1
  120. package/build/esm/components/HotkeysPanel/HotkeysPanel.d.ts +1 -3
  121. package/build/esm/components/HotkeysPanel/__stories__/HotkeysPanel.stories.d.ts +5 -0
  122. package/build/esm/components/HotkeysPanel/__stories__/HotkeysPanelShowcase.d.ts +6 -0
  123. package/build/esm/components/HotkeysPanel/__stories__/moc.d.ts +2 -0
  124. package/build/esm/components/HotkeysPanel/__tests__/helpersPlaywright.d.ts +1 -1
  125. package/build/esm/components/Logo/Logo.d.ts +1 -1
  126. package/build/esm/components/Logo/__stories__/Logo.stories.d.ts +6 -0
  127. package/build/esm/components/Logo/__tests__/helpersPlaywright.d.ts +1 -1
  128. package/build/esm/components/MobileHeader/BurgerMenu/__stories__/BurgerMenu.stories.d.ts +6 -0
  129. package/build/esm/components/MobileHeader/BurgerMenu/__stories__/moc.d.ts +2 -0
  130. package/build/esm/components/MobileHeader/BurgerMenu/__tests__/helpersPlaywright.d.ts +1 -1
  131. package/build/esm/components/MobileHeader/MobileHeader.d.ts +2 -1
  132. package/build/esm/components/MobileHeader/OverlapPanel/__stories__/OverlapPanel.stories.d.ts +6 -0
  133. package/build/esm/components/MobileHeader/OverlapPanel/__stories__/moc.d.ts +2 -0
  134. package/build/esm/components/MobileHeader/OverlapPanel/__tests__/helpersPlaywright.d.ts +1 -1
  135. package/build/esm/components/MobileHeader/__stories__/MobileHeader.stories.d.ts +4 -0
  136. package/build/esm/components/MobileHeader/__stories__/MobileHeaderShowcase.d.ts +3 -0
  137. package/build/esm/components/MobileHeader/__stories__/moc.d.ts +1 -0
  138. package/build/esm/components/MobileHeader/__tests__/helpersPlaywright.d.ts +1 -1
  139. package/build/esm/components/MobileHeader/i18n/index.d.ts +5 -1
  140. package/build/esm/components/MobileHeader/types.d.ts +0 -1
  141. package/build/esm/components/MobileLogo/__stories__/MobileLogo.stories.d.ts +6 -0
  142. package/build/esm/components/MobileLogo/__tests__/helpersPlaywright.d.ts +1 -1
  143. package/build/esm/components/Settings/Settings.d.ts +1 -3
  144. package/build/esm/components/Settings/__stories__/Settings.stories.d.ts +5 -0
  145. package/build/esm/components/Settings/__stories__/SettingsDemo.d.ts +14 -0
  146. package/build/esm/components/Settings/__stories__/SettingsMobileDemo.d.ts +8 -0
  147. package/build/esm/components/Settings/__tests__/helpersPlaywright.d.ts +1 -1
  148. package/build/esm/components/Settings/collect-settings.d.ts +0 -2
  149. package/build/esm/components/Settings/i18n/index.d.ts +5 -1
  150. package/build/esm/components/Title/i18n/index.d.ts +5 -1
  151. package/build/esm/components/TopAlert/TopAlert.d.ts +10 -0
  152. package/build/esm/components/TopAlert/index.d.ts +1 -0
  153. package/build/esm/components/TopAlert/useTopAlertHeight.d.ts +10 -0
  154. package/build/esm/components/types.d.ts +9 -5
  155. package/build/esm/hooks/useForwardRef.d.ts +1 -1
  156. package/build/esm/index-C7O46WxY.js +5689 -0
  157. package/build/esm/index-C7O46WxY.js.map +1 -0
  158. package/build/esm/index-DruPZQaT.js +67 -0
  159. package/build/esm/index-DruPZQaT.js.map +1 -0
  160. package/build/esm/index.js +6 -167
  161. package/build/esm/index.js.map +1 -1
  162. package/package.json +48 -45
  163. package/build/cjs/ActionBar-3c6cdf57.js +0 -63
  164. package/build/cjs/ActionBar-3c6cdf57.js.map +0 -1
  165. package/build/cjs/AsideFallback.js +0 -31
  166. package/build/cjs/AsideFallback.js.map +0 -1
  167. package/build/cjs/AsideHeader.js +0 -38
  168. package/build/cjs/AsideHeader.js.map +0 -1
  169. package/build/cjs/AsideHeaderContext.js +0 -44
  170. package/build/cjs/AsideHeaderContext.js.map +0 -1
  171. package/build/cjs/Content-64d5738a.js +0 -20
  172. package/build/cjs/Content-64d5738a.js.map +0 -1
  173. package/build/cjs/Drawer.js +0 -3201
  174. package/build/cjs/Drawer.js.map +0 -1
  175. package/build/cjs/FooterItem-d34d84ed.js +0 -336
  176. package/build/cjs/FooterItem-d34d84ed.js.map +0 -1
  177. package/build/cjs/FooterItem.js +0 -31
  178. package/build/cjs/FooterItem.js.map +0 -1
  179. package/build/cjs/HotkeysPanel-1c05ffa8.js +0 -67
  180. package/build/cjs/HotkeysPanel-1c05ffa8.js.map +0 -1
  181. package/build/cjs/Item-ff6bc440.js +0 -303
  182. package/build/cjs/Item-ff6bc440.js.map +0 -1
  183. package/build/cjs/PageLayout.js +0 -40
  184. package/build/cjs/PageLayout.js.map +0 -1
  185. package/build/cjs/PageLayoutAside-56a441a9.js +0 -1008
  186. package/build/cjs/PageLayoutAside-56a441a9.js.map +0 -1
  187. package/build/cjs/PageLayoutAside.js +0 -25
  188. package/build/cjs/PageLayoutAside.js.map +0 -1
  189. package/build/cjs/Settings-8dc2a8ee.js +0 -579
  190. package/build/cjs/Settings-8dc2a8ee.js.map +0 -1
  191. package/build/cjs/Title-54580605.js +0 -42
  192. package/build/cjs/Title-54580605.js.map +0 -1
  193. package/build/cjs/TopPanel-c6b83157.js +0 -82
  194. package/build/cjs/TopPanel-c6b83157.js.map +0 -1
  195. package/build/cjs/cn-9933321a.js +0 -11
  196. package/build/cjs/cn-9933321a.js.map +0 -1
  197. package/build/cjs/components/AsideHeader/components/TopPanel.d.ts +0 -7
  198. package/build/cjs/components/AsideHeader/useAsideHeaderTopPanel.d.ts +0 -10
  199. package/build/cjs/constants-d81c3867.js +0 -14
  200. package/build/cjs/constants-d81c3867.js.map +0 -1
  201. package/build/cjs/debounce-8772fd80.js +0 -545
  202. package/build/cjs/debounce-8772fd80.js.map +0 -1
  203. package/build/cjs/divider-collapsed-b743122e.js +0 -41
  204. package/build/cjs/divider-collapsed-b743122e.js.map +0 -1
  205. package/build/cjs/index2.js +0 -14
  206. package/build/cjs/index2.js.map +0 -1
  207. package/build/cjs/index3.js +0 -17
  208. package/build/cjs/index3.js.map +0 -1
  209. package/build/cjs/index4.js +0 -18
  210. package/build/cjs/index4.js.map +0 -1
  211. package/build/cjs/index5.js +0 -22
  212. package/build/cjs/index5.js.map +0 -1
  213. package/build/cjs/index6.js +0 -23
  214. package/build/cjs/index6.js.map +0 -1
  215. package/build/cjs/style-inject.es-dcee06b6.js +0 -31
  216. package/build/cjs/style-inject.es-dcee06b6.js.map +0 -1
  217. package/build/cjs/tslib.es6-705c6589.js +0 -36
  218. package/build/cjs/tslib.es6-705c6589.js.map +0 -1
  219. package/build/cjs/utils-db3e03c2.js +0 -8
  220. package/build/cjs/utils-db3e03c2.js.map +0 -1
  221. package/build/esm/ActionBar-834b178a.js +0 -57
  222. package/build/esm/ActionBar-834b178a.js.map +0 -1
  223. package/build/esm/AsideFallback.js +0 -23
  224. package/build/esm/AsideFallback.js.map +0 -1
  225. package/build/esm/AsideHeader.js +0 -30
  226. package/build/esm/AsideHeader.js.map +0 -1
  227. package/build/esm/AsideHeaderContext.js +0 -31
  228. package/build/esm/AsideHeaderContext.js.map +0 -1
  229. package/build/esm/Content-f94ba85d.js +0 -14
  230. package/build/esm/Content-f94ba85d.js.map +0 -1
  231. package/build/esm/Drawer.js +0 -3173
  232. package/build/esm/Drawer.js.map +0 -1
  233. package/build/esm/FooterItem-af3c4fa3.js +0 -326
  234. package/build/esm/FooterItem-af3c4fa3.js.map +0 -1
  235. package/build/esm/FooterItem.js +0 -23
  236. package/build/esm/FooterItem.js.map +0 -1
  237. package/build/esm/HotkeysPanel-c7bf8466.js +0 -61
  238. package/build/esm/HotkeysPanel-c7bf8466.js.map +0 -1
  239. package/build/esm/Item-55899ec8.js +0 -289
  240. package/build/esm/Item-55899ec8.js.map +0 -1
  241. package/build/esm/PageLayout.js +0 -32
  242. package/build/esm/PageLayout.js.map +0 -1
  243. package/build/esm/PageLayoutAside-edd59955.js +0 -983
  244. package/build/esm/PageLayoutAside-edd59955.js.map +0 -1
  245. package/build/esm/PageLayoutAside.js +0 -17
  246. package/build/esm/PageLayoutAside.js.map +0 -1
  247. package/build/esm/Settings-e660a4c5.js +0 -553
  248. package/build/esm/Settings-e660a4c5.js.map +0 -1
  249. package/build/esm/Title-03b4255a.js +0 -36
  250. package/build/esm/Title-03b4255a.js.map +0 -1
  251. package/build/esm/TopPanel-cd270f27.js +0 -76
  252. package/build/esm/TopPanel-cd270f27.js.map +0 -1
  253. package/build/esm/cn-ffe5e9f5.js +0 -8
  254. package/build/esm/cn-ffe5e9f5.js.map +0 -1
  255. package/build/esm/components/AsideHeader/components/TopPanel.d.ts +0 -7
  256. package/build/esm/components/AsideHeader/useAsideHeaderTopPanel.d.ts +0 -10
  257. package/build/esm/constants-b1604ff5.js +0 -8
  258. package/build/esm/constants-b1604ff5.js.map +0 -1
  259. package/build/esm/debounce-64cd2b4c.js +0 -543
  260. package/build/esm/debounce-64cd2b4c.js.map +0 -1
  261. package/build/esm/divider-collapsed-a0ef54c3.js +0 -19
  262. package/build/esm/divider-collapsed-a0ef54c3.js.map +0 -1
  263. package/build/esm/index2.js +0 -6
  264. package/build/esm/index2.js.map +0 -1
  265. package/build/esm/index3.js +0 -9
  266. package/build/esm/index3.js.map +0 -1
  267. package/build/esm/index4.js +0 -10
  268. package/build/esm/index4.js.map +0 -1
  269. package/build/esm/index5.js +0 -12
  270. package/build/esm/index5.js.map +0 -1
  271. package/build/esm/index6.js +0 -12
  272. package/build/esm/index6.js.map +0 -1
  273. package/build/esm/style-inject.es-1f59c1d0.js +0 -29
  274. package/build/esm/style-inject.es-1f59c1d0.js.map +0 -1
  275. package/build/esm/tslib.es6-3cd4e99f.js +0 -34
  276. package/build/esm/tslib.es6-3cd4e99f.js.map +0 -1
  277. package/build/esm/utils-117463a5.js +0 -6
  278. package/build/esm/utils-117463a5.js.map +0 -1
@@ -1,3173 +0,0 @@
1
- import * as React from 'react';
2
- import React__default, { Children, isValidElement, cloneElement } from 'react';
3
- import { useForkRef, useBodyScrollLock, Portal } from '@gravity-ui/uikit';
4
- import ReactDOM from 'react-dom';
5
- import { b as block } from './cn-ffe5e9f5.js';
6
- import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
- import '@bem-react/classname';
8
-
9
- function _extends() {
10
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
11
- for (var e = 1; e < arguments.length; e++) {
12
- var t = arguments[e];
13
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
14
- }
15
- return n;
16
- }, _extends.apply(null, arguments);
17
- }
18
-
19
- function _objectWithoutPropertiesLoose(r, e) {
20
- if (null == r) return {};
21
- var t = {};
22
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
23
- if (e.indexOf(n) >= 0) continue;
24
- t[n] = r[n];
25
- }
26
- return t;
27
- }
28
-
29
- function _setPrototypeOf(t, e) {
30
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
31
- return t.__proto__ = e, t;
32
- }, _setPrototypeOf(t, e);
33
- }
34
-
35
- function _inheritsLoose(t, o) {
36
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
37
- }
38
-
39
- var propTypes = {exports: {}};
40
-
41
- var reactIs = {exports: {}};
42
-
43
- var reactIs_production_min = {};
44
-
45
- /** @license React v16.13.1
46
- * react-is.production.min.js
47
- *
48
- * Copyright (c) Facebook, Inc. and its affiliates.
49
- *
50
- * This source code is licensed under the MIT license found in the
51
- * LICENSE file in the root directory of this source tree.
52
- */
53
-
54
- var hasRequiredReactIs_production_min;
55
-
56
- function requireReactIs_production_min () {
57
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
58
- hasRequiredReactIs_production_min = 1;
59
- var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
60
- Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
61
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
62
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
63
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
64
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
65
- return reactIs_production_min;
66
- }
67
-
68
- var reactIs_development = {};
69
-
70
- /** @license React v16.13.1
71
- * react-is.development.js
72
- *
73
- * Copyright (c) Facebook, Inc. and its affiliates.
74
- *
75
- * This source code is licensed under the MIT license found in the
76
- * LICENSE file in the root directory of this source tree.
77
- */
78
-
79
- var hasRequiredReactIs_development;
80
-
81
- function requireReactIs_development () {
82
- if (hasRequiredReactIs_development) return reactIs_development;
83
- hasRequiredReactIs_development = 1;
84
-
85
-
86
-
87
- if (process.env.NODE_ENV !== "production") {
88
- (function() {
89
-
90
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
91
- // nor polyfill, then a plain number is used for performance.
92
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
93
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
94
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
95
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
96
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
97
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
98
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
99
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
100
- // (unstable) APIs that have been removed. Can we remove the symbols?
101
-
102
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
103
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
104
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
105
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
106
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
107
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
108
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
109
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
110
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
111
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
112
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
113
-
114
- function isValidElementType(type) {
115
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
116
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
117
- }
118
-
119
- function typeOf(object) {
120
- if (typeof object === 'object' && object !== null) {
121
- var $$typeof = object.$$typeof;
122
-
123
- switch ($$typeof) {
124
- case REACT_ELEMENT_TYPE:
125
- var type = object.type;
126
-
127
- switch (type) {
128
- case REACT_ASYNC_MODE_TYPE:
129
- case REACT_CONCURRENT_MODE_TYPE:
130
- case REACT_FRAGMENT_TYPE:
131
- case REACT_PROFILER_TYPE:
132
- case REACT_STRICT_MODE_TYPE:
133
- case REACT_SUSPENSE_TYPE:
134
- return type;
135
-
136
- default:
137
- var $$typeofType = type && type.$$typeof;
138
-
139
- switch ($$typeofType) {
140
- case REACT_CONTEXT_TYPE:
141
- case REACT_FORWARD_REF_TYPE:
142
- case REACT_LAZY_TYPE:
143
- case REACT_MEMO_TYPE:
144
- case REACT_PROVIDER_TYPE:
145
- return $$typeofType;
146
-
147
- default:
148
- return $$typeof;
149
- }
150
-
151
- }
152
-
153
- case REACT_PORTAL_TYPE:
154
- return $$typeof;
155
- }
156
- }
157
-
158
- return undefined;
159
- } // AsyncMode is deprecated along with isAsyncMode
160
-
161
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
162
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
163
- var ContextConsumer = REACT_CONTEXT_TYPE;
164
- var ContextProvider = REACT_PROVIDER_TYPE;
165
- var Element = REACT_ELEMENT_TYPE;
166
- var ForwardRef = REACT_FORWARD_REF_TYPE;
167
- var Fragment = REACT_FRAGMENT_TYPE;
168
- var Lazy = REACT_LAZY_TYPE;
169
- var Memo = REACT_MEMO_TYPE;
170
- var Portal = REACT_PORTAL_TYPE;
171
- var Profiler = REACT_PROFILER_TYPE;
172
- var StrictMode = REACT_STRICT_MODE_TYPE;
173
- var Suspense = REACT_SUSPENSE_TYPE;
174
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
175
-
176
- function isAsyncMode(object) {
177
- {
178
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
179
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
180
-
181
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
182
- }
183
- }
184
-
185
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
186
- }
187
- function isConcurrentMode(object) {
188
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
189
- }
190
- function isContextConsumer(object) {
191
- return typeOf(object) === REACT_CONTEXT_TYPE;
192
- }
193
- function isContextProvider(object) {
194
- return typeOf(object) === REACT_PROVIDER_TYPE;
195
- }
196
- function isElement(object) {
197
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
198
- }
199
- function isForwardRef(object) {
200
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
201
- }
202
- function isFragment(object) {
203
- return typeOf(object) === REACT_FRAGMENT_TYPE;
204
- }
205
- function isLazy(object) {
206
- return typeOf(object) === REACT_LAZY_TYPE;
207
- }
208
- function isMemo(object) {
209
- return typeOf(object) === REACT_MEMO_TYPE;
210
- }
211
- function isPortal(object) {
212
- return typeOf(object) === REACT_PORTAL_TYPE;
213
- }
214
- function isProfiler(object) {
215
- return typeOf(object) === REACT_PROFILER_TYPE;
216
- }
217
- function isStrictMode(object) {
218
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
219
- }
220
- function isSuspense(object) {
221
- return typeOf(object) === REACT_SUSPENSE_TYPE;
222
- }
223
-
224
- reactIs_development.AsyncMode = AsyncMode;
225
- reactIs_development.ConcurrentMode = ConcurrentMode;
226
- reactIs_development.ContextConsumer = ContextConsumer;
227
- reactIs_development.ContextProvider = ContextProvider;
228
- reactIs_development.Element = Element;
229
- reactIs_development.ForwardRef = ForwardRef;
230
- reactIs_development.Fragment = Fragment;
231
- reactIs_development.Lazy = Lazy;
232
- reactIs_development.Memo = Memo;
233
- reactIs_development.Portal = Portal;
234
- reactIs_development.Profiler = Profiler;
235
- reactIs_development.StrictMode = StrictMode;
236
- reactIs_development.Suspense = Suspense;
237
- reactIs_development.isAsyncMode = isAsyncMode;
238
- reactIs_development.isConcurrentMode = isConcurrentMode;
239
- reactIs_development.isContextConsumer = isContextConsumer;
240
- reactIs_development.isContextProvider = isContextProvider;
241
- reactIs_development.isElement = isElement;
242
- reactIs_development.isForwardRef = isForwardRef;
243
- reactIs_development.isFragment = isFragment;
244
- reactIs_development.isLazy = isLazy;
245
- reactIs_development.isMemo = isMemo;
246
- reactIs_development.isPortal = isPortal;
247
- reactIs_development.isProfiler = isProfiler;
248
- reactIs_development.isStrictMode = isStrictMode;
249
- reactIs_development.isSuspense = isSuspense;
250
- reactIs_development.isValidElementType = isValidElementType;
251
- reactIs_development.typeOf = typeOf;
252
- })();
253
- }
254
- return reactIs_development;
255
- }
256
-
257
- var hasRequiredReactIs;
258
-
259
- function requireReactIs () {
260
- if (hasRequiredReactIs) return reactIs.exports;
261
- hasRequiredReactIs = 1;
262
- (function (module) {
263
-
264
- if (process.env.NODE_ENV === 'production') {
265
- module.exports = requireReactIs_production_min();
266
- } else {
267
- module.exports = requireReactIs_development();
268
- }
269
- } (reactIs));
270
- return reactIs.exports;
271
- }
272
-
273
- /*
274
- object-assign
275
- (c) Sindre Sorhus
276
- @license MIT
277
- */
278
-
279
- var objectAssign;
280
- var hasRequiredObjectAssign;
281
-
282
- function requireObjectAssign () {
283
- if (hasRequiredObjectAssign) return objectAssign;
284
- hasRequiredObjectAssign = 1;
285
- /* eslint-disable no-unused-vars */
286
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
287
- var hasOwnProperty = Object.prototype.hasOwnProperty;
288
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
289
-
290
- function toObject(val) {
291
- if (val === null || val === undefined) {
292
- throw new TypeError('Object.assign cannot be called with null or undefined');
293
- }
294
-
295
- return Object(val);
296
- }
297
-
298
- function shouldUseNative() {
299
- try {
300
- if (!Object.assign) {
301
- return false;
302
- }
303
-
304
- // Detect buggy property enumeration order in older V8 versions.
305
-
306
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
307
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
308
- test1[5] = 'de';
309
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
310
- return false;
311
- }
312
-
313
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
314
- var test2 = {};
315
- for (var i = 0; i < 10; i++) {
316
- test2['_' + String.fromCharCode(i)] = i;
317
- }
318
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
319
- return test2[n];
320
- });
321
- if (order2.join('') !== '0123456789') {
322
- return false;
323
- }
324
-
325
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
326
- var test3 = {};
327
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
328
- test3[letter] = letter;
329
- });
330
- if (Object.keys(Object.assign({}, test3)).join('') !==
331
- 'abcdefghijklmnopqrst') {
332
- return false;
333
- }
334
-
335
- return true;
336
- } catch (err) {
337
- // We don't expect any of the above to throw, but better to be safe.
338
- return false;
339
- }
340
- }
341
-
342
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
343
- var from;
344
- var to = toObject(target);
345
- var symbols;
346
-
347
- for (var s = 1; s < arguments.length; s++) {
348
- from = Object(arguments[s]);
349
-
350
- for (var key in from) {
351
- if (hasOwnProperty.call(from, key)) {
352
- to[key] = from[key];
353
- }
354
- }
355
-
356
- if (getOwnPropertySymbols) {
357
- symbols = getOwnPropertySymbols(from);
358
- for (var i = 0; i < symbols.length; i++) {
359
- if (propIsEnumerable.call(from, symbols[i])) {
360
- to[symbols[i]] = from[symbols[i]];
361
- }
362
- }
363
- }
364
- }
365
-
366
- return to;
367
- };
368
- return objectAssign;
369
- }
370
-
371
- /**
372
- * Copyright (c) 2013-present, Facebook, Inc.
373
- *
374
- * This source code is licensed under the MIT license found in the
375
- * LICENSE file in the root directory of this source tree.
376
- */
377
-
378
- var ReactPropTypesSecret_1;
379
- var hasRequiredReactPropTypesSecret;
380
-
381
- function requireReactPropTypesSecret () {
382
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
383
- hasRequiredReactPropTypesSecret = 1;
384
-
385
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
386
-
387
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
388
- return ReactPropTypesSecret_1;
389
- }
390
-
391
- var has;
392
- var hasRequiredHas;
393
-
394
- function requireHas () {
395
- if (hasRequiredHas) return has;
396
- hasRequiredHas = 1;
397
- has = Function.call.bind(Object.prototype.hasOwnProperty);
398
- return has;
399
- }
400
-
401
- /**
402
- * Copyright (c) 2013-present, Facebook, Inc.
403
- *
404
- * This source code is licensed under the MIT license found in the
405
- * LICENSE file in the root directory of this source tree.
406
- */
407
-
408
- var checkPropTypes_1;
409
- var hasRequiredCheckPropTypes;
410
-
411
- function requireCheckPropTypes () {
412
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
413
- hasRequiredCheckPropTypes = 1;
414
-
415
- var printWarning = function() {};
416
-
417
- if (process.env.NODE_ENV !== 'production') {
418
- var ReactPropTypesSecret = requireReactPropTypesSecret();
419
- var loggedTypeFailures = {};
420
- var has = requireHas();
421
-
422
- printWarning = function(text) {
423
- var message = 'Warning: ' + text;
424
- if (typeof console !== 'undefined') {
425
- console.error(message);
426
- }
427
- try {
428
- // --- Welcome to debugging React ---
429
- // This error was thrown as a convenience so that you can use this stack
430
- // to find the callsite that caused this warning to fire.
431
- throw new Error(message);
432
- } catch (x) { /**/ }
433
- };
434
- }
435
-
436
- /**
437
- * Assert that the values match with the type specs.
438
- * Error messages are memorized and will only be shown once.
439
- *
440
- * @param {object} typeSpecs Map of name to a ReactPropType
441
- * @param {object} values Runtime values that need to be type-checked
442
- * @param {string} location e.g. "prop", "context", "child context"
443
- * @param {string} componentName Name of the component for error messages.
444
- * @param {?Function} getStack Returns the component stack.
445
- * @private
446
- */
447
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
448
- if (process.env.NODE_ENV !== 'production') {
449
- for (var typeSpecName in typeSpecs) {
450
- if (has(typeSpecs, typeSpecName)) {
451
- var error;
452
- // Prop type validation may throw. In case they do, we don't want to
453
- // fail the render phase where it didn't fail before. So we log it.
454
- // After these have been cleaned up, we'll let them throw.
455
- try {
456
- // This is intentionally an invariant that gets caught. It's the same
457
- // behavior as without this statement except with a better message.
458
- if (typeof typeSpecs[typeSpecName] !== 'function') {
459
- var err = Error(
460
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
461
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
462
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
463
- );
464
- err.name = 'Invariant Violation';
465
- throw err;
466
- }
467
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
468
- } catch (ex) {
469
- error = ex;
470
- }
471
- if (error && !(error instanceof Error)) {
472
- printWarning(
473
- (componentName || 'React class') + ': type specification of ' +
474
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
475
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
476
- 'You may have forgotten to pass an argument to the type checker ' +
477
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
478
- 'shape all require an argument).'
479
- );
480
- }
481
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
482
- // Only monitor this failure once because there tends to be a lot of the
483
- // same error.
484
- loggedTypeFailures[error.message] = true;
485
-
486
- var stack = getStack ? getStack() : '';
487
-
488
- printWarning(
489
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
490
- );
491
- }
492
- }
493
- }
494
- }
495
- }
496
-
497
- /**
498
- * Resets warning cache when testing.
499
- *
500
- * @private
501
- */
502
- checkPropTypes.resetWarningCache = function() {
503
- if (process.env.NODE_ENV !== 'production') {
504
- loggedTypeFailures = {};
505
- }
506
- };
507
-
508
- checkPropTypes_1 = checkPropTypes;
509
- return checkPropTypes_1;
510
- }
511
-
512
- /**
513
- * Copyright (c) 2013-present, Facebook, Inc.
514
- *
515
- * This source code is licensed under the MIT license found in the
516
- * LICENSE file in the root directory of this source tree.
517
- */
518
-
519
- var factoryWithTypeCheckers;
520
- var hasRequiredFactoryWithTypeCheckers;
521
-
522
- function requireFactoryWithTypeCheckers () {
523
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
524
- hasRequiredFactoryWithTypeCheckers = 1;
525
-
526
- var ReactIs = requireReactIs();
527
- var assign = requireObjectAssign();
528
-
529
- var ReactPropTypesSecret = requireReactPropTypesSecret();
530
- var has = requireHas();
531
- var checkPropTypes = requireCheckPropTypes();
532
-
533
- var printWarning = function() {};
534
-
535
- if (process.env.NODE_ENV !== 'production') {
536
- printWarning = function(text) {
537
- var message = 'Warning: ' + text;
538
- if (typeof console !== 'undefined') {
539
- console.error(message);
540
- }
541
- try {
542
- // --- Welcome to debugging React ---
543
- // This error was thrown as a convenience so that you can use this stack
544
- // to find the callsite that caused this warning to fire.
545
- throw new Error(message);
546
- } catch (x) {}
547
- };
548
- }
549
-
550
- function emptyFunctionThatReturnsNull() {
551
- return null;
552
- }
553
-
554
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
555
- /* global Symbol */
556
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
557
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
558
-
559
- /**
560
- * Returns the iterator method function contained on the iterable object.
561
- *
562
- * Be sure to invoke the function with the iterable as context:
563
- *
564
- * var iteratorFn = getIteratorFn(myIterable);
565
- * if (iteratorFn) {
566
- * var iterator = iteratorFn.call(myIterable);
567
- * ...
568
- * }
569
- *
570
- * @param {?object} maybeIterable
571
- * @return {?function}
572
- */
573
- function getIteratorFn(maybeIterable) {
574
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
575
- if (typeof iteratorFn === 'function') {
576
- return iteratorFn;
577
- }
578
- }
579
-
580
- /**
581
- * Collection of methods that allow declaration and validation of props that are
582
- * supplied to React components. Example usage:
583
- *
584
- * var Props = require('ReactPropTypes');
585
- * var MyArticle = React.createClass({
586
- * propTypes: {
587
- * // An optional string prop named "description".
588
- * description: Props.string,
589
- *
590
- * // A required enum prop named "category".
591
- * category: Props.oneOf(['News','Photos']).isRequired,
592
- *
593
- * // A prop named "dialog" that requires an instance of Dialog.
594
- * dialog: Props.instanceOf(Dialog).isRequired
595
- * },
596
- * render: function() { ... }
597
- * });
598
- *
599
- * A more formal specification of how these methods are used:
600
- *
601
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
602
- * decl := ReactPropTypes.{type}(.isRequired)?
603
- *
604
- * Each and every declaration produces a function with the same signature. This
605
- * allows the creation of custom validation functions. For example:
606
- *
607
- * var MyLink = React.createClass({
608
- * propTypes: {
609
- * // An optional string or URI prop named "href".
610
- * href: function(props, propName, componentName) {
611
- * var propValue = props[propName];
612
- * if (propValue != null && typeof propValue !== 'string' &&
613
- * !(propValue instanceof URI)) {
614
- * return new Error(
615
- * 'Expected a string or an URI for ' + propName + ' in ' +
616
- * componentName
617
- * );
618
- * }
619
- * }
620
- * },
621
- * render: function() {...}
622
- * });
623
- *
624
- * @internal
625
- */
626
-
627
- var ANONYMOUS = '<<anonymous>>';
628
-
629
- // Important!
630
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
631
- var ReactPropTypes = {
632
- array: createPrimitiveTypeChecker('array'),
633
- bigint: createPrimitiveTypeChecker('bigint'),
634
- bool: createPrimitiveTypeChecker('boolean'),
635
- func: createPrimitiveTypeChecker('function'),
636
- number: createPrimitiveTypeChecker('number'),
637
- object: createPrimitiveTypeChecker('object'),
638
- string: createPrimitiveTypeChecker('string'),
639
- symbol: createPrimitiveTypeChecker('symbol'),
640
-
641
- any: createAnyTypeChecker(),
642
- arrayOf: createArrayOfTypeChecker,
643
- element: createElementTypeChecker(),
644
- elementType: createElementTypeTypeChecker(),
645
- instanceOf: createInstanceTypeChecker,
646
- node: createNodeChecker(),
647
- objectOf: createObjectOfTypeChecker,
648
- oneOf: createEnumTypeChecker,
649
- oneOfType: createUnionTypeChecker,
650
- shape: createShapeTypeChecker,
651
- exact: createStrictShapeTypeChecker,
652
- };
653
-
654
- /**
655
- * inlined Object.is polyfill to avoid requiring consumers ship their own
656
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
657
- */
658
- /*eslint-disable no-self-compare*/
659
- function is(x, y) {
660
- // SameValue algorithm
661
- if (x === y) {
662
- // Steps 1-5, 7-10
663
- // Steps 6.b-6.e: +0 != -0
664
- return x !== 0 || 1 / x === 1 / y;
665
- } else {
666
- // Step 6.a: NaN == NaN
667
- return x !== x && y !== y;
668
- }
669
- }
670
- /*eslint-enable no-self-compare*/
671
-
672
- /**
673
- * We use an Error-like object for backward compatibility as people may call
674
- * PropTypes directly and inspect their output. However, we don't use real
675
- * Errors anymore. We don't inspect their stack anyway, and creating them
676
- * is prohibitively expensive if they are created too often, such as what
677
- * happens in oneOfType() for any type before the one that matched.
678
- */
679
- function PropTypeError(message, data) {
680
- this.message = message;
681
- this.data = data && typeof data === 'object' ? data: {};
682
- this.stack = '';
683
- }
684
- // Make `instanceof Error` still work for returned errors.
685
- PropTypeError.prototype = Error.prototype;
686
-
687
- function createChainableTypeChecker(validate) {
688
- if (process.env.NODE_ENV !== 'production') {
689
- var manualPropTypeCallCache = {};
690
- var manualPropTypeWarningCount = 0;
691
- }
692
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
693
- componentName = componentName || ANONYMOUS;
694
- propFullName = propFullName || propName;
695
-
696
- if (secret !== ReactPropTypesSecret) {
697
- if (throwOnDirectAccess) {
698
- // New behavior only for users of `prop-types` package
699
- var err = new Error(
700
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
701
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
702
- 'Read more at http://fb.me/use-check-prop-types'
703
- );
704
- err.name = 'Invariant Violation';
705
- throw err;
706
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
707
- // Old behavior for people using React.PropTypes
708
- var cacheKey = componentName + ':' + propName;
709
- if (
710
- !manualPropTypeCallCache[cacheKey] &&
711
- // Avoid spamming the console because they are often not actionable except for lib authors
712
- manualPropTypeWarningCount < 3
713
- ) {
714
- printWarning(
715
- 'You are manually calling a React.PropTypes validation ' +
716
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
717
- 'and will throw in the standalone `prop-types` package. ' +
718
- 'You may be seeing this warning due to a third-party PropTypes ' +
719
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
720
- );
721
- manualPropTypeCallCache[cacheKey] = true;
722
- manualPropTypeWarningCount++;
723
- }
724
- }
725
- }
726
- if (props[propName] == null) {
727
- if (isRequired) {
728
- if (props[propName] === null) {
729
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
730
- }
731
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
732
- }
733
- return null;
734
- } else {
735
- return validate(props, propName, componentName, location, propFullName);
736
- }
737
- }
738
-
739
- var chainedCheckType = checkType.bind(null, false);
740
- chainedCheckType.isRequired = checkType.bind(null, true);
741
-
742
- return chainedCheckType;
743
- }
744
-
745
- function createPrimitiveTypeChecker(expectedType) {
746
- function validate(props, propName, componentName, location, propFullName, secret) {
747
- var propValue = props[propName];
748
- var propType = getPropType(propValue);
749
- if (propType !== expectedType) {
750
- // `propValue` being instance of, say, date/regexp, pass the 'object'
751
- // check, but we can offer a more precise error message here rather than
752
- // 'of type `object`'.
753
- var preciseType = getPreciseType(propValue);
754
-
755
- return new PropTypeError(
756
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
757
- {expectedType: expectedType}
758
- );
759
- }
760
- return null;
761
- }
762
- return createChainableTypeChecker(validate);
763
- }
764
-
765
- function createAnyTypeChecker() {
766
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
767
- }
768
-
769
- function createArrayOfTypeChecker(typeChecker) {
770
- function validate(props, propName, componentName, location, propFullName) {
771
- if (typeof typeChecker !== 'function') {
772
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
773
- }
774
- var propValue = props[propName];
775
- if (!Array.isArray(propValue)) {
776
- var propType = getPropType(propValue);
777
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
778
- }
779
- for (var i = 0; i < propValue.length; i++) {
780
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
781
- if (error instanceof Error) {
782
- return error;
783
- }
784
- }
785
- return null;
786
- }
787
- return createChainableTypeChecker(validate);
788
- }
789
-
790
- function createElementTypeChecker() {
791
- function validate(props, propName, componentName, location, propFullName) {
792
- var propValue = props[propName];
793
- if (!isValidElement(propValue)) {
794
- var propType = getPropType(propValue);
795
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
796
- }
797
- return null;
798
- }
799
- return createChainableTypeChecker(validate);
800
- }
801
-
802
- function createElementTypeTypeChecker() {
803
- function validate(props, propName, componentName, location, propFullName) {
804
- var propValue = props[propName];
805
- if (!ReactIs.isValidElementType(propValue)) {
806
- var propType = getPropType(propValue);
807
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
808
- }
809
- return null;
810
- }
811
- return createChainableTypeChecker(validate);
812
- }
813
-
814
- function createInstanceTypeChecker(expectedClass) {
815
- function validate(props, propName, componentName, location, propFullName) {
816
- if (!(props[propName] instanceof expectedClass)) {
817
- var expectedClassName = expectedClass.name || ANONYMOUS;
818
- var actualClassName = getClassName(props[propName]);
819
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
820
- }
821
- return null;
822
- }
823
- return createChainableTypeChecker(validate);
824
- }
825
-
826
- function createEnumTypeChecker(expectedValues) {
827
- if (!Array.isArray(expectedValues)) {
828
- if (process.env.NODE_ENV !== 'production') {
829
- if (arguments.length > 1) {
830
- printWarning(
831
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
832
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
833
- );
834
- } else {
835
- printWarning('Invalid argument supplied to oneOf, expected an array.');
836
- }
837
- }
838
- return emptyFunctionThatReturnsNull;
839
- }
840
-
841
- function validate(props, propName, componentName, location, propFullName) {
842
- var propValue = props[propName];
843
- for (var i = 0; i < expectedValues.length; i++) {
844
- if (is(propValue, expectedValues[i])) {
845
- return null;
846
- }
847
- }
848
-
849
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
850
- var type = getPreciseType(value);
851
- if (type === 'symbol') {
852
- return String(value);
853
- }
854
- return value;
855
- });
856
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
857
- }
858
- return createChainableTypeChecker(validate);
859
- }
860
-
861
- function createObjectOfTypeChecker(typeChecker) {
862
- function validate(props, propName, componentName, location, propFullName) {
863
- if (typeof typeChecker !== 'function') {
864
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
865
- }
866
- var propValue = props[propName];
867
- var propType = getPropType(propValue);
868
- if (propType !== 'object') {
869
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
870
- }
871
- for (var key in propValue) {
872
- if (has(propValue, key)) {
873
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
874
- if (error instanceof Error) {
875
- return error;
876
- }
877
- }
878
- }
879
- return null;
880
- }
881
- return createChainableTypeChecker(validate);
882
- }
883
-
884
- function createUnionTypeChecker(arrayOfTypeCheckers) {
885
- if (!Array.isArray(arrayOfTypeCheckers)) {
886
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
887
- return emptyFunctionThatReturnsNull;
888
- }
889
-
890
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
891
- var checker = arrayOfTypeCheckers[i];
892
- if (typeof checker !== 'function') {
893
- printWarning(
894
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
895
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
896
- );
897
- return emptyFunctionThatReturnsNull;
898
- }
899
- }
900
-
901
- function validate(props, propName, componentName, location, propFullName) {
902
- var expectedTypes = [];
903
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
904
- var checker = arrayOfTypeCheckers[i];
905
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
906
- if (checkerResult == null) {
907
- return null;
908
- }
909
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
910
- expectedTypes.push(checkerResult.data.expectedType);
911
- }
912
- }
913
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
914
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
915
- }
916
- return createChainableTypeChecker(validate);
917
- }
918
-
919
- function createNodeChecker() {
920
- function validate(props, propName, componentName, location, propFullName) {
921
- if (!isNode(props[propName])) {
922
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
923
- }
924
- return null;
925
- }
926
- return createChainableTypeChecker(validate);
927
- }
928
-
929
- function invalidValidatorError(componentName, location, propFullName, key, type) {
930
- return new PropTypeError(
931
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
932
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
933
- );
934
- }
935
-
936
- function createShapeTypeChecker(shapeTypes) {
937
- function validate(props, propName, componentName, location, propFullName) {
938
- var propValue = props[propName];
939
- var propType = getPropType(propValue);
940
- if (propType !== 'object') {
941
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
942
- }
943
- for (var key in shapeTypes) {
944
- var checker = shapeTypes[key];
945
- if (typeof checker !== 'function') {
946
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
947
- }
948
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
949
- if (error) {
950
- return error;
951
- }
952
- }
953
- return null;
954
- }
955
- return createChainableTypeChecker(validate);
956
- }
957
-
958
- function createStrictShapeTypeChecker(shapeTypes) {
959
- function validate(props, propName, componentName, location, propFullName) {
960
- var propValue = props[propName];
961
- var propType = getPropType(propValue);
962
- if (propType !== 'object') {
963
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
964
- }
965
- // We need to check all keys in case some are required but missing from props.
966
- var allKeys = assign({}, props[propName], shapeTypes);
967
- for (var key in allKeys) {
968
- var checker = shapeTypes[key];
969
- if (has(shapeTypes, key) && typeof checker !== 'function') {
970
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
971
- }
972
- if (!checker) {
973
- return new PropTypeError(
974
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
975
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
976
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
977
- );
978
- }
979
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
980
- if (error) {
981
- return error;
982
- }
983
- }
984
- return null;
985
- }
986
-
987
- return createChainableTypeChecker(validate);
988
- }
989
-
990
- function isNode(propValue) {
991
- switch (typeof propValue) {
992
- case 'number':
993
- case 'string':
994
- case 'undefined':
995
- return true;
996
- case 'boolean':
997
- return !propValue;
998
- case 'object':
999
- if (Array.isArray(propValue)) {
1000
- return propValue.every(isNode);
1001
- }
1002
- if (propValue === null || isValidElement(propValue)) {
1003
- return true;
1004
- }
1005
-
1006
- var iteratorFn = getIteratorFn(propValue);
1007
- if (iteratorFn) {
1008
- var iterator = iteratorFn.call(propValue);
1009
- var step;
1010
- if (iteratorFn !== propValue.entries) {
1011
- while (!(step = iterator.next()).done) {
1012
- if (!isNode(step.value)) {
1013
- return false;
1014
- }
1015
- }
1016
- } else {
1017
- // Iterator will provide entry [k,v] tuples rather than values.
1018
- while (!(step = iterator.next()).done) {
1019
- var entry = step.value;
1020
- if (entry) {
1021
- if (!isNode(entry[1])) {
1022
- return false;
1023
- }
1024
- }
1025
- }
1026
- }
1027
- } else {
1028
- return false;
1029
- }
1030
-
1031
- return true;
1032
- default:
1033
- return false;
1034
- }
1035
- }
1036
-
1037
- function isSymbol(propType, propValue) {
1038
- // Native Symbol.
1039
- if (propType === 'symbol') {
1040
- return true;
1041
- }
1042
-
1043
- // falsy value can't be a Symbol
1044
- if (!propValue) {
1045
- return false;
1046
- }
1047
-
1048
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1049
- if (propValue['@@toStringTag'] === 'Symbol') {
1050
- return true;
1051
- }
1052
-
1053
- // Fallback for non-spec compliant Symbols which are polyfilled.
1054
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1055
- return true;
1056
- }
1057
-
1058
- return false;
1059
- }
1060
-
1061
- // Equivalent of `typeof` but with special handling for array and regexp.
1062
- function getPropType(propValue) {
1063
- var propType = typeof propValue;
1064
- if (Array.isArray(propValue)) {
1065
- return 'array';
1066
- }
1067
- if (propValue instanceof RegExp) {
1068
- // Old webkits (at least until Android 4.0) return 'function' rather than
1069
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1070
- // passes PropTypes.object.
1071
- return 'object';
1072
- }
1073
- if (isSymbol(propType, propValue)) {
1074
- return 'symbol';
1075
- }
1076
- return propType;
1077
- }
1078
-
1079
- // This handles more types than `getPropType`. Only used for error messages.
1080
- // See `createPrimitiveTypeChecker`.
1081
- function getPreciseType(propValue) {
1082
- if (typeof propValue === 'undefined' || propValue === null) {
1083
- return '' + propValue;
1084
- }
1085
- var propType = getPropType(propValue);
1086
- if (propType === 'object') {
1087
- if (propValue instanceof Date) {
1088
- return 'date';
1089
- } else if (propValue instanceof RegExp) {
1090
- return 'regexp';
1091
- }
1092
- }
1093
- return propType;
1094
- }
1095
-
1096
- // Returns a string that is postfixed to a warning about an invalid type.
1097
- // For example, "undefined" or "of type array"
1098
- function getPostfixForTypeWarning(value) {
1099
- var type = getPreciseType(value);
1100
- switch (type) {
1101
- case 'array':
1102
- case 'object':
1103
- return 'an ' + type;
1104
- case 'boolean':
1105
- case 'date':
1106
- case 'regexp':
1107
- return 'a ' + type;
1108
- default:
1109
- return type;
1110
- }
1111
- }
1112
-
1113
- // Returns class name of the object, if any.
1114
- function getClassName(propValue) {
1115
- if (!propValue.constructor || !propValue.constructor.name) {
1116
- return ANONYMOUS;
1117
- }
1118
- return propValue.constructor.name;
1119
- }
1120
-
1121
- ReactPropTypes.checkPropTypes = checkPropTypes;
1122
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1123
- ReactPropTypes.PropTypes = ReactPropTypes;
1124
-
1125
- return ReactPropTypes;
1126
- };
1127
- return factoryWithTypeCheckers;
1128
- }
1129
-
1130
- /**
1131
- * Copyright (c) 2013-present, Facebook, Inc.
1132
- *
1133
- * This source code is licensed under the MIT license found in the
1134
- * LICENSE file in the root directory of this source tree.
1135
- */
1136
-
1137
- var factoryWithThrowingShims;
1138
- var hasRequiredFactoryWithThrowingShims;
1139
-
1140
- function requireFactoryWithThrowingShims () {
1141
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1142
- hasRequiredFactoryWithThrowingShims = 1;
1143
-
1144
- var ReactPropTypesSecret = requireReactPropTypesSecret();
1145
-
1146
- function emptyFunction() {}
1147
- function emptyFunctionWithReset() {}
1148
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
1149
-
1150
- factoryWithThrowingShims = function() {
1151
- function shim(props, propName, componentName, location, propFullName, secret) {
1152
- if (secret === ReactPropTypesSecret) {
1153
- // It is still safe when called from React.
1154
- return;
1155
- }
1156
- var err = new Error(
1157
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1158
- 'Use PropTypes.checkPropTypes() to call them. ' +
1159
- 'Read more at http://fb.me/use-check-prop-types'
1160
- );
1161
- err.name = 'Invariant Violation';
1162
- throw err;
1163
- } shim.isRequired = shim;
1164
- function getShim() {
1165
- return shim;
1166
- } // Important!
1167
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1168
- var ReactPropTypes = {
1169
- array: shim,
1170
- bigint: shim,
1171
- bool: shim,
1172
- func: shim,
1173
- number: shim,
1174
- object: shim,
1175
- string: shim,
1176
- symbol: shim,
1177
-
1178
- any: shim,
1179
- arrayOf: getShim,
1180
- element: shim,
1181
- elementType: shim,
1182
- instanceOf: getShim,
1183
- node: shim,
1184
- objectOf: getShim,
1185
- oneOf: getShim,
1186
- oneOfType: getShim,
1187
- shape: getShim,
1188
- exact: getShim,
1189
-
1190
- checkPropTypes: emptyFunctionWithReset,
1191
- resetWarningCache: emptyFunction
1192
- };
1193
-
1194
- ReactPropTypes.PropTypes = ReactPropTypes;
1195
-
1196
- return ReactPropTypes;
1197
- };
1198
- return factoryWithThrowingShims;
1199
- }
1200
-
1201
- /**
1202
- * Copyright (c) 2013-present, Facebook, Inc.
1203
- *
1204
- * This source code is licensed under the MIT license found in the
1205
- * LICENSE file in the root directory of this source tree.
1206
- */
1207
-
1208
- if (process.env.NODE_ENV !== 'production') {
1209
- var ReactIs = requireReactIs();
1210
-
1211
- // By explicitly using `prop-types` you are opting into new development behavior.
1212
- // http://fb.me/prop-types-in-prod
1213
- var throwOnDirectAccess = true;
1214
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1215
- } else {
1216
- // By explicitly using `prop-types` you are opting into new production behavior.
1217
- // http://fb.me/prop-types-in-prod
1218
- propTypes.exports = requireFactoryWithThrowingShims()();
1219
- }
1220
-
1221
- /**
1222
- * Checks if a given element has a CSS class.
1223
- *
1224
- * @param element the element
1225
- * @param className the CSS class name
1226
- */
1227
- function hasClass(element, className) {
1228
- if (element.classList) return !!className && element.classList.contains(className);
1229
- return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
1230
- }
1231
-
1232
- /**
1233
- * Adds a CSS class to a given element.
1234
- *
1235
- * @param element the element
1236
- * @param className the CSS class name
1237
- */
1238
-
1239
- function addClass(element, className) {
1240
- 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);
1241
- }
1242
-
1243
- function replaceClassName(origClass, classToRemove) {
1244
- return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
1245
- }
1246
- /**
1247
- * Removes a CSS class from a given element.
1248
- *
1249
- * @param element the element
1250
- * @param className the CSS class name
1251
- */
1252
-
1253
-
1254
- function removeClass$1(element, className) {
1255
- if (element.classList) {
1256
- element.classList.remove(className);
1257
- } else if (typeof element.className === 'string') {
1258
- element.className = replaceClassName(element.className, className);
1259
- } else {
1260
- element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
1261
- }
1262
- }
1263
-
1264
- var config = {
1265
- disabled: false
1266
- };
1267
-
1268
- var timeoutsShape = process.env.NODE_ENV !== 'production' ? propTypes.exports.oneOfType([propTypes.exports.number, propTypes.exports.shape({
1269
- enter: propTypes.exports.number,
1270
- exit: propTypes.exports.number,
1271
- appear: propTypes.exports.number
1272
- }).isRequired]) : null;
1273
- var classNamesShape = process.env.NODE_ENV !== 'production' ? propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.shape({
1274
- enter: propTypes.exports.string,
1275
- exit: propTypes.exports.string,
1276
- active: propTypes.exports.string
1277
- }), propTypes.exports.shape({
1278
- enter: propTypes.exports.string,
1279
- enterDone: propTypes.exports.string,
1280
- enterActive: propTypes.exports.string,
1281
- exit: propTypes.exports.string,
1282
- exitDone: propTypes.exports.string,
1283
- exitActive: propTypes.exports.string
1284
- })]) : null;
1285
-
1286
- var TransitionGroupContext = React__default.createContext(null);
1287
-
1288
- var forceReflow = function forceReflow(node) {
1289
- return node.scrollTop;
1290
- };
1291
-
1292
- var UNMOUNTED = 'unmounted';
1293
- var EXITED = 'exited';
1294
- var ENTERING = 'entering';
1295
- var ENTERED = 'entered';
1296
- var EXITING = 'exiting';
1297
- /**
1298
- * The Transition component lets you describe a transition from one component
1299
- * state to another _over time_ with a simple declarative API. Most commonly
1300
- * it's used to animate the mounting and unmounting of a component, but can also
1301
- * be used to describe in-place transition states as well.
1302
- *
1303
- * ---
1304
- *
1305
- * **Note**: `Transition` is a platform-agnostic base component. If you're using
1306
- * transitions in CSS, you'll probably want to use
1307
- * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
1308
- * instead. It inherits all the features of `Transition`, but contains
1309
- * additional features necessary to play nice with CSS transitions (hence the
1310
- * name of the component).
1311
- *
1312
- * ---
1313
- *
1314
- * By default the `Transition` component does not alter the behavior of the
1315
- * component it renders, it only tracks "enter" and "exit" states for the
1316
- * components. It's up to you to give meaning and effect to those states. For
1317
- * example we can add styles to a component when it enters or exits:
1318
- *
1319
- * ```jsx
1320
- * import { Transition } from 'react-transition-group';
1321
- *
1322
- * const duration = 300;
1323
- *
1324
- * const defaultStyle = {
1325
- * transition: `opacity ${duration}ms ease-in-out`,
1326
- * opacity: 0,
1327
- * }
1328
- *
1329
- * const transitionStyles = {
1330
- * entering: { opacity: 1 },
1331
- * entered: { opacity: 1 },
1332
- * exiting: { opacity: 0 },
1333
- * exited: { opacity: 0 },
1334
- * };
1335
- *
1336
- * const Fade = ({ in: inProp }) => (
1337
- * <Transition in={inProp} timeout={duration}>
1338
- * {state => (
1339
- * <div style={{
1340
- * ...defaultStyle,
1341
- * ...transitionStyles[state]
1342
- * }}>
1343
- * I'm a fade Transition!
1344
- * </div>
1345
- * )}
1346
- * </Transition>
1347
- * );
1348
- * ```
1349
- *
1350
- * There are 4 main states a Transition can be in:
1351
- * - `'entering'`
1352
- * - `'entered'`
1353
- * - `'exiting'`
1354
- * - `'exited'`
1355
- *
1356
- * Transition state is toggled via the `in` prop. When `true` the component
1357
- * begins the "Enter" stage. During this stage, the component will shift from
1358
- * its current transition state, to `'entering'` for the duration of the
1359
- * transition and then to the `'entered'` stage once it's complete. Let's take
1360
- * the following example (we'll use the
1361
- * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
1362
- *
1363
- * ```jsx
1364
- * function App() {
1365
- * const [inProp, setInProp] = useState(false);
1366
- * return (
1367
- * <div>
1368
- * <Transition in={inProp} timeout={500}>
1369
- * {state => (
1370
- * // ...
1371
- * )}
1372
- * </Transition>
1373
- * <button onClick={() => setInProp(true)}>
1374
- * Click to Enter
1375
- * </button>
1376
- * </div>
1377
- * );
1378
- * }
1379
- * ```
1380
- *
1381
- * When the button is clicked the component will shift to the `'entering'` state
1382
- * and stay there for 500ms (the value of `timeout`) before it finally switches
1383
- * to `'entered'`.
1384
- *
1385
- * When `in` is `false` the same thing happens except the state moves from
1386
- * `'exiting'` to `'exited'`.
1387
- */
1388
-
1389
- var Transition = /*#__PURE__*/function (_React$Component) {
1390
- _inheritsLoose(Transition, _React$Component);
1391
-
1392
- function Transition(props, context) {
1393
- var _this;
1394
-
1395
- _this = _React$Component.call(this, props, context) || this;
1396
- var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
1397
-
1398
- var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
1399
- var initialStatus;
1400
- _this.appearStatus = null;
1401
-
1402
- if (props.in) {
1403
- if (appear) {
1404
- initialStatus = EXITED;
1405
- _this.appearStatus = ENTERING;
1406
- } else {
1407
- initialStatus = ENTERED;
1408
- }
1409
- } else {
1410
- if (props.unmountOnExit || props.mountOnEnter) {
1411
- initialStatus = UNMOUNTED;
1412
- } else {
1413
- initialStatus = EXITED;
1414
- }
1415
- }
1416
-
1417
- _this.state = {
1418
- status: initialStatus
1419
- };
1420
- _this.nextCallback = null;
1421
- return _this;
1422
- }
1423
-
1424
- Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
1425
- var nextIn = _ref.in;
1426
-
1427
- if (nextIn && prevState.status === UNMOUNTED) {
1428
- return {
1429
- status: EXITED
1430
- };
1431
- }
1432
-
1433
- return null;
1434
- } // getSnapshotBeforeUpdate(prevProps) {
1435
- // let nextStatus = null
1436
- // if (prevProps !== this.props) {
1437
- // const { status } = this.state
1438
- // if (this.props.in) {
1439
- // if (status !== ENTERING && status !== ENTERED) {
1440
- // nextStatus = ENTERING
1441
- // }
1442
- // } else {
1443
- // if (status === ENTERING || status === ENTERED) {
1444
- // nextStatus = EXITING
1445
- // }
1446
- // }
1447
- // }
1448
- // return { nextStatus }
1449
- // }
1450
- ;
1451
-
1452
- var _proto = Transition.prototype;
1453
-
1454
- _proto.componentDidMount = function componentDidMount() {
1455
- this.updateStatus(true, this.appearStatus);
1456
- };
1457
-
1458
- _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
1459
- var nextStatus = null;
1460
-
1461
- if (prevProps !== this.props) {
1462
- var status = this.state.status;
1463
-
1464
- if (this.props.in) {
1465
- if (status !== ENTERING && status !== ENTERED) {
1466
- nextStatus = ENTERING;
1467
- }
1468
- } else {
1469
- if (status === ENTERING || status === ENTERED) {
1470
- nextStatus = EXITING;
1471
- }
1472
- }
1473
- }
1474
-
1475
- this.updateStatus(false, nextStatus);
1476
- };
1477
-
1478
- _proto.componentWillUnmount = function componentWillUnmount() {
1479
- this.cancelNextCallback();
1480
- };
1481
-
1482
- _proto.getTimeouts = function getTimeouts() {
1483
- var timeout = this.props.timeout;
1484
- var exit, enter, appear;
1485
- exit = enter = appear = timeout;
1486
-
1487
- if (timeout != null && typeof timeout !== 'number') {
1488
- exit = timeout.exit;
1489
- enter = timeout.enter; // TODO: remove fallback for next major
1490
-
1491
- appear = timeout.appear !== undefined ? timeout.appear : enter;
1492
- }
1493
-
1494
- return {
1495
- exit: exit,
1496
- enter: enter,
1497
- appear: appear
1498
- };
1499
- };
1500
-
1501
- _proto.updateStatus = function updateStatus(mounting, nextStatus) {
1502
- if (mounting === void 0) {
1503
- mounting = false;
1504
- }
1505
-
1506
- if (nextStatus !== null) {
1507
- // nextStatus will always be ENTERING or EXITING.
1508
- this.cancelNextCallback();
1509
-
1510
- if (nextStatus === ENTERING) {
1511
- if (this.props.unmountOnExit || this.props.mountOnEnter) {
1512
- var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
1513
- // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
1514
- // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
1515
-
1516
- if (node) forceReflow(node);
1517
- }
1518
-
1519
- this.performEnter(mounting);
1520
- } else {
1521
- this.performExit();
1522
- }
1523
- } else if (this.props.unmountOnExit && this.state.status === EXITED) {
1524
- this.setState({
1525
- status: UNMOUNTED
1526
- });
1527
- }
1528
- };
1529
-
1530
- _proto.performEnter = function performEnter(mounting) {
1531
- var _this2 = this;
1532
-
1533
- var enter = this.props.enter;
1534
- var appearing = this.context ? this.context.isMounting : mounting;
1535
-
1536
- var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],
1537
- maybeNode = _ref2[0],
1538
- maybeAppearing = _ref2[1];
1539
-
1540
- var timeouts = this.getTimeouts();
1541
- var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
1542
- // if we are mounting and running this it means appear _must_ be set
1543
-
1544
- if (!mounting && !enter || config.disabled) {
1545
- this.safeSetState({
1546
- status: ENTERED
1547
- }, function () {
1548
- _this2.props.onEntered(maybeNode);
1549
- });
1550
- return;
1551
- }
1552
-
1553
- this.props.onEnter(maybeNode, maybeAppearing);
1554
- this.safeSetState({
1555
- status: ENTERING
1556
- }, function () {
1557
- _this2.props.onEntering(maybeNode, maybeAppearing);
1558
-
1559
- _this2.onTransitionEnd(enterTimeout, function () {
1560
- _this2.safeSetState({
1561
- status: ENTERED
1562
- }, function () {
1563
- _this2.props.onEntered(maybeNode, maybeAppearing);
1564
- });
1565
- });
1566
- });
1567
- };
1568
-
1569
- _proto.performExit = function performExit() {
1570
- var _this3 = this;
1571
-
1572
- var exit = this.props.exit;
1573
- var timeouts = this.getTimeouts();
1574
- var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED
1575
-
1576
- if (!exit || config.disabled) {
1577
- this.safeSetState({
1578
- status: EXITED
1579
- }, function () {
1580
- _this3.props.onExited(maybeNode);
1581
- });
1582
- return;
1583
- }
1584
-
1585
- this.props.onExit(maybeNode);
1586
- this.safeSetState({
1587
- status: EXITING
1588
- }, function () {
1589
- _this3.props.onExiting(maybeNode);
1590
-
1591
- _this3.onTransitionEnd(timeouts.exit, function () {
1592
- _this3.safeSetState({
1593
- status: EXITED
1594
- }, function () {
1595
- _this3.props.onExited(maybeNode);
1596
- });
1597
- });
1598
- });
1599
- };
1600
-
1601
- _proto.cancelNextCallback = function cancelNextCallback() {
1602
- if (this.nextCallback !== null) {
1603
- this.nextCallback.cancel();
1604
- this.nextCallback = null;
1605
- }
1606
- };
1607
-
1608
- _proto.safeSetState = function safeSetState(nextState, callback) {
1609
- // This shouldn't be necessary, but there are weird race conditions with
1610
- // setState callbacks and unmounting in testing, so always make sure that
1611
- // we can cancel any pending setState callbacks after we unmount.
1612
- callback = this.setNextCallback(callback);
1613
- this.setState(nextState, callback);
1614
- };
1615
-
1616
- _proto.setNextCallback = function setNextCallback(callback) {
1617
- var _this4 = this;
1618
-
1619
- var active = true;
1620
-
1621
- this.nextCallback = function (event) {
1622
- if (active) {
1623
- active = false;
1624
- _this4.nextCallback = null;
1625
- callback(event);
1626
- }
1627
- };
1628
-
1629
- this.nextCallback.cancel = function () {
1630
- active = false;
1631
- };
1632
-
1633
- return this.nextCallback;
1634
- };
1635
-
1636
- _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
1637
- this.setNextCallback(handler);
1638
- var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
1639
- var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
1640
-
1641
- if (!node || doesNotHaveTimeoutOrListener) {
1642
- setTimeout(this.nextCallback, 0);
1643
- return;
1644
- }
1645
-
1646
- if (this.props.addEndListener) {
1647
- var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
1648
- maybeNode = _ref3[0],
1649
- maybeNextCallback = _ref3[1];
1650
-
1651
- this.props.addEndListener(maybeNode, maybeNextCallback);
1652
- }
1653
-
1654
- if (timeout != null) {
1655
- setTimeout(this.nextCallback, timeout);
1656
- }
1657
- };
1658
-
1659
- _proto.render = function render() {
1660
- var status = this.state.status;
1661
-
1662
- if (status === UNMOUNTED) {
1663
- return null;
1664
- }
1665
-
1666
- var _this$props = this.props,
1667
- children = _this$props.children;
1668
- _this$props.in;
1669
- _this$props.mountOnEnter;
1670
- _this$props.unmountOnExit;
1671
- _this$props.appear;
1672
- _this$props.enter;
1673
- _this$props.exit;
1674
- _this$props.timeout;
1675
- _this$props.addEndListener;
1676
- _this$props.onEnter;
1677
- _this$props.onEntering;
1678
- _this$props.onEntered;
1679
- _this$props.onExit;
1680
- _this$props.onExiting;
1681
- _this$props.onExited;
1682
- _this$props.nodeRef;
1683
- var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
1684
-
1685
- return (
1686
- /*#__PURE__*/
1687
- // allows for nested Transitions
1688
- React__default.createElement(TransitionGroupContext.Provider, {
1689
- value: null
1690
- }, typeof children === 'function' ? children(status, childProps) : React__default.cloneElement(React__default.Children.only(children), childProps))
1691
- );
1692
- };
1693
-
1694
- return Transition;
1695
- }(React__default.Component);
1696
-
1697
- Transition.contextType = TransitionGroupContext;
1698
- Transition.propTypes = process.env.NODE_ENV !== "production" ? {
1699
- /**
1700
- * A React reference to DOM element that need to transition:
1701
- * https://stackoverflow.com/a/51127130/4671932
1702
- *
1703
- * - When `nodeRef` prop is used, `node` is not passed to callback functions
1704
- * (e.g. `onEnter`) because user already has direct access to the node.
1705
- * - When changing `key` prop of `Transition` in a `TransitionGroup` a new
1706
- * `nodeRef` need to be provided to `Transition` with changed `key` prop
1707
- * (see
1708
- * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
1709
- */
1710
- nodeRef: propTypes.exports.shape({
1711
- current: typeof Element === 'undefined' ? propTypes.exports.any : function (propValue, key, componentName, location, propFullName, secret) {
1712
- var value = propValue[key];
1713
- return propTypes.exports.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
1714
- }
1715
- }),
1716
-
1717
- /**
1718
- * A `function` child can be used instead of a React element. This function is
1719
- * called with the current transition status (`'entering'`, `'entered'`,
1720
- * `'exiting'`, `'exited'`), which can be used to apply context
1721
- * specific props to a component.
1722
- *
1723
- * ```jsx
1724
- * <Transition in={this.state.in} timeout={150}>
1725
- * {state => (
1726
- * <MyComponent className={`fade fade-${state}`} />
1727
- * )}
1728
- * </Transition>
1729
- * ```
1730
- */
1731
- children: propTypes.exports.oneOfType([propTypes.exports.func.isRequired, propTypes.exports.element.isRequired]).isRequired,
1732
-
1733
- /**
1734
- * Show the component; triggers the enter or exit states
1735
- */
1736
- in: propTypes.exports.bool,
1737
-
1738
- /**
1739
- * By default the child component is mounted immediately along with
1740
- * the parent `Transition` component. If you want to "lazy mount" the component on the
1741
- * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
1742
- * mounted, even on "exited", unless you also specify `unmountOnExit`.
1743
- */
1744
- mountOnEnter: propTypes.exports.bool,
1745
-
1746
- /**
1747
- * By default the child component stays mounted after it reaches the `'exited'` state.
1748
- * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
1749
- */
1750
- unmountOnExit: propTypes.exports.bool,
1751
-
1752
- /**
1753
- * By default the child component does not perform the enter transition when
1754
- * it first mounts, regardless of the value of `in`. If you want this
1755
- * behavior, set both `appear` and `in` to `true`.
1756
- *
1757
- * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
1758
- * > only adds an additional enter transition. However, in the
1759
- * > `<CSSTransition>` component that first enter transition does result in
1760
- * > additional `.appear-*` classes, that way you can choose to style it
1761
- * > differently.
1762
- */
1763
- appear: propTypes.exports.bool,
1764
-
1765
- /**
1766
- * Enable or disable enter transitions.
1767
- */
1768
- enter: propTypes.exports.bool,
1769
-
1770
- /**
1771
- * Enable or disable exit transitions.
1772
- */
1773
- exit: propTypes.exports.bool,
1774
-
1775
- /**
1776
- * The duration of the transition, in milliseconds.
1777
- * Required unless `addEndListener` is provided.
1778
- *
1779
- * You may specify a single timeout for all transitions:
1780
- *
1781
- * ```jsx
1782
- * timeout={500}
1783
- * ```
1784
- *
1785
- * or individually:
1786
- *
1787
- * ```jsx
1788
- * timeout={{
1789
- * appear: 500,
1790
- * enter: 300,
1791
- * exit: 500,
1792
- * }}
1793
- * ```
1794
- *
1795
- * - `appear` defaults to the value of `enter`
1796
- * - `enter` defaults to `0`
1797
- * - `exit` defaults to `0`
1798
- *
1799
- * @type {number | { enter?: number, exit?: number, appear?: number }}
1800
- */
1801
- timeout: function timeout(props) {
1802
- var pt = timeoutsShape;
1803
- if (!props.addEndListener) pt = pt.isRequired;
1804
-
1805
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1806
- args[_key - 1] = arguments[_key];
1807
- }
1808
-
1809
- return pt.apply(void 0, [props].concat(args));
1810
- },
1811
-
1812
- /**
1813
- * Add a custom transition end trigger. Called with the transitioning
1814
- * DOM node and a `done` callback. Allows for more fine grained transition end
1815
- * logic. Timeouts are still used as a fallback if provided.
1816
- *
1817
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1818
- *
1819
- * ```jsx
1820
- * addEndListener={(node, done) => {
1821
- * // use the css transitionend event to mark the finish of a transition
1822
- * node.addEventListener('transitionend', done, false);
1823
- * }}
1824
- * ```
1825
- */
1826
- addEndListener: propTypes.exports.func,
1827
-
1828
- /**
1829
- * Callback fired before the "entering" status is applied. An extra parameter
1830
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
1831
- *
1832
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1833
- *
1834
- * @type Function(node: HtmlElement, isAppearing: bool) -> void
1835
- */
1836
- onEnter: propTypes.exports.func,
1837
-
1838
- /**
1839
- * Callback fired after the "entering" status is applied. An extra parameter
1840
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
1841
- *
1842
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1843
- *
1844
- * @type Function(node: HtmlElement, isAppearing: bool)
1845
- */
1846
- onEntering: propTypes.exports.func,
1847
-
1848
- /**
1849
- * Callback fired after the "entered" status is applied. An extra parameter
1850
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
1851
- *
1852
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1853
- *
1854
- * @type Function(node: HtmlElement, isAppearing: bool) -> void
1855
- */
1856
- onEntered: propTypes.exports.func,
1857
-
1858
- /**
1859
- * Callback fired before the "exiting" status is applied.
1860
- *
1861
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1862
- *
1863
- * @type Function(node: HtmlElement) -> void
1864
- */
1865
- onExit: propTypes.exports.func,
1866
-
1867
- /**
1868
- * Callback fired after the "exiting" status is applied.
1869
- *
1870
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1871
- *
1872
- * @type Function(node: HtmlElement) -> void
1873
- */
1874
- onExiting: propTypes.exports.func,
1875
-
1876
- /**
1877
- * Callback fired after the "exited" status is applied.
1878
- *
1879
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
1880
- *
1881
- * @type Function(node: HtmlElement) -> void
1882
- */
1883
- onExited: propTypes.exports.func
1884
- } : {}; // Name the function so it is clearer in the documentation
1885
-
1886
- function noop() {}
1887
-
1888
- Transition.defaultProps = {
1889
- in: false,
1890
- mountOnEnter: false,
1891
- unmountOnExit: false,
1892
- appear: false,
1893
- enter: true,
1894
- exit: true,
1895
- onEnter: noop,
1896
- onEntering: noop,
1897
- onEntered: noop,
1898
- onExit: noop,
1899
- onExiting: noop,
1900
- onExited: noop
1901
- };
1902
- Transition.UNMOUNTED = UNMOUNTED;
1903
- Transition.EXITED = EXITED;
1904
- Transition.ENTERING = ENTERING;
1905
- Transition.ENTERED = ENTERED;
1906
- Transition.EXITING = EXITING;
1907
-
1908
- var _addClass = function addClass$1(node, classes) {
1909
- return node && classes && classes.split(' ').forEach(function (c) {
1910
- return addClass(node, c);
1911
- });
1912
- };
1913
-
1914
- var removeClass = function removeClass(node, classes) {
1915
- return node && classes && classes.split(' ').forEach(function (c) {
1916
- return removeClass$1(node, c);
1917
- });
1918
- };
1919
- /**
1920
- * A transition component inspired by the excellent
1921
- * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
1922
- * use it if you're using CSS transitions or animations. It's built upon the
1923
- * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
1924
- * component, so it inherits all of its props.
1925
- *
1926
- * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
1927
- * and `exit` states of the transition. The first class is applied and then a
1928
- * second `*-active` class in order to activate the CSS transition. After the
1929
- * transition, matching `*-done` class names are applied to persist the
1930
- * transition state.
1931
- *
1932
- * ```jsx
1933
- * function App() {
1934
- * const [inProp, setInProp] = useState(false);
1935
- * return (
1936
- * <div>
1937
- * <CSSTransition in={inProp} timeout={200} classNames="my-node">
1938
- * <div>
1939
- * {"I'll receive my-node-* classes"}
1940
- * </div>
1941
- * </CSSTransition>
1942
- * <button type="button" onClick={() => setInProp(true)}>
1943
- * Click to Enter
1944
- * </button>
1945
- * </div>
1946
- * );
1947
- * }
1948
- * ```
1949
- *
1950
- * When the `in` prop is set to `true`, the child component will first receive
1951
- * the class `example-enter`, then the `example-enter-active` will be added in
1952
- * the next tick. `CSSTransition` [forces a
1953
- * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
1954
- * between before adding the `example-enter-active`. This is an important trick
1955
- * because it allows us to transition between `example-enter` and
1956
- * `example-enter-active` even though they were added immediately one after
1957
- * another. Most notably, this is what makes it possible for us to animate
1958
- * _appearance_.
1959
- *
1960
- * ```css
1961
- * .my-node-enter {
1962
- * opacity: 0;
1963
- * }
1964
- * .my-node-enter-active {
1965
- * opacity: 1;
1966
- * transition: opacity 200ms;
1967
- * }
1968
- * .my-node-exit {
1969
- * opacity: 1;
1970
- * }
1971
- * .my-node-exit-active {
1972
- * opacity: 0;
1973
- * transition: opacity 200ms;
1974
- * }
1975
- * ```
1976
- *
1977
- * `*-active` classes represent which styles you want to animate **to**, so it's
1978
- * important to add `transition` declaration only to them, otherwise transitions
1979
- * might not behave as intended! This might not be obvious when the transitions
1980
- * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
1981
- * the example above (minus `transition`), but it becomes apparent in more
1982
- * complex transitions.
1983
- *
1984
- * **Note**: If you're using the
1985
- * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
1986
- * prop, make sure to define styles for `.appear-*` classes as well.
1987
- */
1988
-
1989
-
1990
- var CSSTransition = /*#__PURE__*/function (_React$Component) {
1991
- _inheritsLoose(CSSTransition, _React$Component);
1992
-
1993
- function CSSTransition() {
1994
- var _this;
1995
-
1996
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1997
- args[_key] = arguments[_key];
1998
- }
1999
-
2000
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
2001
- _this.appliedClasses = {
2002
- appear: {},
2003
- enter: {},
2004
- exit: {}
2005
- };
2006
-
2007
- _this.onEnter = function (maybeNode, maybeAppearing) {
2008
- var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
2009
- node = _this$resolveArgument[0],
2010
- appearing = _this$resolveArgument[1];
2011
-
2012
- _this.removeClasses(node, 'exit');
2013
-
2014
- _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
2015
-
2016
- if (_this.props.onEnter) {
2017
- _this.props.onEnter(maybeNode, maybeAppearing);
2018
- }
2019
- };
2020
-
2021
- _this.onEntering = function (maybeNode, maybeAppearing) {
2022
- var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
2023
- node = _this$resolveArgument2[0],
2024
- appearing = _this$resolveArgument2[1];
2025
-
2026
- var type = appearing ? 'appear' : 'enter';
2027
-
2028
- _this.addClass(node, type, 'active');
2029
-
2030
- if (_this.props.onEntering) {
2031
- _this.props.onEntering(maybeNode, maybeAppearing);
2032
- }
2033
- };
2034
-
2035
- _this.onEntered = function (maybeNode, maybeAppearing) {
2036
- var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
2037
- node = _this$resolveArgument3[0],
2038
- appearing = _this$resolveArgument3[1];
2039
-
2040
- var type = appearing ? 'appear' : 'enter';
2041
-
2042
- _this.removeClasses(node, type);
2043
-
2044
- _this.addClass(node, type, 'done');
2045
-
2046
- if (_this.props.onEntered) {
2047
- _this.props.onEntered(maybeNode, maybeAppearing);
2048
- }
2049
- };
2050
-
2051
- _this.onExit = function (maybeNode) {
2052
- var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
2053
- node = _this$resolveArgument4[0];
2054
-
2055
- _this.removeClasses(node, 'appear');
2056
-
2057
- _this.removeClasses(node, 'enter');
2058
-
2059
- _this.addClass(node, 'exit', 'base');
2060
-
2061
- if (_this.props.onExit) {
2062
- _this.props.onExit(maybeNode);
2063
- }
2064
- };
2065
-
2066
- _this.onExiting = function (maybeNode) {
2067
- var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
2068
- node = _this$resolveArgument5[0];
2069
-
2070
- _this.addClass(node, 'exit', 'active');
2071
-
2072
- if (_this.props.onExiting) {
2073
- _this.props.onExiting(maybeNode);
2074
- }
2075
- };
2076
-
2077
- _this.onExited = function (maybeNode) {
2078
- var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
2079
- node = _this$resolveArgument6[0];
2080
-
2081
- _this.removeClasses(node, 'exit');
2082
-
2083
- _this.addClass(node, 'exit', 'done');
2084
-
2085
- if (_this.props.onExited) {
2086
- _this.props.onExited(maybeNode);
2087
- }
2088
- };
2089
-
2090
- _this.resolveArguments = function (maybeNode, maybeAppearing) {
2091
- return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
2092
- : [maybeNode, maybeAppearing];
2093
- };
2094
-
2095
- _this.getClassNames = function (type) {
2096
- var classNames = _this.props.classNames;
2097
- var isStringClassNames = typeof classNames === 'string';
2098
- var prefix = isStringClassNames && classNames ? classNames + "-" : '';
2099
- var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
2100
- var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
2101
- var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
2102
- return {
2103
- baseClassName: baseClassName,
2104
- activeClassName: activeClassName,
2105
- doneClassName: doneClassName
2106
- };
2107
- };
2108
-
2109
- return _this;
2110
- }
2111
-
2112
- var _proto = CSSTransition.prototype;
2113
-
2114
- _proto.addClass = function addClass(node, type, phase) {
2115
- var className = this.getClassNames(type)[phase + "ClassName"];
2116
-
2117
- var _this$getClassNames = this.getClassNames('enter'),
2118
- doneClassName = _this$getClassNames.doneClassName;
2119
-
2120
- if (type === 'appear' && phase === 'done' && doneClassName) {
2121
- className += " " + doneClassName;
2122
- } // This is to force a repaint,
2123
- // which is necessary in order to transition styles when adding a class name.
2124
-
2125
-
2126
- if (phase === 'active') {
2127
- if (node) forceReflow(node);
2128
- }
2129
-
2130
- if (className) {
2131
- this.appliedClasses[type][phase] = className;
2132
-
2133
- _addClass(node, className);
2134
- }
2135
- };
2136
-
2137
- _proto.removeClasses = function removeClasses(node, type) {
2138
- var _this$appliedClasses$ = this.appliedClasses[type],
2139
- baseClassName = _this$appliedClasses$.base,
2140
- activeClassName = _this$appliedClasses$.active,
2141
- doneClassName = _this$appliedClasses$.done;
2142
- this.appliedClasses[type] = {};
2143
-
2144
- if (baseClassName) {
2145
- removeClass(node, baseClassName);
2146
- }
2147
-
2148
- if (activeClassName) {
2149
- removeClass(node, activeClassName);
2150
- }
2151
-
2152
- if (doneClassName) {
2153
- removeClass(node, doneClassName);
2154
- }
2155
- };
2156
-
2157
- _proto.render = function render() {
2158
- var _this$props = this.props;
2159
- _this$props.classNames;
2160
- var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
2161
-
2162
- return /*#__PURE__*/React__default.createElement(Transition, _extends({}, props, {
2163
- onEnter: this.onEnter,
2164
- onEntered: this.onEntered,
2165
- onEntering: this.onEntering,
2166
- onExit: this.onExit,
2167
- onExiting: this.onExiting,
2168
- onExited: this.onExited
2169
- }));
2170
- };
2171
-
2172
- return CSSTransition;
2173
- }(React__default.Component);
2174
-
2175
- CSSTransition.defaultProps = {
2176
- classNames: ''
2177
- };
2178
- CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, Transition.propTypes, {
2179
- /**
2180
- * The animation classNames applied to the component as it appears, enters,
2181
- * exits or has finished the transition. A single name can be provided, which
2182
- * will be suffixed for each stage, e.g. `classNames="fade"` applies:
2183
- *
2184
- * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
2185
- * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
2186
- * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
2187
- *
2188
- * A few details to note about how these classes are applied:
2189
- *
2190
- * 1. They are _joined_ with the ones that are already defined on the child
2191
- * component, so if you want to add some base styles, you can use
2192
- * `className` without worrying that it will be overridden.
2193
- *
2194
- * 2. If the transition component mounts with `in={false}`, no classes are
2195
- * applied yet. You might be expecting `*-exit-done`, but if you think
2196
- * about it, a component cannot finish exiting if it hasn't entered yet.
2197
- *
2198
- * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
2199
- * allows you to define different behavior for when appearing is done and
2200
- * when regular entering is done, using selectors like
2201
- * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
2202
- * an epic entrance animation when element first appears in the DOM using
2203
- * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
2204
- * simply use `fade-enter-done` for defining both cases.
2205
- *
2206
- * Each individual classNames can also be specified independently like:
2207
- *
2208
- * ```js
2209
- * classNames={{
2210
- * appear: 'my-appear',
2211
- * appearActive: 'my-active-appear',
2212
- * appearDone: 'my-done-appear',
2213
- * enter: 'my-enter',
2214
- * enterActive: 'my-active-enter',
2215
- * enterDone: 'my-done-enter',
2216
- * exit: 'my-exit',
2217
- * exitActive: 'my-active-exit',
2218
- * exitDone: 'my-done-exit',
2219
- * }}
2220
- * ```
2221
- *
2222
- * If you want to set these classes using CSS Modules:
2223
- *
2224
- * ```js
2225
- * import styles from './styles.css';
2226
- * ```
2227
- *
2228
- * you might want to use camelCase in your CSS file, that way could simply
2229
- * spread them instead of listing them one by one:
2230
- *
2231
- * ```js
2232
- * classNames={{ ...styles }}
2233
- * ```
2234
- *
2235
- * @type {string | {
2236
- * appear?: string,
2237
- * appearActive?: string,
2238
- * appearDone?: string,
2239
- * enter?: string,
2240
- * enterActive?: string,
2241
- * enterDone?: string,
2242
- * exit?: string,
2243
- * exitActive?: string,
2244
- * exitDone?: string,
2245
- * }}
2246
- */
2247
- classNames: classNamesShape,
2248
-
2249
- /**
2250
- * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
2251
- * applied.
2252
- *
2253
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2254
- *
2255
- * @type Function(node: HtmlElement, isAppearing: bool)
2256
- */
2257
- onEnter: propTypes.exports.func,
2258
-
2259
- /**
2260
- * A `<Transition>` callback fired immediately after the 'enter-active' or
2261
- * 'appear-active' class is applied.
2262
- *
2263
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2264
- *
2265
- * @type Function(node: HtmlElement, isAppearing: bool)
2266
- */
2267
- onEntering: propTypes.exports.func,
2268
-
2269
- /**
2270
- * A `<Transition>` callback fired immediately after the 'enter' or
2271
- * 'appear' classes are **removed** and the `done` class is added to the DOM node.
2272
- *
2273
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2274
- *
2275
- * @type Function(node: HtmlElement, isAppearing: bool)
2276
- */
2277
- onEntered: propTypes.exports.func,
2278
-
2279
- /**
2280
- * A `<Transition>` callback fired immediately after the 'exit' class is
2281
- * applied.
2282
- *
2283
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
2284
- *
2285
- * @type Function(node: HtmlElement)
2286
- */
2287
- onExit: propTypes.exports.func,
2288
-
2289
- /**
2290
- * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
2291
- *
2292
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
2293
- *
2294
- * @type Function(node: HtmlElement)
2295
- */
2296
- onExiting: propTypes.exports.func,
2297
-
2298
- /**
2299
- * A `<Transition>` callback fired immediately after the 'exit' classes
2300
- * are **removed** and the `exit-done` class is added to the DOM node.
2301
- *
2302
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
2303
- *
2304
- * @type Function(node: HtmlElement)
2305
- */
2306
- onExited: propTypes.exports.func
2307
- }) : {};
2308
-
2309
- function _assertThisInitialized(e) {
2310
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2311
- return e;
2312
- }
2313
-
2314
- /**
2315
- * Given `this.props.children`, return an object mapping key to child.
2316
- *
2317
- * @param {*} children `this.props.children`
2318
- * @return {object} Mapping of key to child
2319
- */
2320
-
2321
- function getChildMapping(children, mapFn) {
2322
- var mapper = function mapper(child) {
2323
- return mapFn && isValidElement(child) ? mapFn(child) : child;
2324
- };
2325
-
2326
- var result = Object.create(null);
2327
- if (children) Children.map(children, function (c) {
2328
- return c;
2329
- }).forEach(function (child) {
2330
- // run the map function here instead so that the key is the computed one
2331
- result[child.key] = mapper(child);
2332
- });
2333
- return result;
2334
- }
2335
- /**
2336
- * When you're adding or removing children some may be added or removed in the
2337
- * same render pass. We want to show *both* since we want to simultaneously
2338
- * animate elements in and out. This function takes a previous set of keys
2339
- * and a new set of keys and merges them with its best guess of the correct
2340
- * ordering. In the future we may expose some of the utilities in
2341
- * ReactMultiChild to make this easy, but for now React itself does not
2342
- * directly have this concept of the union of prevChildren and nextChildren
2343
- * so we implement it here.
2344
- *
2345
- * @param {object} prev prev children as returned from
2346
- * `ReactTransitionChildMapping.getChildMapping()`.
2347
- * @param {object} next next children as returned from
2348
- * `ReactTransitionChildMapping.getChildMapping()`.
2349
- * @return {object} a key set that contains all keys in `prev` and all keys
2350
- * in `next` in a reasonable order.
2351
- */
2352
-
2353
- function mergeChildMappings(prev, next) {
2354
- prev = prev || {};
2355
- next = next || {};
2356
-
2357
- function getValueForKey(key) {
2358
- return key in next ? next[key] : prev[key];
2359
- } // For each key of `next`, the list of keys to insert before that key in
2360
- // the combined list
2361
-
2362
-
2363
- var nextKeysPending = Object.create(null);
2364
- var pendingKeys = [];
2365
-
2366
- for (var prevKey in prev) {
2367
- if (prevKey in next) {
2368
- if (pendingKeys.length) {
2369
- nextKeysPending[prevKey] = pendingKeys;
2370
- pendingKeys = [];
2371
- }
2372
- } else {
2373
- pendingKeys.push(prevKey);
2374
- }
2375
- }
2376
-
2377
- var i;
2378
- var childMapping = {};
2379
-
2380
- for (var nextKey in next) {
2381
- if (nextKeysPending[nextKey]) {
2382
- for (i = 0; i < nextKeysPending[nextKey].length; i++) {
2383
- var pendingNextKey = nextKeysPending[nextKey][i];
2384
- childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
2385
- }
2386
- }
2387
-
2388
- childMapping[nextKey] = getValueForKey(nextKey);
2389
- } // Finally, add the keys which didn't appear before any key in `next`
2390
-
2391
-
2392
- for (i = 0; i < pendingKeys.length; i++) {
2393
- childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
2394
- }
2395
-
2396
- return childMapping;
2397
- }
2398
-
2399
- function getProp(child, prop, props) {
2400
- return props[prop] != null ? props[prop] : child.props[prop];
2401
- }
2402
-
2403
- function getInitialChildMapping(props, onExited) {
2404
- return getChildMapping(props.children, function (child) {
2405
- return cloneElement(child, {
2406
- onExited: onExited.bind(null, child),
2407
- in: true,
2408
- appear: getProp(child, 'appear', props),
2409
- enter: getProp(child, 'enter', props),
2410
- exit: getProp(child, 'exit', props)
2411
- });
2412
- });
2413
- }
2414
- function getNextChildMapping(nextProps, prevChildMapping, onExited) {
2415
- var nextChildMapping = getChildMapping(nextProps.children);
2416
- var children = mergeChildMappings(prevChildMapping, nextChildMapping);
2417
- Object.keys(children).forEach(function (key) {
2418
- var child = children[key];
2419
- if (!isValidElement(child)) return;
2420
- var hasPrev = (key in prevChildMapping);
2421
- var hasNext = (key in nextChildMapping);
2422
- var prevChild = prevChildMapping[key];
2423
- var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
2424
-
2425
- if (hasNext && (!hasPrev || isLeaving)) {
2426
- // console.log('entering', key)
2427
- children[key] = cloneElement(child, {
2428
- onExited: onExited.bind(null, child),
2429
- in: true,
2430
- exit: getProp(child, 'exit', nextProps),
2431
- enter: getProp(child, 'enter', nextProps)
2432
- });
2433
- } else if (!hasNext && hasPrev && !isLeaving) {
2434
- // item is old (exiting)
2435
- // console.log('leaving', key)
2436
- children[key] = cloneElement(child, {
2437
- in: false
2438
- });
2439
- } else if (hasNext && hasPrev && isValidElement(prevChild)) {
2440
- // item hasn't changed transition states
2441
- // copy over the last transition props;
2442
- // console.log('unchanged', key)
2443
- children[key] = cloneElement(child, {
2444
- onExited: onExited.bind(null, child),
2445
- in: prevChild.props.in,
2446
- exit: getProp(child, 'exit', nextProps),
2447
- enter: getProp(child, 'enter', nextProps)
2448
- });
2449
- }
2450
- });
2451
- return children;
2452
- }
2453
-
2454
- var values = Object.values || function (obj) {
2455
- return Object.keys(obj).map(function (k) {
2456
- return obj[k];
2457
- });
2458
- };
2459
-
2460
- var defaultProps = {
2461
- component: 'div',
2462
- childFactory: function childFactory(child) {
2463
- return child;
2464
- }
2465
- };
2466
- /**
2467
- * The `<TransitionGroup>` component manages a set of transition components
2468
- * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
2469
- * components, `<TransitionGroup>` is a state machine for managing the mounting
2470
- * and unmounting of components over time.
2471
- *
2472
- * Consider the example below. As items are removed or added to the TodoList the
2473
- * `in` prop is toggled automatically by the `<TransitionGroup>`.
2474
- *
2475
- * Note that `<TransitionGroup>` does not define any animation behavior!
2476
- * Exactly _how_ a list item animates is up to the individual transition
2477
- * component. This means you can mix and match animations across different list
2478
- * items.
2479
- */
2480
-
2481
- var TransitionGroup = /*#__PURE__*/function (_React$Component) {
2482
- _inheritsLoose(TransitionGroup, _React$Component);
2483
-
2484
- function TransitionGroup(props, context) {
2485
- var _this;
2486
-
2487
- _this = _React$Component.call(this, props, context) || this;
2488
-
2489
- var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
2490
-
2491
-
2492
- _this.state = {
2493
- contextValue: {
2494
- isMounting: true
2495
- },
2496
- handleExited: handleExited,
2497
- firstRender: true
2498
- };
2499
- return _this;
2500
- }
2501
-
2502
- var _proto = TransitionGroup.prototype;
2503
-
2504
- _proto.componentDidMount = function componentDidMount() {
2505
- this.mounted = true;
2506
- this.setState({
2507
- contextValue: {
2508
- isMounting: false
2509
- }
2510
- });
2511
- };
2512
-
2513
- _proto.componentWillUnmount = function componentWillUnmount() {
2514
- this.mounted = false;
2515
- };
2516
-
2517
- TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
2518
- var prevChildMapping = _ref.children,
2519
- handleExited = _ref.handleExited,
2520
- firstRender = _ref.firstRender;
2521
- return {
2522
- children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
2523
- firstRender: false
2524
- };
2525
- } // node is `undefined` when user provided `nodeRef` prop
2526
- ;
2527
-
2528
- _proto.handleExited = function handleExited(child, node) {
2529
- var currentChildMapping = getChildMapping(this.props.children);
2530
- if (child.key in currentChildMapping) return;
2531
-
2532
- if (child.props.onExited) {
2533
- child.props.onExited(node);
2534
- }
2535
-
2536
- if (this.mounted) {
2537
- this.setState(function (state) {
2538
- var children = _extends({}, state.children);
2539
-
2540
- delete children[child.key];
2541
- return {
2542
- children: children
2543
- };
2544
- });
2545
- }
2546
- };
2547
-
2548
- _proto.render = function render() {
2549
- var _this$props = this.props,
2550
- Component = _this$props.component,
2551
- childFactory = _this$props.childFactory,
2552
- props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
2553
-
2554
- var contextValue = this.state.contextValue;
2555
- var children = values(this.state.children).map(childFactory);
2556
- delete props.appear;
2557
- delete props.enter;
2558
- delete props.exit;
2559
-
2560
- if (Component === null) {
2561
- return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
2562
- value: contextValue
2563
- }, children);
2564
- }
2565
-
2566
- return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
2567
- value: contextValue
2568
- }, /*#__PURE__*/React__default.createElement(Component, props, children));
2569
- };
2570
-
2571
- return TransitionGroup;
2572
- }(React__default.Component);
2573
-
2574
- TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
2575
- /**
2576
- * `<TransitionGroup>` renders a `<div>` by default. You can change this
2577
- * behavior by providing a `component` prop.
2578
- * If you use React v16+ and would like to avoid a wrapping `<div>` element
2579
- * you can pass in `component={null}`. This is useful if the wrapping div
2580
- * borks your css styles.
2581
- */
2582
- component: propTypes.exports.any,
2583
-
2584
- /**
2585
- * A set of `<Transition>` components, that are toggled `in` and out as they
2586
- * leave. the `<TransitionGroup>` will inject specific transition props, so
2587
- * remember to spread them through if you are wrapping the `<Transition>` as
2588
- * with our `<Fade>` example.
2589
- *
2590
- * While this component is meant for multiple `Transition` or `CSSTransition`
2591
- * children, sometimes you may want to have a single transition child with
2592
- * content that you want to be transitioned out and in when you change it
2593
- * (e.g. routes, images etc.) In that case you can change the `key` prop of
2594
- * the transition child as you change its content, this will cause
2595
- * `TransitionGroup` to transition the child out and back in.
2596
- */
2597
- children: propTypes.exports.node,
2598
-
2599
- /**
2600
- * A convenience prop that enables or disables appear animations
2601
- * for all children. Note that specifying this will override any defaults set
2602
- * on individual children Transitions.
2603
- */
2604
- appear: propTypes.exports.bool,
2605
-
2606
- /**
2607
- * A convenience prop that enables or disables enter animations
2608
- * for all children. Note that specifying this will override any defaults set
2609
- * on individual children Transitions.
2610
- */
2611
- enter: propTypes.exports.bool,
2612
-
2613
- /**
2614
- * A convenience prop that enables or disables exit animations
2615
- * for all children. Note that specifying this will override any defaults set
2616
- * on individual children Transitions.
2617
- */
2618
- exit: propTypes.exports.bool,
2619
-
2620
- /**
2621
- * You may need to apply reactive updates to a child as it is exiting.
2622
- * This is generally done by using `cloneElement` however in the case of an exiting
2623
- * child the element has already been removed and not accessible to the consumer.
2624
- *
2625
- * If you do need to update a child as it leaves you can provide a `childFactory`
2626
- * to wrap every child, even the ones that are leaving.
2627
- *
2628
- * @type Function(child: ReactElement) -> ReactElement
2629
- */
2630
- childFactory: propTypes.exports.func
2631
- } : {};
2632
- TransitionGroup.defaultProps = defaultProps;
2633
-
2634
- /**
2635
- * The `<ReplaceTransition>` component is a specialized `Transition` component
2636
- * that animates between two children.
2637
- *
2638
- * ```jsx
2639
- * <ReplaceTransition in>
2640
- * <Fade><div>I appear first</div></Fade>
2641
- * <Fade><div>I replace the above</div></Fade>
2642
- * </ReplaceTransition>
2643
- * ```
2644
- */
2645
-
2646
- var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
2647
- _inheritsLoose(ReplaceTransition, _React$Component);
2648
-
2649
- function ReplaceTransition() {
2650
- var _this;
2651
-
2652
- for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
2653
- _args[_key] = arguments[_key];
2654
- }
2655
-
2656
- _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
2657
-
2658
- _this.handleEnter = function () {
2659
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2660
- args[_key2] = arguments[_key2];
2661
- }
2662
-
2663
- return _this.handleLifecycle('onEnter', 0, args);
2664
- };
2665
-
2666
- _this.handleEntering = function () {
2667
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
2668
- args[_key3] = arguments[_key3];
2669
- }
2670
-
2671
- return _this.handleLifecycle('onEntering', 0, args);
2672
- };
2673
-
2674
- _this.handleEntered = function () {
2675
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2676
- args[_key4] = arguments[_key4];
2677
- }
2678
-
2679
- return _this.handleLifecycle('onEntered', 0, args);
2680
- };
2681
-
2682
- _this.handleExit = function () {
2683
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
2684
- args[_key5] = arguments[_key5];
2685
- }
2686
-
2687
- return _this.handleLifecycle('onExit', 1, args);
2688
- };
2689
-
2690
- _this.handleExiting = function () {
2691
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
2692
- args[_key6] = arguments[_key6];
2693
- }
2694
-
2695
- return _this.handleLifecycle('onExiting', 1, args);
2696
- };
2697
-
2698
- _this.handleExited = function () {
2699
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
2700
- args[_key7] = arguments[_key7];
2701
- }
2702
-
2703
- return _this.handleLifecycle('onExited', 1, args);
2704
- };
2705
-
2706
- return _this;
2707
- }
2708
-
2709
- var _proto = ReplaceTransition.prototype;
2710
-
2711
- _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
2712
- var _child$props;
2713
-
2714
- var children = this.props.children;
2715
- var child = React__default.Children.toArray(children)[idx];
2716
- if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
2717
-
2718
- if (this.props[handler]) {
2719
- var maybeNode = child.props.nodeRef ? undefined : ReactDOM.findDOMNode(this);
2720
- this.props[handler](maybeNode);
2721
- }
2722
- };
2723
-
2724
- _proto.render = function render() {
2725
- var _this$props = this.props,
2726
- children = _this$props.children,
2727
- inProp = _this$props.in,
2728
- props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
2729
-
2730
- var _React$Children$toArr = React__default.Children.toArray(children),
2731
- first = _React$Children$toArr[0],
2732
- second = _React$Children$toArr[1];
2733
-
2734
- delete props.onEnter;
2735
- delete props.onEntering;
2736
- delete props.onEntered;
2737
- delete props.onExit;
2738
- delete props.onExiting;
2739
- delete props.onExited;
2740
- return /*#__PURE__*/React__default.createElement(TransitionGroup, props, inProp ? React__default.cloneElement(first, {
2741
- key: 'first',
2742
- onEnter: this.handleEnter,
2743
- onEntering: this.handleEntering,
2744
- onEntered: this.handleEntered
2745
- }) : React__default.cloneElement(second, {
2746
- key: 'second',
2747
- onEnter: this.handleExit,
2748
- onEntering: this.handleExiting,
2749
- onEntered: this.handleExited
2750
- }));
2751
- };
2752
-
2753
- return ReplaceTransition;
2754
- }(React__default.Component);
2755
-
2756
- ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
2757
- in: propTypes.exports.bool.isRequired,
2758
- children: function children(props, propName) {
2759
- if (React__default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
2760
- return null;
2761
- }
2762
- } : {};
2763
-
2764
- var _leaveRenders, _enterRenders;
2765
-
2766
- function areChildrenDifferent(oldChildren, newChildren) {
2767
- if (oldChildren === newChildren) return false;
2768
-
2769
- if (React__default.isValidElement(oldChildren) && React__default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
2770
- return false;
2771
- }
2772
-
2773
- return true;
2774
- }
2775
- /**
2776
- * Enum of modes for SwitchTransition component
2777
- * @enum { string }
2778
- */
2779
-
2780
-
2781
- var modes = {
2782
- out: 'out-in',
2783
- in: 'in-out'
2784
- };
2785
-
2786
- var callHook = function callHook(element, name, cb) {
2787
- return function () {
2788
- var _element$props;
2789
-
2790
- element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
2791
- cb();
2792
- };
2793
- };
2794
-
2795
- var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
2796
- var current = _ref.current,
2797
- changeState = _ref.changeState;
2798
- return React__default.cloneElement(current, {
2799
- in: false,
2800
- onExited: callHook(current, 'onExited', function () {
2801
- changeState(ENTERING, null);
2802
- })
2803
- });
2804
- }, _leaveRenders[modes.in] = function (_ref2) {
2805
- var current = _ref2.current,
2806
- changeState = _ref2.changeState,
2807
- children = _ref2.children;
2808
- return [current, React__default.cloneElement(children, {
2809
- in: true,
2810
- onEntered: callHook(children, 'onEntered', function () {
2811
- changeState(ENTERING);
2812
- })
2813
- })];
2814
- }, _leaveRenders);
2815
- var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
2816
- var children = _ref3.children,
2817
- changeState = _ref3.changeState;
2818
- return React__default.cloneElement(children, {
2819
- in: true,
2820
- onEntered: callHook(children, 'onEntered', function () {
2821
- changeState(ENTERED, React__default.cloneElement(children, {
2822
- in: true
2823
- }));
2824
- })
2825
- });
2826
- }, _enterRenders[modes.in] = function (_ref4) {
2827
- var current = _ref4.current,
2828
- children = _ref4.children,
2829
- changeState = _ref4.changeState;
2830
- return [React__default.cloneElement(current, {
2831
- in: false,
2832
- onExited: callHook(current, 'onExited', function () {
2833
- changeState(ENTERED, React__default.cloneElement(children, {
2834
- in: true
2835
- }));
2836
- })
2837
- }), React__default.cloneElement(children, {
2838
- in: true
2839
- })];
2840
- }, _enterRenders);
2841
- /**
2842
- * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
2843
- * You can use it when you want to control the render between state transitions.
2844
- * 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.
2845
- *
2846
- * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
2847
- * 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.
2848
- *
2849
- * **Note**: If you want the animation to happen simultaneously
2850
- * (that is, to have the old child removed and a new child inserted **at the same time**),
2851
- * you should use
2852
- * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
2853
- * instead.
2854
- *
2855
- * ```jsx
2856
- * function App() {
2857
- * const [state, setState] = useState(false);
2858
- * return (
2859
- * <SwitchTransition>
2860
- * <CSSTransition
2861
- * key={state ? "Goodbye, world!" : "Hello, world!"}
2862
- * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
2863
- * classNames='fade'
2864
- * >
2865
- * <button onClick={() => setState(state => !state)}>
2866
- * {state ? "Goodbye, world!" : "Hello, world!"}
2867
- * </button>
2868
- * </CSSTransition>
2869
- * </SwitchTransition>
2870
- * );
2871
- * }
2872
- * ```
2873
- *
2874
- * ```css
2875
- * .fade-enter{
2876
- * opacity: 0;
2877
- * }
2878
- * .fade-exit{
2879
- * opacity: 1;
2880
- * }
2881
- * .fade-enter-active{
2882
- * opacity: 1;
2883
- * }
2884
- * .fade-exit-active{
2885
- * opacity: 0;
2886
- * }
2887
- * .fade-enter-active,
2888
- * .fade-exit-active{
2889
- * transition: opacity 500ms;
2890
- * }
2891
- * ```
2892
- */
2893
-
2894
- var SwitchTransition = /*#__PURE__*/function (_React$Component) {
2895
- _inheritsLoose(SwitchTransition, _React$Component);
2896
-
2897
- function SwitchTransition() {
2898
- var _this;
2899
-
2900
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2901
- args[_key] = arguments[_key];
2902
- }
2903
-
2904
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
2905
- _this.state = {
2906
- status: ENTERED,
2907
- current: null
2908
- };
2909
- _this.appeared = false;
2910
-
2911
- _this.changeState = function (status, current) {
2912
- if (current === void 0) {
2913
- current = _this.state.current;
2914
- }
2915
-
2916
- _this.setState({
2917
- status: status,
2918
- current: current
2919
- });
2920
- };
2921
-
2922
- return _this;
2923
- }
2924
-
2925
- var _proto = SwitchTransition.prototype;
2926
-
2927
- _proto.componentDidMount = function componentDidMount() {
2928
- this.appeared = true;
2929
- };
2930
-
2931
- SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
2932
- if (props.children == null) {
2933
- return {
2934
- current: null
2935
- };
2936
- }
2937
-
2938
- if (state.status === ENTERING && props.mode === modes.in) {
2939
- return {
2940
- status: ENTERING
2941
- };
2942
- }
2943
-
2944
- if (state.current && areChildrenDifferent(state.current, props.children)) {
2945
- return {
2946
- status: EXITING
2947
- };
2948
- }
2949
-
2950
- return {
2951
- current: React__default.cloneElement(props.children, {
2952
- in: true
2953
- })
2954
- };
2955
- };
2956
-
2957
- _proto.render = function render() {
2958
- var _this$props = this.props,
2959
- children = _this$props.children,
2960
- mode = _this$props.mode,
2961
- _this$state = this.state,
2962
- status = _this$state.status,
2963
- current = _this$state.current;
2964
- var data = {
2965
- children: children,
2966
- current: current,
2967
- changeState: this.changeState,
2968
- status: status
2969
- };
2970
- var component;
2971
-
2972
- switch (status) {
2973
- case ENTERING:
2974
- component = enterRenders[mode](data);
2975
- break;
2976
-
2977
- case EXITING:
2978
- component = leaveRenders[mode](data);
2979
- break;
2980
-
2981
- case ENTERED:
2982
- component = current;
2983
- }
2984
-
2985
- return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
2986
- value: {
2987
- isMounting: !this.appeared
2988
- }
2989
- }, component);
2990
- };
2991
-
2992
- return SwitchTransition;
2993
- }(React__default.Component);
2994
-
2995
- SwitchTransition.propTypes = process.env.NODE_ENV !== "production" ? {
2996
- /**
2997
- * Transition modes.
2998
- * `out-in`: Current element transitions out first, then when complete, the new element transitions in.
2999
- * `in-out`: New element transitions in first, then when complete, the current element transitions out.
3000
- *
3001
- * @type {'out-in'|'in-out'}
3002
- */
3003
- mode: propTypes.exports.oneOf([modes.in, modes.out]),
3004
-
3005
- /**
3006
- * Any `Transition` or `CSSTransition` component.
3007
- */
3008
- children: propTypes.exports.oneOfType([propTypes.exports.element.isRequired])
3009
- } : {};
3010
- SwitchTransition.defaultProps = {
3011
- mode: modes.out
3012
- };
3013
-
3014
- const DRAWER_ITEM_MIN_RESIZE_WIDTH = 200;
3015
- const DRAWER_ITEM_MAX_RESIZE_WIDTH = 800;
3016
- const DRAWER_ITEM_INITIAL_RESIZE_WIDTH = 400;
3017
- function getEventClientX(e) {
3018
- var _a, _b;
3019
- return 'touches' in e ? (_b = (_a = e.touches[0]) === null || _a === void 0 ? void 0 : _a.clientX) !== null && _b !== void 0 ? _b : 0 : e.clientX;
3020
- }
3021
- function useResizeHandlers({ onStart, onMove, onEnd }) {
3022
- const initialXPosition = React.useRef(0);
3023
- const currentXPosition = React.useRef(0);
3024
- const handleMove = React.useCallback((e) => {
3025
- const currentX = getEventClientX(e);
3026
- if (currentXPosition.current === currentX) {
3027
- return;
3028
- }
3029
- currentXPosition.current = currentX;
3030
- const delta = initialXPosition.current - currentX;
3031
- onMove(delta);
3032
- }, [onMove]);
3033
- const handleEnd = React.useCallback((e) => {
3034
- window.removeEventListener('mousemove', handleMove);
3035
- window.removeEventListener('touchmove', handleMove);
3036
- document.body.style.removeProperty('user-select');
3037
- document.body.style.removeProperty('-webkit-user-select');
3038
- document.body.style.removeProperty('cursor');
3039
- const currentX = getEventClientX(e);
3040
- const delta = initialXPosition.current - currentX;
3041
- onEnd(delta);
3042
- }, [handleMove, onEnd]);
3043
- const handleStart = React.useCallback((e) => {
3044
- const currentX = getEventClientX(e);
3045
- initialXPosition.current = currentX;
3046
- currentXPosition.current = currentX;
3047
- window.addEventListener('mouseup', handleEnd, { once: true });
3048
- window.addEventListener('touchend', handleEnd, { once: true });
3049
- window.addEventListener('touchcancel', handleEnd, { once: true });
3050
- window.addEventListener('mousemove', handleMove);
3051
- window.addEventListener('touchmove', handleMove);
3052
- document.body.style.setProperty('user-select', 'none');
3053
- document.body.style.setProperty('-webkit-user-select', 'none');
3054
- document.body.style.setProperty('cursor', 'col-resize');
3055
- onStart();
3056
- }, [handleEnd, handleMove, onStart]);
3057
- return {
3058
- onMouseDown: handleStart,
3059
- onTouchStart: handleStart,
3060
- };
3061
- }
3062
- function useResizableDrawerItem(params) {
3063
- const { direction, width, minResizeWidth = DRAWER_ITEM_MIN_RESIZE_WIDTH, maxResizeWidth = DRAWER_ITEM_MAX_RESIZE_WIDTH, onResizeStart, onResize, } = params;
3064
- const [isResizing, setIsResizing] = React.useState(false);
3065
- const [resizeDelta, setResizeDelta] = React.useState(0);
3066
- const [internalWidth, setInternalWidth] = React.useState(width !== null && width !== void 0 ? width : DRAWER_ITEM_INITIAL_RESIZE_WIDTH);
3067
- const getClampedWidth = React.useCallback((width) => Math.min(Math.max(width, minResizeWidth), maxResizeWidth), [minResizeWidth, maxResizeWidth]);
3068
- const getResizedWidth = React.useCallback((delta) => {
3069
- const signedDelta = direction === 'right' ? delta : -delta;
3070
- const newWidth = (width !== null && width !== void 0 ? width : internalWidth) + signedDelta;
3071
- return getClampedWidth(newWidth);
3072
- }, [width, internalWidth, direction, getClampedWidth]);
3073
- const onStart = React.useCallback(() => {
3074
- setIsResizing(true);
3075
- setResizeDelta(0);
3076
- onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart();
3077
- }, [onResizeStart]);
3078
- const onMove = React.useCallback((delta) => {
3079
- setResizeDelta(delta);
3080
- }, []);
3081
- const onEnd = React.useCallback((delta) => {
3082
- const newWidth = getResizedWidth(delta);
3083
- setIsResizing(false);
3084
- setInternalWidth(newWidth);
3085
- onResize === null || onResize === void 0 ? void 0 : onResize(newWidth);
3086
- }, [getResizedWidth, onResize]);
3087
- const displayWidth = isResizing
3088
- ? getResizedWidth(resizeDelta)
3089
- : getClampedWidth(width !== null && width !== void 0 ? width : internalWidth);
3090
- const handlers = useResizeHandlers({ onStart, onMove, onEnd });
3091
- return { resizedWidth: displayWidth, resizerHandlers: handlers, isResizing };
3092
- }
3093
-
3094
- var css_248z = ".gn-drawer{--_--item-shadow-default:0 1px 5px 0 var(--g-color-sfx-shadow);--_--resizer-width:8px;--_--resizer-color:var(--g-color-base-generic);--_--resizer-handle-color:var(--g-color-line-generic);--_--resizer-handle-color-hover:var(--g-color-line-generic-hover);--_--resizer-z-index:100;--_--veil-background-color:var(--g-color-sfx-veil);pointer-events:none}.gn-drawer_hideVeil{--_--item-shadow:var(--gn-drawer-item-shadow,var(--_--item-shadow-default))}.gn-drawer__item{background-color:var(--g-color-base-background);bottom:0;box-shadow:var(--_--item-shadow,none);height:100%;left:0;pointer-events:auto;position:absolute;top:0;will-change:transform;z-index:var(--gn-drawer-item-z-index)}.gn-drawer__item_direction_right{left:auto;right:0}.gn-drawer__item-transition-enter{transform:translate(-100%)}.gn-drawer__item-transition_direction_right-enter{transform:translate(100%)}.gn-drawer__item-transition-enter-active,.gn-drawer__item-transition_direction_right-enter-active{transform:translate(0);transition:transform .3s}.gn-drawer__item-transition-enter-done,.gn-drawer__item-transition_direction_right-enter-done{filter:blur(0);transform:translateZ(0)}.gn-drawer__item-transition-exit,.gn-drawer__item-transition_direction_right-exit{transform:translate(0)}.gn-drawer__item-transition-exit-active,.gn-drawer__item-transition_direction_right-exit-active{transition:transform .3s}.gn-drawer__item-transition-exit-active{transform:translate(-100%)}.gn-drawer__item-transition_direction_right-exit-active{transform:translate(100%)}.gn-drawer__item-transition-exit-done,.gn-drawer__item-transition_direction_right-exit-done,.gn-drawer__item_hidden{visibility:hidden}.gn-drawer__veil{background-color:var(--gn-drawer-veil-background-color,var(--_--veil-background-color));inset:0;pointer-events:auto;position:absolute;z-index:var(--gn-drawer-veil-z-index)}.gn-drawer__veil_hidden{display:none}.gn-drawer__veil-transition-enter{opacity:0}.gn-drawer__veil-transition-enter-active{opacity:1;transition:opacity .3s}.gn-drawer__veil-transition-exit{opacity:1}.gn-drawer__veil-transition-exit-active{opacity:0;transition:opacity .3s}.gn-drawer__veil-transition-exit-done{visibility:hidden}.gn-drawer__resizer-handle{background:var(--gn-drawer-item-resizer-handle-color,var(--_--resizer-handle-color));border-radius:2px;height:28px;width:2px}.gn-drawer__resizer{align-items:center;background:var(--gn-drawer-item-resizer-color,var(--_--resizer-color));cursor:col-resize;display:flex;flex-direction:column;height:100%;justify-content:center;position:absolute;top:0;width:var(--gn-drawer-item-resizer-width,var(--_--resizer-width));z-index:var(--gn-drawer-item-resizer-z-index,var(--_--resizer-z-index))}.gn-drawer__resizer_direction_right{left:0}.gn-drawer__resizer_direction_left{right:0}.gn-drawer__resizer:hover .gn-drawer__resizer-handle{background:var(--gn-drawer-item-resizer-handle-color-hover,var(--_--resizer-handle-color-hover))}";
3095
- styleInject(css_248z);
3096
-
3097
- const b = block('drawer');
3098
- const TIMEOUT = 300;
3099
- const DrawerItem = React__default.forwardRef(function DrawerItem(props, ref) {
3100
- const { visible, content, children, direction = 'left', className, resizable, width, minResizeWidth, maxResizeWidth, onResizeStart, onResize, keepMounted = false, } = props;
3101
- const [isInitialRender, setInitialRender] = React__default.useState(true);
3102
- const itemRef = React__default.useRef(null);
3103
- const handleRef = useForkRef(ref, itemRef);
3104
- const cssDirection = direction === 'left' ? undefined : direction;
3105
- const { resizedWidth, resizerHandlers, isResizing } = useResizableDrawerItem({
3106
- direction,
3107
- width,
3108
- minResizeWidth,
3109
- maxResizeWidth,
3110
- onResizeStart,
3111
- onResize,
3112
- });
3113
- React__default.useEffect(() => {
3114
- setInitialRender(true);
3115
- }, [direction]);
3116
- const resizerElement = resizable ? (React__default.createElement("div", Object.assign({ className: b('resizer', { direction }) }, resizerHandlers),
3117
- React__default.createElement("div", { className: b('resizer-handle') }))) : null;
3118
- return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, mountOnEnter: !keepMounted, unmountOnExit: !keepMounted, classNames: b('item-transition', { direction: cssDirection }), nodeRef: itemRef, onEnter: () => setInitialRender(false), onExit: () => setInitialRender(false) },
3119
- React__default.createElement("div", { ref: handleRef, className: b('item', {
3120
- direction: cssDirection,
3121
- hidden: isInitialRender && !visible,
3122
- resize: isResizing,
3123
- }, [className]), style: { width: resizable ? `${resizedWidth}px` : undefined } },
3124
- resizerElement, children !== null && children !== void 0 ? children : content)));
3125
- });
3126
- const Drawer = ({ className, veilClassName, children, style, onVeilClick, onEscape, preventScrollBody = true, hideVeil, disablePortal = true, keepMounted = false, }) => {
3127
- let someItemVisible = false;
3128
- React__default.Children.forEach(children, (child) => {
3129
- if (React__default.isValidElement(child) && child.type === DrawerItem) {
3130
- const childVisible = Boolean(child.props.visible);
3131
- if (childVisible) {
3132
- someItemVisible = true;
3133
- }
3134
- }
3135
- });
3136
- React__default.useEffect(() => {
3137
- function onKeyDown(event) {
3138
- if (event.key === 'Escape') {
3139
- onEscape === null || onEscape === void 0 ? void 0 : onEscape();
3140
- }
3141
- }
3142
- if (someItemVisible) {
3143
- window.addEventListener('keydown', onKeyDown);
3144
- }
3145
- return () => {
3146
- window.removeEventListener('keydown', onKeyDown);
3147
- };
3148
- }, [onEscape, someItemVisible]);
3149
- useBodyScrollLock({ enabled: preventScrollBody && someItemVisible });
3150
- const containerRef = React__default.useRef(null);
3151
- const veilRef = React__default.useRef(null);
3152
- const drawer = (React__default.createElement(Transition, { in: someItemVisible, timeout: { enter: 0, exit: TIMEOUT }, mountOnEnter: !keepMounted, unmountOnExit: !keepMounted, nodeRef: containerRef }, (state) => {
3153
- const childrenVisible = someItemVisible && state === 'entered';
3154
- return (React__default.createElement("div", { ref: containerRef, className: b({ hideVeil }, className), style: style },
3155
- React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b('veil-transition'), nodeRef: veilRef },
3156
- React__default.createElement("div", { ref: veilRef, className: b('veil', { hidden: hideVeil }, veilClassName), onClick: onVeilClick })),
3157
- React__default.Children.map(children, (child) => {
3158
- if (React__default.isValidElement(child) &&
3159
- child.type === DrawerItem) {
3160
- const childVisible = Boolean(child.props.visible);
3161
- return React__default.cloneElement(child, Object.assign(Object.assign({ keepMounted }, child.props), { visible: childVisible && childrenVisible }));
3162
- }
3163
- return child;
3164
- })));
3165
- }));
3166
- if (disablePortal) {
3167
- return drawer;
3168
- }
3169
- return React__default.createElement(Portal, null, drawer);
3170
- };
3171
-
3172
- export { Drawer, DrawerItem };
3173
- //# sourceMappingURL=Drawer.js.map