@jetshop/ui 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (749) hide show
  1. package/Accordion/Accordion.d.ts +33 -0
  2. package/Accordion/Accordion.js +59 -0
  3. package/Accordion/Accordion.js.map +1 -0
  4. package/Accordion/__doc_utils__/AccordionHeader.js +12 -0
  5. package/Auth/FormFields/CountriesInput.d.ts +16 -0
  6. package/Auth/FormFields/CountriesInput.js +28 -0
  7. package/Auth/FormFields/CountriesInput.js.map +1 -0
  8. package/Auth/LogInBehavior.d.ts +22 -0
  9. package/Auth/LogInBehavior.js +24 -0
  10. package/Auth/LogInBehavior.js.map +1 -0
  11. package/Auth/LogInFormProvider.d.ts +7 -0
  12. package/Auth/LogInFormProvider.js +70 -0
  13. package/Auth/LogInFormProvider.js.map +1 -0
  14. package/Auth/LogOut.d.ts +10 -0
  15. package/Auth/LogOut.js +24 -0
  16. package/Auth/LogOut.js.map +1 -0
  17. package/Auth/logInValidator.d.ts +10 -0
  18. package/Auth/logInValidator.js +16 -0
  19. package/Auth/logInValidator.js.map +1 -0
  20. package/Breadcrumbs/Breadcrumbs.d.ts +14 -0
  21. package/Breadcrumbs/Breadcrumbs.js +84 -0
  22. package/Breadcrumbs/Breadcrumbs.js.map +1 -0
  23. package/Breadcrumbs/getParentsOrCanonicalRoute.d.ts +3 -0
  24. package/Breadcrumbs/getParentsOrCanonicalRoute.js +14 -0
  25. package/Breadcrumbs/getParentsOrCanonicalRoute.js.map +1 -0
  26. package/Breadcrumbs/index.d.ts +1 -0
  27. package/Breadcrumbs/index.js +2 -0
  28. package/Breadcrumbs/index.js.map +1 -0
  29. package/Breakpoints.d.ts +12 -0
  30. package/Breakpoints.js +36 -0
  31. package/Breakpoints.js.map +1 -0
  32. package/Button/Button.d.ts +14 -0
  33. package/Button/Button.js +60 -0
  34. package/Button/Button.js.map +1 -0
  35. package/Button/SecondaryButton.d.ts +2 -0
  36. package/Button/SecondaryButton.js +9 -0
  37. package/Button/SecondaryButton.js.map +1 -0
  38. package/Button/TrendButton.d.ts +2 -0
  39. package/Button/TrendButton.js +8 -0
  40. package/Button/TrendButton.js.map +1 -0
  41. package/Button/index.d.ts +4 -0
  42. package/Button/index.js +5 -0
  43. package/Button/index.js.map +1 -0
  44. package/CategoryLink.d.ts +11 -0
  45. package/CategoryLink.js +49 -0
  46. package/CategoryLink.js.map +1 -0
  47. package/ChannelSelector/ChannelListItem.d.ts +10 -0
  48. package/ChannelSelector/ChannelListItem.js +51 -0
  49. package/ChannelSelector/ChannelListItem.js.map +1 -0
  50. package/ChannelSelector/ChannelListItem.test.js +85 -0
  51. package/ChannelSelector/ChannelSelector.d.ts +63 -0
  52. package/ChannelSelector/ChannelSelector.js +80 -0
  53. package/ChannelSelector/ChannelSelector.js.map +1 -0
  54. package/ChannelSelector/ChannelSelector.test.js +167 -0
  55. package/ChannelSelector/ChannelSelectorButtons.d.ts +2 -0
  56. package/ChannelSelector/ChannelSelectorButtons.js +20 -0
  57. package/ChannelSelector/ChannelSelectorButtons.js.map +1 -0
  58. package/ChannelSelector/Channels.d.ts +17 -0
  59. package/ChannelSelector/Channels.js +12 -0
  60. package/ChannelSelector/Channels.js.map +1 -0
  61. package/ChannelSelector/Channels.test.js +90 -0
  62. package/ChannelSelector/LargeSelector.d.ts +3 -0
  63. package/ChannelSelector/LargeSelector.js +67 -0
  64. package/ChannelSelector/LargeSelector.js.map +1 -0
  65. package/ChannelSelector/MiniSelector.d.ts +4 -0
  66. package/ChannelSelector/MiniSelector.js +58 -0
  67. package/ChannelSelector/MiniSelector.js.map +1 -0
  68. package/ChannelSelector/Region.d.ts +28 -0
  69. package/ChannelSelector/Region.js +21 -0
  70. package/ChannelSelector/Region.js.map +1 -0
  71. package/ChannelSelector/Region.test.js +37 -0
  72. package/ChannelSelector/exampleChannels.js +577 -0
  73. package/ChannelSelector/groupBy.d.ts +7 -0
  74. package/ChannelSelector/groupBy.js +16 -0
  75. package/ChannelSelector/groupBy.js.map +1 -0
  76. package/ChannelSelector/groupBy.test.js +42 -0
  77. package/Checkbox/Checkbox.d.ts +14 -0
  78. package/Checkbox/Checkbox.js +70 -0
  79. package/Checkbox/Checkbox.js.map +1 -0
  80. package/Checkbox/CheckboxGroup.d.ts +27 -0
  81. package/Checkbox/CheckboxGroup.js +22 -0
  82. package/Checkbox/CheckboxGroup.js.map +1 -0
  83. package/Checkbox/index.d.ts +2 -0
  84. package/Checkbox/index.js +3 -0
  85. package/Checkbox/index.js.map +1 -0
  86. package/CloudflareImage/BaseImage.d.ts +40 -0
  87. package/CloudflareImage/BaseImage.js +192 -0
  88. package/CloudflareImage/BaseImage.js.map +1 -0
  89. package/CloudflareImage/Fallback.d.ts +5 -0
  90. package/CloudflareImage/Fallback.js +4 -0
  91. package/CloudflareImage/Fallback.js.map +1 -0
  92. package/CloudflareImage/FlightImage.d.ts +51 -0
  93. package/CloudflareImage/FlightImage.js +61 -0
  94. package/CloudflareImage/FlightImage.js.map +1 -0
  95. package/CloudflareImage/FlightImage.test.js +277 -0
  96. package/CloudflareImage/Image.d.ts +2 -0
  97. package/CloudflareImage/Image.js +3 -0
  98. package/CloudflareImage/Image.js.map +1 -0
  99. package/CloudflareImage/index.d.ts +1 -0
  100. package/CloudflareImage/index.js +2 -0
  101. package/CloudflareImage/index.js.map +1 -0
  102. package/CloudflareImage/useConstructImage.d.ts +49 -0
  103. package/CloudflareImage/useConstructImage.js +122 -0
  104. package/CloudflareImage/useConstructImage.js.map +1 -0
  105. package/CloudflareImage/utils/aspectRatioToFraction.d.ts +2 -0
  106. package/CloudflareImage/utils/aspectRatioToFraction.js +11 -0
  107. package/CloudflareImage/utils/aspectRatioToFraction.js.map +1 -0
  108. package/CloudflareImage/utils/getFullUrl.d.ts +6 -0
  109. package/CloudflareImage/utils/getFullUrl.js +18 -0
  110. package/CloudflareImage/utils/getFullUrl.js.map +1 -0
  111. package/CloudflareImage/utils/getImageWidth.d.ts +1 -0
  112. package/CloudflareImage/utils/getImageWidth.js +12 -0
  113. package/CloudflareImage/utils/getImageWidth.js.map +1 -0
  114. package/CloudflareImage/utils/getImageWidths.d.ts +2 -0
  115. package/CloudflareImage/utils/getImageWidths.js +21 -0
  116. package/CloudflareImage/utils/getImageWidths.js.map +1 -0
  117. package/CloudflareImage/utils/getLQIP.d.ts +8 -0
  118. package/CloudflareImage/utils/getLQIP.js +21 -0
  119. package/CloudflareImage/utils/getLQIP.js.map +1 -0
  120. package/CloudflareImage/utils/getLargestSize.d.ts +7 -0
  121. package/CloudflareImage/utils/getLargestSize.js +17 -0
  122. package/CloudflareImage/utils/getLargestSize.js.map +1 -0
  123. package/CloudflareImage/utils/getSizeForBreakpoint.d.ts +2 -0
  124. package/CloudflareImage/utils/getSizeForBreakpoint.js +16 -0
  125. package/CloudflareImage/utils/getSizeForBreakpoint.js.map +1 -0
  126. package/CloudflareImage/utils/getSizesMap.d.ts +2 -0
  127. package/CloudflareImage/utils/getSizesMap.js +35 -0
  128. package/CloudflareImage/utils/getSizesMap.js.map +1 -0
  129. package/CloudflareImage/utils/getSmallestSize.d.ts +2 -0
  130. package/CloudflareImage/utils/getSmallestSize.js +12 -0
  131. package/CloudflareImage/utils/getSmallestSize.js.map +1 -0
  132. package/CloudflareImage/utils/getSrcSetFromWidths.d.ts +10 -0
  133. package/CloudflareImage/utils/getSrcSetFromWidths.js +10 -0
  134. package/CloudflareImage/utils/getSrcSetFromWidths.js.map +1 -0
  135. package/CloudflareImage/utils/getSrcWithParams.d.ts +3 -0
  136. package/CloudflareImage/utils/getSrcWithParams.js +33 -0
  137. package/CloudflareImage/utils/getSrcWithParams.js.map +1 -0
  138. package/CloudflareImage/utils/paddingForAspectRatio.d.ts +1 -0
  139. package/CloudflareImage/utils/paddingForAspectRatio.js +6 -0
  140. package/CloudflareImage/utils/paddingForAspectRatio.js.map +1 -0
  141. package/CloudflareImage/utils/remToPx.d.ts +1 -0
  142. package/CloudflareImage/utils/remToPx.js +2 -0
  143. package/CloudflareImage/utils/remToPx.js.map +1 -0
  144. package/CloudflareImage/utils/sizeToNumber.d.ts +2 -0
  145. package/CloudflareImage/utils/sizeToNumber.js +27 -0
  146. package/CloudflareImage/utils/sizeToNumber.js.map +1 -0
  147. package/ContentPageLink.d.ts +11 -0
  148. package/ContentPageLink.js +46 -0
  149. package/ContentPageLink.js.map +1 -0
  150. package/ContentRenderer.d.ts +9 -0
  151. package/ContentRenderer.js +36 -0
  152. package/ContentRenderer.js.map +1 -0
  153. package/DropdownMenu/Button.d.ts +7 -0
  154. package/DropdownMenu/Button.js +33 -0
  155. package/DropdownMenu/Button.js.map +1 -0
  156. package/DropdownMenu/DropdownMenu.d.ts +21 -0
  157. package/DropdownMenu/DropdownMenu.js +72 -0
  158. package/DropdownMenu/DropdownMenu.js.map +1 -0
  159. package/DropdownMenu/Item.d.ts +13 -0
  160. package/DropdownMenu/Item.js +48 -0
  161. package/DropdownMenu/Item.js.map +1 -0
  162. package/DropdownMenu/Items.d.ts +16 -0
  163. package/DropdownMenu/Items.js +53 -0
  164. package/DropdownMenu/Items.js.map +1 -0
  165. package/DropdownMenu/index.d.ts +4 -0
  166. package/DropdownMenu/index.js +5 -0
  167. package/DropdownMenu/index.js.map +1 -0
  168. package/ErrorBoundary/Generic.d.ts +18 -0
  169. package/ErrorBoundary/Generic.js +65 -0
  170. package/ErrorBoundary/Generic.js.map +1 -0
  171. package/ErrorBoundary/PassThrough.d.ts +3 -0
  172. package/ErrorBoundary/PassThrough.js +7 -0
  173. package/ErrorBoundary/PassThrough.js.map +1 -0
  174. package/Gallery/Gallery.d.ts +39 -0
  175. package/Gallery/Gallery.js +121 -0
  176. package/Gallery/Gallery.js.map +1 -0
  177. package/Gallery/constructGallery.d.ts +15 -0
  178. package/Gallery/constructGallery.js +40 -0
  179. package/Gallery/constructGallery.js.map +1 -0
  180. package/Image/BaseImage.d.ts +39 -0
  181. package/Image/BaseImage.js +192 -0
  182. package/Image/BaseImage.js.map +1 -0
  183. package/Image/Fallback.d.ts +5 -0
  184. package/Image/Fallback.js +4 -0
  185. package/Image/Fallback.js.map +1 -0
  186. package/Image/FlightImage.d.ts +51 -0
  187. package/Image/FlightImage.js +59 -0
  188. package/Image/FlightImage.js.map +1 -0
  189. package/Image/FlightImage.test.js +277 -0
  190. package/Image/Image.d.ts +2 -0
  191. package/Image/Image.js +3 -0
  192. package/Image/Image.js.map +1 -0
  193. package/Image/index.d.ts +1 -0
  194. package/Image/index.js +2 -0
  195. package/Image/index.js.map +1 -0
  196. package/Image/useConstructImage.d.ts +49 -0
  197. package/Image/useConstructImage.js +122 -0
  198. package/Image/useConstructImage.js.map +1 -0
  199. package/Image/utils/aspectRatioToFraction.d.ts +2 -0
  200. package/Image/utils/aspectRatioToFraction.js +11 -0
  201. package/Image/utils/aspectRatioToFraction.js.map +1 -0
  202. package/Image/utils/getFullUrl.d.ts +6 -0
  203. package/Image/utils/getFullUrl.js +18 -0
  204. package/Image/utils/getFullUrl.js.map +1 -0
  205. package/Image/utils/getImageWidth.d.ts +1 -0
  206. package/Image/utils/getImageWidth.js +12 -0
  207. package/Image/utils/getImageWidth.js.map +1 -0
  208. package/Image/utils/getImageWidths.d.ts +2 -0
  209. package/Image/utils/getImageWidths.js +21 -0
  210. package/Image/utils/getImageWidths.js.map +1 -0
  211. package/Image/utils/getLQIP.d.ts +8 -0
  212. package/Image/utils/getLQIP.js +20 -0
  213. package/Image/utils/getLQIP.js.map +1 -0
  214. package/Image/utils/getLargestSize.d.ts +7 -0
  215. package/Image/utils/getLargestSize.js +17 -0
  216. package/Image/utils/getLargestSize.js.map +1 -0
  217. package/Image/utils/getSizeForBreakpoint.d.ts +2 -0
  218. package/Image/utils/getSizeForBreakpoint.js +16 -0
  219. package/Image/utils/getSizeForBreakpoint.js.map +1 -0
  220. package/Image/utils/getSizesMap.d.ts +2 -0
  221. package/Image/utils/getSizesMap.js +35 -0
  222. package/Image/utils/getSizesMap.js.map +1 -0
  223. package/Image/utils/getSmallestSize.d.ts +2 -0
  224. package/Image/utils/getSmallestSize.js +12 -0
  225. package/Image/utils/getSmallestSize.js.map +1 -0
  226. package/Image/utils/getSrcSetFromWidths.d.ts +10 -0
  227. package/Image/utils/getSrcSetFromWidths.js +9 -0
  228. package/Image/utils/getSrcSetFromWidths.js.map +1 -0
  229. package/Image/utils/getSrcWithParams.d.ts +3 -0
  230. package/Image/utils/getSrcWithParams.js +29 -0
  231. package/Image/utils/getSrcWithParams.js.map +1 -0
  232. package/Image/utils/paddingForAspectRatio.d.ts +1 -0
  233. package/Image/utils/paddingForAspectRatio.js +6 -0
  234. package/Image/utils/paddingForAspectRatio.js.map +1 -0
  235. package/Image/utils/remToPx.d.ts +1 -0
  236. package/Image/utils/remToPx.js +2 -0
  237. package/Image/utils/remToPx.js.map +1 -0
  238. package/Image/utils/sizeToNumber.d.ts +2 -0
  239. package/Image/utils/sizeToNumber.js +27 -0
  240. package/Image/utils/sizeToNumber.js.map +1 -0
  241. package/Input/Input.d.ts +6 -0
  242. package/Input/Input.js +45 -0
  243. package/Input/Input.js.map +1 -0
  244. package/Input/index.d.ts +3 -0
  245. package/Input/index.js +4 -0
  246. package/Input/index.js.map +1 -0
  247. package/JetshopText.d.ts +3 -0
  248. package/JetshopText.js +13 -0
  249. package/JetshopText.js.map +1 -0
  250. package/Loading/LoadingBar.d.ts +8 -0
  251. package/Loading/LoadingBar.js +58 -0
  252. package/Loading/LoadingBar.js.map +1 -0
  253. package/Loading/LoadingLine.d.ts +31 -0
  254. package/Loading/LoadingLine.js +26 -0
  255. package/Loading/LoadingLine.js.map +1 -0
  256. package/Loading/LoadingLine.test.js +18 -0
  257. package/Loading/NetworkStatusNotifier.d.ts +6 -0
  258. package/Loading/NetworkStatusNotifier.js +8 -0
  259. package/Loading/NetworkStatusNotifier.js.map +1 -0
  260. package/Menu/GetMoreSubcategoriesQuery.gql +25 -0
  261. package/Menu/MenuContainer.d.ts +28 -0
  262. package/Menu/MenuContainer.js +46 -0
  263. package/Menu/MenuContainer.js.map +1 -0
  264. package/Menu/MenuContainer.test.js +245 -0
  265. package/Menu/RecursiveTree.d.ts +28 -0
  266. package/Menu/RecursiveTree.js +91 -0
  267. package/Menu/RecursiveTree.js.map +1 -0
  268. package/Menu/RecursiveTree.test.js +417 -0
  269. package/Modal/Drawer/Drawer.d.ts +12 -0
  270. package/Modal/Drawer/Drawer.js +31 -0
  271. package/Modal/Drawer/Drawer.js.map +1 -0
  272. package/Modal/Drawer/DrawerTarget.d.ts +6 -0
  273. package/Modal/Drawer/DrawerTarget.js +12 -0
  274. package/Modal/Drawer/DrawerTarget.js.map +1 -0
  275. package/Modal/Drawer/DrawerTarget.test.js +92 -0
  276. package/Modal/Drawer/DrawerTrigger.d.ts +11 -0
  277. package/Modal/Drawer/DrawerTrigger.js +16 -0
  278. package/Modal/Drawer/DrawerTrigger.js.map +1 -0
  279. package/Modal/Drawer/DrawerTrigger.test.js +51 -0
  280. package/Modal/Drawer/index.d.ts +3 -0
  281. package/Modal/Drawer/index.js +4 -0
  282. package/Modal/Drawer/index.js.map +1 -0
  283. package/Modal/Flyout/FlyoutTarget.d.ts +10 -0
  284. package/Modal/Flyout/FlyoutTarget.js +15 -0
  285. package/Modal/Flyout/FlyoutTarget.js.map +1 -0
  286. package/Modal/Flyout/FlyoutTarget.test.js +84 -0
  287. package/Modal/Flyout/FlyoutTrigger.d.ts +15 -0
  288. package/Modal/Flyout/FlyoutTrigger.js +18 -0
  289. package/Modal/Flyout/FlyoutTrigger.js.map +1 -0
  290. package/Modal/Flyout/FlyoutTrigger.test.js +72 -0
  291. package/Modal/Flyout/index.d.ts +2 -0
  292. package/Modal/Flyout/index.js +3 -0
  293. package/Modal/Flyout/index.js.map +1 -0
  294. package/Modal/ModalContext.d.ts +26 -0
  295. package/Modal/ModalContext.js +9 -0
  296. package/Modal/ModalContext.js.map +1 -0
  297. package/Modal/ModalProvider.d.ts +5 -0
  298. package/Modal/ModalProvider.js +83 -0
  299. package/Modal/ModalProvider.js.map +1 -0
  300. package/Modal/ModalProvider.test.js +26 -0
  301. package/Modal/ModalRoot.d.ts +3 -0
  302. package/Modal/ModalRoot.js +44 -0
  303. package/Modal/ModalRoot.js.map +1 -0
  304. package/Modal/ModalRoot.test.js +80 -0
  305. package/Modal/ModalTrigger.d.ts +9 -0
  306. package/Modal/ModalTrigger.js +9 -0
  307. package/Modal/ModalTrigger.js.map +1 -0
  308. package/Modal/__test_utils__/getComponentWithModalContext.js +29 -0
  309. package/Pagination/Pagination.d.ts +7 -0
  310. package/Pagination/Pagination.js +23 -0
  311. package/Pagination/Pagination.js.map +1 -0
  312. package/Pagination/PaginationBehaviour.d.ts +52 -0
  313. package/Pagination/PaginationBehaviour.js +68 -0
  314. package/Pagination/PaginationBehaviour.js.map +1 -0
  315. package/Pagination/index.d.ts +2 -0
  316. package/Pagination/index.js +3 -0
  317. package/Pagination/index.js.map +1 -0
  318. package/Pagination/usePagination.d.ts +15 -0
  319. package/Pagination/usePagination.js +46 -0
  320. package/Pagination/usePagination.js.map +1 -0
  321. package/PreOrderDateSelector/PreOrderDateSelector.d.ts +23 -0
  322. package/PreOrderDateSelector/PreOrderDateSelector.js +74 -0
  323. package/PreOrderDateSelector/PreOrderDateSelector.js.map +1 -0
  324. package/PreOrderDateSelector/index.d.ts +2 -0
  325. package/PreOrderDateSelector/index.js +3 -0
  326. package/PreOrderDateSelector/index.js.map +1 -0
  327. package/Price/Currency.d.ts +9 -0
  328. package/Price/Currency.js +11 -0
  329. package/Price/Currency.js.map +1 -0
  330. package/Price/Price.d.ts +44 -0
  331. package/Price/Price.js +74 -0
  332. package/Price/Price.js.map +1 -0
  333. package/Price/index.d.ts +1 -0
  334. package/Price/index.js +2 -0
  335. package/Price/index.js.map +1 -0
  336. package/ProductLink.d.ts +23 -0
  337. package/ProductLink.js +88 -0
  338. package/ProductLink.js.map +1 -0
  339. package/ProductList/Badges.d.ts +6 -0
  340. package/ProductList/Badges.js +56 -0
  341. package/ProductList/Badges.js.map +1 -0
  342. package/ProductList/GridProduct.d.ts +24 -0
  343. package/ProductList/GridProduct.js +58 -0
  344. package/ProductList/GridProduct.js.map +1 -0
  345. package/ProductList/ProductGrid.d.ts +16 -0
  346. package/ProductList/ProductGrid.js +30 -0
  347. package/ProductList/ProductGrid.js.map +1 -0
  348. package/ProductList/ProductImage.d.ts +12 -0
  349. package/ProductList/ProductImage.js +21 -0
  350. package/ProductList/ProductImage.js.map +1 -0
  351. package/ProductSpecifications/ProductSpecifications.d.ts +8 -0
  352. package/ProductSpecifications/ProductSpecifications.js +78 -0
  353. package/ProductSpecifications/ProductSpecifications.js.map +1 -0
  354. package/ScrollRestorationHandler/ScrollRestorationHandler.d.ts +8 -0
  355. package/ScrollRestorationHandler/ScrollRestorationHandler.js +17 -0
  356. package/ScrollRestorationHandler/ScrollRestorationHandler.js.map +1 -0
  357. package/ScrollRestorationHandler/ScrollRestorationHandler.test.js +75 -0
  358. package/ScrollRestorationHandler/index.d.ts +1 -0
  359. package/ScrollRestorationHandler/index.js +2 -0
  360. package/ScrollRestorationHandler/index.js.map +1 -0
  361. package/ScrollRestorationHandler/isInIgnoredRouteTypes.d.ts +8 -0
  362. package/ScrollRestorationHandler/isInIgnoredRouteTypes.js +8 -0
  363. package/ScrollRestorationHandler/isInIgnoredRouteTypes.js.map +1 -0
  364. package/ScrollRestorationHandler/useScrollRestore.d.ts +9 -0
  365. package/ScrollRestorationHandler/useScrollRestore.js +20 -0
  366. package/ScrollRestorationHandler/useScrollRestore.js.map +1 -0
  367. package/Search/AutocompleteQuery.gql +10 -0
  368. package/Search/SearchAutoCompleteContainer.d.ts +45 -0
  369. package/Search/SearchAutoCompleteContainer.js +172 -0
  370. package/Search/SearchAutoCompleteContainer.js.map +1 -0
  371. package/Search/SearchAutoCompleteContainer.test.js +460 -0
  372. package/Search/SearchField.d.ts +26 -0
  373. package/Search/SearchField.js +98 -0
  374. package/Search/SearchField.js.map +1 -0
  375. package/Search/SearchPage/PageOf.d.ts +5 -0
  376. package/Search/SearchPage/PageOf.js +7 -0
  377. package/Search/SearchPage/PageOf.js.map +1 -0
  378. package/Search/SearchPage/SearchMeta.d.ts +16 -0
  379. package/Search/SearchPage/SearchMeta.js +20 -0
  380. package/Search/SearchPage/SearchMeta.js.map +1 -0
  381. package/Search/SearchPage/SearchPageBehaviour.d.ts +19 -0
  382. package/Search/SearchPage/SearchPageBehaviour.js +75 -0
  383. package/Search/SearchPage/SearchPageBehaviour.js.map +1 -0
  384. package/Search/SuggestedTerm.d.ts +16 -0
  385. package/Search/SuggestedTerm.js +35 -0
  386. package/Search/SuggestedTerm.js.map +1 -0
  387. package/Search/index.d.ts +1 -0
  388. package/Search/index.js +2 -0
  389. package/Search/index.js.map +1 -0
  390. package/Select/Components.d.ts +28 -0
  391. package/Select/Components.js +91 -0
  392. package/Select/Components.js.map +1 -0
  393. package/Select/SelectComponents/Quantity.d.ts +5 -0
  394. package/Select/SelectComponents/Quantity.js +8 -0
  395. package/Select/SelectComponents/Quantity.js.map +1 -0
  396. package/Select/index.d.ts +5 -0
  397. package/Select/index.js +2 -0
  398. package/Select/index.js.map +1 -0
  399. package/SortOrder/SortOrder.d.ts +16 -0
  400. package/SortOrder/SortOrder.js +33 -0
  401. package/SortOrder/SortOrder.js.map +1 -0
  402. package/SortOrder/SortOrderDropdown.d.ts +9 -0
  403. package/SortOrder/SortOrderDropdown.js +25 -0
  404. package/SortOrder/SortOrderDropdown.js.map +1 -0
  405. package/SortOrder/SortOrderList.d.ts +7 -0
  406. package/SortOrder/SortOrderList.js +17 -0
  407. package/SortOrder/SortOrderList.js.map +1 -0
  408. package/StartPageRenderer/StartPageRenderer.d.ts +17 -0
  409. package/StartPageRenderer/StartPageRenderer.js +52 -0
  410. package/StartPageRenderer/StartPageRenderer.js.map +1 -0
  411. package/StartPageRenderer/index.d.ts +1 -0
  412. package/StartPageRenderer/index.js +2 -0
  413. package/StartPageRenderer/index.js.map +1 -0
  414. package/Stock/StockStatusContainer.d.ts +21 -0
  415. package/Stock/StockStatusContainer.js +45 -0
  416. package/Stock/StockStatusContainer.js.map +1 -0
  417. package/Stock/__tests__/StockStatusContainer.test.js +65 -0
  418. package/Text/Text.d.ts +11 -0
  419. package/Text/Text.js +22 -0
  420. package/Text/Text.js.map +1 -0
  421. package/Text/index.d.ts +3 -0
  422. package/Text/index.js +4 -0
  423. package/Text/index.js.map +1 -0
  424. package/Theme/createTheme.d.ts +16 -0
  425. package/Theme/createTheme.js +5 -0
  426. package/Theme/createTheme.js.map +1 -0
  427. package/Theme/cssReset.d.ts +1 -0
  428. package/Theme/cssReset.js +160 -0
  429. package/Theme/cssReset.js.map +1 -0
  430. package/Theme/normalizeCss.d.ts +1 -0
  431. package/Theme/normalizeCss.js +357 -0
  432. package/Theme/normalizeCss.js.map +1 -0
  433. package/Theme/sanitizeCss.d.ts +1 -0
  434. package/Theme/sanitizeCss.js +572 -0
  435. package/Theme/sanitizeCss.js.map +1 -0
  436. package/WindowGrid/WindowGrid.d.ts +11 -0
  437. package/WindowGrid/WindowGrid.js +58 -0
  438. package/WindowGrid/WindowGrid.js.map +1 -0
  439. package/WindowGrid/index.d.ts +1 -0
  440. package/WindowGrid/index.js +2 -0
  441. package/WindowGrid/index.js.map +1 -0
  442. package/WindowGrid/useResizeObserver.d.ts +3 -0
  443. package/WindowGrid/useResizeObserver.js +14 -0
  444. package/WindowGrid/useResizeObserver.js.map +1 -0
  445. package/WindowGrid/useScrollWithWindow.d.ts +12 -0
  446. package/WindowGrid/useScrollWithWindow.js +39 -0
  447. package/WindowGrid/useScrollWithWindow.js.map +1 -0
  448. package/dependencies.d.ts +98 -0
  449. package/fuzzySearch/fuzzySearch.d.ts +8 -0
  450. package/fuzzySearch/fuzzySearch.js +43 -0
  451. package/fuzzySearch/fuzzySearch.js.map +1 -0
  452. package/fuzzySearch/index.d.ts +1 -0
  453. package/fuzzySearch/index.js +2 -0
  454. package/fuzzySearch/index.js.map +1 -0
  455. package/global.d.ts +1 -0
  456. package/hooks/index.d.ts +2 -0
  457. package/hooks/index.js +3 -0
  458. package/hooks/index.js.map +1 -0
  459. package/hooks/useOnClickOutside.d.ts +6 -0
  460. package/hooks/useOnClickOutside.js +17 -0
  461. package/hooks/useOnClickOutside.js.map +1 -0
  462. package/hooks/useOnEsc.d.ts +4 -0
  463. package/hooks/useOnEsc.js +17 -0
  464. package/hooks/useOnEsc.js.map +1 -0
  465. package/package.json +64 -0
  466. package/setupTests.js +2 -0
  467. package/svg/Carrot.svg +1 -0
  468. package/svg/Check.svg +1 -0
  469. package/svg/Cross.svg +1 -0
  470. package/svg/facebook.svg +1 -0
  471. package/svg/flags/ad.svg +150 -0
  472. package/svg/flags/ae.svg +6 -0
  473. package/svg/flags/af.svg +81 -0
  474. package/svg/flags/ag.svg +14 -0
  475. package/svg/flags/ai.svg +767 -0
  476. package/svg/flags/al.svg +5 -0
  477. package/svg/flags/am.svg +5 -0
  478. package/svg/flags/ao.svg +13 -0
  479. package/svg/flags/aq.svg +6 -0
  480. package/svg/flags/ar.svg +31 -0
  481. package/svg/flags/as.svg +33 -0
  482. package/svg/flags/at.svg +6 -0
  483. package/svg/flags/au.svg +9 -0
  484. package/svg/flags/aw.svg +186 -0
  485. package/svg/flags/ax.svg +18 -0
  486. package/svg/flags/az.svg +8 -0
  487. package/svg/flags/ba.svg +12 -0
  488. package/svg/flags/bb.svg +6 -0
  489. package/svg/flags/bd.svg +4 -0
  490. package/svg/flags/be.svg +7 -0
  491. package/svg/flags/bf.svg +7 -0
  492. package/svg/flags/bg.svg +7 -0
  493. package/svg/flags/bh.svg +11 -0
  494. package/svg/flags/bi.svg +15 -0
  495. package/svg/flags/bj.svg +14 -0
  496. package/svg/flags/bl.svg +7 -0
  497. package/svg/flags/bm.svg +98 -0
  498. package/svg/flags/bn.svg +36 -0
  499. package/svg/flags/bo.svg +676 -0
  500. package/svg/flags/bq.svg +5 -0
  501. package/svg/flags/br.svg +45 -0
  502. package/svg/flags/bs.svg +13 -0
  503. package/svg/flags/bt.svg +89 -0
  504. package/svg/flags/bv.svg +13 -0
  505. package/svg/flags/bw.svg +7 -0
  506. package/svg/flags/by.svg +20 -0
  507. package/svg/flags/bz.svg +145 -0
  508. package/svg/flags/ca.svg +4 -0
  509. package/svg/flags/cc.svg +19 -0
  510. package/svg/flags/cd.svg +5 -0
  511. package/svg/flags/cf.svg +15 -0
  512. package/svg/flags/cg.svg +12 -0
  513. package/svg/flags/ch.svg +9 -0
  514. package/svg/flags/ci.svg +7 -0
  515. package/svg/flags/ck.svg +9 -0
  516. package/svg/flags/cl.svg +13 -0
  517. package/svg/flags/cm.svg +15 -0
  518. package/svg/flags/cn.svg +11 -0
  519. package/svg/flags/co.svg +7 -0
  520. package/svg/flags/cr.svg +7 -0
  521. package/svg/flags/cu.svg +13 -0
  522. package/svg/flags/cv.svg +13 -0
  523. package/svg/flags/cw.svg +14 -0
  524. package/svg/flags/cx.svg +15 -0
  525. package/svg/flags/cy.svg +6 -0
  526. package/svg/flags/cz.svg +12 -0
  527. package/svg/flags/de.svg +5 -0
  528. package/svg/flags/dj.svg +13 -0
  529. package/svg/flags/dk.svg +5 -0
  530. package/svg/flags/dm.svg +152 -0
  531. package/svg/flags/do.svg +6745 -0
  532. package/svg/flags/dz.svg +5 -0
  533. package/svg/flags/ec.svg +138 -0
  534. package/svg/flags/ee.svg +7 -0
  535. package/svg/flags/eg.svg +38 -0
  536. package/svg/flags/eh.svg +15 -0
  537. package/svg/flags/er.svg +8 -0
  538. package/svg/flags/es-ct.svg +4 -0
  539. package/svg/flags/es.svg +544 -0
  540. package/svg/flags/et.svg +14 -0
  541. package/svg/flags/eu.svg +28 -0
  542. package/svg/flags/fi.svg +5 -0
  543. package/svg/flags/fj.svg +120 -0
  544. package/svg/flags/fk.svg +89 -0
  545. package/svg/flags/fm.svg +11 -0
  546. package/svg/flags/fo.svg +12 -0
  547. package/svg/flags/fr.svg +7 -0
  548. package/svg/flags/ga.svg +7 -0
  549. package/svg/flags/gb-eng.svg +5 -0
  550. package/svg/flags/gb-nir.svg +131 -0
  551. package/svg/flags/gb-sct.svg +4 -0
  552. package/svg/flags/gb-wls.svg +9 -0
  553. package/svg/flags/gb.svg +15 -0
  554. package/svg/flags/gd.svg +27 -0
  555. package/svg/flags/ge.svg +6 -0
  556. package/svg/flags/gf.svg +5 -0
  557. package/svg/flags/gg.svg +9 -0
  558. package/svg/flags/gh.svg +6 -0
  559. package/svg/flags/gi.svg +32 -0
  560. package/svg/flags/gl.svg +4 -0
  561. package/svg/flags/gm.svg +14 -0
  562. package/svg/flags/gn.svg +7 -0
  563. package/svg/flags/gp.svg +7 -0
  564. package/svg/flags/gq.svg +23 -0
  565. package/svg/flags/gr.svg +22 -0
  566. package/svg/flags/gs.svg +201 -0
  567. package/svg/flags/gt.svg +204 -0
  568. package/svg/flags/gu.svg +39 -0
  569. package/svg/flags/gw.svg +13 -0
  570. package/svg/flags/gy.svg +9 -0
  571. package/svg/flags/hk.svg +30 -0
  572. package/svg/flags/hm.svg +9 -0
  573. package/svg/flags/hn.svg +18 -0
  574. package/svg/flags/hr.svg +58 -0
  575. package/svg/flags/ht.svg +116 -0
  576. package/svg/flags/hu.svg +7 -0
  577. package/svg/flags/id.svg +6 -0
  578. package/svg/flags/ie.svg +7 -0
  579. package/svg/flags/il.svg +14 -0
  580. package/svg/flags/im.svg +36 -0
  581. package/svg/flags/in.svg +25 -0
  582. package/svg/flags/io.svg +138 -0
  583. package/svg/flags/iq.svg +10 -0
  584. package/svg/flags/ir.svg +219 -0
  585. package/svg/flags/is.svg +12 -0
  586. package/svg/flags/it.svg +7 -0
  587. package/svg/flags/je.svg +31 -0
  588. package/svg/flags/jm.svg +8 -0
  589. package/svg/flags/jo.svg +16 -0
  590. package/svg/flags/jp.svg +11 -0
  591. package/svg/flags/ke.svg +23 -0
  592. package/svg/flags/kg.svg +15 -0
  593. package/svg/flags/kh.svg +61 -0
  594. package/svg/flags/ki.svg +36 -0
  595. package/svg/flags/km.svg +16 -0
  596. package/svg/flags/kn.svg +14 -0
  597. package/svg/flags/kp.svg +15 -0
  598. package/svg/flags/kr.svg +24 -0
  599. package/svg/flags/kw.svg +13 -0
  600. package/svg/flags/ky.svg +63 -0
  601. package/svg/flags/kz.svg +23 -0
  602. package/svg/flags/la.svg +12 -0
  603. package/svg/flags/lb.svg +15 -0
  604. package/svg/flags/lc.svg +8 -0
  605. package/svg/flags/li.svg +43 -0
  606. package/svg/flags/lk.svg +22 -0
  607. package/svg/flags/lr.svg +14 -0
  608. package/svg/flags/ls.svg +8 -0
  609. package/svg/flags/lt.svg +7 -0
  610. package/svg/flags/lu.svg +5 -0
  611. package/svg/flags/lv.svg +6 -0
  612. package/svg/flags/ly.svg +13 -0
  613. package/svg/flags/ma.svg +4 -0
  614. package/svg/flags/mc.svg +6 -0
  615. package/svg/flags/md.svg +70 -0
  616. package/svg/flags/me.svg +116 -0
  617. package/svg/flags/mf.svg +7 -0
  618. package/svg/flags/mg.svg +7 -0
  619. package/svg/flags/mh.svg +7 -0
  620. package/svg/flags/mk.svg +5 -0
  621. package/svg/flags/ml.svg +7 -0
  622. package/svg/flags/mm.svg +16 -0
  623. package/svg/flags/mn.svg +13 -0
  624. package/svg/flags/mo.svg +9 -0
  625. package/svg/flags/mp.svg +86 -0
  626. package/svg/flags/mq.svg +7 -0
  627. package/svg/flags/mr.svg +6 -0
  628. package/svg/flags/ms.svg +39 -0
  629. package/svg/flags/mt.svg +49 -0
  630. package/svg/flags/mu.svg +8 -0
  631. package/svg/flags/mv.svg +6 -0
  632. package/svg/flags/mw.svg +10 -0
  633. package/svg/flags/mx.svg +382 -0
  634. package/svg/flags/my.svg +15 -0
  635. package/svg/flags/mz.svg +21 -0
  636. package/svg/flags/na.svg +16 -0
  637. package/svg/flags/nc.svg +7 -0
  638. package/svg/flags/ne.svg +6 -0
  639. package/svg/flags/nf.svg +9 -0
  640. package/svg/flags/ng.svg +6 -0
  641. package/svg/flags/ni.svg +129 -0
  642. package/svg/flags/nl.svg +7 -0
  643. package/svg/flags/no.svg +7 -0
  644. package/svg/flags/np.svg +14 -0
  645. package/svg/flags/nr.svg +12 -0
  646. package/svg/flags/nu.svg +26 -0
  647. package/svg/flags/nz.svg +41 -0
  648. package/svg/flags/om.svg +115 -0
  649. package/svg/flags/pa.svg +14 -0
  650. package/svg/flags/pe.svg +244 -0
  651. package/svg/flags/pf.svg +19 -0
  652. package/svg/flags/pg.svg +9 -0
  653. package/svg/flags/ph.svg +13 -0
  654. package/svg/flags/pk.svg +15 -0
  655. package/svg/flags/pl.svg +6 -0
  656. package/svg/flags/pm.svg +7 -0
  657. package/svg/flags/pn.svg +62 -0
  658. package/svg/flags/pr.svg +13 -0
  659. package/svg/flags/ps.svg +15 -0
  660. package/svg/flags/pt.svg +57 -0
  661. package/svg/flags/pw.svg +11 -0
  662. package/svg/flags/py.svg +157 -0
  663. package/svg/flags/qa.svg +4 -0
  664. package/svg/flags/re.svg +7 -0
  665. package/svg/flags/ro.svg +7 -0
  666. package/svg/flags/rs.svg +292 -0
  667. package/svg/flags/ru.svg +7 -0
  668. package/svg/flags/rw.svg +13 -0
  669. package/svg/flags/sa.svg +26 -0
  670. package/svg/flags/sb.svg +13 -0
  671. package/svg/flags/sc.svg +14 -0
  672. package/svg/flags/sd.svg +13 -0
  673. package/svg/flags/se.svg +16 -0
  674. package/svg/flags/sg.svg +13 -0
  675. package/svg/flags/sh.svg +74 -0
  676. package/svg/flags/si.svg +18 -0
  677. package/svg/flags/sj.svg +7 -0
  678. package/svg/flags/sk.svg +9 -0
  679. package/svg/flags/sl.svg +7 -0
  680. package/svg/flags/sm.svg +91 -0
  681. package/svg/flags/sn.svg +8 -0
  682. package/svg/flags/so.svg +11 -0
  683. package/svg/flags/sr.svg +6 -0
  684. package/svg/flags/ss.svg +8 -0
  685. package/svg/flags/st.svg +16 -0
  686. package/svg/flags/sv.svg +606 -0
  687. package/svg/flags/sx.svg +56 -0
  688. package/svg/flags/sy.svg +6 -0
  689. package/svg/flags/sz.svg +45 -0
  690. package/svg/flags/tc.svg +67 -0
  691. package/svg/flags/td.svg +7 -0
  692. package/svg/flags/tf.svg +15 -0
  693. package/svg/flags/tg.svg +14 -0
  694. package/svg/flags/th.svg +7 -0
  695. package/svg/flags/tj.svg +22 -0
  696. package/svg/flags/tk.svg +5 -0
  697. package/svg/flags/tl.svg +13 -0
  698. package/svg/flags/tm.svg +206 -0
  699. package/svg/flags/tn.svg +13 -0
  700. package/svg/flags/to.svg +10 -0
  701. package/svg/flags/tr.svg +8 -0
  702. package/svg/flags/tt.svg +5 -0
  703. package/svg/flags/tv.svg +27 -0
  704. package/svg/flags/tw.svg +14 -0
  705. package/svg/flags/tz.svg +13 -0
  706. package/svg/flags/ua.svg +6 -0
  707. package/svg/flags/ug.svg +30 -0
  708. package/svg/flags/um.svg +15 -0
  709. package/svg/flags/un.svg +16 -0
  710. package/svg/flags/us.svg +10 -0
  711. package/svg/flags/uy.svg +28 -0
  712. package/svg/flags/uz.svg +30 -0
  713. package/svg/flags/va.svg +479 -0
  714. package/svg/flags/vc.svg +8 -0
  715. package/svg/flags/ve.svg +26 -0
  716. package/svg/flags/vg.svg +127 -0
  717. package/svg/flags/vi.svg +28 -0
  718. package/svg/flags/vn.svg +11 -0
  719. package/svg/flags/vu.svg +18 -0
  720. package/svg/flags/wf.svg +7 -0
  721. package/svg/flags/ws.svg +7 -0
  722. package/svg/flags/ye.svg +7 -0
  723. package/svg/flags/yt.svg +7 -0
  724. package/svg/flags/za.svg +17 -0
  725. package/svg/flags/zm.svg +27 -0
  726. package/svg/flags/zw.svg +21 -0
  727. package/svg/instagram.svg +1 -0
  728. package/test-utils/mock-response/product-status.js +44 -0
  729. package/utils/breakpoints.d.ts +23 -0
  730. package/utils/breakpoints.js +94 -0
  731. package/utils/breakpoints.js.map +1 -0
  732. package/utils/callAllEventHandlers.d.ts +5 -0
  733. package/utils/callAllEventHandlers.js +9 -0
  734. package/utils/callAllEventHandlers.js.map +1 -0
  735. package/utils/text.d.ts +1 -0
  736. package/utils/text.js +23 -0
  737. package/utils/text.js.map +1 -0
  738. package/utils/theme.d.ts +3 -0
  739. package/utils/theme.js +5 -0
  740. package/utils/theme.js.map +1 -0
  741. package/utils/useHoverIntent.d.ts +10 -0
  742. package/utils/useHoverIntent.js +78 -0
  743. package/utils/useHoverIntent.js.map +1 -0
  744. package/utils/usePropsOfType.d.ts +11 -0
  745. package/utils/usePropsOfType.js +18 -0
  746. package/utils/usePropsOfType.js.map +1 -0
  747. package/withFlightUI.d.ts +17 -0
  748. package/withFlightUI.js +20 -0
  749. package/withFlightUI.js.map +1 -0
@@ -0,0 +1,417 @@
1
+ import { render, act, cleanup, wait } from '@testing-library/react';
2
+ import React from 'react';
3
+ import RecursiveTree from './RecursiveTree';
4
+ import getMoreSubcategories from './GetMoreSubcategoriesQuery.gql';
5
+ import { MockedProvider } from '@apollo/client/testing';
6
+ import { StaticRouter } from 'react-router';
7
+
8
+ afterEach(cleanup);
9
+
10
+ const MOCK_CATEGORIES = [
11
+ {
12
+ id: 159,
13
+ name: 'News!',
14
+ level: 1,
15
+ parentId: null,
16
+ hasSubcategories: true,
17
+ primaryRoute: {
18
+ path: '/news',
19
+ __typename: 'Route'
20
+ },
21
+ subcategories: [
22
+ {
23
+ id: 160,
24
+ name: 'All products',
25
+ level: 2,
26
+ parentId: 159,
27
+ hasSubcategories: false,
28
+ primaryRoute: {
29
+ path: '/news/all-products',
30
+ __typename: 'Route'
31
+ },
32
+ subcategories: [],
33
+ __typename: 'Category'
34
+ },
35
+ {
36
+ id: 161,
37
+ name: 'Ladies',
38
+ level: 2,
39
+ parentId: 159,
40
+ hasSubcategories: false,
41
+ primaryRoute: {
42
+ path: '/news/ladies',
43
+ __typename: 'Route'
44
+ },
45
+ subcategories: [],
46
+ __typename: 'Category'
47
+ },
48
+ {
49
+ id: 162,
50
+ name: 'Mens',
51
+ level: 2,
52
+ parentId: 159,
53
+ hasSubcategories: false,
54
+ primaryRoute: {
55
+ path: '/news/mens',
56
+ __typename: 'Route'
57
+ },
58
+ subcategories: [],
59
+ __typename: 'Category'
60
+ },
61
+ {
62
+ id: 164,
63
+ name: 'Kids',
64
+ level: 2,
65
+ parentId: 159,
66
+ hasSubcategories: true,
67
+ primaryRoute: {
68
+ path: '/news/kids',
69
+ __typename: 'Route'
70
+ },
71
+ subcategories: [
72
+ {
73
+ id: 302,
74
+ name: 'Tier 3',
75
+ level: 3,
76
+ parentId: 164,
77
+ primaryRoute: null,
78
+ __typename: 'Category'
79
+ }
80
+ ],
81
+ __typename: 'Category'
82
+ }
83
+ ],
84
+ __typename: 'Category'
85
+ },
86
+ {
87
+ id: 1159,
88
+ name: 'News!',
89
+ level: 1,
90
+ parentId: null,
91
+ hasSubcategories: true,
92
+ primaryRoute: {
93
+ path: '/news',
94
+ __typename: 'Route'
95
+ },
96
+ subcategories: [
97
+ {
98
+ id: 1160,
99
+ name: 'All products',
100
+ level: 2,
101
+ parentId: 1159,
102
+ hasSubcategories: false,
103
+ primaryRoute: {
104
+ path: '/news/all-products',
105
+ __typename: 'Route'
106
+ },
107
+ subcategories: [],
108
+ __typename: 'Category'
109
+ },
110
+ {
111
+ id: 1161,
112
+ name: 'Ladies',
113
+ level: 2,
114
+ parentId: 1159,
115
+ hasSubcategories: false,
116
+ primaryRoute: {
117
+ path: '/news/ladies',
118
+ __typename: 'Route'
119
+ },
120
+ subcategories: [],
121
+ __typename: 'Category'
122
+ },
123
+ {
124
+ id: 1162,
125
+ name: 'Mens',
126
+ level: 2,
127
+ parentId: 1159,
128
+ hasSubcategories: false,
129
+ primaryRoute: {
130
+ path: '/news/mens',
131
+ __typename: 'Route'
132
+ },
133
+ subcategories: [],
134
+ __typename: 'Category'
135
+ },
136
+ {
137
+ id: 1164,
138
+ name: 'Kids',
139
+ level: 2,
140
+ parentId: 1159,
141
+ hasSubcategories: true,
142
+ primaryRoute: {
143
+ path: '/news/kids',
144
+ __typename: 'Route'
145
+ },
146
+ subcategories: [
147
+ {
148
+ id: 3102,
149
+ name: 'Tier 3',
150
+ level: 3,
151
+ parentId: 1164,
152
+ primaryRoute: null,
153
+ __typename: 'Category'
154
+ }
155
+ ],
156
+ __typename: 'Category'
157
+ }
158
+ ],
159
+ __typename: 'Category'
160
+ },
161
+ {
162
+ id: 159,
163
+ name: 'News!',
164
+ level: 1,
165
+ parentId: null,
166
+ hasSubcategories: true,
167
+ primaryRoute: {
168
+ path: '/news',
169
+ __typename: 'Route'
170
+ },
171
+ subcategories: [
172
+ {
173
+ id: 160,
174
+ name: 'All products',
175
+ level: 2,
176
+ parentId: 159,
177
+ hasSubcategories: true,
178
+ primaryRoute: {
179
+ path: '/news/all-products',
180
+ __typename: 'Route'
181
+ },
182
+ subcategories: [
183
+ {
184
+ id: 3102,
185
+ name: 'Tier 3',
186
+ level: 3,
187
+ parentId: 1164,
188
+ primaryRoute: {
189
+ path: '/news/all-products/tier-3',
190
+ __typename: 'Route'
191
+ },
192
+ hasSubcategories: true,
193
+ __typename: 'Category'
194
+ }
195
+ ],
196
+ __typename: 'Category'
197
+ }
198
+ ],
199
+ __typename: 'Category'
200
+ }
201
+ ];
202
+
203
+ const tier4 = {
204
+ __typename: 'Category',
205
+ hasSubcategories: false,
206
+ id: 8000,
207
+ name: 'Tier 4',
208
+ level: 4,
209
+ parentId: 3102,
210
+ primaryRoute: null,
211
+ subcategories: []
212
+ };
213
+
214
+ describe('RecursiveNav', () => {
215
+ it('renders child as fn with args', () => {
216
+ const { renderArg } = setup();
217
+ expect(renderArg).toMatchSnapshot();
218
+ });
219
+ });
220
+
221
+ describe('the fetchMore render arg', () => {
222
+ it('fetches more categories and adds them to the subcategories object', async () => {
223
+ const { childrenSpy, renderArg } = setup();
224
+ let promise;
225
+
226
+ act(() => {
227
+ promise = renderArg.fetchMore();
228
+ });
229
+
230
+ await wait();
231
+
232
+ await promise;
233
+ expect(childrenSpy).toHaveBeenCalledWith(
234
+ expect.objectContaining({
235
+ subcategories: [expect.objectContaining({ id: 9000 })]
236
+ })
237
+ );
238
+ });
239
+
240
+ it('does not fetch more categories when the current category level is an even number', async () => {
241
+ const { childrenSpy, renderArg } = setup({
242
+ containerProps: {
243
+ category: MOCK_CATEGORIES[0].subcategories[0]
244
+ }
245
+ });
246
+
247
+ let promise;
248
+
249
+ act(() => {
250
+ promise = renderArg.fetchMore();
251
+ });
252
+
253
+ await promise;
254
+ expect(childrenSpy).toHaveBeenLastCalledWith(
255
+ expect.objectContaining({
256
+ subcategories: []
257
+ })
258
+ );
259
+ });
260
+ });
261
+
262
+ describe('the category render arg', () => {
263
+ it('just passes through the base category', () => {
264
+ const { renderArg } = setup({
265
+ containerProps: {
266
+ category: MOCK_CATEGORIES[0]
267
+ }
268
+ });
269
+
270
+ expect(renderArg.category).toBe(MOCK_CATEGORIES[0]);
271
+ });
272
+ });
273
+
274
+ describe('the renderRecursive render arg', () => {
275
+ it('renders for each subcategory of the current category', () => {
276
+ const { queryByText, getByText, renderArg } = setup();
277
+
278
+ expect(getByText(/News!/)).toBeInTheDocument();
279
+ MOCK_CATEGORIES[0].subcategories.forEach((cat) =>
280
+ expect(queryByText(cat.name)).not.toBeInTheDocument()
281
+ );
282
+
283
+ renderArg.menuContainerProps.setActiveCategory(MOCK_CATEGORIES[0]);
284
+
285
+ MOCK_CATEGORIES[0].subcategories.forEach((cat) =>
286
+ expect(getByText(cat.name)).toBeInTheDocument()
287
+ );
288
+ });
289
+ });
290
+
291
+ describe('the initialOpenMatchingCategories prop', () => {
292
+ it('automatically opens categories matching the current path', () => {
293
+ const renderFn = jest.fn((props) => props.renderSubnav);
294
+ setup({
295
+ containerProps: {
296
+ category: MOCK_CATEGORIES[0],
297
+ initialOpenMatchingCategories: true
298
+ },
299
+ path: '/news/all-products',
300
+ renderFn
301
+ });
302
+
303
+ expect(renderFn).toHaveBeenCalledTimes(5);
304
+ expect(renderFn).toHaveBeenCalledWith(
305
+ expect.objectContaining({
306
+ menuContainerProps: expect.objectContaining({
307
+ activeCategories: expect.arrayContaining([MOCK_CATEGORIES[0]])
308
+ })
309
+ })
310
+ );
311
+ expect(renderFn).toHaveBeenCalledWith(
312
+ expect.objectContaining({
313
+ menuContainerProps: expect.objectContaining({
314
+ activeCategories: expect.arrayContaining([
315
+ MOCK_CATEGORIES[0].subcategories[0]
316
+ ])
317
+ })
318
+ })
319
+ );
320
+ });
321
+
322
+ it('fetches subcategories from the api if they are not already fetched', async () => {
323
+ const renderFn = jest.fn((props) => props.renderSubnav);
324
+ setup({
325
+ containerProps: {
326
+ category: MOCK_CATEGORIES[2],
327
+ initialOpenMatchingCategories: true
328
+ },
329
+ path: '/news/all-products',
330
+ renderFn
331
+ });
332
+
333
+ await wait();
334
+
335
+ expect(renderFn).toHaveBeenCalledTimes(5);
336
+ expect(renderFn).toHaveBeenCalledWith(
337
+ expect.objectContaining({
338
+ subcategories: expect.arrayContaining([tier4])
339
+ })
340
+ );
341
+ });
342
+ });
343
+
344
+ function setup({
345
+ containerProps = { category: MOCK_CATEGORIES[0] },
346
+ renderFn,
347
+ path
348
+ } = {}) {
349
+ let renderArg;
350
+
351
+ const childrenSpy = jest.fn((controllerArg) => {
352
+ renderArg = controllerArg;
353
+
354
+ if (renderFn) return renderFn(controllerArg);
355
+ return (
356
+ <div>
357
+ <span>{controllerArg.category.name}</span>
358
+ <nav>{controllerArg.renderSubnav}</nav>
359
+ </div>
360
+ );
361
+ });
362
+
363
+ const utils = render(
364
+ <StaticRouter location={path} context={{}}>
365
+ <MockedProvider
366
+ mocks={[
367
+ {
368
+ request: {
369
+ query: getMoreSubcategories,
370
+ variables: { id: MOCK_CATEGORIES[0].id }
371
+ },
372
+ result: {
373
+ data: {
374
+ category: {
375
+ __typename: 'Category',
376
+ hasSubcategories: true,
377
+ subcategories: [
378
+ {
379
+ id: 9000,
380
+ name: 'Mock category',
381
+ level: 2,
382
+ parentId: null,
383
+ primaryRoute: null,
384
+ hasSubcategories: false,
385
+ subcategories: [],
386
+ __typename: 'Category'
387
+ }
388
+ ]
389
+ }
390
+ }
391
+ }
392
+ },
393
+ {
394
+ request: {
395
+ query: getMoreSubcategories,
396
+ variables: {
397
+ id: MOCK_CATEGORIES[2].subcategories[0].subcategories[0].id
398
+ }
399
+ },
400
+ result: {
401
+ data: {
402
+ category: {
403
+ ...MOCK_CATEGORIES[2].subcategories[0].subcategories[0],
404
+ subcategories: [tier4]
405
+ }
406
+ }
407
+ }
408
+ }
409
+ ]}
410
+ >
411
+ <RecursiveTree {...containerProps}>{childrenSpy}</RecursiveTree>
412
+ </MockedProvider>
413
+ </StaticRouter>
414
+ );
415
+
416
+ return { ...utils, childrenSpy, renderArg };
417
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface DrawerProps {
3
+ /** Whether to attach the drawer to the right of the screen. Defauts to false. */
4
+ right: boolean;
5
+ /** The size of the drawer in pixels. Defaults to 320. */
6
+ size: number;
7
+ /** Whether the drawer is open or not. Defaults to false. */
8
+ isOpen: boolean;
9
+ children?: React.ReactNode;
10
+ }
11
+ declare const Drawer: ({ right, size, isOpen, children }: DrawerProps) => React.JSX.Element;
12
+ export default Drawer;
@@ -0,0 +1,31 @@
1
+ import { css, cx } from 'linaria';
2
+ import React from 'react';
3
+ const containerStyles = css `
4
+ background: white;
5
+ height: 100%;
6
+ position: fixed;
7
+ display: flex;
8
+ flex-direction: column;
9
+ top: 0;
10
+ height: 100%;
11
+ z-index: 99999;
12
+ max-width: 100%;
13
+ -webkit-overflow-scrolling: touch;
14
+ overflow-y: auto;
15
+
16
+ transition: transform 0.3s ease-in-out;
17
+ `;
18
+ const Drawer = ({ right = false, size = 320, isOpen = false, children }) => {
19
+ const initialPosition = right // this is for server side rendering since popmotion doesn't support it
20
+ ? {
21
+ transform: `translateX(${isOpen ? 0 : size}px)`,
22
+ right: 0
23
+ }
24
+ : {
25
+ transform: `translateX(-${isOpen ? 0 : size}px)`,
26
+ left: 0
27
+ };
28
+ return (React.createElement("div", { className: cx(containerStyles, isOpen ? 'open' : 'closed', right ? 'right' : 'left'), style: Object.assign({ width: `${size}px` }, initialPosition) }, children));
29
+ };
30
+ export default Drawer;
31
+ //# sourceMappingURL=Drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;;CAc1B,CAAC;AAYF,MAAM,MAAM,GAAG,CAAC,EACd,KAAK,GAAG,KAAK,EACb,IAAI,GAAG,GAAG,EACV,MAAM,GAAG,KAAK,EACd,QAAQ,EACI,EAAE,EAAE;IAChB,MAAM,eAAe,GAAG,KAAK,CAAC,uEAAuE;QACnG,CAAC,CAAC;YACE,SAAS,EAAE,cAAc,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK;YAC/C,KAAK,EAAE,CAAC;SACT;QACH,CAAC,CAAC;YACE,SAAS,EAAE,eAAe,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK;YAChD,IAAI,EAAE,CAAC;SACR,CAAC;IACN,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CACX,eAAe,EACf,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAC1B,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CACzB,EACD,KAAK,kBAAI,KAAK,EAAE,GAAG,IAAI,IAAI,IAAK,eAAe,KAE9C,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { ModalState } from '../ModalContext';
3
+ export declare const DrawerTarget: React.SFC<{
4
+ id: string;
5
+ children: (args: Partial<ModalState>) => React.ReactNode;
6
+ }>;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import ModalContext from '../ModalContext';
3
+ export const DrawerTarget = ({ id, children }) => {
4
+ return (React.createElement(ModalContext.Consumer, null, ({ modals, hideTarget }) => {
5
+ const { modalId, isOpen } = modals.find(({ modalId }) => modalId === id) || {};
6
+ // For drawers, the child should always render.
7
+ // Drawers implement their own hide/show behaviour that relies
8
+ // on `isOpen` being toggled to trigger the animation
9
+ return children({ hideTarget, isOpen: isOpen && modalId === id });
10
+ }));
11
+ };
12
+ //# sourceMappingURL=DrawerTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawerTarget.js","sourceRoot":"","sources":["DrawerTarget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,YAA4B,MAAM,iBAAiB,CAAC;AAE3D,MAAM,CAAC,MAAM,YAAY,GAGpB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxB,OAAO,CACL,oBAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAC1B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GACvB,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;QACrD,+CAA+C;QAC/C,8DAA8D;QAC9D,qDAAqD;QACrD,OAAO,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC,CACqB,CACzB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import getComponentWithModalContext, {
3
+ defaultContext
4
+ } from '../__test_utils__/getComponentWithModalContext';
5
+
6
+ beforeEach(() => {
7
+ jest.resetModules();
8
+ });
9
+
10
+ const target = getComponentWithModalContext(
11
+ 'Drawer/DrawerTarget',
12
+ 'DrawerTarget'
13
+ );
14
+
15
+ xdescribe('DrawerTarget', () => {
16
+ describe('renders a child component', () => {
17
+ let wrapper;
18
+ let reachableChild = jest.fn().mockReturnValue('I will always render');
19
+
20
+ afterEach(() => {
21
+ expect(wrapper.text()).toBe('I will always render');
22
+ });
23
+
24
+ it('no matter what the context state is', () => {
25
+ const DrawerTarget = target({
26
+ ...defaultContext,
27
+ modals: [
28
+ {
29
+ modalType: 'drawer',
30
+ isOpen: false
31
+ }
32
+ ]
33
+ });
34
+ wrapper = mount(<DrawerTarget>{reachableChild}</DrawerTarget>);
35
+ });
36
+
37
+ it('with `isOpen` prop passed', () => {
38
+ expect(
39
+ wrapper.children().children().props().modals[0].isOpen
40
+ ).toBeDefined();
41
+ });
42
+
43
+ it('with `modalType` prop passed', () => {
44
+ expect(wrapper.children().children().props().modals[0].modalType).toBe(
45
+ 'drawer'
46
+ );
47
+ });
48
+
49
+ it('with `hideTarget` func passed', () => {
50
+ expect(wrapper.children().children().props().hideTarget).toBe(
51
+ defaultContext.hideTarget
52
+ );
53
+ });
54
+
55
+ describe('with `isOpen` prop set to `true`', () => {
56
+ it('when `isOpen` is true and `modalId` matches `id`', () => {
57
+ const DrawerTarget = target({
58
+ ...defaultContext,
59
+ modals: [{ modalType: 'drawer', isOpen: true, modalId: 'foo' }]
60
+ });
61
+ wrapper = mount(<DrawerTarget id="foo">{reachableChild}</DrawerTarget>);
62
+ expect(wrapper.children().children().props().modals[0].isOpen).toBe(
63
+ true
64
+ );
65
+ });
66
+ });
67
+
68
+ describe('with `isOpen` prop set to `false`', () => {
69
+ it('when `isOpen` is false', () => {
70
+ const DrawerTarget = target({
71
+ ...defaultContext,
72
+ modals: [{ modalType: 'drawer', isOpen: false, modalId: 'foo' }]
73
+ });
74
+ wrapper = mount(<DrawerTarget id="foo">{reachableChild}</DrawerTarget>);
75
+ expect(wrapper.children().children().props().modals[0].isOpen).toBe(
76
+ false
77
+ );
78
+ });
79
+
80
+ it('when received `modalId` does not match `id` prop', () => {
81
+ const DrawerTarget = target({
82
+ ...defaultContext,
83
+ modals: [{ modalType: 'drawer', isOpen: true, modalId: 'bar' }]
84
+ });
85
+ wrapper = mount(<DrawerTarget id="foo">{reachableChild}</DrawerTarget>);
86
+ expect(wrapper.children().children().props().modals[0].isOpen).toBe(
87
+ false
88
+ );
89
+ });
90
+ });
91
+ });
92
+ });
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { ModalState } from '../ModalContext';
3
+ export declare const DrawerTrigger: ({ id, children, showCover, canCloseOnEsc, coverStyles }: {
4
+ id: string;
5
+ /** Whether to show a clickable semi-opaque Cover behind the flyout */
6
+ showCover: boolean;
7
+ /** Whether to prevent the body from scrolling when flyout is open */
8
+ canCloseOnEsc?: boolean;
9
+ coverStyles?: React.CSSProperties;
10
+ children: (args: Partial<ModalState>) => React.ReactNode;
11
+ }) => React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import ModalContext from '../ModalContext';
3
+ export const DrawerTrigger = ({ id, children, showCover = true, canCloseOnEsc = true, coverStyles }) => {
4
+ return (React.createElement(ModalContext.Consumer, null, ({ showTarget, hideTarget, modals }) => {
5
+ return children({
6
+ showTarget: () => showTarget(null, 'drawer', id, {
7
+ showCover,
8
+ coverStyles,
9
+ canCloseOnEsc
10
+ }),
11
+ hideTarget,
12
+ isOpen: modals.some(({ modalId }) => modalId === id)
13
+ });
14
+ }));
15
+ };
16
+ //# sourceMappingURL=DrawerTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawerTrigger.js","sourceRoot":"","sources":["DrawerTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,YAA4B,MAAM,iBAAiB,CAAC;AAE3D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,EAAE,EACF,QAAQ,EACR,SAAS,GAAG,IAAI,EAChB,aAAa,GAAG,IAAI,EACpB,WAAW,EASZ,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;QACtC,OAAO,QAAQ,CAAC;YACd,UAAU,EAAE,GAAG,EAAE,CACf,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;gBAC7B,SAAS;gBACT,WAAW;gBACX,aAAa;aACd,CAAC;YACJ,UAAU;YACV,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC,CACqB,CACzB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import getComponentWithModalContext, {
3
+ defaultContext
4
+ } from '../__test_utils__/getComponentWithModalContext';
5
+
6
+ beforeEach(() => {
7
+ jest.resetModules();
8
+ });
9
+
10
+ const trigger = getComponentWithModalContext(
11
+ 'Drawer/DrawerTrigger',
12
+ 'DrawerTrigger'
13
+ );
14
+
15
+ xdescribe('DrawerTrigger', () => {
16
+ let funcAsChild = jest.fn().mockReturnValue(<div>Rendered child</div>);
17
+
18
+ it('renders a Consumer', () => {
19
+ const DrawerTrigger = trigger();
20
+ const wrapper = mount(<DrawerTrigger>{funcAsChild}</DrawerTrigger>);
21
+ expect(wrapper.find('Consumer')).toHaveLength(1);
22
+ });
23
+ describe('takes a func as child prop', () => {
24
+ it('calls it with `showTarget`, `hideTarget`, and `open`', () => {
25
+ const DrawerTrigger = trigger();
26
+
27
+ mount(<DrawerTrigger id="foo">{funcAsChild}</DrawerTrigger>);
28
+ expect(funcAsChild).toHaveBeenCalledWith(
29
+ expect.objectContaining({
30
+ showTarget: expect.any(Function),
31
+ hideTarget: defaultContext.hideTarget,
32
+ isOpen: defaultContext.isOpen
33
+ })
34
+ );
35
+ });
36
+ it('calls `showTarget` with `id` passed via prop', () => {
37
+ const DrawerTrigger = trigger();
38
+ const wrapper = mount(
39
+ <DrawerTrigger id="foo">
40
+ {({ showTarget }) => <div onClick={showTarget}>hello</div>}
41
+ </DrawerTrigger>
42
+ );
43
+ wrapper.find('div').simulate('click');
44
+ expect(defaultContext.showTarget).toHaveBeenCalledWith(
45
+ null,
46
+ 'drawer',
47
+ 'foo'
48
+ );
49
+ });
50
+ });
51
+ });
@@ -0,0 +1,3 @@
1
+ export { DrawerTrigger } from './DrawerTrigger';
2
+ export { DrawerTarget } from './DrawerTarget';
3
+ export { default } from './Drawer';
@@ -0,0 +1,4 @@
1
+ export { DrawerTrigger } from './DrawerTrigger';
2
+ export { DrawerTarget } from './DrawerTarget';
3
+ export { default } from './Drawer';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { ModalState } from '../ModalContext';
3
+ export interface FlyoutTargetProps {
4
+ id: string;
5
+ children: (args: Partial<ModalState>) => React.ReactNode;
6
+ }
7
+ export declare class FlyoutTarget extends React.Component<FlyoutTargetProps, any> {
8
+ render(): React.JSX.Element;
9
+ }
10
+ export default FlyoutTarget;