@redneckz/wildless-cms-uni-blocks 0.11.0 → 0.11.2

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 (275) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +84 -53
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/Calculator/checkCreditSourceBookRowCommonParams.d.ts +9 -0
  5. package/bundle/components/Calculator/getCreditCalculatorLimitParams.d.ts +9 -0
  6. package/bundle/components/Calculator/getCreditCalculatorRateParams.d.ts +11 -0
  7. package/bundle/components/Calculator/rangeHelpers.d.ts +2 -2
  8. package/bundle/components/Header/Header.mobile.d.ts +2 -2
  9. package/bundle/components/Header/HeaderContent.d.ts +13 -1
  10. package/bundle/components/Header/HeaderTop.d.ts +6 -2
  11. package/bundle/components/ProductGallery/ProductGallery.mobile.d.ts +5 -0
  12. package/bundle/icons/IconName.d.ts +4 -2
  13. package/bundle/ui-kit/Heading/headingTag.d.ts +2 -0
  14. package/bundle/ui-kit/Heading/headingTag.mobile.d.ts +2 -0
  15. package/cosmos-static/icons/ChevronLeft.svg +1 -0
  16. package/dist/components/BaseTile/BaseTile.js +2 -1
  17. package/dist/components/BaseTile/BaseTile.js.map +1 -1
  18. package/dist/components/Blocks.mobile.js +4 -0
  19. package/dist/components/Blocks.mobile.js.map +1 -1
  20. package/dist/components/Calculator/checkCreditSourceBookRowCommonParams.d.ts +9 -0
  21. package/dist/components/Calculator/checkCreditSourceBookRowCommonParams.js +28 -0
  22. package/dist/components/Calculator/checkCreditSourceBookRowCommonParams.js.map +1 -0
  23. package/dist/components/Calculator/getCreditCalculatorLimitParams.d.ts +9 -0
  24. package/dist/components/Calculator/getCreditCalculatorLimitParams.js +10 -0
  25. package/dist/components/Calculator/getCreditCalculatorLimitParams.js.map +1 -0
  26. package/dist/components/Calculator/getCreditCalculatorRateParams.d.ts +11 -0
  27. package/dist/components/Calculator/getCreditCalculatorRateParams.js +14 -0
  28. package/dist/components/Calculator/getCreditCalculatorRateParams.js.map +1 -0
  29. package/dist/components/Calculator/rangeHelpers.d.ts +2 -2
  30. package/dist/components/Calculator/rangeHelpers.js +2 -2
  31. package/dist/components/Calculator/rangeHelpers.js.map +1 -1
  32. package/dist/components/Calculator/useCreditCalculatorParams.js +26 -38
  33. package/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  34. package/dist/components/Footer/TextInformation.js +1 -1
  35. package/dist/components/Footer/TextInformation.js.map +1 -1
  36. package/dist/components/Header/Header.mobile.d.ts +2 -2
  37. package/dist/components/Header/Header.mobile.js +3 -17
  38. package/dist/components/Header/Header.mobile.js.map +1 -1
  39. package/dist/components/Header/HeaderContent.d.ts +13 -1
  40. package/dist/components/Header/HeaderTop.d.ts +6 -2
  41. package/dist/components/Header/HeaderTop.js +15 -2
  42. package/dist/components/Header/HeaderTop.js.map +1 -1
  43. package/dist/components/Headline/headlineVersionStyles.js +6 -6
  44. package/dist/components/Headline/headlineVersionStyles.js.map +1 -1
  45. package/dist/components/ProductBlock/ProductBlockInner.js +1 -1
  46. package/dist/components/ProductGallery/ProductGallery.mobile.d.ts +5 -0
  47. package/dist/components/ProductGallery/ProductGallery.mobile.js +13 -0
  48. package/dist/components/ProductGallery/ProductGallery.mobile.js.map +1 -0
  49. package/dist/content-page-repository/transformImg.js +1 -1
  50. package/dist/content-page-repository/transformImg.js.map +1 -1
  51. package/dist/icons/IconName.d.ts +4 -2
  52. package/dist/icons/IconName.js +3 -1
  53. package/dist/icons/IconName.js.map +1 -1
  54. package/dist/ui-kit/Heading/Heading.js +5 -1
  55. package/dist/ui-kit/Heading/Heading.js.map +1 -1
  56. package/dist/ui-kit/Heading/headingTag.d.ts +2 -0
  57. package/dist/ui-kit/Heading/headingTag.js +5 -0
  58. package/dist/ui-kit/Heading/headingTag.js.map +1 -0
  59. package/dist/ui-kit/Heading/headingTag.mobile.d.ts +2 -0
  60. package/dist/ui-kit/Heading/headingTag.mobile.js +13 -0
  61. package/dist/ui-kit/Heading/headingTag.mobile.js.map +1 -0
  62. package/dist/ui-kit/Img/ImgAsPicture.js +1 -1
  63. package/dist/ui-kit/InnerTable/InnerTableButton.js +1 -1
  64. package/dist/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  65. package/lib/common.css +1 -1
  66. package/lib/components/BaseTile/BaseTile.js +2 -1
  67. package/lib/components/BaseTile/BaseTile.js.map +1 -1
  68. package/lib/components/Blocks.mobile.js +4 -0
  69. package/lib/components/Blocks.mobile.js.map +1 -1
  70. package/lib/components/Calculator/checkCreditSourceBookRowCommonParams.d.ts +9 -0
  71. package/lib/components/Calculator/checkCreditSourceBookRowCommonParams.js +25 -0
  72. package/lib/components/Calculator/checkCreditSourceBookRowCommonParams.js.map +1 -0
  73. package/lib/components/Calculator/getCreditCalculatorLimitParams.d.ts +9 -0
  74. package/lib/components/Calculator/getCreditCalculatorLimitParams.js +7 -0
  75. package/lib/components/Calculator/getCreditCalculatorLimitParams.js.map +1 -0
  76. package/lib/components/Calculator/getCreditCalculatorRateParams.d.ts +11 -0
  77. package/lib/components/Calculator/getCreditCalculatorRateParams.js +11 -0
  78. package/lib/components/Calculator/getCreditCalculatorRateParams.js.map +1 -0
  79. package/lib/components/Calculator/rangeHelpers.d.ts +2 -2
  80. package/lib/components/Calculator/rangeHelpers.js +4 -4
  81. package/lib/components/Calculator/rangeHelpers.js.map +1 -1
  82. package/lib/components/Calculator/useCreditCalculatorParams.js +27 -39
  83. package/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  84. package/lib/components/Footer/TextInformation.js +1 -1
  85. package/lib/components/Footer/TextInformation.js.map +1 -1
  86. package/lib/components/Header/Header.fixture.mobile.d.ts +2 -0
  87. package/lib/components/Header/Header.mobile.d.ts +2 -2
  88. package/lib/components/Header/Header.mobile.js +4 -18
  89. package/lib/components/Header/Header.mobile.js.map +1 -1
  90. package/lib/components/Header/HeaderContent.d.ts +13 -1
  91. package/lib/components/Header/HeaderTop.d.ts +6 -2
  92. package/lib/components/Header/HeaderTop.js +15 -2
  93. package/lib/components/Header/HeaderTop.js.map +1 -1
  94. package/lib/components/Headline/headlineVersionStyles.js +6 -6
  95. package/lib/components/Headline/headlineVersionStyles.js.map +1 -1
  96. package/lib/components/ProductBlock/ProductBlockInner.js +1 -1
  97. package/lib/components/ProductGallery/ProductGallery.fixture.mobile.d.ts +7 -0
  98. package/lib/components/ProductGallery/ProductGallery.mobile.d.ts +5 -0
  99. package/lib/components/ProductGallery/ProductGallery.mobile.js +11 -0
  100. package/lib/components/ProductGallery/ProductGallery.mobile.js.map +1 -0
  101. package/lib/content-page-repository/transformImg.js +1 -1
  102. package/lib/content-page-repository/transformImg.js.map +1 -1
  103. package/lib/icons/IconName.d.ts +4 -2
  104. package/lib/icons/IconName.js +3 -1
  105. package/lib/icons/IconName.js.map +1 -1
  106. package/lib/ui-kit/Heading/Heading.js +5 -1
  107. package/lib/ui-kit/Heading/Heading.js.map +1 -1
  108. package/lib/ui-kit/Heading/headingTag.d.ts +2 -0
  109. package/lib/ui-kit/Heading/headingTag.js +2 -0
  110. package/lib/ui-kit/Heading/headingTag.js.map +1 -0
  111. package/lib/ui-kit/Heading/headingTag.mobile.d.ts +2 -0
  112. package/lib/ui-kit/Heading/headingTag.mobile.js +10 -0
  113. package/lib/ui-kit/Heading/headingTag.mobile.js.map +1 -0
  114. package/lib/ui-kit/Img/ImgAsPicture.js +1 -1
  115. package/lib/ui-kit/InnerTable/InnerTableButton.js +1 -1
  116. package/lib/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  117. package/mobile/bundle/bundle.umd.js +123 -410
  118. package/mobile/bundle/bundle.umd.min.js +1 -1
  119. package/mobile/bundle/components/Calculator/checkCreditSourceBookRowCommonParams.d.ts +9 -0
  120. package/mobile/bundle/components/Calculator/getCreditCalculatorLimitParams.d.ts +9 -0
  121. package/mobile/bundle/components/Calculator/getCreditCalculatorRateParams.d.ts +11 -0
  122. package/mobile/bundle/components/Calculator/rangeHelpers.d.ts +2 -2
  123. package/mobile/bundle/components/Header/Header.d.ts +2 -2
  124. package/mobile/bundle/components/Header/HeaderContent.d.ts +13 -1
  125. package/mobile/bundle/components/Header/HeaderTop.d.ts +6 -2
  126. package/mobile/bundle/icons/IconName.d.ts +4 -2
  127. package/mobile/bundle/ui-kit/Heading/headingTag.d.ts +2 -0
  128. package/mobile/dist/components/BaseTile/BaseTile.js +2 -1
  129. package/mobile/dist/components/BaseTile/BaseTile.js.map +1 -1
  130. package/mobile/dist/components/Blocks.js +4 -0
  131. package/mobile/dist/components/Blocks.js.map +1 -1
  132. package/mobile/dist/components/Calculator/checkCreditSourceBookRowCommonParams.d.ts +9 -0
  133. package/mobile/dist/components/Calculator/checkCreditSourceBookRowCommonParams.js +28 -0
  134. package/mobile/dist/components/Calculator/checkCreditSourceBookRowCommonParams.js.map +1 -0
  135. package/mobile/dist/components/Calculator/getCreditCalculatorLimitParams.d.ts +9 -0
  136. package/mobile/dist/components/Calculator/getCreditCalculatorLimitParams.js +10 -0
  137. package/mobile/dist/components/Calculator/getCreditCalculatorLimitParams.js.map +1 -0
  138. package/mobile/dist/components/Calculator/getCreditCalculatorRateParams.d.ts +11 -0
  139. package/mobile/dist/components/Calculator/getCreditCalculatorRateParams.js +14 -0
  140. package/mobile/dist/components/Calculator/getCreditCalculatorRateParams.js.map +1 -0
  141. package/mobile/dist/components/Calculator/rangeHelpers.d.ts +2 -2
  142. package/mobile/dist/components/Calculator/rangeHelpers.js +2 -2
  143. package/mobile/dist/components/Calculator/rangeHelpers.js.map +1 -1
  144. package/mobile/dist/components/Calculator/useCreditCalculatorParams.js +26 -38
  145. package/mobile/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  146. package/mobile/dist/components/Footer/TextInformation.js +1 -1
  147. package/mobile/dist/components/Footer/TextInformation.js.map +1 -1
  148. package/mobile/dist/components/Header/Header.d.ts +2 -2
  149. package/mobile/dist/components/Header/Header.js +3 -17
  150. package/mobile/dist/components/Header/Header.js.map +1 -1
  151. package/mobile/dist/components/Header/HeaderContent.d.ts +13 -1
  152. package/mobile/dist/components/Header/HeaderTop.d.ts +6 -2
  153. package/mobile/dist/components/Header/HeaderTop.js +15 -2
  154. package/mobile/dist/components/Header/HeaderTop.js.map +1 -1
  155. package/mobile/dist/components/Headline/headlineVersionStyles.js +6 -6
  156. package/mobile/dist/components/Headline/headlineVersionStyles.js.map +1 -1
  157. package/mobile/dist/components/ProductBlock/ProductBlockInner.js +1 -1
  158. package/mobile/dist/components/ProductGallery/ProductGallery.js +4 -17
  159. package/mobile/dist/components/ProductGallery/ProductGallery.js.map +1 -1
  160. package/mobile/dist/content-page-repository/transformImg.js +1 -1
  161. package/mobile/dist/content-page-repository/transformImg.js.map +1 -1
  162. package/mobile/dist/icons/IconName.d.ts +4 -2
  163. package/mobile/dist/icons/IconName.js +3 -1
  164. package/mobile/dist/icons/IconName.js.map +1 -1
  165. package/mobile/dist/ui-kit/Heading/Heading.js +12 -11
  166. package/mobile/dist/ui-kit/Heading/Heading.js.map +1 -1
  167. package/mobile/dist/ui-kit/Heading/headingTag.d.ts +2 -0
  168. package/mobile/dist/ui-kit/Heading/headingTag.js +13 -0
  169. package/mobile/dist/ui-kit/Heading/headingTag.js.map +1 -0
  170. package/mobile/dist/ui-kit/Img/ImgAsPicture.js +1 -1
  171. package/mobile/dist/ui-kit/InnerTable/InnerTableButton.js +1 -1
  172. package/mobile/dist/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  173. package/mobile/lib/common.css +1 -1
  174. package/mobile/lib/components/BaseTile/BaseTile.js +2 -1
  175. package/mobile/lib/components/BaseTile/BaseTile.js.map +1 -1
  176. package/mobile/lib/components/Blocks.js +4 -0
  177. package/mobile/lib/components/Blocks.js.map +1 -1
  178. package/mobile/lib/components/Calculator/checkCreditSourceBookRowCommonParams.d.ts +9 -0
  179. package/mobile/lib/components/Calculator/checkCreditSourceBookRowCommonParams.js +25 -0
  180. package/mobile/lib/components/Calculator/checkCreditSourceBookRowCommonParams.js.map +1 -0
  181. package/mobile/lib/components/Calculator/getCreditCalculatorLimitParams.d.ts +9 -0
  182. package/mobile/lib/components/Calculator/getCreditCalculatorLimitParams.js +7 -0
  183. package/mobile/lib/components/Calculator/getCreditCalculatorLimitParams.js.map +1 -0
  184. package/mobile/lib/components/Calculator/getCreditCalculatorRateParams.d.ts +11 -0
  185. package/mobile/lib/components/Calculator/getCreditCalculatorRateParams.js +11 -0
  186. package/mobile/lib/components/Calculator/getCreditCalculatorRateParams.js.map +1 -0
  187. package/mobile/lib/components/Calculator/rangeHelpers.d.ts +2 -2
  188. package/mobile/lib/components/Calculator/rangeHelpers.js +4 -4
  189. package/mobile/lib/components/Calculator/rangeHelpers.js.map +1 -1
  190. package/mobile/lib/components/Calculator/useCreditCalculatorParams.js +27 -39
  191. package/mobile/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  192. package/mobile/lib/components/Footer/TextInformation.js +1 -1
  193. package/mobile/lib/components/Footer/TextInformation.js.map +1 -1
  194. package/mobile/lib/components/Header/Header.d.ts +2 -2
  195. package/mobile/lib/components/Header/Header.js +4 -18
  196. package/mobile/lib/components/Header/Header.js.map +1 -1
  197. package/mobile/lib/components/Header/HeaderContent.d.ts +13 -1
  198. package/mobile/lib/components/Header/HeaderTop.d.ts +6 -2
  199. package/mobile/lib/components/Header/HeaderTop.js +15 -2
  200. package/mobile/lib/components/Header/HeaderTop.js.map +1 -1
  201. package/mobile/lib/components/Headline/headlineVersionStyles.js +6 -6
  202. package/mobile/lib/components/Headline/headlineVersionStyles.js.map +1 -1
  203. package/mobile/lib/components/ProductBlock/ProductBlockInner.js +1 -1
  204. package/mobile/lib/components/ProductGallery/ProductGallery.js +5 -18
  205. package/mobile/lib/components/ProductGallery/ProductGallery.js.map +1 -1
  206. package/mobile/lib/content-page-repository/transformImg.js +1 -1
  207. package/mobile/lib/content-page-repository/transformImg.js.map +1 -1
  208. package/mobile/lib/icons/IconName.d.ts +4 -2
  209. package/mobile/lib/icons/IconName.js +3 -1
  210. package/mobile/lib/icons/IconName.js.map +1 -1
  211. package/mobile/lib/ui-kit/Heading/Heading.js +12 -11
  212. package/mobile/lib/ui-kit/Heading/Heading.js.map +1 -1
  213. package/mobile/lib/ui-kit/Heading/headingTag.d.ts +2 -0
  214. package/mobile/lib/ui-kit/Heading/headingTag.js +10 -0
  215. package/mobile/lib/ui-kit/Heading/headingTag.js.map +1 -0
  216. package/mobile/lib/ui-kit/Img/ImgAsPicture.js +1 -1
  217. package/mobile/lib/ui-kit/InnerTable/InnerTableButton.js +1 -1
  218. package/mobile/lib/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  219. package/mobile/src/components/BaseTile/BaseTile.tsx +6 -3
  220. package/mobile/src/components/Blocks.ts +4 -0
  221. package/mobile/src/components/Calculator/checkCreditSourceBookRowCommonParams.ts +47 -0
  222. package/mobile/src/components/Calculator/getCreditCalculatorLimitParams.ts +24 -0
  223. package/mobile/src/components/Calculator/getCreditCalculatorRateParams.ts +33 -0
  224. package/mobile/src/components/Calculator/rangeHelpers.ts +4 -4
  225. package/mobile/src/components/Calculator/useCreditCalculatorParams.ts +38 -73
  226. package/mobile/src/components/Footer/TextInformation.tsx +2 -2
  227. package/mobile/src/components/Header/Header.tsx +19 -50
  228. package/mobile/src/components/Header/HeaderContent.ts +15 -1
  229. package/mobile/src/components/Header/HeaderTop.tsx +62 -25
  230. package/mobile/src/components/Headline/headlineVersionStyles.ts +6 -6
  231. package/mobile/src/components/ProductBlock/ProductBlockInner.tsx +1 -1
  232. package/mobile/src/components/ProductGallery/ProductGallery.tsx +18 -59
  233. package/mobile/src/content-page-repository/transformImg.ts +1 -1
  234. package/mobile/src/icons/ChevronLeft.svg +3 -0
  235. package/mobile/src/icons/IconName.ts +5 -5
  236. package/mobile/src/ui-kit/Heading/Heading.tsx +17 -16
  237. package/mobile/src/ui-kit/Heading/headingTag.ts +12 -0
  238. package/mobile/src/ui-kit/Img/ImgAsPicture.tsx +1 -1
  239. package/mobile/src/ui-kit/InnerTable/InnerTableButton.tsx +1 -1
  240. package/package.json +1 -1
  241. package/src/components/BaseTile/BaseTile.tsx +6 -3
  242. package/src/components/Blocks.mobile.ts +4 -0
  243. package/src/components/Calculator/checkCreditSourceBookRowCommonParams.ts +47 -0
  244. package/src/components/Calculator/getCreditCalculatorLimitParams.ts +24 -0
  245. package/src/components/Calculator/getCreditCalculatorRateParams.ts +33 -0
  246. package/src/components/Calculator/rangeHelpers.ts +4 -4
  247. package/src/components/Calculator/useCreditCalculatorParams.ts +38 -73
  248. package/src/components/Footer/TextInformation.tsx +2 -2
  249. package/src/components/Header/Header.fixture.mobile.tsx +4 -0
  250. package/src/components/Header/Header.mobile.tsx +19 -50
  251. package/src/components/Header/HeaderContent.ts +15 -1
  252. package/src/components/Header/HeaderTop.tsx +62 -25
  253. package/src/components/Headline/headlineVersionStyles.ts +6 -6
  254. package/src/components/ProductBlock/ProductBlockInner.tsx +1 -1
  255. package/src/components/ProductGallery/ProductGallery.fixture.mobile.tsx +142 -0
  256. package/src/components/ProductGallery/ProductGallery.mobile.tsx +34 -0
  257. package/src/content-page-repository/transformImg.ts +1 -1
  258. package/src/icons/ChevronLeft.svg +3 -0
  259. package/src/icons/IconName.ts +5 -1
  260. package/src/ui-kit/Heading/Heading.fixture.mobile.tsx +6 -6
  261. package/src/ui-kit/Heading/Heading.fixture.tsx +6 -6
  262. package/src/ui-kit/Heading/Heading.tsx +8 -3
  263. package/src/ui-kit/Heading/headingTag.mobile.ts +12 -0
  264. package/src/ui-kit/Heading/headingTag.ts +3 -0
  265. package/src/ui-kit/Img/ImgAsPicture.tsx +1 -1
  266. package/src/ui-kit/InnerTable/InnerTableButton.tsx +1 -1
  267. package/tailwind.config.cjs +10 -19
  268. package/bundle/ui-kit/Heading/Heading.mobile.d.ts +0 -2
  269. package/dist/ui-kit/Heading/Heading.mobile.d.ts +0 -2
  270. package/dist/ui-kit/Heading/Heading.mobile.js +0 -18
  271. package/dist/ui-kit/Heading/Heading.mobile.js.map +0 -1
  272. package/lib/ui-kit/Heading/Heading.mobile.d.ts +0 -2
  273. package/lib/ui-kit/Heading/Heading.mobile.js +0 -16
  274. package/lib/ui-kit/Heading/Heading.mobile.js.map +0 -1
  275. package/src/ui-kit/Heading/Heading.mobile.tsx +0 -22
@@ -460,7 +460,6 @@
460
460
 
461
461
  const defaultDiscriminator = (_) => _;
462
462
  const maxBy = (discriminator = defaultDiscriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
463
- const max = maxBy();
464
463
 
465
464
  const minBy = (discriminator = defaultDiscriminator) => maxBy((_) => -discriminator(_));
466
465
 
@@ -604,7 +603,7 @@
604
603
  const renderImg = (image, imageClassName = '', isMobile = false) => {
605
604
  const style = {
606
605
  width: image.size?.width ? `${image.size?.width}px` : '100%',
607
- height: image.size?.height ? `${image.size?.height}px` : '100%',
606
+ height: image.size?.height ? `${image.size?.height}px` : 'auto',
608
607
  };
609
608
  const title = image.title || '';
610
609
  const alt = image.alt || image.title;
@@ -810,6 +809,30 @@
810
809
  const getAlignStyle = (isAlignCenter) => isAlignCenter ? 'flex justify-center' : '';
811
810
  const renderDots = (containerRef, dotsActiveIndex, itemCount) => (jsx(SwipeListControlDots, { containerRef: containerRef, activeIndex: dotsActiveIndex, dotCount: itemCount, listType: 'horizontal-list' }));
812
811
 
812
+ const mobileHeadingTagMap = {
813
+ h1: 'h1',
814
+ h2: 'h1',
815
+ h3: 'h2',
816
+ h4: 'h2',
817
+ h5: 'h3',
818
+ h6: 'h3',
819
+ };
820
+ const headingTag = (tag) => mobileHeadingTagMap[tag] || 'h3';
821
+
822
+ const styles = {
823
+ h0: 'text-h0',
824
+ h1: 'text-h1',
825
+ h2: 'text-h2',
826
+ h3: 'text-h3',
827
+ h4: 'text-h4',
828
+ h5: 'text-h5',
829
+ h6: 'text-h6', // 20
830
+ };
831
+ const Heading = JSX(({ className = '', headingType = 'h3', as = 'h3', title, children }) => {
832
+ const Tag = headingTag(as);
833
+ return (jsx(Tag, { className: `font-sans m-0 ${styles[headingType]} ${className}`, children: title || children }));
834
+ });
835
+
813
836
  const LinkWrapper = JSX(({ className = '', href, target, isRemote = false, children }) => {
814
837
  const link = useLink({ isRemote });
815
838
  const linkProps = link({ href, target });
@@ -817,6 +840,11 @@
817
840
  return (jsx(Tag, { className: style('block', className), ...(href ? linkProps : {}), children: children }));
818
841
  });
819
842
 
843
+ const CarouselProgramsCard = JSX(({ className = '', title, icon, list = [], href, target, ...rest }) => {
844
+ return (jsx(BlockWrapper, { className: style('border border-gray', className), ...rest, children: jsxs(LinkWrapper, { className: "flex", href: href, target: target, children: [jsxs("div", { className: "w-[200px] min-w-[200px] self-center", children: [icon?.icon ? jsx(Img, { image: icon }) : null, icon?.src ? jsx(Img, { image: icon }) : null] }), jsxs("div", { className: "p-8 pl-3 w-full", children: [title ? jsx(Heading, { className: "mb-3.5", headingType: "h5", title: title }) : null, list.length ? (jsx("div", { className: "flex flex-col gap-3", children: list?.map(renderList$1) })) : null] })] }) }));
845
+ });
846
+ const renderList$1 = (_, i) => (jsxs("div", { className: "break-words", children: [_.title ? jsx("div", { className: "text-h6", children: _.title }) : null, _.description ? jsx("span", { className: "text-l-light mt-1", children: _.description }) : null] }, String(i)));
847
+
820
848
  const DOT_SIZE_MAP = {
821
849
  L: 'w-1.5 h-1.5 mr-4',
822
850
  M: 'w-1.5 h-1.5 mr-3',
@@ -886,52 +914,38 @@
886
914
 
887
915
  const SocialMedia = JSX(({ className = '', media }) => (jsx("div", { className: `flex gap-2 items-start justify-start ${className}`, children: media?.map((_, index) => (jsx(MediaButton, { ..._ }, String(index)))) })));
888
916
 
889
- const HeadingClass = {
890
- h0: 'text-m-title',
891
- h1: 'text-m-title',
892
- h2: 'text-m-title',
893
- h3: 'text-h6',
894
- h4: 'text-m-title-xs',
895
- h5: 'text-m-title-xs',
896
- h6: 'text-m-title-xs',
897
- };
898
- const Heading = JSX((props) => {
899
- const { className, headingType = 'h3', title, as: Tag = 'h3' } = props;
900
- return (jsx(Tag, { className: `font-sans font-medium m-0 ${HeadingClass[headingType]} ${className || ''}`, children: title }));
901
- });
902
-
903
917
  const Paragraph = JSX(({ children, ...style }) => (jsx("p", { className: ['font-sans', ...Object.values(style)].join(' '), children: children })));
904
918
 
905
919
  const headlineVersionStyles = {
906
920
  XXL: {
907
921
  title: { headingType: 'h0', as: 'h1' },
908
922
  descriptionSize: 'text-h5',
909
- descriptionStyle: 'mt-5',
923
+ descriptionStyle: 'mt-headline-xxl',
910
924
  },
911
925
  XL: {
912
926
  title: { headingType: 'h1', as: 'h1' },
913
927
  descriptionSize: 'text-xl-light',
914
- descriptionStyle: 'mt-4',
928
+ descriptionStyle: 'mt-headline-l',
915
929
  },
916
930
  L: {
917
931
  title: { headingType: 'h2', as: 'h2' },
918
932
  descriptionSize: 'text-xl-light',
919
- descriptionStyle: 'mt-4',
933
+ descriptionStyle: 'mt-headline-l',
920
934
  },
921
935
  M: {
922
936
  title: { headingType: 'h3', as: 'h3' },
923
937
  descriptionSize: 'text-xl-light',
924
- descriptionStyle: 'mt-3',
938
+ descriptionStyle: 'mt-headline-m',
925
939
  },
926
940
  S: {
927
941
  title: { headingType: 'h4', as: 'h4' },
928
942
  descriptionSize: 'text-xl-light',
929
- descriptionStyle: 'mt-2',
943
+ descriptionStyle: 'mt-headline-s',
930
944
  },
931
945
  XS: {
932
946
  title: { headingType: 'h5', as: 'h5' },
933
947
  descriptionSize: 'text-l-light',
934
- descriptionStyle: 'mt-2',
948
+ descriptionStyle: 'mt-headline-s',
935
949
  },
936
950
  };
937
951
 
@@ -1123,15 +1137,6 @@
1123
1137
  }
1124
1138
  }
1125
1139
 
1126
- async function fetchJSON(url, options) {
1127
- try {
1128
- return url ? await fetchJSONUnsafe(url, options) : null;
1129
- }
1130
- catch (err) {
1131
- console.error(err);
1132
- }
1133
- return null;
1134
- }
1135
1140
  async function fetchJSONUnsafe(url, options) {
1136
1141
  const response = await fetch(url, {
1137
1142
  ...options,
@@ -1242,7 +1247,7 @@
1242
1247
 
1243
1248
  const textInformationTextSize = 'text-s';
1244
1249
 
1245
- const TextInformation = JSX(({ className = '', links }) => (jsxs("div", { className: className, children: [jsx("div", { className: "pt-5 sm:py-4", children: jsx(Text, { size: textInformationTextSize, color: "text-secondary-text", children: `\u00a9\u00A02000-${new Date().getFullYear()}\u00A0АО \u00ABРоссельхозбанк\u00BB Генеральная лицензия Банка России \u2116\u00A03349 от\u00A012.08.2015\u00A0г.` }) }), links?.length ? (jsx("div", { className: "flex justify-start items-start gap-5 pt-2.5", children: links.map((_, i) => (jsx(TextInformationLink, { index: i, ..._ }, String(i)))) })) : null] })));
1250
+ const TextInformation = JSX(({ className = '', links }) => (jsxs("div", { className: className, children: [jsx("div", { className: "pt-4 xl:pt-5", children: jsx(Text, { size: textInformationTextSize, color: "text-secondary-text", children: `\u00a9\u00A02000-${new Date().getFullYear()}\u00A0АО \u00ABРоссельхозбанк\u00BB Генеральная лицензия Банка России \u2116\u00A03349 от\u00A012.08.2015\u00A0г.` }) }), links?.length ? (jsx("div", { className: "flex justify-start items-start gap-5 pt-4", children: links.map((_, i) => (jsx(TextInformationLink, { index: i, ..._ }, String(i)))) })) : null] })));
1246
1251
 
1247
1252
  const Footer = JSX(({ className = '', ...rest }) => {
1248
1253
  const fallback = rest.options?.page?.fallback;
@@ -1251,371 +1256,6 @@
1251
1256
  return (jsxs(BlockWrapper, { tag: "footer", className: style('px-4 py-6', className), ...rest, children: [jsx("div", { className: "mb-4 pb-5 border-b border-main-divider", children: sitemap.topItems?.map((item, i) => (jsx(RollupItem, { label: item?.text, labelIcon: item?.icon, children: jsx(LinkList, { items: item.items, className: "my-3" }) }, String(i)))) }), jsx(Contacts, { className: "overflow-hidden", items: contacts }), jsx(SocialMedia, { className: "mb-4", media: socialMedia }), jsx(Button, { className: "w-full mb-4", text: "Google Play", version: "secondary", href: "/", target: "_blank" }), jsx(HorizontalNavigation, { className: "pt-4 pb-7 border-y border-main-divider", title: horizontalNavigationTitle, links: relatedEnterprises }), jsx(TextInformation, {})] }));
1252
1257
  });
1253
1258
 
1254
- const isHrefActive = (router) => ({ href }) => withoutQuery(isURL(href) ? router.href : router.pathname).startsWith(withoutQuery(href));
1255
-
1256
- const findActiveSubItem = (router) => (items = []) => {
1257
- const possibleActiveSubItems = items?.filter(isHrefActive(router));
1258
- return possibleActiveSubItems?.length
1259
- ? maxBy((_) => _.href?.length || 0)(possibleActiveSubItems) // More specific item with max length
1260
- : undefined;
1261
- };
1262
-
1263
- const isTopItemActive = (router) => isHrefActive(projectSettings.BASE_PATH ? { pathname: projectSettings.BASE_PATH } : router);
1264
-
1265
- const HeaderItem = JSX(({ className = '', active, dataItemName, children, ...rest }) => {
1266
- const link = useLink();
1267
- const { href, target, text, onClick } = link(rest);
1268
- return (jsxs("a", { className: style('relative inline-block bg-transparent text-center no-underline', className), href: href, target: target, "data-item-name": dataItemName, onClick: onClick, children: [jsx("span", { className: getTextStyle(active), children: text || children }), active ? (jsx("div", { className: "absolute left-0 -bottom-3 w-full h-0.5 bg-primary-main group-data-transparent:bg-transparent" })) : null] }));
1269
- });
1270
- const getTextStyle = (active = false) => style('font-sans text-s', active ? 'text-primary-main' : 'text-secondary-text hover:text-primary-main', 'group-data-transparent:text-white group-data-transparent:hover:text-primary-hover');
1271
-
1272
- const STORAGE_DEFAULT_TTL = 86400000; // 24 * 60 * 60 * 1000
1273
- function useCachedAsyncData(key, fetcher, storage = globalThis?.localStorage) {
1274
- const cachedFetcher = useCallback(async (...args) => {
1275
- const storageKey = `async:${key}`;
1276
- const storageData = storage.getItem(storageKey);
1277
- const cachedData = getParsedData(storageData);
1278
- if (cachedData) {
1279
- return cachedData;
1280
- }
1281
- const data = await fetcher(...args);
1282
- storage.setItem(storageKey, JSON.stringify({ data, timestamp: Date.now() }));
1283
- return data;
1284
- }, [key, fetcher]);
1285
- return useAsyncData(key, cachedFetcher);
1286
- }
1287
- function getParsedData(storageData) {
1288
- const { data = null, timestamp = null } = storageData ? JSON.parse(storageData) : {};
1289
- return data && Date.now() - timestamp < STORAGE_DEFAULT_TTL ? data : undefined;
1290
- }
1291
-
1292
- const REGION_URL = '/api/v1/region';
1293
- function useLocation(defaultLocation = 'Москва') {
1294
- const currentLocation = getLocalStorageLocation();
1295
- const [location, setLocation] = useState(currentLocation?.region ?? { name: defaultLocation });
1296
- const { data } = useCachedAsyncData(REGION_URL, fetchJSONUnsafe);
1297
- useEffect(() => {
1298
- setLocation(currentLocation?.region && currentLocation?.manual
1299
- ? currentLocation.region
1300
- : data || { name: defaultLocation });
1301
- }, [data]);
1302
- const onChangeLocation = useCallback((region) => {
1303
- globalThis.localStorage?.setItem('location', JSON.stringify({ manual: true, region }));
1304
- setLocation(region);
1305
- }, []);
1306
- return [location, onChangeLocation];
1307
- }
1308
- const getLocalStorageLocation = () => {
1309
- const localStorageLocation = globalThis.localStorage?.getItem('location');
1310
- try {
1311
- return localStorageLocation ? JSON.parse(localStorageLocation) : null;
1312
- }
1313
- catch (_) {
1314
- return null;
1315
- }
1316
- };
1317
-
1318
- const CloseButton = JSX(({ className, onClick }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-1 bg-transparent border-none', className), onClick: onClick, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) })));
1319
-
1320
- function assertUnreachable(x) {
1321
- throw new Error(x);
1322
- }
1323
-
1324
- function useDialogHandlers({ onOpen, onClose } = {}) {
1325
- useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
1326
- switch (action.type) {
1327
- case 'open':
1328
- onOpen && onOpen(action);
1329
- break;
1330
- case 'close':
1331
- onClose && onClose();
1332
- break;
1333
- default:
1334
- assertUnreachable(action);
1335
- }
1336
- }), [onOpen, onClose]);
1337
- }
1338
-
1339
- const useDebouncedEffect = (effect, deps, delay = 300) => useEffect(() => {
1340
- const timerId = setTimeout(effect, delay);
1341
- return () => {
1342
- clearTimeout(timerId);
1343
- };
1344
- }, deps);
1345
-
1346
- const compareBy = (indexOf) => (a, b) => indexOf(a) - indexOf(b);
1347
- const desc = (cmp) => (a, b) => -cmp(a, b);
1348
-
1349
- function zip(firstCol, ...restCols) {
1350
- return firstCol.map((firstEl, rowIndex) => [firstEl, ...restCols.map((col) => col[rowIndex])]);
1351
- }
1352
-
1353
- const JARO_WINKLER_P = 0.1;
1354
- const JARO_WINKLER_MAX_L = 4;
1355
- const jaroWinklerDistance = (s1) => (s2) => {
1356
- if (s1 === s2) {
1357
- return 1;
1358
- }
1359
- if (!s1 || !s2) {
1360
- return 0;
1361
- }
1362
- const { m, s1Matches, s2Matches } = computeM(s1, s2);
1363
- if (m === 0) {
1364
- return 0;
1365
- }
1366
- const t = computeT(s1, s2, { s1Matches, s2Matches });
1367
- const jaroWeight = (m / s1.length + m / s2.length + (m - t / 2) / m) / 3;
1368
- const winklerWeight = jaroWeight > 0.7 ? computePrefixL(s1, s2) * JARO_WINKLER_P : 0;
1369
- return jaroWeight + winklerWeight * (1 - jaroWeight);
1370
- };
1371
- function computeM(s1, s2) {
1372
- const range = Math.max(0, Math.floor(Math.max(s1.length, s2.length) / 2) - 1);
1373
- const s1Matches = new Array(s1.length);
1374
- const s2Matches = new Array(s2.length);
1375
- let m = 0;
1376
- for (let i = 0; i < s1.length; i++) {
1377
- const low = Math.max(0, i - range);
1378
- const high = Math.min(i + range, s2.length - 1);
1379
- for (let j = low; j <= high; j++) {
1380
- if (s1Matches[i] || s2Matches[j] || s1[i] !== s2[j]) {
1381
- continue;
1382
- }
1383
- m++;
1384
- s1Matches[i] = true;
1385
- s2Matches[j] = true;
1386
- }
1387
- }
1388
- return { m, s1Matches, s2Matches };
1389
- }
1390
- function computeT(s1, s2, { s1Matches, s2Matches }) {
1391
- let t = 0;
1392
- for (let i = 0, k = 0; i < s1.length; i++) {
1393
- if (!s1Matches[i]) {
1394
- continue;
1395
- }
1396
- let j = k;
1397
- for (; j < s2.length; j++) {
1398
- if (s2Matches[j]) {
1399
- k = j + 1;
1400
- break;
1401
- }
1402
- }
1403
- if (s1[i] !== s2[j]) {
1404
- t++;
1405
- }
1406
- }
1407
- return t;
1408
- }
1409
- function computePrefixL(s1, s2) {
1410
- let prefixL = 0;
1411
- while (s1[prefixL] === s2[prefixL] && prefixL < JARO_WINKLER_MAX_L) {
1412
- prefixL++;
1413
- }
1414
- return prefixL;
1415
- }
1416
-
1417
- const joinMaps = (aggregate, emptyVal) => (acc, map) => {
1418
- for (const [key, b] of map) {
1419
- acc.set(key, aggregate(acc.get(key) || emptyVal, b));
1420
- }
1421
- return acc;
1422
- };
1423
-
1424
- const sum = (list = []) => list.reduce((a, b) => a + b, 0);
1425
-
1426
- const MIN_TERM_LEN = 3;
1427
- const tokenize = (text) => text
1428
- .toLowerCase()
1429
- .split(/[^0-9a-zа-я-]+/)
1430
- .filter((token) => token.length >= MIN_TERM_LEN && !/[0-9a-z]/.test(token));
1431
-
1432
- const textRank = (queryTokens) => (text) => {
1433
- const textTokens = tokenize(text || '');
1434
- return textTokens.length
1435
- ? sum(queryTokens.map((qToken) => max(textTokens.map(jaroWinklerDistance(qToken)))))
1436
- : 0;
1437
- };
1438
-
1439
- const JW_THRESHOLD = 0.8;
1440
- const RANK_EPS = 0.001;
1441
- const search = (query) => (searchIndex) => {
1442
- const { corpus, dictionary } = searchIndex || {};
1443
- if (!query || !corpus?.length || !dictionary || !Object.keys(dictionary).length) {
1444
- return [];
1445
- }
1446
- const queryTokens = tokenize(query);
1447
- if (!queryTokens.length) {
1448
- return [];
1449
- }
1450
- const dictEntries = Object.entries(dictionary);
1451
- const pagesRanking = queryTokens
1452
- .map(computePagesRankingPerToken(dictEntries))
1453
- .reduce(joinMaps((a, b) => a + b, 0), new Map());
1454
- const relevantPages = [...pagesRanking.entries()]
1455
- .filter(([, pageRank]) => pageRank >= (JW_THRESHOLD - RANK_EPS) * queryTokens.length) // Multiplication of query tokens
1456
- .map(([pageIndex]) => corpus[pageIndex]);
1457
- return sortResultsByRank(queryTokens)(relevantPages);
1458
- };
1459
- const computePagesRankingPerToken = (dictEntries) => (qToken) => dictEntries
1460
- .map(([stem, pageIndices]) => [jaroWinklerDistance(qToken)(stem), pageIndices])
1461
- .filter(([stemRank]) => stemRank >= JW_THRESHOLD)
1462
- .map(([stemRank, pageIndices]) => fillMapWith(pageIndices, stemRank))
1463
- .reduce(joinMaps(Math.max, 0), new Map());
1464
- const sortResultsByRank = (queryTokens) => (results) => zip(results, results.map(({ title }) => title).map(textRank(queryTokens)))
1465
- .sort(desc(compareBy(([, pageTitleRank]) => pageTitleRank)))
1466
- .map(([corpusItem]) => corpusItem);
1467
- const fillMapWith = (keys, value) => new Map(keys.map((_) => [_, value]));
1468
-
1469
- const SEARCH_INDEX_FILENAME = 'search.index.json';
1470
- const DEFAULT_BASE_PATH = ['/'];
1471
- const useSearch = ({ basePathList = DEFAULT_BASE_PATH, initialQuery = '', wasOpened, }) => {
1472
- const [query, setQuery] = useState(initialQuery || '');
1473
- useEffect(() => {
1474
- if (initialQuery !== undefined && initialQuery !== null) {
1475
- setQuery(initialQuery);
1476
- }
1477
- }, [initialQuery]);
1478
- const key = useMemo(() => basePathList.map((_) => (wasOpened ? _ : null)), // Load search index on very first search
1479
- [wasOpened, basePathList]);
1480
- const { data } = useAsyncData(key, fetchSearchIndex);
1481
- const [result, setResult] = useState(null);
1482
- useDebouncedEffect(() => {
1483
- if (data) {
1484
- setResult(data.map(search(query)));
1485
- }
1486
- }, [data, query]);
1487
- return [result, { value: query, onChange: setQuery }];
1488
- };
1489
- const fetchSearchIndex = async (...basePathList) => (await Promise.allSettled(basePathList.map((basePath) => fetchJSON(joinPath(basePath, '/', SEARCH_INDEX_FILENAME))))).map((_) => (_.status === 'fulfilled' ? _.value : {}));
1490
-
1491
- const Dialog = JSX(({ className, isOpened, head, children, onClose }) => {
1492
- useEffect(() => {
1493
- const handleEscape = ({ key }) => {
1494
- if (key === 'Escape') {
1495
- onClose && onClose();
1496
- }
1497
- };
1498
- globalThis.document?.addEventListener('keydown', handleEscape);
1499
- return () => {
1500
- globalThis.document?.removeEventListener('keydown', handleEscape);
1501
- };
1502
- }, [onClose]);
1503
- return isOpened ? (jsx("div", { className: style('fixed inset-0 bg-white text-l-light z-50 overflow-x-hidden overflow-y-scroll no-scrollbar', className), role: "dialog", children: jsxs("div", { className: "relative container pb-12 min-h-full", children: [jsxs("div", { className: "sticky bg-white pt-6 top-0", children: [jsx(CloseButton, { className: "absolute top-10 -right-12", onClick: onClose }), head] }), children] }) })) : null;
1504
- });
1505
-
1506
- function useBool(defaultValue = false) {
1507
- const [value, setValue] = useState(defaultValue);
1508
- const setTrue = useCallback(() => setValue(true), []);
1509
- const setFalse = useCallback(() => setValue(false), []);
1510
- const toggle = useCallback(() => setValue((_) => !_), []);
1511
- return [value, { setValue, setTrue, setFalse, toggle }];
1512
- }
1513
-
1514
- function useDialogProps(id, initOpen = false) {
1515
- const [isOpened, { setTrue: open, setFalse: close }] = useBool(initOpen);
1516
- const [params, setParams] = useState({ id });
1517
- const wasOpened = useRef(isOpened);
1518
- wasOpened.current ||= isOpened;
1519
- const handleOpen = useCallback((_) => {
1520
- if (_.id === id) {
1521
- setParams(_);
1522
- open();
1523
- }
1524
- else {
1525
- close();
1526
- }
1527
- }, [id]);
1528
- useDialogHandlers({
1529
- onOpen: handleOpen,
1530
- onClose: close,
1531
- });
1532
- const handleCloseAsEventSource = useCallback(() => {
1533
- close();
1534
- defaultEventBus.fire('dialog', { type: 'close' });
1535
- }, []);
1536
- return {
1537
- ...params,
1538
- isOpened,
1539
- wasOpened: wasOpened.current,
1540
- onClose: handleCloseAsEventSource,
1541
- };
1542
- }
1543
-
1544
- const Sitemap = JSX(({ className, topItems }) => {
1545
- const link = useLink({ isRemote: true });
1546
- return (jsx("div", { className: style('flex items-start justify-between', className), children: topItems?.map(link).map(renderColumn) }));
1547
- });
1548
- const renderColumn = (menuItem, index) => {
1549
- const { text, items, href, target, onClick } = menuItem;
1550
- return (jsxs("div", { className: "flex flex-col gap-3.5 w-1/4", children: [jsx("a", { className: "leading-5 text-l text-primary-text hover:text-primary-main no-underline", href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }), items?.map((_, i) => (jsx(ColumnItem, { ..._, basePath: appendSlash(href), index: i }, String(i))))] }, String(index)));
1551
- };
1552
- const ColumnItem = JSX(({ text, index, basePath, ...rest }) => {
1553
- const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
1554
- const link = useLink({ isRemote: isAnotherPortal, basePath });
1555
- const { href, target, onClick } = link(rest);
1556
- return (jsx("a", { className: style('text-l-light text-secondary-text hover:text-primary-main no-underline', 'overflow-x-hidden overflow-ellipsis whitespace-nowrap'), href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }));
1557
- });
1558
-
1559
- const SearchInput = JSX(({ className, value, autoFocus, onChange, onFocus }) => {
1560
- const handleChange = useCallback((ev) => {
1561
- onChange && onChange(ev.target?.value || '');
1562
- }, [onChange]);
1563
- return (jsxs("div", { className: style('font-sans relative', className), role: "form", children: [jsx("div", { className: "absolute h-full flex items-center pl-4 pointer-events-none", children: jsx(Img, { image: { icon: 'LoupeIcon' }, width: "24", height: "24" }) }), jsx("input", { className: style('h-12 pl-12 w-full text-l text-black outline-none box-border', 'border border-solid rounded-md border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'), value: value, type: "text", name: "search-bar-input", placeholder: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443", autoFocus: autoFocus, onChange: handleChange, onFocus: onFocus })] }));
1564
- });
1565
-
1566
- const SEARCH_DIALOG_ID = 'search';
1567
- JSX(({ topItems }) => {
1568
- const dialogProps = useDialogProps(SEARCH_DIALOG_ID);
1569
- const basePathList = useMemo(() => topItems?.map((_) => _.href || '/'), [topItems]);
1570
- const [searchResult, searchInputProps] = useSearch({
1571
- basePathList,
1572
- initialQuery: dialogProps.message,
1573
- wasOpened: dialogProps.wasOpened,
1574
- });
1575
- const searchItems = useMemo(() => combineTopItemsAndSearchResult(topItems)(searchResult), [topItems, searchResult]);
1576
- useEffect(() => printSearchItems(searchItems), [searchItems]); // Temp
1577
- return (jsx(Dialog, { ...dialogProps, head: jsx(SearchInput, { className: "my-5", autoFocus: true, ...searchInputProps }), children: jsx(Sitemap, { topItems: searchItems }) }));
1578
- });
1579
- const combineTopItemsAndSearchResult = (topItems) => (searchResult) => topItems?.length && searchResult?.length
1580
- ? zip(topItems, searchResult).map(([_, portalSearchResult]) => ({
1581
- ..._,
1582
- items: portalSearchResult?.map(({ title, uri }) => ({ text: title, href: joinPath('/', uri) })),
1583
- }))
1584
- : [];
1585
- // Temp
1586
- function printSearchItems(topItems) {
1587
- for (const _ of topItems.filter(({ items }) => items?.length)) {
1588
- console.group(_.text);
1589
- console.table(_.items, ['text', 'href']);
1590
- console.groupEnd();
1591
- }
1592
- }
1593
-
1594
- const MIN_QUERY_LEN = 3;
1595
- const SearchBar = JSX(({ className }) => {
1596
- const [value, setValue] = useState('');
1597
- const resetQueryOnDialogClose = useCallback(() => setValue(''), []);
1598
- useDialogHandlers({ onClose: resetQueryOnDialogClose });
1599
- const { open } = useDialog(SEARCH_DIALOG_ID);
1600
- const handleInitialInputChange = useCallback((_) => {
1601
- setValue(_);
1602
- if (isQueryLongEnough(_)) {
1603
- open(_);
1604
- }
1605
- }, []);
1606
- return (jsxs("div", { className: className, children: [jsx(SearchInput, { value: value, onChange: handleInitialInputChange }), jsx(CloseButton, { className: "absolute top-2 right-3 sm:hidden", onClick: resetQueryOnDialogClose })] }));
1607
- });
1608
- const isQueryLongEnough = (_) => _ && _.length >= MIN_QUERY_LEN;
1609
-
1610
- const HeaderBurger = JSX(({ burgerSubMenu, onClick, defaultLocation = '', children }) => {
1611
- const [location] = useLocation(defaultLocation);
1612
- return (jsxs("div", { className: "absolute top-0 left-0 w-full h-full bg-white p-4 box-border z-20", children: [jsx("button", { className: "absolute top-4 right-4 border-none bg-transparent cursor-pointer", onClick: onClick, children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) }), jsxs("button", { className: "flex items-center text-s p-0 mb-4 bg-transparent cursor-pointer", children: [jsx(Img, { image: { icon: 'GeolocationIcon' }, width: "20", height: "20", className: "text-primary-main box-border mr-2" }), jsx(Text, { color: "text-secondary-text", children: location.name })] }), children, jsx("div", { className: "mb-7", children: burgerSubMenu?.map(renderBurgerSubMenuItem) }), jsx(SearchBar, { className: "grow" })] }));
1613
- });
1614
- const renderBurgerSubMenuItem = (menu, i) => {
1615
- const { icon, href, text } = menu;
1616
- return (jsxs("a", { href: href, className: "flex text-s mb-4 hover:text-primary-main", children: [icon ? jsx(Img, { className: "text-primary-main pr-1", image: icon, width: "24", height: "24" }) : null, jsx("span", { className: "font-medium pl-0.5", children: text })] }, `headerSubMenu-${i}`));
1617
- };
1618
-
1619
1259
  const ICON_VERSION_MAP = {
1620
1260
  'bg-white': 'color',
1621
1261
  transparent: 'white',
@@ -1643,22 +1283,27 @@
1643
1283
  return (jsxs("a", { className: `inline-flex items-center font-sans no-underline ${className}`, href: href || 'https://rshb.ru/', target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title || 'Россельхозбанк', children: [renderImage$1(bgColor, logo?.image, { width: '34', height: '34' }), showTitle ? renderTitle(children || logo?.title, bgColor, 'text-s') : null] }));
1644
1284
  });
1645
1285
 
1646
- const HeaderTop = JSX(({ onClick, bgColor, logo }) => (jsxs("div", { className: "flex items-center justify-between border-0 border-b border-main-divider h-12", children: [jsxs("div", { className: "flex items-center", children: [jsx("button", { className: "pl-0 pr-4 border-0 bg-transparent cursor-pointer", onClick: onClick, "aria-label": "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043C\u0435\u043D\u044E", children: jsx(Img, { image: { icon: 'BurgerIcon', iconVersion: bgColor === 'bg-white' ? 'black' : 'white' }, className: "text-primary-text w-6 h-6", width: "24", height: "24" }) }), jsx(Logo, { className: "mr-8", bgColor: bgColor, logo: logo })] }), jsx("button", { className: "text-primary-main group-data-transparent:text-white group-data-transparent:hover:text-primary-hover text-s border-0 bg-transparent", children: "\u0412\u043E\u0439\u0442\u0438" })] })));
1286
+ const BUTTON_STYLE = {
1287
+ default: 'px-5 bg-main-divider rounded hover:text-primary-main',
1288
+ transparent: 'text-white hover:text-primary-hover',
1289
+ };
1290
+ const HeaderTop = JSX(({ bgColor, logo, internetBankUrl, version, mobileHeaderType, mobileTitle, mobileBackwardButtonTitle, }) => {
1291
+ const isTypeNone = mobileHeaderType === 'none';
1292
+ const isTypeWithTitle = mobileHeaderType === 'withTitle';
1293
+ return (jsxs("div", { className: "flex items-center justify-between w-full", children: [isTypeNone || isTypeWithTitle ? (jsx(Logo, { bgColor: bgColor, logo: logo, showTitle: isTypeNone })) : null, isTypeWithTitle ? mobileTitle : null, mobileHeaderType === 'backwardButton' ? (jsxs(Button, { className: "flex items-center text-l", children: [jsx(Img, { className: "w-6 h-6", image: {
1294
+ icon: 'ChevronLeft',
1295
+ iconVersion: 'black',
1296
+ } }), mobileBackwardButtonTitle] })) : null, internetBankUrl ? (jsx(Button, { href: internetBankUrl, ariaLabel: "\u0412\u043E\u0439\u0442\u0438", target: "_blank", className: style('p-3 my-1 text-s whitespace-nowrap text-primary-main hover:text-primary-hover', BUTTON_STYLE[version === 'transparent' ? 'transparent' : 'default']), children: "\u0412\u043E\u0439\u0442\u0438" })) : null] }));
1297
+ });
1647
1298
 
1648
1299
  const BG_COLOR_TO_BLOCK_VERSION = {
1649
1300
  'bg-white': 'primary',
1650
1301
  transparent: 'transparent',
1651
1302
  };
1652
- const Header = JSX(({ bgColor = 'bg-white', version = BG_COLOR_TO_BLOCK_VERSION[bgColor], ...rest }) => {
1653
- const router = useRouter();
1303
+ const Header = JSX(({ bgColor = 'bg-white', version = BG_COLOR_TO_BLOCK_VERSION[bgColor], mobileHeaderType = 'none', ...rest }) => {
1654
1304
  const fallback = rest.options?.page?.fallback;
1655
- const { topItems, dispositions, defaultLocation, logo } = useSWRResource(projectSettings.SITEMAP || 'sitemap', fallback);
1656
- const activeTopItem = topItems?.find(isTopItemActive(router));
1657
- const subItems = activeTopItem?.items;
1658
- const activeSubItem = findActiveSubItem(router)(subItems);
1659
- const [burgerMenuShow, setBurgerMenuShow] = useState(false);
1660
- const handleBurgerMenuShow = useCallback(() => setBurgerMenuShow((_) => !_), []);
1661
- return (jsxs(BlockWrapper, { tag: "header", version: version, ...rest, children: [jsxs("div", { className: "container px-4 py-0 box-border", children: [jsx(HeaderTop, { onClick: handleBurgerMenuShow, bgColor: bgColor, logo: logo }), jsx("nav", { className: "flex items-center m-0 p-0 overflow-y-hidden w-full h-12", children: jsx("div", { className: "flex no-scrollbar horizontal-list h-full items-center", children: subItems?.map((_, i) => (jsx(HeaderItem, { className: "mr-8 whitespace-nowrap text-s", active: _ === activeSubItem, ..._ }, String(i)))) }) })] }), burgerMenuShow ? (jsx(HeaderBurger, { onClick: handleBurgerMenuShow, burgerSubMenu: dispositions, defaultLocation: defaultLocation, children: jsx("div", { className: "list-none m-0 p-0", children: topItems?.map((item, i) => (jsx(RollupItem, { label: item.text, children: jsx(LinkList, { className: "mt-2.5", items: item.items }) }, String(i)))) }) })) : null] }));
1305
+ const { logo, internetBankUrl } = useSWRResource(projectSettings.SITEMAP || 'sitemap', fallback);
1306
+ return (jsx(BlockWrapper, { tag: "header", version: version, ...rest, children: jsx("div", { className: "container px-4 py-1 box-border", children: jsx(HeaderTop, { bgColor: bgColor, logo: logo, internetBankUrl: internetBankUrl, version: version, mobileHeaderType: mobileHeaderType, ...rest }) }) }));
1662
1307
  });
1663
1308
 
1664
1309
  const ImgBlock = JSX((props) => {
@@ -1750,7 +1395,8 @@
1750
1395
  return (jsx("div", { className: style(richVersion, 'md-container'), dangerouslySetInnerHTML: { __html } }));
1751
1396
  });
1752
1397
 
1753
- const BaseTile = JSX(({ className, title = '', insetTitle = '', buttons, leftImage, rightImage, backImage, children, }) => (jsxs("div", { className: style('relative flex flex-col font-sans', className), children: [backImage ? jsx("div", { className: "absolute bottom-0 right-0 z-0", children: backImage }) : null, title, jsxs("div", { className: "grow relative flex flex-wrap justify-between items-stretch gap-8", children: [leftImage, jsxs("div", { className: style('flex flex-col gap-8', leftImage ? '' : 'grow'), children: [insetTitle, jsx("div", { className: "grow", children: children }), buttons] }), rightImage ? jsx("div", { className: "sm:-order-1 md:-order-1", children: rightImage }) : null] })] })));
1398
+ const BaseTile = JSX(({ className, title = '', insetTitle = '', buttons, leftImage, rightImage, backImage, children, }) => (jsxs("div", { className: style('relative flex flex-col font-sans', className), children: [backImage ? jsx("div", { className: "absolute bottom-0 right-0 z-0", children: backImage }) : null, title, jsxs("div", { className: "grow relative flex flex-wrap sm:flex-nowrap justify-between items-stretch gap-8", children: [renderImageContainer(leftImage), jsxs("div", { className: style('flex flex-col gap-8', leftImage ? '' : 'grow'), children: [insetTitle, jsx("div", { className: "grow", children: children }), buttons] }), renderImageContainer(rightImage, { className: '-order-1 sm:order-1' })] })] })));
1399
+ const renderImageContainer = (image, { className } = {}) => image ? jsx("div", { className: style('flex-none', className), children: image }) : null;
1754
1400
 
1755
1401
  const BenefitItem = JSX(({ className, icon, label, description, version = 'primary', benefitsVersion = 'normal' }) => (jsxs("div", { className: style('flex gap-5', description ? 'items-start' : 'items-center', className), children: [icon ? (jsx("div", { className: getBenefitIconBgStyle(version, benefitsVersion), children: jsx(Img, { className: "w-6 h-6", image: { ...icon, iconVersion: icon.iconVersion || benefitsVersion } }) })) : null, jsxs("div", { children: [label ? (jsx(Text, { size: "text-h6", color: "text-primary-text group-data-secondary:text-white", children: label })) : null, description ? (jsx(Paragraph, { size: "text-m-light", color: "text-secondary-text group-data-secondary:text-white", children: description })) : null] })] })));
1756
1402
  function getBenefitIconBgStyle(version, benefitsVersion) {
@@ -1769,7 +1415,7 @@
1769
1415
  const ProductBlockInner = JSX(({ className, version = 'primary', headlineVersion = 'L', title, description, benefits, benefitsVersion, items, isDotted = true, __html, buttons, image, directionRight = true, }) => {
1770
1416
  const benefitsWithLabel = benefits?.filter((_) => _.label);
1771
1417
  const img = image?.src ? jsx(Img, { className: "mt-[-50px]", image: image }) : null;
1772
- return (jsxs(BaseTile, { className: className, insetTitle: jsx(Headline, { className: "max-w-[600px] xl:max-w-[800px]", title: title, description: description, headlineVersion: headlineVersion, align: "text-left", isPadding: false }), ...(directionRight ? { rightImage: img } : { leftImage: img }), buttons: renderButtonsSection(buttons), children: [benefitsWithLabel?.length ? (jsx("div", { className: "flex flex-wrap gap-6", children: benefitsWithLabel.map(renderBenefit(version, benefitsVersion)) })) : null, __html ? (jsx("div", { className: "mt-5", children: jsx(RichText, { __html: __html }) })) : null, items?.length ? jsx(List, { className: "mt-5", items: items, isDotted: isDotted }) : null] }));
1418
+ return (jsxs(BaseTile, { className: className, insetTitle: jsx(Headline, { className: "max-w-[600px] xl:max-w-[728px]", title: title, description: description, headlineVersion: headlineVersion, align: "text-left", isPadding: false }), ...(directionRight ? { rightImage: img } : { leftImage: img }), buttons: renderButtonsSection(buttons), children: [benefitsWithLabel?.length ? (jsx("div", { className: "flex flex-wrap gap-6", children: benefitsWithLabel.map(renderBenefit(version, benefitsVersion)) })) : null, __html ? (jsx("div", { className: "mt-5", children: jsx(RichText, { __html: __html }) })) : null, items?.length ? jsx(List, { className: "mt-5", items: items, isDotted: isDotted }) : null] }));
1773
1419
  });
1774
1420
 
1775
1421
  function renderBackwardButton({ text, href, target, icon }, version) {
@@ -1786,11 +1432,21 @@
1786
1432
  ? renderBackwardButton(backwardButton, !rest.version || rest.version === 'primary' ? 'primary' : 'white')
1787
1433
  : null, jsx(ProductBlockInner, { className: "grow", ...rest })] })));
1788
1434
 
1435
+ const ProductGallery = JSX(({ className = '', slides = [], ...rest }) => {
1436
+ const galleryBlocks = slides.map((s) => s.productBlock);
1437
+ return (jsx(BlockWrapper, { className: `box-border py-6 overflow-hidden relative w-100 mb-6 ${className}`, ...rest, children: jsx(SwipeListControl, { gap: 0, padding: 0, children: galleryBlocks.map((_, i) => renderProductBlock({ ..._, ...rest }, i)) }) }));
1438
+ });
1439
+ const renderProductBlock = (block, i) => (jsx(ProductBlockInner, { className: "z-10 px-5 group-data-secondary:text-white", ...block }, String(i)));
1440
+
1789
1441
  const RichTextBlock = JSX((props) => {
1790
1442
  const { __html, richVersion, ...rest } = props;
1791
1443
  return (jsx(BlockWrapper, { ...rest, children: jsx(RichText, { __html: __html, richVersion: richVersion }) }));
1792
1444
  });
1793
1445
 
1446
+ function assertUnreachable(x) {
1447
+ throw new Error(x);
1448
+ }
1449
+
1794
1450
  const checkCanRenderIcon = (icon) => Boolean(icon?.icon || icon?.src);
1795
1451
 
1796
1452
  const STEPS_BLOCK_STYLE = {
@@ -1943,8 +1599,18 @@
1943
1599
  RollupItem,
1944
1600
  VerticalLayout,
1945
1601
  CarouselRecommendationCard,
1602
+ CarouselProgramsCard,
1603
+ ProductGallery,
1946
1604
  };
1947
1605
 
1606
+ function useBool(defaultValue = false) {
1607
+ const [value, setValue] = useState(defaultValue);
1608
+ const setTrue = useCallback(() => setValue(true), []);
1609
+ const setFalse = useCallback(() => setValue(false), []);
1610
+ const toggle = useCallback(() => setValue((_) => !_), []);
1611
+ return [value, { setValue, setTrue, setFalse, toggle }];
1612
+ }
1613
+
1948
1614
  const debounce = (fn, delay = 600) => {
1949
1615
  let timerId;
1950
1616
  const debouncedCallback = (...args) => {
@@ -2000,6 +1666,53 @@
2000
1666
  }, [scrollTarget]);
2001
1667
  }
2002
1668
 
1669
+ const CloseButton = JSX(({ className, onClick }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-1 bg-transparent border-none', className), onClick: onClick, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) })));
1670
+
1671
+ function useDialogHandlers({ onOpen, onClose } = {}) {
1672
+ useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
1673
+ switch (action.type) {
1674
+ case 'open':
1675
+ onOpen && onOpen(action);
1676
+ break;
1677
+ case 'close':
1678
+ onClose && onClose();
1679
+ break;
1680
+ default:
1681
+ assertUnreachable(action);
1682
+ }
1683
+ }), [onOpen, onClose]);
1684
+ }
1685
+
1686
+ function useDialogProps(id, initOpen = false) {
1687
+ const [isOpened, { setTrue: open, setFalse: close }] = useBool(initOpen);
1688
+ const [params, setParams] = useState({ id });
1689
+ const wasOpened = useRef(isOpened);
1690
+ wasOpened.current ||= isOpened;
1691
+ const handleOpen = useCallback((_) => {
1692
+ if (_.id === id) {
1693
+ setParams(_);
1694
+ open();
1695
+ }
1696
+ else {
1697
+ close();
1698
+ }
1699
+ }, [id]);
1700
+ useDialogHandlers({
1701
+ onOpen: handleOpen,
1702
+ onClose: close,
1703
+ });
1704
+ const handleCloseAsEventSource = useCallback(() => {
1705
+ close();
1706
+ defaultEventBus.fire('dialog', { type: 'close' });
1707
+ }, []);
1708
+ return {
1709
+ ...params,
1710
+ isOpened,
1711
+ wasOpened: wasOpened.current,
1712
+ onClose: handleCloseAsEventSource,
1713
+ };
1714
+ }
1715
+
2003
1716
  const COOKIE_DIALOG_ID = 'cookie';
2004
1717
  const LOCAL_STORAGE_NAME = 'cookieClose';
2005
1718
  const CookiePopup = JSX(({ termLink, personalDataPolicyLink }) => {
@@ -2087,7 +1800,7 @@
2087
1800
 
2088
1801
  const joinList = (sep) => (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: `sep-${i}` }, el) : [el]), []);
2089
1802
 
2090
- const packageVersion = "0.11.0";
1803
+ const packageVersion = "0.11.2";
2091
1804
 
2092
1805
  exports.Blocks = Blocks;
2093
1806
  exports.ContentPage = ContentPage;