@blaze-cms/react-page-builder 0.139.0-alpha.1 → 0.139.0-alpha.4

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 (742) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +9 -0
  3. package/lib/BannerContext/helpers/set-initial-banner-counters.js +1 -2
  4. package/lib/BannerContext/helpers/set-initial-banner-counters.js.map +1 -1
  5. package/lib/BannerContext/index.js +4 -6
  6. package/lib/BannerContext/index.js.map +1 -1
  7. package/lib/HOC/recreateOnNavigation.js +1 -2
  8. package/lib/HOC/recreateOnNavigation.js.map +1 -1
  9. package/lib/HOC/withInfiniteScroll.js +3 -4
  10. package/lib/HOC/withInfiniteScroll.js.map +1 -1
  11. package/lib/HOC/withTitle.js +3 -4
  12. package/lib/HOC/withTitle.js.map +1 -1
  13. package/lib/PBContext/index.js +1 -2
  14. package/lib/PBContext/index.js.map +1 -1
  15. package/lib/application/query/index.js +15 -30
  16. package/lib/application/query/index.js.map +1 -1
  17. package/lib/components/BackToTop/BackToTop.js +3 -4
  18. package/lib/components/BackToTop/BackToTop.js.map +1 -1
  19. package/lib/components/BackToTop/index.js +1 -2
  20. package/lib/components/BackToTop/index.js.map +1 -1
  21. package/lib/components/Banner/AdSlotRender.js +3 -4
  22. package/lib/components/Banner/AdSlotRender.js.map +1 -1
  23. package/lib/components/Banner/Banner.js +3 -4
  24. package/lib/components/Banner/Banner.js.map +1 -1
  25. package/lib/components/Banner/BannerRender.js +1 -2
  26. package/lib/components/Banner/BannerRender.js.map +1 -1
  27. package/lib/components/Banner/helpers.js +10 -20
  28. package/lib/components/Banner/helpers.js.map +1 -1
  29. package/lib/components/Banner/index.js +3 -4
  30. package/lib/components/Banner/index.js.map +1 -1
  31. package/lib/components/BlazeLink.js +3 -4
  32. package/lib/components/BlazeLink.js.map +1 -1
  33. package/lib/components/Breadcrumb/Breadcrumb.js +3 -4
  34. package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
  35. package/lib/components/Breadcrumb/index.js +1 -2
  36. package/lib/components/Breadcrumb/index.js.map +1 -1
  37. package/lib/components/Button.js +3 -4
  38. package/lib/components/Button.js.map +1 -1
  39. package/lib/components/Card/Card.js +8 -7
  40. package/lib/components/Card/Card.js.map +1 -1
  41. package/lib/components/Card/CardsContainer.js +4 -8
  42. package/lib/components/Card/CardsContainer.js.map +1 -1
  43. package/lib/components/Card/CardsFactory.js +1 -2
  44. package/lib/components/Card/CardsFactory.js.map +1 -1
  45. package/lib/components/Card/CardsRender.js +4 -6
  46. package/lib/components/Card/CardsRender.js.map +1 -1
  47. package/lib/components/Card/constants.js +2 -4
  48. package/lib/components/Card/constants.js.map +1 -1
  49. package/lib/components/Card/helpers/filter-query-setup.js +1 -2
  50. package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
  51. package/lib/components/Card/helpers/filters-setup.js +1 -2
  52. package/lib/components/Card/helpers/filters-setup.js.map +1 -1
  53. package/lib/components/Card/helpers/get-dynamic-grid-classes.js +1 -2
  54. package/lib/components/Card/helpers/get-dynamic-grid-classes.js.map +1 -1
  55. package/lib/components/Card/helpers/get-published-listing-url.js +1 -2
  56. package/lib/components/Card/helpers/get-published-listing-url.js.map +1 -1
  57. package/lib/components/Card/helpers/get-updated-items-to-display.js +1 -2
  58. package/lib/components/Card/helpers/get-updated-items-to-display.js.map +1 -1
  59. package/lib/components/Card/helpers/get-updated-sort-properties.js +1 -2
  60. package/lib/components/Card/helpers/get-updated-sort-properties.js.map +1 -1
  61. package/lib/components/Card/helpers/should-return.js +1 -2
  62. package/lib/components/Card/helpers/should-return.js.map +1 -1
  63. package/lib/components/Card/helpers/should-skip-single-query.js +1 -2
  64. package/lib/components/Card/helpers/should-skip-single-query.js.map +1 -1
  65. package/lib/components/Card/helpers/use-dynamic-size-key.js +1 -2
  66. package/lib/components/Card/helpers/use-dynamic-size-key.js.map +1 -1
  67. package/lib/components/Card/index.js +1 -2
  68. package/lib/components/Card/index.js.map +1 -1
  69. package/lib/components/Carousel/Carousel.js +27 -19
  70. package/lib/components/Carousel/Carousel.js.map +1 -1
  71. package/lib/components/Carousel/CarouselImage/CarouselImage.js +1 -2
  72. package/lib/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
  73. package/lib/components/Carousel/CarouselImage/index.js +1 -2
  74. package/lib/components/Carousel/CarouselImage/index.js.map +1 -1
  75. package/lib/components/Carousel/CarouselRender/CarouselRender.js +35 -62
  76. package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
  77. package/lib/components/Carousel/CarouselRender/index.js +1 -2
  78. package/lib/components/Carousel/CarouselRender/index.js.map +1 -1
  79. package/lib/components/Carousel/hooks/useCarouselNavigation.js +56 -0
  80. package/lib/components/Carousel/hooks/useCarouselNavigation.js.map +1 -0
  81. package/lib/components/Carousel/index.js +1 -2
  82. package/lib/components/Carousel/index.js.map +1 -1
  83. package/lib/components/CarouselWrapper/CarouselWrapper.js +1 -2
  84. package/lib/components/CarouselWrapper/CarouselWrapper.js.map +1 -1
  85. package/lib/components/CarouselWrapper/DefaultCarousel.js +3 -4
  86. package/lib/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
  87. package/lib/components/CarouselWrapper/SmoothScrollCarousel.js +1 -2
  88. package/lib/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
  89. package/lib/components/CarouselWrapper/index.js +1 -2
  90. package/lib/components/CarouselWrapper/index.js.map +1 -1
  91. package/lib/components/ClickWrapper.js +3 -4
  92. package/lib/components/ClickWrapper.js.map +1 -1
  93. package/lib/components/Code/Code.js +3 -4
  94. package/lib/components/Code/Code.js.map +1 -1
  95. package/lib/components/Code/ScriptTag.js +3 -4
  96. package/lib/components/Code/ScriptTag.js.map +1 -1
  97. package/lib/components/Code/helpers/wrap-script-tags.js +1 -2
  98. package/lib/components/Code/helpers/wrap-script-tags.js.map +1 -1
  99. package/lib/components/Code/index.js +1 -2
  100. package/lib/components/Code/index.js.map +1 -1
  101. package/lib/components/ContentGroup/ContentGroup.js +1 -2
  102. package/lib/components/ContentGroup/ContentGroup.js.map +1 -1
  103. package/lib/components/ContentGroup/ContentGroupTabs.js +3 -4
  104. package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
  105. package/lib/components/ContentGroup/constants.js +5 -10
  106. package/lib/components/ContentGroup/constants.js.map +1 -1
  107. package/lib/components/ContentGroup/helpers/get-active-tab.js +1 -2
  108. package/lib/components/ContentGroup/helpers/get-active-tab.js.map +1 -1
  109. package/lib/components/ContentGroup/helpers/get-sections-data.js +1 -2
  110. package/lib/components/ContentGroup/helpers/get-sections-data.js.map +1 -1
  111. package/lib/components/ContentGroup/index.js +1 -2
  112. package/lib/components/ContentGroup/index.js.map +1 -1
  113. package/lib/components/ContentGroupSection/ContentGroupSection.js +1 -2
  114. package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  115. package/lib/components/ContentGroupSection/index.js +1 -2
  116. package/lib/components/ContentGroupSection/index.js.map +1 -1
  117. package/lib/components/DataSummary/DataSummaryFactory.js +3 -4
  118. package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
  119. package/lib/components/DataSummary/DataSummaryRender.js +1 -2
  120. package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
  121. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js +1 -2
  122. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js.map +1 -1
  123. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js +3 -4
  124. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.map +1 -1
  125. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/index.js +1 -2
  126. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/index.js.map +1 -1
  127. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js +1 -2
  128. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js.map +1 -1
  129. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -4
  130. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
  131. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/index.js +1 -2
  132. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/index.js.map +1 -1
  133. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js +1 -2
  134. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js.map +1 -1
  135. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js +3 -4
  136. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.map +1 -1
  137. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/index.js +1 -2
  138. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/index.js.map +1 -1
  139. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js +1 -2
  140. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js.map +1 -1
  141. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js +3 -4
  142. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.map +1 -1
  143. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/index.js +1 -2
  144. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/index.js.map +1 -1
  145. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js +1 -2
  146. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js.map +1 -1
  147. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js +3 -4
  148. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.map +1 -1
  149. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/index.js +1 -2
  150. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/index.js.map +1 -1
  151. package/lib/components/DataSummary/DataSummaryTypes/index.js +3 -4
  152. package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
  153. package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -2
  154. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  155. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +1 -2
  156. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
  157. package/lib/components/DataSummary/helpers/get-data-summary-query.js +1 -2
  158. package/lib/components/DataSummary/helpers/get-data-summary-query.js.map +1 -1
  159. package/lib/components/DataSummary/helpers/get-link-based-on-value.js +1 -2
  160. package/lib/components/DataSummary/helpers/get-link-based-on-value.js.map +1 -1
  161. package/lib/components/DataSummary/helpers/get-link-props.js +1 -2
  162. package/lib/components/DataSummary/helpers/get-link-props.js.map +1 -1
  163. package/lib/components/DataSummary/helpers/get-link-to-published-content.js +1 -2
  164. package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  165. package/lib/components/DataSummary/helpers/get-loop-props-limit.js +1 -2
  166. package/lib/components/DataSummary/helpers/get-loop-props-limit.js.map +1 -1
  167. package/lib/components/DataSummary/helpers/get-prop-value.js +1 -2
  168. package/lib/components/DataSummary/helpers/get-prop-value.js.map +1 -1
  169. package/lib/components/DataSummary/helpers/get-value-from-array.js +3 -5
  170. package/lib/components/DataSummary/helpers/get-value-from-array.js.map +1 -1
  171. package/lib/components/DataSummary/helpers/parse-boolean-values.js +1 -2
  172. package/lib/components/DataSummary/helpers/parse-boolean-values.js.map +1 -1
  173. package/lib/components/DataSummary/helpers/strip-summary-props-content.js +1 -2
  174. package/lib/components/DataSummary/helpers/strip-summary-props-content.js.map +1 -1
  175. package/lib/components/DataSummary/index.js +1 -2
  176. package/lib/components/DataSummary/index.js.map +1 -1
  177. package/lib/components/EmailConfirm/EmailConfirm.js +3 -4
  178. package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
  179. package/lib/components/EmailConfirm/index.js +1 -2
  180. package/lib/components/EmailConfirm/index.js.map +1 -1
  181. package/lib/components/EmailConfirm/mutation.js +1 -2
  182. package/lib/components/EmailConfirm/mutation.js.map +1 -1
  183. package/lib/components/Iframe/Iframe.js +1 -2
  184. package/lib/components/Iframe/Iframe.js.map +1 -1
  185. package/lib/components/Iframe/constants.js +2 -4
  186. package/lib/components/Iframe/constants.js.map +1 -1
  187. package/lib/components/Iframe/index.js +1 -2
  188. package/lib/components/Iframe/index.js.map +1 -1
  189. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js +3 -4
  190. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
  191. package/lib/components/Image/GlobalLightbox/NavButton.js +1 -2
  192. package/lib/components/Image/GlobalLightbox/NavButton.js.map +1 -1
  193. package/lib/components/Image/GlobalLightbox/index.js +3 -4
  194. package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
  195. package/lib/components/Image/Image.js +3 -4
  196. package/lib/components/Image/Image.js.map +1 -1
  197. package/lib/components/Image/ImageDetails.js +1 -2
  198. package/lib/components/Image/ImageDetails.js.map +1 -1
  199. package/lib/components/Image/ImageFactory.js +3 -4
  200. package/lib/components/Image/ImageFactory.js.map +1 -1
  201. package/lib/components/Image/ImageRender.js +1 -2
  202. package/lib/components/Image/ImageRender.js.map +1 -1
  203. package/lib/components/Image/Lightbox/Lightbox.js +3 -4
  204. package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
  205. package/lib/components/Image/Lightbox/index.js +1 -2
  206. package/lib/components/Image/Lightbox/index.js.map +1 -1
  207. package/lib/components/Image/index.js +1 -2
  208. package/lib/components/Image/index.js.map +1 -1
  209. package/lib/components/ItemList/ItemListButton/ItemListButton.js +3 -4
  210. package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -1
  211. package/lib/components/ItemList/ItemListButton/index.js +1 -2
  212. package/lib/components/ItemList/ItemListButton/index.js.map +1 -1
  213. package/lib/components/ItemList/ItemListCounter/ItemListCounter.js +1 -2
  214. package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -1
  215. package/lib/components/ItemList/ItemListCounter/index.js +1 -2
  216. package/lib/components/ItemList/ItemListCounter/index.js.map +1 -1
  217. package/lib/components/ItemList/ItemListNew/ItemListNew.js +1 -2
  218. package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -1
  219. package/lib/components/ItemList/ItemListNew/index.js +1 -2
  220. package/lib/components/ItemList/ItemListNew/index.js.map +1 -1
  221. package/lib/components/ItemList/constants.js +5 -10
  222. package/lib/components/ItemList/constants.js.map +1 -1
  223. package/lib/components/ItemList/helpers/get-item-list-data.js +1 -2
  224. package/lib/components/ItemList/helpers/get-item-list-data.js.map +1 -1
  225. package/lib/components/ItemList/helpers/get-item-list-id.js +1 -2
  226. package/lib/components/ItemList/helpers/get-item-list-id.js.map +1 -1
  227. package/lib/components/ItemList/helpers/get-item-list-ids.js +1 -2
  228. package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -1
  229. package/lib/components/ItemList/helpers/set-item-list-id.js +1 -2
  230. package/lib/components/ItemList/helpers/set-item-list-id.js.map +1 -1
  231. package/lib/components/ItemList/helpers/set-param-and-redirect.js +1 -2
  232. package/lib/components/ItemList/helpers/set-param-and-redirect.js.map +1 -1
  233. package/lib/components/ItemList/hooks/use-item-list-id.js +1 -2
  234. package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -1
  235. package/lib/components/Layout/Layout.js +8 -5
  236. package/lib/components/Layout/Layout.js.map +1 -1
  237. package/lib/components/Layout/LayoutFactory.js +3 -4
  238. package/lib/components/Layout/LayoutFactory.js.map +1 -1
  239. package/lib/components/Layout/LayoutWithStickyTimer.js +3 -4
  240. package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -1
  241. package/lib/components/Layout/constants.js +3 -6
  242. package/lib/components/Layout/constants.js.map +1 -1
  243. package/lib/components/Layout/helpers/check-if-row-has-columns.js +1 -2
  244. package/lib/components/Layout/helpers/check-if-row-has-columns.js.map +1 -1
  245. package/lib/components/Layout/helpers/get-styles-to-update.js +1 -2
  246. package/lib/components/Layout/helpers/get-styles-to-update.js.map +1 -1
  247. package/lib/components/Layout/index.js +1 -2
  248. package/lib/components/Layout/index.js.map +1 -1
  249. package/lib/components/LazyImage/LazyImage.js +1 -2
  250. package/lib/components/LazyImage/LazyImage.js.map +1 -1
  251. package/lib/components/LazyImage/index.js +3 -4
  252. package/lib/components/LazyImage/index.js.map +1 -1
  253. package/lib/components/List/ListBuilder.js +1 -2
  254. package/lib/components/List/ListBuilder.js.map +1 -1
  255. package/lib/components/List/ListFactory.js +3 -4
  256. package/lib/components/List/ListFactory.js.map +1 -1
  257. package/lib/components/List/ListRender.js +1 -2
  258. package/lib/components/List/ListRender.js.map +1 -1
  259. package/lib/components/List/components/Cards/CardRenderWithInfiniteScroll.js +1 -2
  260. package/lib/components/List/components/Cards/CardRenderWithInfiniteScroll.js.map +1 -1
  261. package/lib/components/List/components/Cards/CardsRender.js +3 -4
  262. package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
  263. package/lib/components/List/components/Cards/CardsRenderItem.js +1 -2
  264. package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
  265. package/lib/components/List/components/Cards/CardsRenderWrapper.js +3 -4
  266. package/lib/components/List/components/Cards/CardsRenderWrapper.js.map +1 -1
  267. package/lib/components/List/components/Cards/index.js +1 -2
  268. package/lib/components/List/components/Cards/index.js.map +1 -1
  269. package/lib/components/List/components/Full/FullRender.js +3 -4
  270. package/lib/components/List/components/Full/FullRender.js.map +1 -1
  271. package/lib/components/List/components/Full/FullRenderItem.js +3 -4
  272. package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
  273. package/lib/components/List/components/Full/FullRenderWithInfiniteScroll.js +1 -2
  274. package/lib/components/List/components/Full/FullRenderWithInfiniteScroll.js.map +1 -1
  275. package/lib/components/List/components/Full/index.js +1 -2
  276. package/lib/components/List/components/Full/index.js.map +1 -1
  277. package/lib/components/List/components/Header/ListHeader.js +1 -2
  278. package/lib/components/List/components/Header/ListHeader.js.map +1 -1
  279. package/lib/components/List/components/Header/index.js +1 -2
  280. package/lib/components/List/components/Header/index.js.map +1 -1
  281. package/lib/components/List/components/Pagination/Classic.js +1 -2
  282. package/lib/components/List/components/Pagination/Classic.js.map +1 -1
  283. package/lib/components/List/components/Pagination/ListPagination.js +3 -4
  284. package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
  285. package/lib/components/List/components/Pagination/LoadMore.js +1 -2
  286. package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
  287. package/lib/components/List/components/Pagination/index.js +1 -2
  288. package/lib/components/List/components/Pagination/index.js.map +1 -1
  289. package/lib/components/List/components/helpers/check-if-should-render-banner.js +2 -4
  290. package/lib/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
  291. package/lib/components/List/components/helpers/check-if-should-render-gtm.js +1 -2
  292. package/lib/components/List/components/helpers/check-if-should-render-gtm.js.map +1 -1
  293. package/lib/components/List/constants.js +7 -14
  294. package/lib/components/List/constants.js.map +1 -1
  295. package/lib/components/List/helpers/build-az-aggregations.js +1 -2
  296. package/lib/components/List/helpers/build-az-aggregations.js.map +1 -1
  297. package/lib/components/List/helpers/build-az-url.js +2 -4
  298. package/lib/components/List/helpers/build-az-url.js.map +1 -1
  299. package/lib/components/List/helpers/build-pagination-items.js +1 -2
  300. package/lib/components/List/helpers/build-pagination-items.js.map +1 -1
  301. package/lib/components/List/helpers/build-pagination-url.js +1 -2
  302. package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
  303. package/lib/components/List/helpers/get-az-query-filter.js +1 -2
  304. package/lib/components/List/helpers/get-az-query-filter.js.map +1 -1
  305. package/lib/components/List/helpers/get-items-per-page-to-use.js +1 -2
  306. package/lib/components/List/helpers/get-items-per-page-to-use.js.map +1 -1
  307. package/lib/components/List/helpers/get-list-component.js +1 -2
  308. package/lib/components/List/helpers/get-list-component.js.map +1 -1
  309. package/lib/components/List/helpers/get-list-query.js +1 -2
  310. package/lib/components/List/helpers/get-list-query.js.map +1 -1
  311. package/lib/components/List/helpers/get-list-specific-search-filter.js +1 -2
  312. package/lib/components/List/helpers/get-list-specific-search-filter.js.map +1 -1
  313. package/lib/components/List/helpers/get-sort-props.js +1 -2
  314. package/lib/components/List/helpers/get-sort-props.js.map +1 -1
  315. package/lib/components/List/helpers/has-required-item-list-details.js +1 -2
  316. package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -1
  317. package/lib/components/List/helpers/sort-aggs.js +1 -2
  318. package/lib/components/List/helpers/sort-aggs.js.map +1 -1
  319. package/lib/components/List/helpers/strip-query-key.js +1 -2
  320. package/lib/components/List/helpers/strip-query-key.js.map +1 -1
  321. package/lib/components/List/index.js +1 -2
  322. package/lib/components/List/index.js.map +1 -1
  323. package/lib/components/Menu/Menu.js +4 -6
  324. package/lib/components/Menu/Menu.js.map +1 -1
  325. package/lib/components/Menu/MenuContext.js +1 -2
  326. package/lib/components/Menu/MenuContext.js.map +1 -1
  327. package/lib/components/Menu/index.js +1 -2
  328. package/lib/components/Menu/index.js.map +1 -1
  329. package/lib/components/MenuItem/MenuItem.js +3 -4
  330. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  331. package/lib/components/MenuItem/index.js +1 -2
  332. package/lib/components/MenuItem/index.js.map +1 -1
  333. package/lib/components/Modal/Modal.js +1 -2
  334. package/lib/components/Modal/Modal.js.map +1 -1
  335. package/lib/components/Modal/index.js +1 -2
  336. package/lib/components/Modal/index.js.map +1 -1
  337. package/lib/components/SearchContent/SearchContent.js +58 -56
  338. package/lib/components/SearchContent/SearchContent.js.map +1 -1
  339. package/lib/components/SearchContent/SearchContentItems.js +1 -2
  340. package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
  341. package/lib/components/SearchContent/SearchContentResults.js +17 -19
  342. package/lib/components/SearchContent/SearchContentResults.js.map +1 -1
  343. package/lib/components/SearchContent/SearchContentToggleIcon.js +9 -18
  344. package/lib/components/SearchContent/SearchContentToggleIcon.js.map +1 -1
  345. package/lib/components/SearchContent/constants.js +10 -0
  346. package/lib/components/SearchContent/constants.js.map +1 -0
  347. package/lib/components/SearchContent/index.js +1 -2
  348. package/lib/components/SearchContent/index.js.map +1 -1
  349. package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js +1 -2
  350. package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
  351. package/lib/components/SearchFilter/SearchFilter/FiltersList.js +3 -4
  352. package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
  353. package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js +1 -2
  354. package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
  355. package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js +1 -2
  356. package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
  357. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +3 -4
  358. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  359. package/lib/components/SearchFilter/SearchFilter/index.js +1 -2
  360. package/lib/components/SearchFilter/SearchFilter/index.js.map +1 -1
  361. package/lib/components/SearchFilter/SearchFilterContainer.js +3 -5
  362. package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  363. package/lib/components/SearchFilter/components/Checkbox.js +3 -4
  364. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  365. package/lib/components/SearchFilter/components/Range.js +1 -2
  366. package/lib/components/SearchFilter/components/Range.js.map +1 -1
  367. package/lib/components/SearchFilter/components/Select.js +1 -2
  368. package/lib/components/SearchFilter/components/Select.js.map +1 -1
  369. package/lib/components/SearchFilter/components/TextSearch.js +1 -2
  370. package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
  371. package/lib/components/SearchFilter/constants.js +24 -48
  372. package/lib/components/SearchFilter/constants.js.map +1 -1
  373. package/lib/components/SearchFilter/helpers/build-filters-query.js +1 -2
  374. package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  375. package/lib/components/SearchFilter/helpers/build-new-url.js +1 -2
  376. package/lib/components/SearchFilter/helpers/build-new-url.js.map +1 -1
  377. package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js +1 -2
  378. package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
  379. package/lib/components/SearchFilter/helpers/build-url-query.js +1 -2
  380. package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -1
  381. package/lib/components/SearchFilter/helpers/calculate-min-max.js +1 -2
  382. package/lib/components/SearchFilter/helpers/calculate-min-max.js.map +1 -1
  383. package/lib/components/SearchFilter/helpers/calculate-step.js +1 -2
  384. package/lib/components/SearchFilter/helpers/calculate-step.js.map +1 -1
  385. package/lib/components/SearchFilter/helpers/check-if-range-updated.js +1 -2
  386. package/lib/components/SearchFilter/helpers/check-if-range-updated.js.map +1 -1
  387. package/lib/components/SearchFilter/helpers/decode-encode.js +2 -4
  388. package/lib/components/SearchFilter/helpers/decode-encode.js.map +1 -1
  389. package/lib/components/SearchFilter/helpers/get-display-value.js +1 -2
  390. package/lib/components/SearchFilter/helpers/get-display-value.js.map +1 -1
  391. package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +1 -2
  392. package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -1
  393. package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js +1 -2
  394. package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
  395. package/lib/components/SearchFilter/helpers/get-filter-values.js +1 -2
  396. package/lib/components/SearchFilter/helpers/get-filter-values.js.map +1 -1
  397. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +1 -2
  398. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
  399. package/lib/components/SearchFilter/helpers/get-intersected-prop.js +1 -2
  400. package/lib/components/SearchFilter/helpers/get-intersected-prop.js.map +1 -1
  401. package/lib/components/SearchFilter/helpers/get-range-value.js +1 -2
  402. package/lib/components/SearchFilter/helpers/get-range-value.js.map +1 -1
  403. package/lib/components/SearchFilter/helpers/get-responsive-filter-classnames.js +1 -2
  404. package/lib/components/SearchFilter/helpers/get-responsive-filter-classnames.js.map +1 -1
  405. package/lib/components/SearchFilter/helpers/get-select-options.js +1 -2
  406. package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
  407. package/lib/components/SearchFilter/helpers/get-updated-filter-by.js +1 -2
  408. package/lib/components/SearchFilter/helpers/get-updated-filter-by.js.map +1 -1
  409. package/lib/components/SearchFilter/helpers/is-device-desktop.js +1 -2
  410. package/lib/components/SearchFilter/helpers/is-device-desktop.js.map +1 -1
  411. package/lib/components/SearchFilter/helpers/parse-filter-value.js +1 -2
  412. package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
  413. package/lib/components/SearchFilter/index.js +1 -2
  414. package/lib/components/SearchFilter/index.js.map +1 -1
  415. package/lib/components/SearchFilter/searchFilterReducer.js +1 -2
  416. package/lib/components/SearchFilter/searchFilterReducer.js.map +1 -1
  417. package/lib/components/SearchFilterSort/SearchFilterSort.js +1 -2
  418. package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  419. package/lib/components/SearchFilterSort/constants.js +4 -8
  420. package/lib/components/SearchFilterSort/constants.js.map +1 -1
  421. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +1 -2
  422. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
  423. package/lib/components/SearchFilterSort/helpers/update-sort.js +2 -4
  424. package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  425. package/lib/components/SearchFilterSort/index.js +1 -2
  426. package/lib/components/SearchFilterSort/index.js.map +1 -1
  427. package/lib/components/SocialFollow/SFItem.js +1 -2
  428. package/lib/components/SocialFollow/SFItem.js.map +1 -1
  429. package/lib/components/SocialFollow/SocialFollow.js +1 -2
  430. package/lib/components/SocialFollow/SocialFollow.js.map +1 -1
  431. package/lib/components/SocialFollow/SocialFollowRender.js +1 -2
  432. package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
  433. package/lib/components/SocialFollow/index.js +1 -2
  434. package/lib/components/SocialFollow/index.js.map +1 -1
  435. package/lib/components/SocialFollow/sf.config.js +4 -8
  436. package/lib/components/SocialFollow/sf.config.js.map +1 -1
  437. package/lib/components/SubMenu/SubMenu.js +1 -2
  438. package/lib/components/SubMenu/SubMenu.js.map +1 -1
  439. package/lib/components/SubMenu/index.js +1 -2
  440. package/lib/components/SubMenu/index.js.map +1 -1
  441. package/lib/components/TextBlock/TextBlockRender.js +1 -2
  442. package/lib/components/TextBlock/TextBlockRender.js.map +1 -1
  443. package/lib/components/TextBlock/index.js +1 -2
  444. package/lib/components/TextBlock/index.js.map +1 -1
  445. package/lib/components/Video/Video.js +1 -2
  446. package/lib/components/Video/Video.js.map +1 -1
  447. package/lib/components/Video/VideoModal.js +3 -4
  448. package/lib/components/Video/VideoModal.js.map +1 -1
  449. package/lib/components/Video/VideoRender.js +1 -2
  450. package/lib/components/Video/VideoRender.js.map +1 -1
  451. package/lib/components/Video/index.js +1 -2
  452. package/lib/components/Video/index.js.map +1 -1
  453. package/lib/components/Video/providers/Default.js +1 -2
  454. package/lib/components/Video/providers/Default.js.map +1 -1
  455. package/lib/components/Video/providers/JWPlayer/JWPlayerController.js +1 -2
  456. package/lib/components/Video/providers/JWPlayer/JWPlayerController.js.map +1 -1
  457. package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js +1 -2
  458. package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
  459. package/lib/components/Video/providers/Vimeo/VimeoProvider.js +3 -4
  460. package/lib/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
  461. package/lib/components/Video/providers/Vimeo/helpers/add-extra-params-to-url.js +1 -2
  462. package/lib/components/Video/providers/Vimeo/helpers/add-extra-params-to-url.js.map +1 -1
  463. package/lib/components/Video/providers/YouTube/YouTubeProvider.js +1 -2
  464. package/lib/components/Video/providers/YouTube/YouTubeProvider.js.map +1 -1
  465. package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js +3 -4
  466. package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
  467. package/lib/components/Video/providers/YouTube/helpers/index.js +3 -6
  468. package/lib/components/Video/providers/YouTube/helpers/index.js.map +1 -1
  469. package/lib/components/Video/providers/get-provider.js +3 -4
  470. package/lib/components/Video/providers/get-provider.js.map +1 -1
  471. package/lib/components/Video/providers/index.js +1 -2
  472. package/lib/components/Video/providers/index.js.map +1 -1
  473. package/lib/components/Wrapper.js +1 -2
  474. package/lib/components/Wrapper.js.map +1 -1
  475. package/lib/components/index.js +3 -4
  476. package/lib/components/index.js.map +1 -1
  477. package/lib/constants/componentsDefaultValues.js +1 -2
  478. package/lib/constants/componentsDefaultValues.js.map +1 -1
  479. package/lib/constants/index.js +107 -212
  480. package/lib/constants/index.js.map +1 -1
  481. package/lib/helpers/append-images.js +1 -2
  482. package/lib/helpers/append-images.js.map +1 -1
  483. package/lib/helpers/build-az-filter.js +1 -2
  484. package/lib/helpers/build-az-filter.js.map +1 -1
  485. package/lib/helpers/build-checkbox-filters.js +1 -2
  486. package/lib/helpers/build-checkbox-filters.js.map +1 -1
  487. package/lib/helpers/build-image-properties.js +1 -2
  488. package/lib/helpers/build-image-properties.js.map +1 -1
  489. package/lib/helpers/build-inherited-filters.js +1 -2
  490. package/lib/helpers/build-inherited-filters.js.map +1 -1
  491. package/lib/helpers/build-link-extra-props.js +1 -2
  492. package/lib/helpers/build-link-extra-props.js.map +1 -1
  493. package/lib/helpers/build-props-query.js +1 -2
  494. package/lib/helpers/build-props-query.js.map +1 -1
  495. package/lib/helpers/build-query-fields.js +1 -2
  496. package/lib/helpers/build-query-fields.js.map +1 -1
  497. package/lib/helpers/build-query-key.js +1 -2
  498. package/lib/helpers/build-query-key.js.map +1 -1
  499. package/lib/helpers/build-raw-query-base.js +2 -4
  500. package/lib/helpers/build-raw-query-base.js.map +1 -1
  501. package/lib/helpers/build-raw-query.js +1 -2
  502. package/lib/helpers/build-raw-query.js.map +1 -1
  503. package/lib/helpers/build-search-values-checkbox-select.js +1 -2
  504. package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
  505. package/lib/helpers/build-search-values-text.js +1 -2
  506. package/lib/helpers/build-search-values-text.js.map +1 -1
  507. package/lib/helpers/build-set-filters.js +1 -2
  508. package/lib/helpers/build-set-filters.js.map +1 -1
  509. package/lib/helpers/build-sort-values.js +1 -2
  510. package/lib/helpers/build-sort-values.js.map +1 -1
  511. package/lib/helpers/check-for-error.js +1 -2
  512. package/lib/helpers/check-for-error.js.map +1 -1
  513. package/lib/helpers/check-props-to-use.js +1 -2
  514. package/lib/helpers/check-props-to-use.js.map +1 -1
  515. package/lib/helpers/entities/constants.js +3 -6
  516. package/lib/helpers/entities/constants.js.map +1 -1
  517. package/lib/helpers/get-checkbox-filters.js +1 -2
  518. package/lib/helpers/get-checkbox-filters.js.map +1 -1
  519. package/lib/helpers/get-click-wrapper-options.js +1 -2
  520. package/lib/helpers/get-click-wrapper-options.js.map +1 -1
  521. package/lib/helpers/get-current-offset.js +1 -2
  522. package/lib/helpers/get-current-offset.js.map +1 -1
  523. package/lib/helpers/get-dictionary-match.js +1 -2
  524. package/lib/helpers/get-dictionary-match.js.map +1 -1
  525. package/lib/helpers/get-display-count-data.js +1 -2
  526. package/lib/helpers/get-display-count-data.js.map +1 -1
  527. package/lib/helpers/get-elasticsearch-operator.js +1 -2
  528. package/lib/helpers/get-elasticsearch-operator.js.map +1 -1
  529. package/lib/helpers/get-entity-data.js +1 -2
  530. package/lib/helpers/get-entity-data.js.map +1 -1
  531. package/lib/helpers/get-entity-render-props.js +1 -2
  532. package/lib/helpers/get-entity-render-props.js.map +1 -1
  533. package/lib/helpers/get-extra-az-bits.js +1 -2
  534. package/lib/helpers/get-extra-az-bits.js.map +1 -1
  535. package/lib/helpers/get-filter-props.js +1 -2
  536. package/lib/helpers/get-filter-props.js.map +1 -1
  537. package/lib/helpers/get-filter-relation-keys.js +1 -2
  538. package/lib/helpers/get-filter-relation-keys.js.map +1 -1
  539. package/lib/helpers/get-generic-props.js +1 -2
  540. package/lib/helpers/get-generic-props.js.map +1 -1
  541. package/lib/helpers/get-generic-render-variables.js +1 -2
  542. package/lib/helpers/get-generic-render-variables.js.map +1 -1
  543. package/lib/helpers/get-image-ids.js +1 -2
  544. package/lib/helpers/get-image-ids.js.map +1 -1
  545. package/lib/helpers/get-inherited-filters.js +1 -2
  546. package/lib/helpers/get-inherited-filters.js.map +1 -1
  547. package/lib/helpers/get-items-to-display-ids.js +1 -2
  548. package/lib/helpers/get-items-to-display-ids.js.map +1 -1
  549. package/lib/helpers/get-modifiers.js +1 -2
  550. package/lib/helpers/get-modifiers.js.map +1 -1
  551. package/lib/helpers/get-pagination-index.js +1 -2
  552. package/lib/helpers/get-pagination-index.js.map +1 -1
  553. package/lib/helpers/get-parsed-prop-values.js +1 -2
  554. package/lib/helpers/get-parsed-prop-values.js.map +1 -1
  555. package/lib/helpers/get-parsed-summary-value.js +1 -2
  556. package/lib/helpers/get-parsed-summary-value.js.map +1 -1
  557. package/lib/helpers/get-prop-values.js +1 -2
  558. package/lib/helpers/get-prop-values.js.map +1 -1
  559. package/lib/helpers/get-query-filters.js +1 -2
  560. package/lib/helpers/get-query-filters.js.map +1 -1
  561. package/lib/helpers/get-query-props.js +1 -2
  562. package/lib/helpers/get-query-props.js.map +1 -1
  563. package/lib/helpers/get-required-schemas.js +1 -2
  564. package/lib/helpers/get-required-schemas.js.map +1 -1
  565. package/lib/helpers/get-sanitized-prop-values.js +1 -2
  566. package/lib/helpers/get-sanitized-prop-values.js.map +1 -1
  567. package/lib/helpers/get-search-filter-type.js +1 -2
  568. package/lib/helpers/get-search-filter-type.js.map +1 -1
  569. package/lib/helpers/get-sort-by-field-name.js +1 -2
  570. package/lib/helpers/get-sort-by-field-name.js.map +1 -1
  571. package/lib/helpers/get-unpublished-entity-name.js +1 -2
  572. package/lib/helpers/get-unpublished-entity-name.js.map +1 -1
  573. package/lib/helpers/get-updated-filter-by.js +1 -2
  574. package/lib/helpers/get-updated-filter-by.js.map +1 -1
  575. package/lib/helpers/get-wrapped-value-with-link.js +1 -2
  576. package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
  577. package/lib/helpers/has-children.js +1 -2
  578. package/lib/helpers/has-children.js.map +1 -1
  579. package/lib/helpers/inject-multiple-banners/get-banners-for-entities/index.js +1 -2
  580. package/lib/helpers/inject-multiple-banners/get-banners-for-entities/index.js.map +1 -1
  581. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/index.js +1 -2
  582. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/index.js.map +1 -1
  583. package/lib/helpers/inject-multiple-banners/index.js +1 -2
  584. package/lib/helpers/inject-multiple-banners/index.js.map +1 -1
  585. package/lib/helpers/is-browser.js +1 -2
  586. package/lib/helpers/is-browser.js.map +1 -1
  587. package/lib/helpers/is-filter-entitys-id.js +1 -2
  588. package/lib/helpers/is-filter-entitys-id.js.map +1 -1
  589. package/lib/helpers/is-object.js +1 -2
  590. package/lib/helpers/is-object.js.map +1 -1
  591. package/lib/helpers/is-using-relation-image.js +1 -2
  592. package/lib/helpers/is-using-relation-image.js.map +1 -1
  593. package/lib/helpers/parse-TextBlock.js +3 -4
  594. package/lib/helpers/parse-TextBlock.js.map +1 -1
  595. package/lib/helpers/parse-props-to-display.js +3 -4
  596. package/lib/helpers/parse-props-to-display.js.map +1 -1
  597. package/lib/helpers/process-data-summary-value.js +4 -6
  598. package/lib/helpers/process-data-summary-value.js.map +1 -1
  599. package/lib/helpers/remove-extra-items.js +1 -2
  600. package/lib/helpers/remove-extra-items.js.map +1 -1
  601. package/lib/helpers/remove-unwanted-characters.js +1 -2
  602. package/lib/helpers/remove-unwanted-characters.js.map +1 -1
  603. package/lib/helpers/render-children.js +1 -2
  604. package/lib/helpers/render-children.js.map +1 -1
  605. package/lib/helpers/should-render-waypoint.js +1 -2
  606. package/lib/helpers/should-render-waypoint.js.map +1 -1
  607. package/lib/helpers/should-show-property.js +1 -2
  608. package/lib/helpers/should-show-property.js.map +1 -1
  609. package/lib/helpers/sort-response-data.js +1 -2
  610. package/lib/helpers/sort-response-data.js.map +1 -1
  611. package/lib/helpers/split-children.js +1 -2
  612. package/lib/helpers/split-children.js.map +1 -1
  613. package/lib/helpers/update-childrens-parent.js +1 -2
  614. package/lib/helpers/update-childrens-parent.js.map +1 -1
  615. package/lib/hooks/helpers/RenderComponent.js +10 -4
  616. package/lib/hooks/helpers/RenderComponent.js.map +1 -1
  617. package/lib/hooks/helpers/StoreImages.js +1 -2
  618. package/lib/hooks/helpers/StoreImages.js.map +1 -1
  619. package/lib/hooks/helpers/append-gtm-classname.js +1 -2
  620. package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
  621. package/lib/hooks/helpers/buildPBComponents.js +1 -2
  622. package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
  623. package/lib/hooks/helpers/check-banner-insertion-set.js +1 -2
  624. package/lib/hooks/helpers/check-banner-insertion-set.js.map +1 -1
  625. package/lib/hooks/helpers/check-collisions.js +2 -4
  626. package/lib/hooks/helpers/check-collisions.js.map +1 -1
  627. package/lib/hooks/helpers/constants.js +4 -8
  628. package/lib/hooks/helpers/constants.js.map +1 -1
  629. package/lib/hooks/helpers/get-banner-index.js +1 -2
  630. package/lib/hooks/helpers/get-banner-index.js.map +1 -1
  631. package/lib/hooks/helpers/get-banners-by-type.js +1 -2
  632. package/lib/hooks/helpers/get-banners-by-type.js.map +1 -1
  633. package/lib/hooks/helpers/get-lightbox-images.js +1 -2
  634. package/lib/hooks/helpers/get-lightbox-images.js.map +1 -1
  635. package/lib/hooks/helpers/getVariant.js +18 -0
  636. package/lib/hooks/helpers/getVariant.js.map +1 -0
  637. package/lib/hooks/helpers/index.js +1 -2
  638. package/lib/hooks/helpers/index.js.map +1 -1
  639. package/lib/hooks/helpers/inject-element-banners.js +1 -2
  640. package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
  641. package/lib/hooks/helpers/inject-textblock-banners.js +1 -2
  642. package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
  643. package/lib/hooks/helpers/insert-banners.js +1 -2
  644. package/lib/hooks/helpers/insert-banners.js.map +1 -1
  645. package/lib/hooks/helpers/update-targetings.js +1 -2
  646. package/lib/hooks/helpers/update-targetings.js.map +1 -1
  647. package/lib/hooks/use-banner-insertion.js +1 -2
  648. package/lib/hooks/use-banner-insertion.js.map +1 -1
  649. package/lib/hooks/use-check-mobile-screen.js +1 -2
  650. package/lib/hooks/use-check-mobile-screen.js.map +1 -1
  651. package/lib/hooks/use-get-entity-schema.js +1 -2
  652. package/lib/hooks/use-get-entity-schema.js.map +1 -1
  653. package/lib/hooks/use-get-entity-schemas-as-obj.js +1 -2
  654. package/lib/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
  655. package/lib/hooks/use-get-image-id-from-relation.js +1 -2
  656. package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
  657. package/lib/hooks/use-get-images.js +1 -2
  658. package/lib/hooks/use-get-images.js.map +1 -1
  659. package/lib/hooks/use-get-single-entity-schema.js +1 -2
  660. package/lib/hooks/use-get-single-entity-schema.js.map +1 -1
  661. package/lib/hooks/use-page-builder.js +1 -2
  662. package/lib/hooks/use-page-builder.js.map +1 -1
  663. package/lib/index.js +13 -0
  664. package/lib/index.js.map +1 -1
  665. package/lib/utils/component-map.js +4 -5
  666. package/lib/utils/component-map.js.map +1 -1
  667. package/lib/utils/get-image-data.js +1 -2
  668. package/lib/utils/get-image-data.js.map +1 -1
  669. package/lib/utils/get-props-to-display-modifiers.js +1 -2
  670. package/lib/utils/get-props-to-display-modifiers.js.map +1 -1
  671. package/lib/utils/index.js +7 -0
  672. package/lib/utils/index.js.map +1 -1
  673. package/lib/utils/variant-handler.js +39 -0
  674. package/lib/utils/variant-handler.js.map +1 -0
  675. package/lib/variants/index.js +9 -0
  676. package/lib/variants/index.js.map +1 -0
  677. package/lib-es/components/Card/Card.js +5 -3
  678. package/lib-es/components/Card/Card.js.map +1 -1
  679. package/lib-es/components/Card/CardsContainer.js +2 -5
  680. package/lib-es/components/Card/CardsContainer.js.map +1 -1
  681. package/lib-es/components/Card/CardsRender.js +1 -2
  682. package/lib-es/components/Card/CardsRender.js.map +1 -1
  683. package/lib-es/components/Carousel/Carousel.js +27 -17
  684. package/lib-es/components/Carousel/Carousel.js.map +1 -1
  685. package/lib-es/components/Carousel/CarouselRender/CarouselRender.js +33 -53
  686. package/lib-es/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
  687. package/lib-es/components/Carousel/hooks/useCarouselNavigation.js +49 -0
  688. package/lib-es/components/Carousel/hooks/useCarouselNavigation.js.map +1 -0
  689. package/lib-es/components/Layout/Layout.js +8 -4
  690. package/lib-es/components/Layout/Layout.js.map +1 -1
  691. package/lib-es/components/SearchContent/SearchContent.js +53 -49
  692. package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
  693. package/lib-es/components/SearchContent/SearchContentResults.js +16 -17
  694. package/lib-es/components/SearchContent/SearchContentResults.js.map +1 -1
  695. package/lib-es/components/SearchContent/SearchContentToggleIcon.js +13 -23
  696. package/lib-es/components/SearchContent/SearchContentToggleIcon.js.map +1 -1
  697. package/lib-es/components/SearchContent/constants.js +4 -0
  698. package/lib-es/components/SearchContent/constants.js.map +1 -0
  699. package/lib-es/components/SearchFilter/SearchFilterContainer.js +0 -1
  700. package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  701. package/lib-es/helpers/process-data-summary-value.js +2 -2
  702. package/lib-es/hooks/helpers/RenderComponent.js +5 -2
  703. package/lib-es/hooks/helpers/RenderComponent.js.map +1 -1
  704. package/lib-es/hooks/helpers/getVariant.js +14 -0
  705. package/lib-es/hooks/helpers/getVariant.js.map +1 -0
  706. package/lib-es/index.js +2 -1
  707. package/lib-es/index.js.map +1 -1
  708. package/lib-es/utils/component-map.js +4 -4
  709. package/lib-es/utils/component-map.js.map +1 -1
  710. package/lib-es/utils/index.js +2 -1
  711. package/lib-es/utils/index.js.map +1 -1
  712. package/lib-es/utils/variant-handler.js +26 -0
  713. package/lib-es/utils/variant-handler.js.map +1 -0
  714. package/lib-es/variants/index.js +2 -0
  715. package/lib-es/variants/index.js.map +1 -0
  716. package/package.json +4 -4
  717. package/src/components/Card/Card.js +1 -2
  718. package/src/components/Card/CardsContainer.js +0 -3
  719. package/src/components/Card/CardsRender.js +0 -1
  720. package/src/components/Carousel/Carousel.js +28 -12
  721. package/src/components/Carousel/CarouselRender/CarouselRender.js +36 -56
  722. package/src/components/Carousel/hooks/useCarouselNavigation.js +50 -0
  723. package/src/components/Layout/Layout.js +8 -5
  724. package/src/components/SearchContent/SearchContent.js +66 -52
  725. package/src/components/SearchContent/SearchContentResults.js +17 -17
  726. package/src/components/SearchContent/SearchContentToggleIcon.js +10 -23
  727. package/src/components/SearchContent/constants.js +6 -0
  728. package/src/hooks/helpers/RenderComponent.js +4 -0
  729. package/src/hooks/helpers/getVariant.js +11 -0
  730. package/src/index.js +2 -1
  731. package/src/utils/component-map.js +4 -5
  732. package/src/utils/index.js +9 -1
  733. package/src/utils/variant-handler.js +33 -0
  734. package/src/variants/index.js +1 -0
  735. package/tests/unit/src/components/Carousel/Carousel.test.js +23 -0
  736. package/tests/unit/src/components/Carousel/CarouselRender/CarouselRender.test.js +14 -22
  737. package/tests/unit/src/components/Carousel/__snapshots__/Carousel.test.js.snap +10 -0
  738. package/tests/unit/src/components/Layout/Layout.test.js +11 -0
  739. package/tests/unit/src/components/Menu/__snapshots__/Menu.test.js.snap +1 -1
  740. package/tests/unit/src/components/SearchContent/SearchContent.test.js +32 -7
  741. package/tests/unit/src/components/SearchContent/__snapshots__/SearchContent.test.js.snap +66 -2
  742. package/tests/unit/src/utils/variant-handler.test.js +41 -0
@@ -1 +1 @@
1
- {"version":3,"file":"CardsRender.js","names":["React","useContext","useQuery","dynamic","PropTypes","MainContext","generateSingleItemQuery","SEARCH_PUBLISHED_CONTENT","AND","FULL","useGetEntitySchemasAsObj","useGetImages","getUpdatedFilterBy","getEntityData","getRequiredSchemas","sortResponseData","getUnpublishedEntityName","renderChildren","splitChildren","removeExtraItems","appendImages","filtersSetup","filterQuerySetup","shouldSkipSingleQuery","shouldReturn","getUpdatedSortProperties","getUpdatedItemsToDisplay","CardsContainer","CardsRender","_ref","entity","legacyEntity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties","_excluded","isPreview","parent","itemId","parentId","itemEntity","parentEntity","filterBy","filterByProperty","sortby","sort","sortProperties","operator","filterOperator","useRandomSort","updatedSortProperties","sortbyFilters","variableProps","_objectSpread","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","allEntityNames","uniqueEntityNames","Set","data","mainSchemas","loading","_loading","error","_error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","docTypes","docType","type","entityTypes","eType","style","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","currentSchema","itemEntityUpdated","isFull","entityData","parentEntityData","_err","_load","variables","id","skip","requiredSchema","schemaLoading","schemaError","updatedFilterBy","updatedItemsToDisplay","limit","getEntitySchemas","Object","values","hasNoFiltersOrItemsToDisplay","length","cardData","cardsError","fetchPolicy","imageIds","imageId","filter","Boolean","imagesData","imagesLoading","isLoading","hasError","message","results","cardDataResults","orderedData","regularChildren","gtmChildren","name","updatedCards","createElement","Fragment","_extends","cardChildren","propTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND, FULL } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const { style } = otherProps;\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName,\n isFull: style === FULL\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData = {}, error: cardsError } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT] || {};\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n parent={otherProps.parent}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,OAAO,MAAM,cAAc;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,wBAAwB,EAAEC,GAAG,EAAEC,IAAI,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,EAAEC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AI,CAAC,CAAC;EAClF3G,MAAM,EAAE1B,SAAS,CAACsI,MAAM,CAACC,UAAU;EACnC1G,YAAY,EAAE7B,SAAS,CAACsI,MAAM,CAACC,UAAU;EACzCzG,cAAc,EAAE9B,SAAS,CAACwI,KAAK;EAC/B5G,QAAQ,EAAE5B,SAAS,CAACwI;AACtB,CAAC;AAEDhH,WAAW,CAACiH,YAAY,GAAG;EACzB1G,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,WAAW"}
1
+ {"version":3,"file":"CardsRender.js","names":["React","useContext","useQuery","dynamic","PropTypes","MainContext","generateSingleItemQuery","SEARCH_PUBLISHED_CONTENT","AND","FULL","useGetEntitySchemasAsObj","useGetImages","getUpdatedFilterBy","getEntityData","getRequiredSchemas","sortResponseData","getUnpublishedEntityName","renderChildren","splitChildren","removeExtraItems","appendImages","filtersSetup","filterQuerySetup","shouldSkipSingleQuery","shouldReturn","getUpdatedSortProperties","getUpdatedItemsToDisplay","CardsContainer","CardsRender","_ref","entity","legacyEntity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties","_excluded","isPreview","parent","itemId","parentId","itemEntity","parentEntity","filterBy","filterByProperty","sortby","sort","sortProperties","operator","filterOperator","useRandomSort","updatedSortProperties","sortbyFilters","variableProps","_objectSpread","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","allEntityNames","uniqueEntityNames","Set","data","mainSchemas","loading","_loading","error","_error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","docTypes","docType","type","entityTypes","eType","style","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","currentSchema","itemEntityUpdated","isFull","entityData","parentEntityData","_err","_load","variables","id","skip","requiredSchema","schemaLoading","schemaError","updatedFilterBy","updatedItemsToDisplay","limit","getEntitySchemas","Object","values","hasNoFiltersOrItemsToDisplay","length","cardData","cardsError","fetchPolicy","imageIds","imageId","filter","Boolean","imagesData","imagesLoading","isLoading","hasError","message","results","cardDataResults","orderedData","regularChildren","gtmChildren","name","updatedCards","createElement","Fragment","_extends","cardChildren","propTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND, FULL } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const { style } = otherProps;\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName,\n isFull: style === FULL\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData = {}, error: cardsError } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT] || {};\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],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B,kBAAmB;IAC3BqE,WAAW,EAAEA,WAAY;IACzBM,YAAY,EAAEP,eAAgB;IAC9BpD,gBAAgB,EAAEA;EAAiB,GAC/BnB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAED3B,WAAW,CAAC0G,SAAS,GAAG;EACtBnG,QAAQ,EAAE/B,SAAS,CAACmI,SAAS,CAAC,CAACnI,SAAS,CAACoI,OAAO,CAACpI,SAAS,CAACqI,IAAI,CAAC,EAAErI,SAAS,CAACqI,IAAI,CAAC,CAAC;EAClF3G,MAAM,EAAE1B,SAAS,CAACsI,MAAM,CAACC,UAAU;EACnC1G,YAAY,EAAE7B,SAAS,CAACsI,MAAM,CAACC,UAAU;EACzCzG,cAAc,EAAE9B,SAAS,CAACwI,KAAK;EAC/B5G,QAAQ,EAAE5B,SAAS,CAACwI;AACtB,CAAC;AAEDhH,WAAW,CAACiH,YAAY,GAAG;EACzB1G,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,WAAW"}
@@ -1,35 +1,45 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- const _excluded = ["caption", "imageIds", "isCaptionDisplayed"];
3
+ const _excluded = ["caption", "imageIds", "isCaptionDisplayed", "VariantComponent"];
4
4
  import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import CarouselImage from './CarouselImage';
6
7
  import CarouselRender from './CarouselRender';
7
- const Carousel = _ref => {
8
- let {
8
+ import { useCarouselNavigation } from './hooks/useCarouselNavigation';
9
+ import { getDisplayCountData } from '../../helpers';
10
+ const Carousel = props => {
11
+ const {
9
12
  caption,
10
13
  imageIds,
11
- isCaptionDisplayed
12
- } = _ref,
13
- otherProps = _objectWithoutProperties(_ref, _excluded);
14
+ isCaptionDisplayed,
15
+ VariantComponent
16
+ } = props,
17
+ otherProps = _objectWithoutProperties(props, _excluded);
18
+ const navigationProps = useCarouselNavigation(props);
14
19
  if (!imageIds || !imageIds.length) return null;
15
20
  const shouldDisplayCaption = isCaptionDisplayed && caption;
16
- return /*#__PURE__*/React.createElement("div", {
17
- className: "carousel"
18
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CarouselRender, _extends({
19
- imageIds: imageIds
20
- }, otherProps))), shouldDisplayCaption && /*#__PURE__*/React.createElement("div", {
21
- className: "carousel__details",
22
- "data-testid": "carousel-details"
23
- }, /*#__PURE__*/React.createElement("div", {
24
- className: "caption"
25
- }, caption)));
21
+ const {
22
+ shouldDisplayCount,
23
+ countMessage
24
+ } = getDisplayCountData(navigationProps.showCount, imageIds);
25
+ const ComponentToRender = VariantComponent || CarouselRender;
26
+ return /*#__PURE__*/React.createElement(ComponentToRender, _extends({
27
+ caption: caption,
28
+ imageIds: imageIds,
29
+ CarouselImage: CarouselImage,
30
+ shouldDisplayCaption: shouldDisplayCaption,
31
+ shouldDisplayCount: shouldDisplayCount,
32
+ countMessage: countMessage
33
+ }, navigationProps, otherProps));
26
34
  };
27
35
  Carousel.propTypes = {
28
36
  caption: PropTypes.string,
29
37
  imageIds: PropTypes.array,
30
- isCaptionDisplayed: PropTypes.bool
38
+ isCaptionDisplayed: PropTypes.bool,
39
+ VariantComponent: PropTypes.func
31
40
  };
32
41
  Carousel.defaultProps = {
42
+ VariantComponent: null,
33
43
  caption: '',
34
44
  imageIds: [],
35
45
  isCaptionDisplayed: false
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.js","names":["React","PropTypes","CarouselRender","Carousel","_ref","caption","imageIds","isCaptionDisplayed","otherProps","_objectWithoutProperties","_excluded","length","shouldDisplayCaption","createElement","className","_extends","propTypes","string","array","bool","defaultProps"],"sources":["../../../src/components/Carousel/Carousel.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselRender from './CarouselRender';\n\nconst Carousel = ({ caption, imageIds, isCaptionDisplayed, ...otherProps }) => {\n if (!imageIds || !imageIds.length) return null;\n const shouldDisplayCaption = isCaptionDisplayed && caption;\n\n return (\n <div className=\"carousel\">\n <div>\n <CarouselRender imageIds={imageIds} {...otherProps} />\n </div>\n {shouldDisplayCaption && (\n <div className=\"carousel__details\" data-testid=\"carousel-details\">\n <div className=\"caption\">{caption}</div>\n </div>\n )}\n </div>\n );\n};\n\nCarousel.propTypes = {\n caption: PropTypes.string,\n imageIds: PropTypes.array,\n isCaptionDisplayed: PropTypes.bool\n};\n\nCarousel.defaultProps = {\n caption: '',\n imageIds: [],\n isCaptionDisplayed: false\n};\n\nexport default Carousel;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,MAAMC,QAAQ,GAAGC,IAAA,IAA8D;EAAA,IAA7D;MAAEC,OAAO;MAAEC,QAAQ;MAAEC;IAAkC,CAAC,GAAAH,IAAA;IAAZI,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EACtE,IAAI,CAACJ,QAAQ,IAAI,CAACA,QAAQ,CAACK,MAAM,EAAE,OAAO,IAAI;EAC9C,MAAMC,oBAAoB,GAAGL,kBAAkB,IAAIF,OAAO;EAE1D,oBACEL,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC;EAAU,gBACvBd,KAAA,CAAAa,aAAA,2BACEb,KAAA,CAAAa,aAAA,CAACX,cAAc,EAAAa,QAAA;IAACT,QAAQ,EAAEA;EAAS,GAAKE,UAAU,CAAG,CAClD,CAAC,EACLI,oBAAoB,iBACnBZ,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC,mBAAmB;IAAC,eAAY;EAAkB,gBAC/Dd,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC;EAAS,GAAET,OAAa,CACpC,CAEJ,CAAC;AAEV,CAAC;AAEDF,QAAQ,CAACa,SAAS,GAAG;EACnBX,OAAO,EAAEJ,SAAS,CAACgB,MAAM;EACzBX,QAAQ,EAAEL,SAAS,CAACiB,KAAK;EACzBX,kBAAkB,EAAEN,SAAS,CAACkB;AAChC,CAAC;AAEDhB,QAAQ,CAACiB,YAAY,GAAG;EACtBf,OAAO,EAAE,EAAE;EACXC,QAAQ,EAAE,EAAE;EACZC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeJ,QAAQ"}
1
+ {"version":3,"file":"Carousel.js","names":["React","PropTypes","CarouselImage","CarouselRender","useCarouselNavigation","getDisplayCountData","Carousel","props","caption","imageIds","isCaptionDisplayed","VariantComponent","otherProps","_objectWithoutProperties","_excluded","navigationProps","length","shouldDisplayCaption","shouldDisplayCount","countMessage","showCount","ComponentToRender","createElement","_extends","propTypes","string","array","bool","func","defaultProps"],"sources":["../../../src/components/Carousel/Carousel.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselImage from './CarouselImage';\nimport CarouselRender from './CarouselRender';\nimport { useCarouselNavigation } from './hooks/useCarouselNavigation';\nimport { getDisplayCountData } from '../../helpers';\n\nconst Carousel = props => {\n const { caption, imageIds, isCaptionDisplayed, VariantComponent, ...otherProps } = props;\n\n const navigationProps = useCarouselNavigation(props);\n\n if (!imageIds || !imageIds.length) return null;\n const shouldDisplayCaption = isCaptionDisplayed && caption;\n\n const { shouldDisplayCount, countMessage } = getDisplayCountData(\n navigationProps.showCount,\n imageIds\n );\n\n const ComponentToRender = VariantComponent || CarouselRender;\n\n return (\n <ComponentToRender\n caption={caption}\n imageIds={imageIds}\n CarouselImage={CarouselImage}\n shouldDisplayCaption={shouldDisplayCaption}\n shouldDisplayCount={shouldDisplayCount}\n countMessage={countMessage}\n {...navigationProps}\n {...otherProps}\n />\n );\n};\n\nCarousel.propTypes = {\n caption: PropTypes.string,\n imageIds: PropTypes.array,\n isCaptionDisplayed: PropTypes.bool,\n VariantComponent: PropTypes.func\n};\n\nCarousel.defaultProps = {\n VariantComponent: null,\n caption: '',\n imageIds: [],\n isCapt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V,SAAS,CAAC2B;AAC9B,CAAC;AAEDtB,QAAQ,CAACuB,YAAY,GAAG;EACtBlB,gBAAgB,EAAE,IAAI;EACtBH,OAAO,EAAE,EAAE;EACXC,QAAQ,EAAE,EAAE;EACZC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeJ,QAAQ"}
@@ -1,66 +1,29 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- const _excluded = ["imageIds", "displayCount", "priorityLimit"];
4
- import React, { useRef, useState } from 'react';
3
+ const _excluded = ["handleNavigation", "imageIds", "listRef", "shouldDisplayCount", "shouldDisplayCaption", "caption", "countMessage", "direction", "priorityLimit"];
4
+ import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import CarouselImage from '../CarouselImage';
7
7
  import { withTitle } from '../../../HOC';
8
- import { getDisplayCountData } from '../../../helpers';
9
8
  const CarouselRender = _ref => {
10
9
  let {
10
+ handleNavigation,
11
11
  imageIds,
12
- displayCount,
12
+ listRef,
13
+ shouldDisplayCount,
14
+ shouldDisplayCaption,
15
+ caption,
16
+ countMessage,
17
+ direction,
13
18
  priorityLimit
14
19
  } = _ref,
15
20
  otherProps = _objectWithoutProperties(_ref, _excluded);
16
- const [showCount, setShowCount] = useState(displayCount);
17
- const listRef = useRef(null);
18
- const getListElement = () => {
19
- if (!listRef) return null;
20
- const {
21
- current
22
- } = listRef;
23
- return current;
24
- };
25
- const moveScroll = (numberOfPixels, isNext) => {
26
- const listElement = getListElement();
27
- if (!listElement) return;
28
- const totalDistance = listElement.scrollLeft + numberOfPixels;
29
- const {
30
- scrollLeft,
31
- offsetWidth,
32
- scrollWidth
33
- } = listElement;
34
- if (isNext && offsetWidth + scrollLeft >= scrollWidth) return;
35
- const leftPosition = totalDistance < 0 ? 0 : Math.max(-scrollLeft, totalDistance);
36
- listElement.scrollTo({
37
- top: 0,
38
- left: leftPosition,
39
- behavior: 'smooth'
40
- });
41
- };
42
- const handleNavigation = direction => {
43
- setShowCount(false);
44
- const listElement = getListElement();
45
- if (!listElement) return;
46
- const {
47
- scrollWidth
48
- } = listElement;
49
- const offset = scrollWidth / imageIds.length;
50
- direction ? moveScroll(offset, direction) : moveScroll(-offset, direction);
51
- };
52
- const navigation = {
53
- next: true,
54
- back: false
55
- };
56
- const {
57
- shouldDisplayCount,
58
- countMessage
59
- } = getDisplayCountData(showCount, imageIds);
60
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ className: "carousel"
23
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
61
24
  className: "carousel__button carousel__button--previous",
62
25
  role: "button",
63
- onClick: () => handleNavigation(navigation.back)
26
+ onClick: () => handleNavigation(direction.back)
64
27
  }, /*#__PURE__*/React.createElement("div", {
65
28
  className: "arrow arrow--left"
66
29
  })), /*#__PURE__*/React.createElement("div", {
@@ -73,19 +36,36 @@ const CarouselRender = _ref => {
73
36
  }, otherProps)))), /*#__PURE__*/React.createElement("div", {
74
37
  className: "carousel__button carousel__button--next",
75
38
  role: "button",
76
- onClick: () => handleNavigation(navigation.next)
77
- }, shouldDisplayCount && /*#__PURE__*/React.createElement("p", null, countMessage), /*#__PURE__*/React.createElement("div", {
39
+ onClick: () => handleNavigation(direction.next)
40
+ }, shouldDisplayCount && /*#__PURE__*/React.createElement("p", {
41
+ "data-testid": "count"
42
+ }, countMessage), /*#__PURE__*/React.createElement("div", {
78
43
  className: "arrow arrow--right"
79
- })));
44
+ }))), shouldDisplayCaption && /*#__PURE__*/React.createElement("div", {
45
+ className: "carousel__details",
46
+ "data-testid": "carousel-details"
47
+ }, /*#__PURE__*/React.createElement("div", {
48
+ className: "caption"
49
+ }, caption)));
80
50
  };
81
51
  CarouselRender.propTypes = {
52
+ caption: PropTypes.string,
53
+ shouldDisplayCaption: PropTypes.bool.isRequired,
82
54
  imageIds: PropTypes.array,
83
55
  displayCount: PropTypes.bool,
56
+ listRef: PropTypes.object,
57
+ countMessage: PropTypes.number,
58
+ direction: PropTypes.object.isRequired,
59
+ handleNavigation: PropTypes.func.isRequired,
60
+ shouldDisplayCount: PropTypes.bool.isRequired,
84
61
  priorityLimit: PropTypes.number
85
62
  };
86
63
  CarouselRender.defaultProps = {
64
+ listRef: null,
87
65
  imageIds: [],
66
+ caption: '',
88
67
  displayCount: false,
68
+ countMessage: null,
89
69
  priorityLimit: 0
90
70
  };
91
71
  export default withTitle(CarouselRender);
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselRender.js","names":["React","useRef","useState","PropTypes","CarouselImage","withTitle","getDisplayCountData","CarouselRender","_ref","imageIds","displayCount","priorityLimit","otherProps","_objectWithoutProperties","_excluded","showCount","setShowCount","listRef","getListElement","current","moveScroll","numberOfPixels","isNext","listElement","totalDistance","scrollLeft","offsetWidth","scrollWidth","leftPosition","Math","max","scrollTo","top","left","behavior","handleNavigation","direction","offset","length","navigation","next","back","shouldDisplayCount","countMessage","createElement","Fragment","className","role","onClick","ref","map","imageId","index","_extends","key","priority","propTypes","array","bool","number","defaultProps"],"sources":["../../../../src/components/Carousel/CarouselRender/CarouselRender.js"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselImage from '../CarouselImage';\nimport { withTitle } from '../../../HOC';\nimport { getDisplayCountData } from '../../../helpers';\n\nconst CarouselRender = ({ imageIds, displayCount, priorityLimit, ...otherProps }) => {\n const [showCount, setShowCount] = useState(displayCount);\n const listRef = useRef(null);\n\n const getListElement = () => {\n if (!listRef) return null;\n const { current } = listRef;\n return current;\n };\n\n const moveScroll = (numberOfPixels, isNext) => {\n const listElement = getListElement();\n if (!listElement) return;\n\n const totalDistance = listElement.scrollLeft + numberOfPixels;\n const { scrollLeft, offsetWidth, scrollWidth } = listElement;\n if (isNext && offsetWidth + scrollLeft >= scrollWidth) return;\n\n const leftPosition = totalDistance < 0 ? 0 : Math.max(-scrollLeft, totalDistance);\n\n listElement.scrollTo({\n top: 0,\n left: leftPosition,\n behavior: 'smooth'\n });\n };\n\n const handleNavigation = direction => {\n setShowCount(false);\n\n const listElement = getListElement();\n if (!listElement) return;\n\n const { scrollWidth } = listElement;\n const offset = scrollWidth / imageIds.length;\n\n direction ? moveScroll(offset, direction) : moveScroll(-offset, direction);\n };\n\n const navigation = {\n next: true,\n back: false\n };\n\n const { shouldDisplayCount, countMessage } = getDisplayCountData(showCount, imageIds);\n\n return (\n <>\n <div\n className=\"carousel__button carousel__button--previous\"\n role=\"button\"\n onClick={() => handleNavigation(navigation.back)}>\n <div className=\"arrow arrow--left\" />\n </div>\n <div className=\"carousel__list\" ref={listRef}>\n {imageIds.map((imageId, index) => (\n <CarouselImage\n key={imageId}\n priority={index < priorityLimit}\n imageId={imageId}\n {...otherProps}\n />\n ))}\n </div>\n <div\n className=\"carousel__button carousel__button--next\"\n role=\"button\"\n onClick={() => handleNavigation(navigation.next)}>\n {shouldDisplayCount && <p>{countMessage}</p>}\n <div className=\"arrow arrow--right\" />\n </div>\n </>\n );\n};\n\nCarouselRender.propTypes = {\n imageIds: PropTypes.array,\n displayCount: PropTypes.bool,\n priorityLimit: PropTypes.number\n};\n\nCarouselRender.defaultProps = {\n imageIds: [],\n displayCount: false,\n priorityLimit: 0\n};\n\nexport default withTitle(CarouselRender);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtD,MAAMC,cAAc,GAAGC,IAAA,IAA8D;EAAA,IAA7D;MAAEC,QAAQ;MAAEC,YAAY;MAAEC;IAA6B,CAAC,GAAAH,IAAA;IAAZI,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAC5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D,IAAI;EAC5B/C,aAAa,EAAER,SAAS,CAACwD;AAC3B,CAAC;AAEDpD,cAAc,CAACqD,YAAY,GAAG;EAC5BnD,QAAQ,EAAE,EAAE;EACZC,YAAY,EAAE,KAAK;EACnBC,aAAa,EAAE;AACjB,CAAC;AAED,eAAeN,SAAS,CAACE,cAAc,CAAC"}
1
+ {"version":3,"file":"CarouselRender.js","names":["React","PropTypes","CarouselImage","withTitle","CarouselRender","_ref","handleNavigation","imageIds","listRef","shouldDisplayCount","shouldDisplayCaption","caption","countMessage","direction","priorityLimit","otherProps","_objectWithoutProperties","_excluded","createElement","className","role","onClick","back","ref","map","imageId","index","_extends","key","priority","next","propTypes","string","bool","isRequired","array","displayCount","object","number","func","defaultProps"],"sources":["../../../../src/components/Carousel/CarouselRender/CarouselRender.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselImage from '../CarouselImage';\nimport { withTitle } from '../../../HOC';\n\nconst CarouselRender = ({\n handleNavigation,\n imageIds,\n listRef,\n shouldDisplayCount,\n shouldDisplayCaption,\n caption,\n countMessage,\n direction,\n priorityLimit,\n ...otherProps\n}) => (\n <div className=\"carousel\">\n <div>\n <div\n className=\"carousel__button carousel__button--previous\"\n role=\"button\"\n onClick={() => handleNavigation(direction.back)}>\n <div className=\"arrow arrow--left\" />\n </div>\n <div className=\"carousel__list\" ref={listRef}>\n {imageIds.map((imageId, index) => (\n <CarouselImage\n key={imageId}\n priority={index < priorityLimit}\n imageId={imageId}\n {...otherProps}\n />\n ))}\n </div>\n <div\n className=\"carousel__button carousel__button--next\"\n role=\"button\"\n onClick={() => handleNavigation(direction.next)}>\n {shouldDisplayCount && <p data-testid=\"count\">{countMessage}</p>}\n <div className=\"arrow arrow--right\" />\n </div>\n </div>\n {shouldDisplayCaption && (\n <div className=\"carousel__details\" data-testid=\"carousel-details\">\n <div className=\"caption\">{caption}</div>\n </div>\n )}\n </div>\n);\n\nCarouselRender.propTypes = {\n caption: PropTypes.string,\n shouldDisplayCaption: PropTypes.bool.isRequired,\n imageIds: PropTypes.array,\n displayCount: PropTypes.bool,\n listRef: PropTypes.object,\n countMessage: PropTypes.number,\n direction: PropTypes.object.isRequired,\n handleNavigation: PropTypes.func.isRequired,\n shouldDisplayCount: PropTypes.bool.isRequired,\n priorityLimit: PropTypes.number\n};\n\nCarouselRender.defaultProps = {\n listRef: null,\n imageIds: [],\n caption: '',\n displayCount: false,\n countMessage: null,\n priorityLimit: 0\n};\n\nexport default withTitle(CarouselRender);\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,cAAc;AAExC,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;MACtBC,gBAAgB;MAChBC,QAAQ;MACRC,OAAO;MACPC,kBAAkB;MAClBC,oBAAoB;MACpBC,OAAO;MACPC,YAAY;MACZC,SAAS;MACTC;IAEF,CAAC,GAAAT,IAAA;IADIU,UAAU,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA;EAAA,oBAEbjB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAU,gBACvBnB,KAAA,CAAAkB,aAAA,2BACElB,KAAA,CAAAkB,aAAA;IACEC,SAAS,EAAC,6CAA6C;IACvDC,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEA,CAAA,KAAMf,gBAAgB,CAACO,SAAS,CAACS,IAAI;EAAE,gBAChDtB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAmB,CAAE,CACjC,CAAC,eACNnB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC,gBAAgB;IAACI,GAAG,EAAEf;EAAQ,GAC1CD,QAAQ,CAACiB,GAAG,CAAC,CAACC,OAAO,EAAEC,KAAK,kBAC3B1B,KAAA,CAAAkB,aAAA,CAAChB,aAAa,EAAAyB,QAAA;IACZC,GAAG,EAAE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EAAE;EACXyB,YAAY,EAAE,KAAK;EACnBxB,YAAY,EAAE,IAAI;EAClBE,aAAa,EAAE;AACjB,CAAC;AAED,eAAeX,SAAS,CAACC,cAAc,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { useState, useRef } from 'react';
2
+ export function useCarouselNavigation({
3
+ imageIds,
4
+ displayCount
5
+ }) {
6
+ const [showCount, setShowCount] = useState(displayCount);
7
+ const listRef = useRef(null);
8
+ const getListElement = () => {
9
+ if (!listRef.current) return null;
10
+ return listRef.current;
11
+ };
12
+ const moveScroll = (numberOfPixels, isNext) => {
13
+ const listElement = getListElement();
14
+ if (!listElement) return;
15
+ const totalDistance = listElement.scrollLeft + numberOfPixels;
16
+ const {
17
+ scrollLeft,
18
+ offsetWidth,
19
+ scrollWidth
20
+ } = listElement;
21
+ if (isNext && offsetWidth + scrollLeft >= scrollWidth) return;
22
+ const leftPosition = totalDistance < 0 ? 0 : Math.max(-scrollLeft, totalDistance);
23
+ listElement.scrollTo({
24
+ top: 0,
25
+ left: leftPosition,
26
+ behavior: 'smooth'
27
+ });
28
+ };
29
+ const handleNavigation = direction => {
30
+ setShowCount(false);
31
+ const listElement = getListElement();
32
+ if (!listElement) return;
33
+ const {
34
+ scrollWidth
35
+ } = listElement;
36
+ const offset = scrollWidth / imageIds.length;
37
+ direction ? moveScroll(offset, direction) : moveScroll(-offset, direction);
38
+ };
39
+ return {
40
+ listRef,
41
+ showCount,
42
+ handleNavigation,
43
+ direction: {
44
+ next: true,
45
+ back: false
46
+ }
47
+ };
48
+ }
49
+ //# sourceMappingURL=useCarouselNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCarouselNavigation.js","names":["useState","useRef","useCarouselNavigation","imageIds","displayCount","showCount","setShowCount","listRef","getListElement","current","moveScroll","numberOfPixels","isNext","listElement","totalDistance","scrollLeft","offsetWidth","scrollWidth","leftPosition","Math","max","scrollTo","top","left","behavior","handleNavigation","direction","offset","length","next","back"],"sources":["../../../../src/components/Carousel/hooks/useCarouselNavigation.js"],"sourcesContent":["import { useState, useRef } from 'react';\n\nexport function useCarouselNavigation({ imageIds, displayCount }) {\n const [showCount, setShowCount] = useState(displayCount);\n const listRef = useRef(null);\n\n const getListElement = () => {\n if (!listRef.current) return null;\n return listRef.current;\n };\n\n const moveScroll = (numberOfPixels, isNext) => {\n const listElement = getListElement();\n if (!listElement) return;\n\n const totalDistance = listElement.scrollLeft + numberOfPixels;\n const { scrollLeft, offsetWidth, scrollWidth } = listElement;\n if (isNext && offsetWidth + scrollLeft >= scrollWidth) return;\n\n const leftPosition = totalDistance < 0 ? 0 : Math.max(-scrollLeft, totalDistance);\n\n listElement.scrollTo({\n top: 0,\n left: leftPosition,\n behavior: 'smooth'\n });\n };\n\n const handleNavigation = direction => {\n setShowCount(false);\n\n const listElement = getListElement();\n if (!listElement) return;\n\n const { scrollWidth } = listElement;\n const offset = scrollWidth / imageIds.length;\n\n direction ? moveScroll(offset, direction) : moveScroll(-offset, direction);\n };\n\n return {\n listRef,\n showCount,\n handleNavigation,\n direction: {\n next: true,\n back: false\n }\n };\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAExC,OAAO,SAASC,qBAAqBA,CAAC;EAAEC,QAAQ;EAAEC;AAAa,CAAC,EAAE;EAChE,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGN,QAAQ,CAACI,YAAY,CAAC;EACxD,MAAMG,OAAO,GAAGN,MAAM,CAAC,IAAI,CAAC;EAE5B,MAAMO,cAAc,GAAGA,CAAA,KAAM;IAC3B,IAAI,CAACD,OAAO,CAACE,OAAO,EAAE,OAAO,IAAI;IACjC,OAAOF,OAAO,CAACE,OAAO;EACxB,CAAC;EAED,MAAMC,UAAU,GAAGA,CAACC,cAAc,EAAEC,MAAM,KAAK;IAC7C,MAAMC,WAAW,GAAGL,cAAc,CAAC,CAAC;IACpC,IAAI,CAACK,WAAW,EAAE;IAElB,MAAMC,aAAa,GAAGD,WAAW,CAACE,UAAU,GAAGJ,cAAc;IAC7D,MAAM;MAAEI,UAAU;MAAEC,WAAW;MAAEC;IAAY,CAAC,GAAGJ,WAAW;IAC5D,IAAID,MAAM,IAAII,WAAW,GAAGD,UAAU,IAAIE,WAAW,EAAE;IAEvD,MAAMC,YAAY,GAAGJ,aAAa,GAAG,CAAC,GAAG,CAAC,GAAGK,IAAI,CAACC,GAAG,CAAC,CAACL,UAAU,EAAED,aAAa,CAAC;IAEjFD,WAAW,CAACQ,QAAQ,CAAC;MACnBC,GAAG,EAAE,CAAC;MACNC,IAAI,EAAEL,YAAY;MAClBM,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ,CAAC;EAED,MAAMC,gBAAgB,GAAGC,SAAS,IAAI;IACpCpB,YAAY,CAAC,KAAK,CAAC;IAEnB,MAAMO,WAAW,GAAGL,cAAc,CAAC,CAAC;IACpC,IAAI,CAACK,WAAW,EAAE;IAElB,MAAM;MAAEI;IAAY,CAAC,GAAGJ,WAAW;IACnC,MAAMc,MAAM,GAAGV,WAAW,GAAGd,QAAQ,CAACyB,MAAM;IAE5CF,SAAS,GAAGhB,UAAU,CAACiB,MAAM,EAAED,SAAS,CAAC,GAAGhB,UAAU,CAAC,CAACiB,MAAM,EAAED,SAAS,CAAC;EAC5E,CAAC;EAED,OAAO;IACLnB,OAAO;IACPF,SAAS;IACToB,gBAAgB;IAChBC,SAAS,EAAE;MACTG,IAAI,EAAE,IAAI;MACVC,IAAI,EAAE;IACR;EACF,CAAC;AACH"}
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- const _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "tagType", "dataNoSnippet", "sticky"];
4
+ const _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "tagType", "dataNoSnippet", "sticky", "VariantComponent"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import React from 'react';
@@ -21,7 +21,8 @@ const Layout = React.forwardRef((_ref, ref) => {
21
21
  backgroundImage,
22
22
  tagType,
23
23
  dataNoSnippet,
24
- sticky
24
+ sticky,
25
+ VariantComponent
25
26
  } = _ref,
26
27
  otherProps = _objectWithoutProperties(_ref, _excluded);
27
28
  const {
@@ -45,7 +46,8 @@ const Layout = React.forwardRef((_ref, ref) => {
45
46
  if (type === COLUMN && !hasChildren(children)) return null;
46
47
  const otherWrapperProps = {};
47
48
  if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;
48
- return /*#__PURE__*/React.createElement(Wrapper, _extends({
49
+ const WrapperComponent = VariantComponent || Wrapper;
50
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
49
51
  ref: ref,
50
52
  tagType: tagType,
51
53
  className: type,
@@ -65,6 +67,7 @@ Layout.propTypes = {
65
67
  backgroundImage: PropTypes.string,
66
68
  tagType: PropTypes.string,
67
69
  dataNoSnippet: PropTypes.bool,
70
+ VariantComponent: PropTypes.func,
68
71
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
69
72
  };
70
73
  Layout.defaultProps = {
@@ -75,7 +78,8 @@ Layout.defaultProps = {
75
78
  modifier: '',
76
79
  tagType: '',
77
80
  dataNoSnippet: false,
78
- sticky: false
81
+ sticky: false,
82
+ VariantComponent: null
79
83
  };
80
84
  export default Layout;
81
85
  //# sourceMappingURL=Layout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.js","names":["React","PropTypes","Wrapper","getClassModifiers","useGetImages","getStylesToUpdate","checkIfRowHasColumns","renderChildren","hasChildren","COLUMN","Layout","forwardRef","_ref","ref","type","children","settings","modifier","backgroundImage","tagType","dataNoSnippet","sticky","otherProps","_objectWithoutProperties","_excluded","data","getFile","url","style","title","classModifiers","_objectSpread","additionalRowModifier","otherWrapperProps","createElement","_extends","className","modifiers","propTypes","string","isRequired","bool","shape","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = React.forwardRef(\n (\n {\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n tagType,\n dataNoSnippet,\n sticky,\n ...otherProps\n },\n ref\n ) => {\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage);\n\n const style = getStylesToUpdate({ backgroundImage: url });\n const { title } = settings;\n\n const classModifiers = getClassModifiers(type, { modifier, sticky, ...otherProps });\n const additionalRowModifier = checkIfRowHasColumns(type, children) ? ' display-row' : '';\n\n if (type === COLUMN && !hasChildren(children)) return null;\n\n const otherWrapperProps = {};\n if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;\n\n return (\n <Wrapper\n ref={ref}\n tagType={tagType}\n className={type}\n modifiers={`${classModifiers}${additionalRowModifier}`}\n style={style}\n {...otherWrapperProps}>\n {title && <h2 className=\"heading heading--section\">{title}</h2>}\n {renderChildren(children, otherProps)}\n </Wrapper>\n );\n }\n);\n\nLayout.propTypes = {\n type: PropTypes.string.isRequired,\n sticky: PropTypes.bool,\n settings: PropTypes.shape({\n title: PropTypes.string\n }),\n modifier: PropTypes.string,\n backgroundImage: PropTypes.string,\n tagType: PropTypes.string,\n dataNoSnippet: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nLayout.defaultProps = {\n settings: {\n title: ''\n },\n backgroundImage: '',\n modifier: '',\n tagType: '',\n dataNoSnippet: false,\n sticky: false\n};\n\nexport default Layout;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,iBAAiB,EAAEC,oBAAoB,QAAQ,WAAW;AACnE,SAASC,cAAc,EAAEC,WAAW,QAAQ,eAAe;AAC3D,SAASC,MAAM,QAAQ,iBAAiB;AAExC,MAAMC,MAAM,GAAGV,KAAK,CAACW,UAAU,CAC7B,CAAAC,IAAA,EAYEC,GAAG,KACA;EAAA,IAZH;MACEC,IAAI;MACJC,QAAQ;MACRC,QAAQ;MACRC,QAAQ;MACRC,eAAe;MACfC,OAAO;MACPC,aAAa;MACbC;IAEF,CAAC,GAAAT,IAAA;IADIU,UAAU,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA;EAIf,MAAM;IACJC,IAAI,EAAE;MAAEC,OAAO,EAAE;QAAEC,GAAG,GAAG;MAAK,CAAC,GAAG,CAAC;IAAE;EACvC,CAAC,GAAGvB,YAAY,CAACc,eAAe,CAAC;EAEjC,MAAMU,KAAK,GAAGvB,iBAAiB,CAAC;IAAEa,eAAe,EAAES;EAAI,CAAC,CAAC;EACzD,MAAM;IAAEE;EAAM,CAAC,GAAGb,QAAQ;EAE1B,MAAMc,cAAc,GAAG3B,iBAAiB,CAACW,IAAI,EAAAiB,aAAA;IAAId,Q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SAAS,CAAC4C,IAAI,CAAC,EAAE5C,SAAS,CAAC4C,IAAI,CAAC,CAAC,CAACL;AACrF,CAAC;AAED9B,MAAM,CAACoC,YAAY,GAAG;EACpB9B,QAAQ,EAAE;IACRa,KAAK,EAAE;EACT,CAAC;EACDX,eAAe,EAAE,EAAE;EACnBD,QAAQ,EAAE,EAAE;EACZE,OAAO,EAAE,EAAE;EACXC,aAAa,EAAE,KAAK;EACpBC,MAAM,EAAE;AACV,CAAC;AAED,eAAeX,MAAM"}
1
+ {"version":3,"file":"Layout.js","names":["React","PropTypes","Wrapper","getClassModifiers","useGetImages","getStylesToUpdate","checkIfRowHasColumns","renderChildren","hasChildren","COLUMN","Layout","forwardRef","_ref","ref","type","children","settings","modifier","backgroundImage","tagType","dataNoSnippet","sticky","VariantComponent","otherProps","_objectWithoutProperties","_excluded","data","getFile","url","style","title","classModifiers","_objectSpread","additionalRowModifier","otherWrapperProps","WrapperComponent","createElement","_extends","className","modifiers","propTypes","string","isRequired","bool","shape","func","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = React.forwardRef(\n (\n {\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n tagType,\n dataNoSnippet,\n sticky,\n VariantComponent,\n ...otherProps\n },\n ref\n ) => {\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage);\n const style = getStylesToUpdate({ backgroundImage: url });\n const { title } = settings;\n const classModifiers = getClassModifiers(type, { modifier, sticky, ...otherProps });\n const additionalRowModifier = checkIfRowHasColumns(type, children) ? ' display-row' : '';\n\n if (type === COLUMN && !hasChildren(children)) return null;\n\n const otherWrapperProps = {};\n if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;\n\n const WrapperComponent = VariantComponent || Wrapper;\n\n return (\n <WrapperComponent\n ref={ref}\n tagType={tagType}\n className={type}\n modifiers={`${classModifiers}${additionalRowModifier}`}\n style={style}\n {...otherWrapperProps}>\n {title && <h2 className=\"heading heading--section\">{title}</h2>}\n {renderChildren(children, otherProps)}\n </WrapperComponent>\n );\n }\n);\n\nLayout.propTypes = {\n type: PropTypes.string.isRequired,\n sticky: PropTypes.bool,\n settings: PropTypes.shape({\n title: PropTypes.string\n }),\n modifier: PropTypes.string,\n backgroundImage: PropTypes.string,\n tagType: PropTypes.string,\n dataNoSnippet: PropTypes.bool,\n VariantComponent: PropTypes.func,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nLayout.defaultProps = {\n settings: {\n title: ''\n },\n backgroundImage: '',\n modifier: '',\n tagType: '',\n dataNoSnippet: false,\n sticky: false,\n VariantComponent: null\n};\n\nexport default Layout;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,iBAAiB,EAAEC,oBAAoB,QAAQ,WAAW;AACnE,SAASC,cAAc,EAAEC,WAAW,QAAQ,eAAe;AAC3D,SAASC,MAAM,QAAQ,iBAAiB;AAExC,MAAMC,MAAM,GAAGV,KAAK,CAACW,UAAU,CAC7B,CAAAC,IAAA,EAaEC,GAAG,KACA;EAAA,IAbH;MACEC,IAAI;MACJC,QAAQ;MACRC,QAAQ;MACRC,QAAQ;MACRC,eAAe;MACfC,OAAO;MACPC,aAAa;MACbC,MAAM;MACNC;IAEF,CAAC,GAAAV,IAAA;IADIW,UAAU,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA;EAIf,MAA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,SAAS,CAAC0C,IAAI;EACtB3B,QAAQ,EAAEf,SAAS,CAAC2C,KAAK,CAAC;IACxBd,KAAK,EAAE7B,SAAS,CAACwC;EACnB,CAAC,CAAC;EACFxB,QAAQ,EAAEhB,SAAS,CAACwC,MAAM;EAC1BvB,eAAe,EAAEjB,SAAS,CAACwC,MAAM;EACjCtB,OAAO,EAAElB,SAAS,CAACwC,MAAM;EACzBrB,aAAa,EAAEnB,SAAS,CAAC0C,IAAI;EAC7BrB,gBAAgB,EAAErB,SAAS,CAAC4C,IAAI;EAChC9B,QAAQ,EAAEd,SAAS,CAAC6C,SAAS,CAAC,CAAC7C,SAAS,CAAC8C,OAAO,CAAC9C,SAAS,CAAC+C,IAAI,CAAC,EAAE/C,SAAS,CAAC+C,IAAI,CAAC,CAAC,CAACN;AACrF,CAAC;AAEDhC,MAAM,CAACuC,YAAY,GAAG;EACpBjC,QAAQ,EAAE;IACRc,KAAK,EAAE;EACT,CAAC;EACDZ,eAAe,EAAE,EAAE;EACnBD,QAAQ,EAAE,EAAE;EACZE,OAAO,EAAE,EAAE;EACXC,aAAa,EAAE,KAAK;EACpBC,MAAM,EAAE,KAAK;EACbC,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAeZ,MAAM"}
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useRouter } from 'next/router';
4
4
  import { useDebounceSearch } from '@blaze-cms/plugin-search-ui';
@@ -6,7 +6,6 @@ import SearchContentResults from './SearchContentResults';
6
6
  import SearchContentToggleIcon from './SearchContentToggleIcon';
7
7
  const SearchContent = ({
8
8
  entities,
9
- searchInputAlignment,
10
9
  searchInputWrapperMobile,
11
10
  searchInputWrapperDesktop,
12
11
  isMobile,
@@ -14,7 +13,9 @@ const SearchContent = ({
14
13
  modifier,
15
14
  collapsedSearch
16
15
  }) => {
16
+ const searchContentRef = useRef(null);
17
17
  const [collapsed, setCollapsed] = useState(collapsedSearch);
18
+ const [showResults, setShowResults] = useState(false);
18
19
  const router = useRouter();
19
20
  const {
20
21
  results,
@@ -27,14 +28,33 @@ const SearchContent = ({
27
28
  resultKeys: 'id, name, image { url }, url'
28
29
  });
29
30
  useEffect(() => {
30
- const handleRouteChange = () => setSearchTerm('');
31
+ const handleRouteChange = () => {
32
+ setSearchTerm('');
33
+ setShowResults(false);
34
+ if (collapsedSearch) setCollapsed(true);
35
+ };
31
36
  router.events.on('routeChangeStart', handleRouteChange);
32
37
  return () => {
33
38
  router.events.off('routeChangeStart', handleRouteChange);
34
39
  };
35
- }, [router.events, setSearchTerm]);
40
+ }, [collapsedSearch, router.events, setSearchTerm]);
41
+ useEffect(() => {
42
+ const handleClickOutside = event => {
43
+ if (searchContentRef.current && !searchContentRef.current.contains(event.target)) {
44
+ setShowResults(false);
45
+ if (collapsedSearch) {
46
+ setCollapsed(true);
47
+ setSearchTerm('');
48
+ }
49
+ }
50
+ };
51
+ document.addEventListener('click', handleClickOutside);
52
+ return () => {
53
+ document.removeEventListener('click', handleClickOutside);
54
+ };
55
+ }, [collapsedSearch, setSearchTerm]);
36
56
  const responsiveClasses = isMobile ? searchInputWrapperMobile : searchInputWrapperDesktop;
37
- const handleClick = (e, url) => {
57
+ const handleNavigation = (e, url) => {
38
58
  e.preventDefault();
39
59
  router.push(url);
40
60
  };
@@ -43,63 +63,48 @@ const SearchContent = ({
43
63
  router.push(`/search?search_term=${e.target.value}`);
44
64
  }
45
65
  };
46
- const handleOnBlur = () => {
47
- if (!collapsedSearch) return;
48
- if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);
49
- };
50
- const handleClearSearchResults = () => {
51
- setSearchTerm('');
66
+ const handleIconClick = () => {
67
+ const isCloseIcon = collapsedSearch ? !collapsed : debouncedSearchTerm;
68
+ if (collapsedSearch) setCollapsed(!collapsed);
69
+ if (isCloseIcon) {
70
+ setSearchTerm('');
71
+ setShowResults(false);
72
+ } else {
73
+ setShowResults(true);
74
+ }
52
75
  };
53
76
  const className = ['search-content', modifier, responsiveClasses].filter(Boolean).join(' ');
54
- return collapsed ? /*#__PURE__*/React.createElement("div", {
55
- className: className
56
- }, /*#__PURE__*/React.createElement("div", {
57
- className: "search-content--collapse__wrapper"
58
- }, /*#__PURE__*/React.createElement("label", {
59
- className: "search-content--collapse__label"
60
- }, /*#__PURE__*/React.createElement("span", {
61
- className: "search-content--collapse__icon_wrapper"
62
- }, /*#__PURE__*/React.createElement("svg", {
63
- className: "search-content--collapse__icon",
64
- viewBox: "0 0 20 20"
65
- }, /*#__PURE__*/React.createElement("path", {
66
- fillRule: "evenodd",
67
- d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",
68
- clipRule: "evenodd"
69
- }))), /*#__PURE__*/React.createElement("input", {
70
- onFocus: () => setCollapsed(false),
71
- onChange: e => setSearchTerm(e.target.value),
72
- type: "text",
73
- name: "search",
74
- className: "search-content--collapse__input"
75
- })))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
76
- className: className
77
+ const searchModifier = collapsed ? 'search-content--collapse' : 'search-content--expanded';
78
+ return /*#__PURE__*/React.createElement("div", {
79
+ className: className,
80
+ ref: searchContentRef
77
81
  }, /*#__PURE__*/React.createElement("div", {
78
- className: "search-content--expanded__wrapper"
82
+ className: `${searchModifier}__wrapper`
79
83
  }, /*#__PURE__*/React.createElement("label", {
80
- className: "search-content--expanded__label"
84
+ className: `${searchModifier}__label`
81
85
  }, /*#__PURE__*/React.createElement("span", {
82
- className: "search-content--expanded__icon_wrapper"
86
+ className: `${searchModifier}__icon_wrapper`
83
87
  }, /*#__PURE__*/React.createElement(SearchContentToggleIcon, {
84
- results: results,
85
- onClear: handleClearSearchResults
86
- })), /*#__PURE__*/React.createElement("input", {
88
+ searchTerm: debouncedSearchTerm,
89
+ onClick: handleIconClick,
90
+ useCloseIcon: collapsedSearch ? !collapsed : debouncedSearchTerm
91
+ })), !collapsed && /*#__PURE__*/React.createElement("input", {
92
+ className: `${searchModifier}__input`,
87
93
  type: "text",
88
94
  name: "search",
89
- onChange: e => setSearchTerm(e.target.value),
90
- onKeyPress: handleKeyPress,
91
- className: "search-content--expanded__input",
92
95
  placeholder: placeholder,
93
96
  value: searchTerm,
94
- onBlur: handleOnBlur
95
- }))), /*#__PURE__*/React.createElement(SearchContentResults, {
97
+ onChange: e => setSearchTerm(e.target.value),
98
+ onKeyPress: handleKeyPress,
99
+ onFocus: () => setShowResults(true),
100
+ "data-testid": "search-content-input"
101
+ }))), showResults && /*#__PURE__*/React.createElement(SearchContentResults, {
96
102
  results: results,
97
103
  debouncedSearchTerm: debouncedSearchTerm,
98
- handleClick: handleClick
99
- })));
104
+ handleClick: handleNavigation
105
+ }));
100
106
  };
101
107
  SearchContent.propTypes = {
102
- searchInputAlignment: PropTypes.string,
103
108
  searchInputWrapperMobile: PropTypes.string,
104
109
  searchInputWrapperDesktop: PropTypes.string,
105
110
  placeholder: PropTypes.string,
@@ -109,7 +114,6 @@ SearchContent.propTypes = {
109
114
  collapsedSearch: PropTypes.bool
110
115
  };
111
116
  SearchContent.defaultProps = {
112
- searchInputAlignment: '',
113
117
  searchInputWrapperMobile: '',
114
118
  searchInputWrapperDesktop: '',
115
119
  placeholder: '',