@redneckz/wildless-cms-uni-blocks 0.2.99 → 0.2.103

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 (288) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +126 -63
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/BlockContent.d.ts +3 -2
  5. package/dist/components/Blocks.d.ts +1 -0
  6. package/dist/components/Blocks.js +2 -0
  7. package/dist/components/Blocks.js.map +1 -1
  8. package/dist/components/CreditCalculator/CreditCalculator.js +2 -2
  9. package/dist/components/CreditCalculator/CreditCalculator.js.map +1 -1
  10. package/dist/components/Footer/FooterContent.d.ts +1 -1
  11. package/dist/components/Footer/Sitemap.d.ts +1 -1
  12. package/dist/components/Footer/Sitemap.js +2 -2
  13. package/dist/components/Footer/Sitemap.js.map +1 -1
  14. package/dist/components/Header/Header.js +13 -9
  15. package/dist/components/Header/Header.js.map +1 -1
  16. package/dist/components/Header/HeaderContent.d.ts +8 -1
  17. package/dist/components/Header/HeaderSecondaryMenu.d.ts +2 -1
  18. package/dist/components/Header/HeaderSecondaryMenu.js +14 -2
  19. package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  20. package/dist/components/Header/HeaderSecondaryMenuButton.js +1 -1
  21. package/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  22. package/dist/components/Headline/HeadlineContent.d.ts +2 -9
  23. package/dist/components/MobileBlocks.d.ts +1 -0
  24. package/dist/components/MobileBlocks.js +2 -0
  25. package/dist/components/MobileBlocks.js.map +1 -1
  26. package/dist/components/Navigation/Navigation.d.ts +5 -0
  27. package/dist/components/Navigation/Navigation.js +16 -0
  28. package/dist/components/Navigation/Navigation.js.map +1 -0
  29. package/dist/components/Navigation/NavigationContent.d.ts +10 -0
  30. package/dist/components/Navigation/NavigationContent.js +2 -0
  31. package/dist/components/Navigation/NavigationContent.js.map +1 -0
  32. package/dist/components/Navigation/NavigationItem.d.ts +4 -0
  33. package/dist/components/Navigation/NavigationItem.js +6 -0
  34. package/dist/components/Navigation/NavigationItem.js.map +1 -0
  35. package/dist/components/StepsBlock/StepsBlock.d.ts +1 -1
  36. package/dist/components/StepsBlock/StepsBlock.js +3 -3
  37. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  38. package/dist/components/StepsBlock/StepsBlockContent.d.ts +5 -2
  39. package/dist/hooks/useLink.js +2 -1
  40. package/dist/hooks/useLink.js.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/model/BgColorVersion.d.ts +8 -0
  44. package/dist/model/BgColorVersion.js +2 -0
  45. package/dist/model/BgColorVersion.js.map +1 -0
  46. package/dist/services/sitemap/SitemapProps.d.ts +13 -0
  47. package/dist/services/sitemap/SitemapProps.js +2 -0
  48. package/dist/services/sitemap/SitemapProps.js.map +1 -0
  49. package/dist/services/sitemap/findActiveSubItem.d.ts +3 -0
  50. package/dist/services/sitemap/findActiveSubItem.js +13 -0
  51. package/dist/services/sitemap/findActiveSubItem.js.map +1 -0
  52. package/dist/services/sitemap/isHrefActive.d.ts +4 -0
  53. package/dist/services/sitemap/isHrefActive.js +9 -0
  54. package/dist/services/sitemap/isHrefActive.js.map +1 -0
  55. package/dist/services/sitemap/isSubItemActive.d.ts +3 -0
  56. package/dist/services/sitemap/isSubItemActive.js +6 -0
  57. package/dist/services/sitemap/isSubItemActive.js.map +1 -0
  58. package/dist/services/sitemap/isTopItemActive.d.ts +3 -0
  59. package/dist/services/sitemap/isTopItemActive.js +7 -0
  60. package/dist/services/sitemap/isTopItemActive.js.map +1 -0
  61. package/dist/services/sitemap/mergeTopItems.d.ts +2 -0
  62. package/dist/{mergeTopItems.js → services/sitemap/mergeTopItems.js} +1 -3
  63. package/dist/services/sitemap/mergeTopItems.js.map +1 -0
  64. package/dist/services/sitemap/useSitemap.d.ts +3 -0
  65. package/dist/{hooks → services/sitemap}/useSitemap.js +1 -1
  66. package/dist/services/sitemap/useSitemap.js.map +1 -0
  67. package/dist/ui-kit/Button/ButtonProps.d.ts +1 -1
  68. package/dist/ui-kit/HeaderItem/HeaderItem.js +16 -4
  69. package/dist/ui-kit/HeaderItem/HeaderItem.js.map +1 -1
  70. package/dist/ui-kit/Icon/IconProps.d.ts +83 -45
  71. package/dist/ui-kit/Icon/IconProps.js +62 -43
  72. package/dist/ui-kit/Icon/IconProps.js.map +1 -1
  73. package/dist/ui-kit/Logo/Logo.d.ts +1 -0
  74. package/dist/ui-kit/Logo/Logo.js +10 -2
  75. package/dist/ui-kit/Logo/Logo.js.map +1 -1
  76. package/dist/ui-kit/TopItem/TopItem.d.ts +2 -0
  77. package/dist/ui-kit/TopItem/TopItem.js +19 -7
  78. package/dist/ui-kit/TopItem/TopItem.js.map +1 -1
  79. package/dist/utils/adjustHref.d.ts +4 -0
  80. package/dist/utils/adjustHref.js +21 -0
  81. package/dist/utils/adjustHref.js.map +1 -0
  82. package/dist/utils/maxBy.d.ts +2 -0
  83. package/dist/utils/maxBy.js +7 -0
  84. package/dist/utils/maxBy.js.map +1 -0
  85. package/dist/utils/url.d.ts +0 -13
  86. package/dist/utils/url.js +2 -26
  87. package/dist/utils/url.js.map +1 -1
  88. package/dist/utils/withoutMobilePath.d.ts +2 -0
  89. package/dist/utils/withoutMobilePath.js +6 -0
  90. package/dist/utils/withoutMobilePath.js.map +1 -0
  91. package/lib/common.css +1 -1
  92. package/lib/components/BlockContent.d.ts +3 -2
  93. package/lib/components/Blocks.d.ts +1 -0
  94. package/lib/components/Blocks.js +2 -0
  95. package/lib/components/Blocks.js.map +1 -1
  96. package/lib/components/CreditCalculator/CreditCalculator.js +2 -2
  97. package/lib/components/CreditCalculator/CreditCalculator.js.map +1 -1
  98. package/lib/components/Footer/FooterContent.d.ts +1 -1
  99. package/lib/components/Footer/Sitemap.d.ts +1 -1
  100. package/lib/components/Footer/Sitemap.js +2 -2
  101. package/lib/components/Footer/Sitemap.js.map +1 -1
  102. package/lib/components/Header/Header.fixture.d.ts +4 -1
  103. package/lib/components/Header/Header.js +13 -9
  104. package/lib/components/Header/Header.js.map +1 -1
  105. package/lib/components/Header/HeaderContent.d.ts +8 -1
  106. package/lib/components/Header/HeaderSecondaryMenu.d.ts +2 -1
  107. package/lib/components/Header/HeaderSecondaryMenu.js +14 -2
  108. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  109. package/lib/components/Header/HeaderSecondaryMenuButton.js +1 -1
  110. package/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  111. package/lib/components/Headline/HeadlineContent.d.ts +2 -9
  112. package/lib/components/MobileBlocks.d.ts +1 -0
  113. package/lib/components/MobileBlocks.js +2 -0
  114. package/lib/components/MobileBlocks.js.map +1 -1
  115. package/lib/components/Navigation/Navigation.d.ts +5 -0
  116. package/lib/components/Navigation/Navigation.fixture.d.ts +2 -0
  117. package/lib/components/Navigation/Navigation.js +14 -0
  118. package/lib/components/Navigation/Navigation.js.map +1 -0
  119. package/lib/components/Navigation/NavigationContent.d.ts +10 -0
  120. package/lib/components/Navigation/NavigationContent.js +2 -0
  121. package/lib/components/Navigation/NavigationContent.js.map +1 -0
  122. package/lib/components/Navigation/NavigationItem.d.ts +4 -0
  123. package/lib/components/Navigation/NavigationItem.js +4 -0
  124. package/lib/components/Navigation/NavigationItem.js.map +1 -0
  125. package/lib/components/StepsBlock/StepsBlock.d.ts +1 -1
  126. package/lib/components/StepsBlock/StepsBlock.js +3 -3
  127. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  128. package/lib/components/StepsBlock/StepsBlockContent.d.ts +5 -2
  129. package/lib/hooks/useLink.js +2 -1
  130. package/lib/hooks/useLink.js.map +1 -1
  131. package/lib/index.d.ts +1 -1
  132. package/lib/index.js.map +1 -1
  133. package/lib/model/BgColorVersion.d.ts +8 -0
  134. package/lib/model/BgColorVersion.js +2 -0
  135. package/lib/model/BgColorVersion.js.map +1 -0
  136. package/lib/services/sitemap/SitemapProps.d.ts +13 -0
  137. package/lib/services/sitemap/SitemapProps.js +2 -0
  138. package/lib/services/sitemap/SitemapProps.js.map +1 -0
  139. package/lib/services/sitemap/findActiveSubItem.d.ts +3 -0
  140. package/lib/services/sitemap/findActiveSubItem.js +10 -0
  141. package/lib/services/sitemap/findActiveSubItem.js.map +1 -0
  142. package/lib/services/sitemap/isHrefActive.d.ts +4 -0
  143. package/lib/services/sitemap/isHrefActive.js +6 -0
  144. package/lib/services/sitemap/isHrefActive.js.map +1 -0
  145. package/lib/services/sitemap/isSubItemActive.d.ts +3 -0
  146. package/lib/services/sitemap/isSubItemActive.js +3 -0
  147. package/lib/services/sitemap/isSubItemActive.js.map +1 -0
  148. package/lib/services/sitemap/isTopItemActive.d.ts +3 -0
  149. package/lib/services/sitemap/isTopItemActive.js +4 -0
  150. package/lib/services/sitemap/isTopItemActive.js.map +1 -0
  151. package/lib/services/sitemap/mergeTopItems.d.ts +2 -0
  152. package/lib/{mergeTopItems.js → services/sitemap/mergeTopItems.js} +1 -3
  153. package/lib/services/sitemap/mergeTopItems.js.map +1 -0
  154. package/lib/services/sitemap/useSitemap.d.ts +3 -0
  155. package/lib/{hooks → services/sitemap}/useSitemap.js +1 -1
  156. package/lib/services/sitemap/useSitemap.js.map +1 -0
  157. package/lib/ui-kit/Button/ButtonProps.d.ts +1 -1
  158. package/lib/ui-kit/HeaderItem/HeaderItem.js +16 -4
  159. package/lib/ui-kit/HeaderItem/HeaderItem.js.map +1 -1
  160. package/lib/ui-kit/Icon/IconProps.d.ts +83 -45
  161. package/lib/ui-kit/Icon/IconProps.js +62 -43
  162. package/lib/ui-kit/Icon/IconProps.js.map +1 -1
  163. package/lib/ui-kit/Logo/Logo.d.ts +1 -0
  164. package/lib/ui-kit/Logo/Logo.js +10 -2
  165. package/lib/ui-kit/Logo/Logo.js.map +1 -1
  166. package/lib/ui-kit/TopItem/TopItem.d.ts +2 -0
  167. package/lib/ui-kit/TopItem/TopItem.js +19 -7
  168. package/lib/ui-kit/TopItem/TopItem.js.map +1 -1
  169. package/lib/utils/adjustHref.d.ts +4 -0
  170. package/lib/utils/adjustHref.js +18 -0
  171. package/lib/utils/adjustHref.js.map +1 -0
  172. package/lib/utils/maxBy.d.ts +2 -0
  173. package/lib/utils/maxBy.js +3 -0
  174. package/lib/utils/maxBy.js.map +1 -0
  175. package/lib/utils/url.d.ts +0 -13
  176. package/lib/utils/url.js +1 -21
  177. package/lib/utils/url.js.map +1 -1
  178. package/lib/utils/withoutMobilePath.d.ts +2 -0
  179. package/lib/utils/withoutMobilePath.js +3 -0
  180. package/lib/utils/withoutMobilePath.js.map +1 -0
  181. package/package.json +4 -2
  182. package/src/components/BlockContent.ts +4 -2
  183. package/src/components/Blocks.ts +2 -0
  184. package/src/components/ContentPage/ContentPage.page.json +28 -15
  185. package/src/components/CreditCalculator/CreditCalculator.tsx +4 -6
  186. package/src/components/Footer/FooterContent.ts +1 -1
  187. package/src/components/Footer/Sitemap.tsx +4 -3
  188. package/src/components/Header/Header.fixture.tsx +4 -18
  189. package/src/components/Header/Header.tsx +56 -45
  190. package/src/components/Header/HeaderContent.ts +8 -1
  191. package/src/components/Header/HeaderSecondaryMenu.tsx +25 -12
  192. package/src/components/Header/HeaderSecondaryMenuButton.tsx +2 -4
  193. package/src/components/Headline/HeadlineContent.ts +2 -10
  194. package/src/components/MobileBlocks.ts +2 -0
  195. package/src/components/Navigation/Navigation.fixture.tsx +28 -0
  196. package/src/components/Navigation/Navigation.tsx +39 -0
  197. package/src/components/Navigation/NavigationContent.ts +11 -0
  198. package/src/components/Navigation/NavigationItem.tsx +17 -0
  199. package/src/components/PictureText/PictureText.example.json +2 -2
  200. package/src/components/PictureText/PictureText.fixture.tsx +2 -2
  201. package/src/components/StepsBlock/StepsBlock.example.json +3 -1
  202. package/src/components/StepsBlock/StepsBlock.tsx +21 -16
  203. package/src/components/StepsBlock/StepsBlockContent.ts +5 -2
  204. package/src/hooks/useLink.ts +2 -1
  205. package/src/icons/Calendar2Icon.svg +1 -0
  206. package/src/icons/CalendarCircleIcon.svg +1 -0
  207. package/src/icons/CalendarTickIcon.svg +1 -0
  208. package/src/icons/CardIcon.svg +1 -0
  209. package/src/icons/CardPosIcon.svg +1 -0
  210. package/src/icons/CardTickIcon.svg +1 -0
  211. package/src/icons/CardWithGemIcon.svg +1 -0
  212. package/src/icons/ChartSquareIcon.svg +1 -0
  213. package/src/icons/CreditCardsIcon.svg +1 -0
  214. package/src/icons/DischountStarIcon.svg +1 -0
  215. package/src/icons/{DocumentText.svg → DocumentTextIcon.svg} +0 -0
  216. package/src/icons/EarthIcon.svg +1 -0
  217. package/src/icons/EmptyWalletChangeIcon.svg +1 -0
  218. package/src/icons/GlobalIcon.svg +1 -0
  219. package/src/icons/GridIcon.svg +1 -1
  220. package/src/icons/GridIconWhite.svg +4 -0
  221. package/src/icons/InterestGrowthIcon.svg +1 -0
  222. package/src/icons/InterestIcon.svg +1 -0
  223. package/src/icons/JCBIcon.svg +1 -0
  224. package/src/icons/MasterCardIcon.svg +1 -0
  225. package/src/icons/MinusIcon.svg +1 -0
  226. package/src/icons/MirIcon.svg +1 -0
  227. package/src/icons/MoneyIcon.svg +1 -0
  228. package/src/icons/MoneyInsuranceIcon.svg +1 -0
  229. package/src/icons/MonitorMobileIcon.svg +1 -0
  230. package/src/icons/OfficeIcon.svg +1 -0
  231. package/src/icons/PercentageRoundIcon.svg +1 -0
  232. package/src/icons/PersonalCardIcon.svg +1 -0
  233. package/src/icons/PlusIcon.svg +1 -0
  234. package/src/icons/Profile2UserIcon.svg +1 -0
  235. package/src/icons/RoundRubleIcon.svg +1 -0
  236. package/src/icons/SafeIcon.svg +1 -0
  237. package/src/icons/ShieldTickIcon.svg +1 -0
  238. package/src/icons/SmallClockIcon.svg +1 -0
  239. package/src/icons/UnionPayIcon.svg +1 -0
  240. package/src/icons/UserTickIcon.svg +1 -0
  241. package/src/icons/VisaIcon.svg +1 -0
  242. package/src/icons/WalletAdd2Icon.svg +1 -0
  243. package/src/icons/WalletAddIcon.svg +1 -0
  244. package/src/icons/WalletWithMoneyIcon.svg +1 -0
  245. package/src/index.ts +1 -1
  246. package/src/model/BgColorVersion.ts +8 -0
  247. package/src/services/sitemap/SitemapProps.ts +15 -0
  248. package/src/services/sitemap/findActiveSubItem.ts +14 -0
  249. package/src/services/sitemap/isHrefActive.ts +13 -0
  250. package/src/services/sitemap/isSubItemActive.ts +8 -0
  251. package/src/services/sitemap/isTopItemActive.ts +9 -0
  252. package/src/{mergeTopItems.spec.ts → services/sitemap/mergeTopItems.spec.ts} +0 -0
  253. package/src/{mergeTopItems.ts → services/sitemap/mergeTopItems.ts} +3 -4
  254. package/src/{hooks → services/sitemap}/useSitemap.ts +3 -3
  255. package/src/ui-kit/Button/ButtonProps.ts +1 -1
  256. package/src/ui-kit/HeaderItem/HeaderItem.tsx +32 -18
  257. package/src/ui-kit/Icon/IconProps.ts +44 -6
  258. package/src/ui-kit/Logo/Logo.tsx +30 -18
  259. package/src/ui-kit/TopItem/TopItem.tsx +46 -19
  260. package/src/utils/adjustHref.spec.ts +25 -0
  261. package/src/utils/adjustHref.ts +24 -0
  262. package/src/utils/maxBy.spec.ts +11 -0
  263. package/src/utils/maxBy.ts +7 -0
  264. package/src/utils/url.spec.ts +1 -37
  265. package/src/utils/url.ts +2 -39
  266. package/src/utils/withoutMobilePath.ts +3 -0
  267. package/dist/components/Header/isSubItemActive.d.ts +0 -3
  268. package/dist/components/Header/isSubItemActive.js +0 -8
  269. package/dist/components/Header/isSubItemActive.js.map +0 -1
  270. package/dist/components/Header/isTopItemActive.d.ts +0 -3
  271. package/dist/components/Header/isTopItemActive.js +0 -8
  272. package/dist/components/Header/isTopItemActive.js.map +0 -1
  273. package/dist/hooks/useSitemap.d.ts +0 -3
  274. package/dist/hooks/useSitemap.js.map +0 -1
  275. package/dist/mergeTopItems.d.ts +0 -2
  276. package/dist/mergeTopItems.js.map +0 -1
  277. package/lib/components/Header/isSubItemActive.d.ts +0 -3
  278. package/lib/components/Header/isSubItemActive.js +0 -5
  279. package/lib/components/Header/isSubItemActive.js.map +0 -1
  280. package/lib/components/Header/isTopItemActive.d.ts +0 -3
  281. package/lib/components/Header/isTopItemActive.js +0 -5
  282. package/lib/components/Header/isTopItemActive.js.map +0 -1
  283. package/lib/hooks/useSitemap.d.ts +0 -3
  284. package/lib/hooks/useSitemap.js.map +0 -1
  285. package/lib/mergeTopItems.d.ts +0 -2
  286. package/lib/mergeTopItems.js.map +0 -1
  287. package/src/components/Header/isSubItemActive.ts +0 -7
  288. package/src/components/Header/isTopItemActive.ts +0 -8
@@ -1,10 +1,22 @@
1
1
  import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
- export const TopItem = JSX(({ className, text, href, target, active, flat, onClick, children, ariaLabel }) => {
4
- const linkStyle = active ? 'border-primary-main rounded-md' : 'border-transparent';
5
- const textStyle = active
6
- ? 'text-primary-main'
7
- : `${flat ? 'text-primary-text' : 'text-secondary-text'} hover:text-primary-main`;
8
- return (_jsx("a", { className: `inline-block border border-solid bg-transparent text-center no-underline ${flat ? '' : 'px-4 py-2'} ${linkStyle} ${className || ''}`, href: href, target: target, onClick: onClick, rel: "noopener noreferrer", "aria-label": ariaLabel, children: _jsx("span", { className: `font-sans font-normal text-sm ${textStyle}`, children: text || children }) }));
9
- });
3
+ const TEXT_CLASSES = 'font-sans font-normal text-sm';
4
+ const LINK_CLASSES = 'inline-block border border-solid bg-transparent text-center no-underline';
5
+ export const TopItem = JSX(({ className = '', text, href, target, active, flat, onClick, children, ariaLabel, bgColor = 'bg-white', }) => (_jsx("a", { className: `${getLinkClasses(bgColor, active, flat)} ${className}`, href: href, target: target, onClick: onClick, rel: "noopener noreferrer", "aria-label": ariaLabel, children: _jsx("span", { className: getTextClasses(bgColor, active, flat), children: text || children }) })));
6
+ const getLinkClasses = (bgColor, active, flat) => {
7
+ let classes = 'border-transparent';
8
+ if (active) {
9
+ classes = `rounded-md ${bgColor === 'bg-white' ? 'border-primary-main' : 'border-white'}`;
10
+ }
11
+ return `${classes} ${LINK_CLASSES} ${flat ? '' : 'px-4 py-2'}`;
12
+ };
13
+ const getTextClasses = (bgColor, active, flat) => {
14
+ let classes = 'text-white';
15
+ if (bgColor === 'bg-white') {
16
+ classes = active
17
+ ? 'text-primary-main'
18
+ : `${flat ? 'text-primary-text' : 'text-secondary-text'} hover:text-primary-main`;
19
+ }
20
+ return `${classes} ${TEXT_CLASSES}`;
21
+ };
10
22
  //# sourceMappingURL=TopItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopItem.js","sourceRoot":"","sources":["../../../src/ui-kit/TopItem/TopItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAcxC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CACxB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IAChF,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACnF,MAAM,SAAS,GAAG,MAAM;QACtB,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,qBAAqB,0BAA0B,CAAC;IAEpF,OAAO,CACL,YACE,SAAS,EAAE,4EACT,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WACd,IAAI,SAAS,IAAI,SAAS,IAAI,EAAE,EAAE,EAClC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,GAAG,EAAC,qBAAqB,gBACb,SAAS,YAErB,eAAM,SAAS,EAAE,iCAAiC,SAAS,EAAE,YAAG,IAAI,IAAI,QAAQ,GAAQ,GACtF,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"TopItem.js","sourceRoot":"","sources":["../../../src/ui-kit/TopItem/TopItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAgBxC,MAAM,YAAY,GAAG,+BAA+B,CAAC;AACrD,MAAM,YAAY,GAAG,0EAA0E,CAAC;AAEhG,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CACxB,CAAC,EACC,SAAS,GAAG,EAAE,EACd,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,UAAU,GACrB,EAAE,EAAE,CAAC,CACJ,YACE,SAAS,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,SAAS,EAAE,EAClE,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,GAAG,EAAC,qBAAqB,gBACb,SAAS,YAErB,eAAM,SAAS,EAAE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,YAAG,IAAI,IAAI,QAAQ,GAAQ,GAC/E,CACL,CACF,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,OAAuB,EAAE,MAAgB,EAAE,IAAc,EAAE,EAAE;IACnF,IAAI,OAAO,GAAG,oBAAoB,CAAC;IACnC,IAAI,MAAM,EAAE;QACV,OAAO,GAAG,cAAc,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;KAC3F;IAED,OAAO,GAAG,OAAO,IAAI,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,OAAuB,EAAE,MAAgB,EAAE,IAAc,EAAE,EAAE;IACnF,IAAI,OAAO,GAAG,YAAY,CAAC;IAC3B,IAAI,OAAO,KAAK,UAAU,EAAE;QAC1B,OAAO,GAAG,MAAM;YACd,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,qBAAqB,0BAA0B,CAAC;KACrF;IAED,OAAO,GAAG,OAAO,IAAI,YAAY,EAAE,CAAC;AACtC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const adjustHref: (href: string | undefined, router: {
2
+ pathname: string;
3
+ href?: string | undefined;
4
+ }) => string | undefined;
@@ -0,0 +1,18 @@
1
+ import { getOrigin, isURL } from './url.js';
2
+ import { MOBILE_URL_PATH } from './withoutMobilePath.js';
3
+ export const adjustHref = (href, router) => {
4
+ if (!href) {
5
+ return href;
6
+ }
7
+ const relativeHref = toRelativeHref(href, router) || '';
8
+ const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
9
+ return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
10
+ };
11
+ const toRelativeHref = (href, router) => {
12
+ if (!href) {
13
+ return href;
14
+ }
15
+ const origin = getOrigin(router?.href);
16
+ return origin ? href.replace(origin, '') || '/' : href;
17
+ };
18
+ //# sourceMappingURL=adjustHref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adjustHref.js","sourceRoot":"","sources":["../../src/utils/adjustHref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAwB,EACxB,MAA2C,EAC3C,EAAE;IACF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACxD,MAAM,YAAY,GAAG,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAClE,OAAO,YAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,GAAG,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAwB,EAAE,MAAyB,EAAE,EAAE;IAC7E,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const maxBy: <Item, Value>(discriminator: (item: Item) => Value) => (list: Item[]) => Item;
2
+ export declare const minBy: <Item, Value>(discriminator: (item: Item) => Value) => (list: Item[]) => Item;
@@ -0,0 +1,3 @@
1
+ export const maxBy = (discriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
2
+ export const minBy = (discriminator) => maxBy((_) => -discriminator(_));
3
+ //# sourceMappingURL=maxBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maxBy.js","sourceRoot":"","sources":["../../src/utils/maxBy.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAChB,CAAc,aAAoC,EAAE,EAAE,CACtD,CAAC,IAAY,EAAQ,EAAE,CACrB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAc,aAAoC,EAAE,EAAE,CACzE,KAAK,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,16 +1,3 @@
1
- export declare const MOBILE_URL_PATH = "/mobile";
2
1
  export declare const isURL: (href?: string) => boolean | undefined;
3
- export declare const isHrefActive: (href: string | undefined, router: {
4
- pathname?: string | undefined;
5
- href?: string | undefined;
6
- }, cmp?: (href: string, baseHref: string) => boolean) => boolean;
7
2
  export declare const withoutQuery: (href?: string) => string;
8
- export declare const withoutMobilePath: (href?: string) => string;
9
3
  export declare const getOrigin: (href?: string) => string | undefined;
10
- export declare const adjustHref: (href: string | undefined, router: {
11
- pathname: string;
12
- href?: string | undefined;
13
- }) => string | undefined;
14
- export declare const toRelativeHref: (href: string | undefined, router: {
15
- href?: string | undefined;
16
- }) => string | undefined;
package/lib/utils/url.js CHANGED
@@ -1,12 +1,7 @@
1
- export const MOBILE_URL_PATH = '/mobile';
2
1
  export const isURL = (href) => href?.includes('//');
3
- export const isHrefActive = (href, router, cmp = (href, baseHref) => href === baseHref) => {
4
- return cmp(withoutQuery(href), withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)));
5
- };
6
2
  export const withoutQuery = (href) => (href || '').replace(/\/?\?.*/, '');
7
- export const withoutMobilePath = (href) => (href || '').replace(MOBILE_URL_PATH, '');
8
3
  export const getOrigin = (href) => {
9
- if (!isURL(href)) {
4
+ if (!href || !isURL(href)) {
10
5
  return undefined;
11
6
  }
12
7
  const url = href;
@@ -15,19 +10,4 @@ export const getOrigin = (href) => {
15
10
  const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
16
11
  return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
17
12
  };
18
- export const adjustHref = (href, router) => {
19
- if (!href) {
20
- return href;
21
- }
22
- const relativeHref = toRelativeHref(href, router);
23
- const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
24
- return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
25
- };
26
- export const toRelativeHref = (href, router) => {
27
- if (!href) {
28
- return href;
29
- }
30
- const origin = getOrigin(router?.href);
31
- return origin ? href.replace(origin, '') || '/' : href;
32
- };
33
13
  //# sourceMappingURL=url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAwB,EACxB,MAA4C,EAC5C,MAAmD,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,EACxF,EAAE;IACF,OAAO,GAAG,CACR,YAAY,CAAC,IAAI,CAAC,EAClB,iBAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAK,CAAC;IAClB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAwB,EACxB,MAA2C,EAC3C,EAAE;IACF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAE,CAAC;IACnD,MAAM,YAAY,GAAG,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAClE,OAAO,YAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,GAAG,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAwB,EAAE,MAAyB,EAAE,EAAE;IACpF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC"}
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const MOBILE_URL_PATH = "/mobile";
2
+ export declare const withoutMobilePath: (href?: string) => string;
@@ -0,0 +1,3 @@
1
+ export const MOBILE_URL_PATH = '/mobile';
2
+ export const withoutMobilePath = (href) => (href || '').replace(MOBILE_URL_PATH, '');
3
+ //# sourceMappingURL=withoutMobilePath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withoutMobilePath.js","sourceRoot":"","sources":["../../src/utils/withoutMobilePath.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.2.99",
3
+ "version": "0.2.103",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -142,7 +142,9 @@
142
142
  ],
143
143
  "lint-staged": {
144
144
  "src/**/*.{js,jsx,ts,tsx,css}": [
145
- "prettier --write",
145
+ "prettier --write"
146
+ ],
147
+ "src/**/*.{js,jsx,ts,tsx}": [
146
148
  "eslint"
147
149
  ],
148
150
  "*.{js,jsx,ts,tsx,css,json}": [
@@ -6,6 +6,7 @@ import type { GalleryContent } from './Gallery/GalleryContent';
6
6
  import type { HeaderContent } from './Header/HeaderContent';
7
7
  import type { LinkDocsContent } from './LinkDocs/LinkDocsContent';
8
8
  import type { MobileAppTileContent } from './MobileAppTile/MobileAppTileContent';
9
+ import type { NavigationContent } from './Navigation/NavigationContent';
9
10
  import type { PictureTextContent } from './PictureText/PictureTextContent';
10
11
  import type { PlaceholderContent } from './Placeholder/PlaceholderContent';
11
12
  import type { ProductBlockContent } from './ProductBlock/ProductBlockContent';
@@ -13,9 +14,9 @@ import type { ProductGalleryContent } from './ProductGallery/ProductGalleryConte
13
14
  import type { ProductTileContent } from './ProductTile/ProductTileContent';
14
15
  import type { PromoTileContent } from './PromoTile/PromoTileContent';
15
16
  import type { StepsBlockContent } from './StepsBlock/StepsBlockContent';
17
+ import type { TariffsTableContent } from './TariffsTable/TariffsTableContent';
16
18
  import type { TextBlockContent } from './TextBlock/TextBlockContent';
17
19
  import type { TileContent } from './Tile/TileContent';
18
- import { TariffsTableContent } from './TariffsTable/TariffsTableContent';
19
20
 
20
21
  /**
21
22
  * @hidden
@@ -38,4 +39,5 @@ export type BlockContent =
38
39
  | StepsBlockContent
39
40
  | TariffsTableContent
40
41
  | TextBlockContent
41
- | TileContent;
42
+ | TileContent
43
+ | NavigationContent;
@@ -10,6 +10,7 @@ import { Headline } from './Headline/Headline';
10
10
  import { LinkDocs } from './LinkDocs/LinkDocs';
11
11
  import { MiniGallery } from './MiniGallery/MiniGallery';
12
12
  import { MobileAppTile } from './MobileAppTile/MobileAppTile';
13
+ import { Navigation } from './Navigation/Navigation';
13
14
  import { PictureText } from './PictureText/PictureText';
14
15
  import { Placeholder } from './Placeholder/Placeholder';
15
16
  import { ProductBlock } from './ProductBlock/ProductBlock';
@@ -44,4 +45,5 @@ export const Blocks = {
44
45
  TariffsTable,
45
46
  TextBlock,
46
47
  Tile,
48
+ Navigation,
47
49
  };
@@ -18,25 +18,38 @@
18
18
  "type": "Header",
19
19
  "style": ["-mx-20", "mb-5", "shadow-[0_8px_32px_0px_#00000014]"],
20
20
  "content": {
21
- "defaultLocation": "Москва",
22
- "topItems": [
23
- {
24
- "href": "https://rshb.ru/",
25
- "text": "Бизнес клиентам",
26
- "target": "_blank"
27
- },
28
- {
29
- "href": "https://rshb.ru/",
30
- "text": "Частным клиентам",
31
- "target": "_blank"
32
- }
33
- ]
21
+ "defaultLocation": "Москва"
34
22
  }
35
23
  }
36
24
  ]
37
25
  }
38
26
  },
39
27
  "blocks": [
28
+ {
29
+ "type": "Navigation",
30
+ "style": ["col-span-12"],
31
+ "content": {
32
+ "title": "Потребительский кредит наличными",
33
+ "buttons": [
34
+ {
35
+ "href": "/credits",
36
+ "text": "Оформить"
37
+ },
38
+ {
39
+ "href": "/tariffs",
40
+ "text": "Тарифы"
41
+ },
42
+ {
43
+ "href": "/harvest",
44
+ "text": "Урожай"
45
+ },
46
+ {
47
+ "href": "/faq",
48
+ "text": "Частые вопросы"
49
+ }
50
+ ]
51
+ }
52
+ },
40
53
  {
41
54
  "type": "ProductGallery",
42
55
  "style": ["col-span-12"],
@@ -1838,12 +1851,12 @@
1838
1851
  {
1839
1852
  "label": "Кредит по одному документу",
1840
1853
  "description": "До 300 тыс ₽ по упрощённой процедуре получения кредита",
1841
- "icon": "DocumentText"
1854
+ "icon": "DocumentTextIcon"
1842
1855
  },
1843
1856
  {
1844
1857
  "label": "Кредит на общих условиях",
1845
1858
  "description": "До 5 млн ₽ на общих условиях получения кредита",
1846
- "icon": "DiscountShape"
1859
+ "icon": "DiscountShapeIcon"
1847
1860
  }
1848
1861
  ],
1849
1862
  "image": {
@@ -72,12 +72,10 @@ export const CreditCalculator = JSX<CreditCalculatorProps>(
72
72
  }
73
73
 
74
74
  return (
75
- <section className={`font-sans text-primary-text bg-white p-4 w-[847px] ${className || ''}`}>
76
- <div
77
- className={`box-border p-[49px] pr-[53px] flex flex-col justify-between ${borderStyle}`}
78
- >
75
+ <section className={`font-sans text-primary-text p-10 bg-white ${className || ''}`}>
76
+ <div className={`box-border p-[49px] pr-[56px] mx-auto w-max ${borderStyle}`}>
79
77
  <div className="flex justify-between ">
80
- <div className="grow mr-[42px] w-[465px]">
78
+ <div className="mr-[42px]">
81
79
  <InputRange
82
80
  title="Желаемая сумма кредита, ₽"
83
81
  items={[
@@ -115,7 +113,7 @@ export const CreditCalculator = JSX<CreditCalculatorProps>(
115
113
  onChange={setIsInsuranceChecked}
116
114
  />
117
115
  </div>
118
- <div className="basis-[226px] shrink-0 box-border h-fit p-9 bg-primary-main rounded-md text-white">
116
+ <div className="box-border h-fit p-9 bg-primary-main rounded-md text-white">
119
117
  <div className="text-base mb-[18px]">Наше предложение</div>
120
118
  <div className="text-sm opacity-60">Ежемесячный платёж</div>
121
119
  <div className="text-lg mb-3">
@@ -1,5 +1,5 @@
1
1
  import type { LinkProps } from '../../model/LinkProps';
2
- import type { SitemapProps } from '../../model/SitemapProps';
2
+ import type { SitemapProps } from '../../services/sitemap/SitemapProps';
3
3
 
4
4
  /**
5
5
  * @title Тип контакта
@@ -1,10 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useLink } from '../../hooks/useLink';
3
- import { useSitemap } from '../../hooks/useSitemap';
4
- import { mergeTopItems } from '../../mergeTopItems';
5
3
  import type { LinkProps } from '../../model/LinkProps';
6
- import type { TopMenuItem } from '../../model/SitemapProps';
4
+ import { mergeTopItems } from '../../services/sitemap/mergeTopItems';
5
+ import type { TopMenuItem } from '../../services/sitemap/SitemapProps';
6
+ import { useSitemap } from '../../services/sitemap/useSitemap';
7
7
  import type { UniBlockProps } from '../../types';
8
+
8
9
  export interface SitemapProps extends UniBlockProps {
9
10
  items?: TopMenuItem[];
10
11
  }
@@ -1,21 +1,7 @@
1
1
  import { context } from '../../setup-fixture';
2
2
  import { Header } from './Header';
3
3
 
4
- export default (
5
- <Header
6
- context={context}
7
- defaultLocation="Москва"
8
- topItems={[
9
- {
10
- href: 'https://rshb.ru/',
11
- text: 'Бизнес клиентам',
12
- target: '_blank',
13
- },
14
- {
15
- href: 'https://rshb.ru/',
16
- text: 'Частным клиентам',
17
- target: '_blank',
18
- },
19
- ]}
20
- />
21
- );
4
+ export default {
5
+ default: <Header context={context} defaultLocation="Москва" />,
6
+ transparent: <Header context={context} defaultLocation="Москва" bgColor="transparent" />,
7
+ };
@@ -1,61 +1,72 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useLink } from '../../hooks/useLink';
3
- import { useSitemap } from '../../hooks/useSitemap';
4
- import { mergeTopItems } from '../../mergeTopItems';
3
+ import type { BgColorVersion } from '../../model/BgColorVersion';
4
+ import { findActiveSubItem } from '../../services/sitemap/findActiveSubItem';
5
+ import { isTopItemActive } from '../../services/sitemap/isTopItemActive';
6
+ import { mergeTopItems } from '../../services/sitemap/mergeTopItems';
7
+ import { useSitemap } from '../../services/sitemap/useSitemap';
5
8
  import type { UniBlockProps } from '../../types';
6
9
  import { HeaderItem } from '../../ui-kit/HeaderItem/HeaderItem';
7
10
  import { Logo } from '../../ui-kit/Logo/Logo';
8
11
  import { TopItem } from '../../ui-kit/TopItem/TopItem';
9
12
  import type { HeaderContent } from './HeaderContent';
10
13
  import { HeaderSecondaryMenu } from './HeaderSecondaryMenu';
11
- import { isSubItemActive } from './isSubItemActive';
12
- import { isTopItemActive } from './isTopItemActive';
14
+
15
+ const BORDER_COLORS: Record<BgColorVersion, string> = {
16
+ 'bg-white': 'bg-main-divider',
17
+ transparent: 'bg-main-divider opacity-30',
18
+ };
13
19
 
14
20
  export interface HeaderProps extends HeaderContent, UniBlockProps {}
15
21
 
16
- export const Header = JSX<HeaderProps>(({ className, defaultLocation, context, topItems }) => {
17
- const router = context.useRouter();
18
- const sitemap = useSitemap(context.useAsyncData);
19
- const { handlerDecorator } = context;
22
+ export const Header = JSX<HeaderProps>(
23
+ ({ className, defaultLocation, bgColor = 'bg-white', context, topItems }) => {
24
+ const router = context.useRouter();
25
+ const sitemap = useSitemap(context.useAsyncData);
26
+ const { handlerDecorator } = context;
20
27
 
21
- const mergedItems = mergeTopItems(sitemap.topItems, topItems);
22
- const activeTopItem = mergedItems.find(isTopItemActive(router));
23
- const subItems = activeTopItem?.items;
24
- const activeSubItem = subItems?.find(isSubItemActive(router));
28
+ const mergedItems = mergeTopItems(sitemap.topItems, topItems);
29
+ const activeTopItem = mergedItems.find(isTopItemActive(router));
30
+ const subItems = activeTopItem?.items;
31
+ const activeSubItem = findActiveSubItem(router)(subItems);
25
32
 
26
- const topMenu = mergedItems.map((_, i) => (
27
- <TopItem
28
- key={String(i)}
29
- active={_ === activeTopItem}
30
- {...useLink({ router, handlerDecorator }, _)}
31
- ariaLabel={_.text}
32
- />
33
- ));
33
+ const topMenu = mergedItems.map((_, i) => (
34
+ <TopItem
35
+ key={String(i)}
36
+ active={_ === activeTopItem}
37
+ {...useLink({ router, handlerDecorator }, _)}
38
+ ariaLabel={_.text}
39
+ bgColor={bgColor}
40
+ />
41
+ ));
34
42
 
35
- const subMenu = subItems?.map((_) => (
36
- <HeaderItem
37
- key={_.href}
38
- className="mr-8"
39
- active={_ === activeSubItem}
40
- {...useLink({ router, handlerDecorator }, _)}
41
- />
42
- ));
43
+ const subMenu = subItems?.map((_) => (
44
+ <HeaderItem
45
+ key={_.href}
46
+ className="mr-8"
47
+ active={_ === activeSubItem}
48
+ {...useLink({ router, handlerDecorator }, _)}
49
+ bgColor={bgColor}
50
+ />
51
+ ));
43
52
 
44
- return (
45
- <header className={`pt-5 pb-8 px-20 bg-white ${className || ''}`}>
46
- <div className="container">
47
- <div className="flex items-center">
48
- <Logo className="mr-8" />
49
- {topMenu}
50
- <HeaderSecondaryMenu
51
- context={context}
52
- className="ml-auto"
53
- defaultLocation={defaultLocation}
54
- />
53
+ return (
54
+ <header className={`pt-5 pb-8 px-20 ${bgColor} ${className || ''}`}>
55
+ <div className="container">
56
+ <div className="flex items-center">
57
+ <Logo className="mr-8" bgColor={bgColor} />
58
+ {topMenu}
59
+ <HeaderSecondaryMenu
60
+ context={context}
61
+ className="ml-auto"
62
+ defaultLocation={defaultLocation}
63
+ bgColor={bgColor}
64
+ />
65
+ </div>
66
+ <div className={`mt-5 h-[1px] ${BORDER_COLORS[bgColor]}`} />
67
+ <nav className="mt-5">{subMenu}</nav>
55
68
  </div>
56
- <div className="mt-5 h-[1px] bg-main-divider" />
57
- <nav className="mt-5">{subMenu}</nav>
58
- </div>
59
- </header>
60
- );
61
- });
69
+ </header>
70
+ );
71
+ },
72
+ );
@@ -1,4 +1,5 @@
1
- import type { SitemapProps } from '../../model/SitemapProps';
1
+ import { BgColorVersion } from '../../model/BgColorVersion';
2
+ import type { SitemapProps } from '../../services/sitemap/SitemapProps';
2
3
 
3
4
  /**
4
5
  * @title Шапка
@@ -10,4 +11,10 @@ export interface HeaderContent extends SitemapProps {
10
11
  * @default Москва
11
12
  */
12
13
  defaultLocation?: string;
14
+ /**
15
+ * @title Фон элемента
16
+ * @hidden
17
+ * @default white
18
+ */
19
+ bgColor?: BgColorVersion;
13
20
  }
@@ -1,20 +1,34 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import type { BgColorVersion } from '../../model/BgColorVersion';
2
3
  import type { UniBlockProps } from '../../types';
3
4
  import { Icon } from '../../ui-kit/Icon/Icon';
5
+ import type { IconName } from '../../ui-kit/Icon/IconProps';
4
6
  import { TopItem } from '../../ui-kit/TopItem/TopItem';
5
7
  import { HeaderSecondaryMenuButton } from './HeaderSecondaryMenuButton';
6
8
 
7
9
  interface HeaderSecondaryMenuContent {
8
10
  defaultLocation?: string;
9
- className?: string;
11
+ bgColor?: BgColorVersion;
10
12
  }
11
13
 
12
14
  export interface HeaderSecondaryMenuProps extends HeaderSecondaryMenuContent, UniBlockProps {}
13
15
 
16
+ const COLORS_MAP: Record<BgColorVersion, string> = {
17
+ 'bg-white': 'text-primary-text hover:text-primary-main',
18
+ transparent: 'text-white',
19
+ };
20
+ const DOP_LINKS_COLORS_MAP: Record<BgColorVersion, string> = {
21
+ 'bg-white': 'text-secondary-light hover:text-secondary-hover',
22
+ transparent: 'text-white',
23
+ };
24
+ const DOP_LINKS_ICON_NAME_MAP: Record<BgColorVersion, IconName> = {
25
+ 'bg-white': 'GridIcon',
26
+ transparent: 'GridIconWhite',
27
+ };
28
+
14
29
  export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
15
- ({ context, className, defaultLocation = '' }) => {
30
+ ({ context, className, defaultLocation = '', bgColor = 'bg-white' }) => {
16
31
  const [city, getCity] = context.useGeolocation(defaultLocation);
17
-
18
32
  return (
19
33
  <div className={`flex items-center ${className || ''}`}>
20
34
  <TopItem
@@ -24,6 +38,7 @@ export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
24
38
  text={city}
25
39
  ariaLabel="Местоположение"
26
40
  onClick={getCity}
41
+ bgColor={bgColor}
27
42
  />
28
43
  <TopItem
29
44
  className="mr-7"
@@ -31,24 +46,22 @@ export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
31
46
  href="#"
32
47
  text="Офисы и банкоматы"
33
48
  ariaLabel="Список всех доступных офисов и банкоматов"
49
+ bgColor={bgColor}
34
50
  />
35
51
  <HeaderSecondaryMenuButton
36
- className="mr-5 text-primary-text hover:text-primary-main"
52
+ className={`mr-5 ${COLORS_MAP[bgColor]}`}
37
53
  ariaLabel="Поиск по сайту"
38
54
  >
39
- <Icon name="LoupeIcon" aria-hidden="true" className="h-full" asSVG />
55
+ <Icon name="LoupeIcon" className="h-full" asSVG />
40
56
  </HeaderSecondaryMenuButton>
41
- <HeaderSecondaryMenuButton
42
- className="mr-5 text-primary-text hover:text-primary-main"
43
- ariaLabel="Профиль"
44
- >
45
- <Icon name="ProfileIcon" aria-hidden="true" className="h-full" asSVG />
57
+ <HeaderSecondaryMenuButton className={`mr-5 ${COLORS_MAP[bgColor]}`} ariaLabel="Профиль">
58
+ <Icon name="ProfileIcon" className="h-full" asSVG />
46
59
  </HeaderSecondaryMenuButton>
47
60
  <HeaderSecondaryMenuButton
48
- className="min-w-[32px] min-h-[32px] fill-secondary-light hover:fill-secondary-hover"
61
+ className={`${DOP_LINKS_COLORS_MAP[bgColor]} min-w-[32px] min-h-[32px]`}
49
62
  ariaLabel="Дополнительные ссылки"
50
63
  >
51
- <Icon name="GridIcon" aria-hidden="true" className="h-full" asSVG />
64
+ <Icon name={DOP_LINKS_ICON_NAME_MAP[bgColor]} className="h-full" asSVG />
52
65
  </HeaderSecondaryMenuButton>
53
66
  </div>
54
67
  );
@@ -6,12 +6,10 @@ interface HeaderSecondaryMenuButtonProps {
6
6
  }
7
7
 
8
8
  export const HeaderSecondaryMenuButton = JSX<HeaderSecondaryMenuButtonProps>(
9
- ({ className, children, ariaLabel }) => (
9
+ ({ className = '', children, ariaLabel }) => (
10
10
  <button
11
11
  type="button"
12
- className={`border-0 p-0 w-[24px] h-[24px] flex items-center bg-inherit cursor-pointer ${
13
- className || ''
14
- }`}
12
+ className={`border-0 p-0 w-[24px] h-[24px] flex items-center bg-inherit cursor-pointer ${className}`}
15
13
  disabled={true}
16
14
  aria-label={ariaLabel}
17
15
  >
@@ -1,18 +1,10 @@
1
+ import type { BgColorVersion } from '../../model/BgColorVersion';
1
2
  import type { BaseTileCommonProps } from '../BaseTile/BaseTileProps';
2
3
 
3
- /**
4
- * @title Цвет фона
5
- * @enumNames [
6
- * "Прозрачный",
7
- * "Белый"
8
- * ]
9
- */
10
- export type HeadlineBgColor = 'transparent' | 'bg-white';
11
-
12
4
  /**
13
5
  * @title Заголовок
14
6
  */
15
7
  export interface HeadlineContent
16
8
  extends Pick<BaseTileCommonProps, 'title' | 'titleSize' | 'description' | 'align'> {
17
- bgColor?: HeadlineBgColor;
9
+ bgColor?: BgColorVersion;
18
10
  }
@@ -4,6 +4,7 @@ import { Gallery } from './Gallery/Gallery.mobile';
4
4
  import { Header } from './Header/Header';
5
5
  import { Headline } from './Headline/Headline';
6
6
  import { MobileAppTile } from './MobileAppTile/MobileAppTile';
7
+ import { Navigation } from './Navigation/Navigation';
7
8
  import { PictureText } from './PictureText/PictureText';
8
9
  import { Placeholder } from './Placeholder/Placeholder';
9
10
  import { ProductBlock } from './ProductBlock/ProductBlock.mobile';
@@ -24,4 +25,5 @@ export const MobileBlocks = {
24
25
  ProductTile,
25
26
  TextBlock,
26
27
  Tile,
28
+ Navigation,
27
29
  };