@redneckz/wildless-cms-uni-blocks 0.7.6 → 0.7.7

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 (228) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +87 -60
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  5. package/bundle/components/Footer/MediaButton.d.ts +3 -4
  6. package/bundle/components/Footer/SocialMedia.d.ts +2 -3
  7. package/bundle/components/Header/HeaderChatBotButton.d.ts +11 -0
  8. package/bundle/components/Header/HeaderContent.d.ts +6 -1
  9. package/bundle/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  10. package/bundle/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  11. package/bundle/components/Header/useChatBot.d.ts +2 -0
  12. package/bundle/hooks/useBool.d.ts +9 -0
  13. package/bundle/icons/IconName.d.ts +4 -2
  14. package/bundle/model/ButtonVersion.d.ts +2 -2
  15. package/cosmos-static/icons/HeadphonesIcon.svg +1 -0
  16. package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  17. package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  18. package/dist/components/CarouselProductCard/CarouselProductCard.js +1 -1
  19. package/dist/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  20. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  21. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  22. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  23. package/dist/components/Footer/Footer.js +2 -2
  24. package/dist/components/Footer/Footer.js.map +1 -1
  25. package/dist/components/Footer/Footer.mobile.js.map +1 -1
  26. package/dist/components/Footer/MediaButton.d.ts +3 -4
  27. package/dist/components/Footer/MediaButton.js +4 -5
  28. package/dist/components/Footer/MediaButton.js.map +1 -1
  29. package/dist/components/Footer/SocialMedia.d.ts +2 -3
  30. package/dist/components/Footer/SocialMedia.js +1 -1
  31. package/dist/components/Footer/SocialMedia.js.map +1 -1
  32. package/dist/components/Header/DropdownMenu.js +3 -2
  33. package/dist/components/Header/DropdownMenu.js.map +1 -1
  34. package/dist/components/Header/Header.js +3 -2
  35. package/dist/components/Header/Header.js.map +1 -1
  36. package/dist/components/Header/HeaderChatBotButton.d.ts +11 -0
  37. package/dist/components/Header/HeaderChatBotButton.js +19 -0
  38. package/dist/components/Header/HeaderChatBotButton.js.map +1 -0
  39. package/dist/components/Header/HeaderContent.d.ts +6 -1
  40. package/dist/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  41. package/dist/components/Header/HeaderSecondaryMenu.js +6 -11
  42. package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  43. package/dist/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  44. package/dist/components/Header/HeaderSecondaryMenuButton.js +5 -1
  45. package/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  46. package/dist/components/Header/useChatBot.d.ts +2 -0
  47. package/dist/components/Header/useChatBot.js +15 -0
  48. package/dist/components/Header/useChatBot.js.map +1 -0
  49. package/dist/hooks/useBool.d.ts +9 -0
  50. package/dist/hooks/useBool.js +12 -0
  51. package/dist/hooks/useBool.js.map +1 -0
  52. package/dist/icons/IconName.d.ts +4 -2
  53. package/dist/icons/IconName.js +3 -1
  54. package/dist/icons/IconName.js.map +1 -1
  55. package/dist/model/ButtonVersion.d.ts +2 -2
  56. package/dist/ui-kit/Button/buttonClassNameConstants.js +3 -0
  57. package/dist/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  58. package/lib/common.css +1 -1
  59. package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  60. package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  61. package/lib/components/CarouselProductCard/CarouselProductCard.js +1 -1
  62. package/lib/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  63. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  64. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  65. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  66. package/lib/components/Footer/Footer.js +2 -2
  67. package/lib/components/Footer/Footer.js.map +1 -1
  68. package/lib/components/Footer/Footer.mobile.js.map +1 -1
  69. package/lib/components/Footer/MediaButton.d.ts +3 -4
  70. package/lib/components/Footer/MediaButton.js +4 -5
  71. package/lib/components/Footer/MediaButton.js.map +1 -1
  72. package/lib/components/Footer/SocialMedia.d.ts +2 -3
  73. package/lib/components/Footer/SocialMedia.js +1 -1
  74. package/lib/components/Footer/SocialMedia.js.map +1 -1
  75. package/lib/components/Header/DropdownMenu.js +3 -2
  76. package/lib/components/Header/DropdownMenu.js.map +1 -1
  77. package/lib/components/Header/Header.js +3 -2
  78. package/lib/components/Header/Header.js.map +1 -1
  79. package/lib/components/Header/HeaderChatBotButton.d.ts +11 -0
  80. package/lib/components/Header/HeaderChatBotButton.js +17 -0
  81. package/lib/components/Header/HeaderChatBotButton.js.map +1 -0
  82. package/lib/components/Header/HeaderContent.d.ts +6 -1
  83. package/lib/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  84. package/lib/components/Header/HeaderSecondaryMenu.js +6 -11
  85. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  86. package/lib/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  87. package/lib/components/Header/HeaderSecondaryMenuButton.js +5 -1
  88. package/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  89. package/lib/components/Header/useChatBot.d.ts +2 -0
  90. package/lib/components/Header/useChatBot.js +12 -0
  91. package/lib/components/Header/useChatBot.js.map +1 -0
  92. package/lib/hooks/useBool.d.ts +9 -0
  93. package/lib/hooks/useBool.js +9 -0
  94. package/lib/hooks/useBool.js.map +1 -0
  95. package/lib/icons/IconName.d.ts +4 -2
  96. package/lib/icons/IconName.js +3 -1
  97. package/lib/icons/IconName.js.map +1 -1
  98. package/lib/model/ButtonVersion.d.ts +2 -2
  99. package/lib/ui-kit/Button/buttonClassNameConstants.js +3 -0
  100. package/lib/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  101. package/mobile/bundle/bundle.umd.js +7 -5
  102. package/mobile/bundle/bundle.umd.min.js +1 -1
  103. package/mobile/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  104. package/mobile/bundle/components/Footer/MediaButton.d.ts +3 -4
  105. package/mobile/bundle/components/Header/HeaderChatBotButton.d.ts +11 -0
  106. package/mobile/bundle/components/Header/HeaderContent.d.ts +6 -1
  107. package/mobile/bundle/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  108. package/mobile/bundle/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  109. package/mobile/bundle/components/Header/useChatBot.d.ts +2 -0
  110. package/mobile/bundle/hooks/useBool.d.ts +9 -0
  111. package/mobile/bundle/icons/IconName.d.ts +4 -2
  112. package/mobile/bundle/model/ButtonVersion.d.ts +2 -2
  113. package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  114. package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  115. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js +1 -1
  116. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  117. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  118. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  119. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  120. package/mobile/dist/components/Footer/Footer.js.map +1 -1
  121. package/mobile/dist/components/Footer/MediaButton.d.ts +3 -4
  122. package/mobile/dist/components/Footer/MediaButton.js +4 -5
  123. package/mobile/dist/components/Footer/MediaButton.js.map +1 -1
  124. package/mobile/dist/components/Header/DropdownMenu.js +3 -2
  125. package/mobile/dist/components/Header/DropdownMenu.js.map +1 -1
  126. package/mobile/dist/components/Header/HeaderChatBotButton.d.ts +11 -0
  127. package/mobile/dist/components/Header/HeaderChatBotButton.js +19 -0
  128. package/mobile/dist/components/Header/HeaderChatBotButton.js.map +1 -0
  129. package/mobile/dist/components/Header/HeaderContent.d.ts +6 -1
  130. package/mobile/dist/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  131. package/mobile/dist/components/Header/HeaderSecondaryMenu.js +6 -11
  132. package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  133. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  134. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.js +5 -1
  135. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  136. package/mobile/dist/components/Header/useChatBot.d.ts +2 -0
  137. package/mobile/dist/components/Header/useChatBot.js +15 -0
  138. package/mobile/dist/components/Header/useChatBot.js.map +1 -0
  139. package/mobile/dist/hooks/useBool.d.ts +9 -0
  140. package/mobile/dist/hooks/useBool.js +12 -0
  141. package/mobile/dist/hooks/useBool.js.map +1 -0
  142. package/mobile/dist/icons/IconName.d.ts +4 -2
  143. package/mobile/dist/icons/IconName.js +3 -1
  144. package/mobile/dist/icons/IconName.js.map +1 -1
  145. package/mobile/dist/model/ButtonVersion.d.ts +2 -2
  146. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.js +3 -0
  147. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  148. package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  149. package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  150. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js +1 -1
  151. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  152. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  153. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  154. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  155. package/mobile/lib/components/Footer/Footer.js.map +1 -1
  156. package/mobile/lib/components/Footer/MediaButton.d.ts +3 -4
  157. package/mobile/lib/components/Footer/MediaButton.js +4 -5
  158. package/mobile/lib/components/Footer/MediaButton.js.map +1 -1
  159. package/mobile/lib/components/Header/DropdownMenu.js +3 -2
  160. package/mobile/lib/components/Header/DropdownMenu.js.map +1 -1
  161. package/mobile/lib/components/Header/HeaderChatBotButton.d.ts +11 -0
  162. package/mobile/lib/components/Header/HeaderChatBotButton.js +17 -0
  163. package/mobile/lib/components/Header/HeaderChatBotButton.js.map +1 -0
  164. package/mobile/lib/components/Header/HeaderContent.d.ts +6 -1
  165. package/mobile/lib/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  166. package/mobile/lib/components/Header/HeaderSecondaryMenu.js +6 -11
  167. package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  168. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  169. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.js +5 -1
  170. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  171. package/mobile/lib/components/Header/useChatBot.d.ts +2 -0
  172. package/mobile/lib/components/Header/useChatBot.js +12 -0
  173. package/mobile/lib/components/Header/useChatBot.js.map +1 -0
  174. package/mobile/lib/hooks/useBool.d.ts +9 -0
  175. package/mobile/lib/hooks/useBool.js +9 -0
  176. package/mobile/lib/hooks/useBool.js.map +1 -0
  177. package/mobile/lib/icons/IconName.d.ts +4 -2
  178. package/mobile/lib/icons/IconName.js +3 -1
  179. package/mobile/lib/icons/IconName.js.map +1 -1
  180. package/mobile/lib/model/ButtonVersion.d.ts +2 -2
  181. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.js +3 -0
  182. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  183. package/mobile/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +0 -1
  184. package/mobile/src/components/CarouselProductCard/CarouselProductCard.tsx +0 -1
  185. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +6 -3
  186. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +2 -0
  187. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.ui.json +7 -0
  188. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +5 -9
  189. package/mobile/src/components/Footer/Footer.tsx +1 -1
  190. package/mobile/src/components/Footer/MediaButton.tsx +19 -17
  191. package/mobile/src/components/Header/DropdownMenu.tsx +7 -5
  192. package/mobile/src/components/Header/HeaderChatBotButton.tsx +45 -0
  193. package/mobile/src/components/Header/HeaderContent.ts +7 -1
  194. package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +20 -30
  195. package/mobile/src/components/Header/HeaderSecondaryMenuButton.tsx +24 -5
  196. package/mobile/src/components/Header/useChatBot.ts +16 -0
  197. package/mobile/src/hooks/useBool.ts +19 -0
  198. package/mobile/src/icons/HeadphonesIcon.svg +5 -0
  199. package/mobile/src/icons/IconName.ts +5 -5
  200. package/mobile/src/model/ButtonVersion.ts +9 -2
  201. package/mobile/src/ui-kit/Button/buttonClassNameConstants.ts +3 -0
  202. package/mobile/src/ui-kit/Img/ImgProps.ts +1 -0
  203. package/package.json +1 -1
  204. package/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +0 -1
  205. package/src/components/CarouselProductCard/CarouselProductCard.tsx +0 -1
  206. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +6 -3
  207. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.tsx +20 -5
  208. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +2 -0
  209. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.ui.json +7 -0
  210. package/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +5 -9
  211. package/src/components/Footer/Footer.mobile.tsx +1 -1
  212. package/src/components/Footer/Footer.tsx +2 -2
  213. package/src/components/Footer/MediaButton.tsx +19 -17
  214. package/src/components/Footer/SocialMedia.tsx +4 -5
  215. package/src/components/Header/DropdownMenu.tsx +7 -5
  216. package/src/components/Header/Header.fixture.tsx +3 -3
  217. package/src/components/Header/Header.tsx +13 -5
  218. package/src/components/Header/HeaderChatBotButton.tsx +45 -0
  219. package/src/components/Header/HeaderContent.ts +7 -1
  220. package/src/components/Header/HeaderSecondaryMenu.tsx +20 -30
  221. package/src/components/Header/HeaderSecondaryMenuButton.tsx +24 -5
  222. package/src/components/Header/useChatBot.ts +16 -0
  223. package/src/hooks/useBool.ts +19 -0
  224. package/src/icons/HeadphonesIcon.svg +5 -0
  225. package/src/icons/IconName.ts +6 -340
  226. package/src/model/ButtonVersion.ts +9 -2
  227. package/src/ui-kit/Button/buttonClassNameConstants.ts +3 -0
  228. package/src/ui-kit/Img/ImgProps.ts +1 -0
@@ -1,4 +1,4 @@
1
- import type { LinkProps } from '../../model/LinkProps';
1
+ import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
2
2
  import type { Picture } from '../../model/Picture';
3
3
  import '../../setup-fixture';
4
4
  import { CarouselRecommendationCard } from './CarouselRecommendationCard';
@@ -14,10 +14,25 @@ const image: Picture = {
14
14
  title: 'product-basket',
15
15
  };
16
16
 
17
- const socialMedia: LinkProps[] = [
18
- { href: 'https://t.me' },
19
- { href: 'https://vk.com' },
20
- { href: 'https://ok.ru' },
17
+ const socialMedia: ButtonWithIconProps[] = [
18
+ {
19
+ href: 'https://t.me',
20
+ target: '_blank',
21
+ version: 'gray',
22
+ rounded: false,
23
+ },
24
+ {
25
+ href: 'https://vk.com',
26
+ target: '_blank',
27
+ version: 'gray',
28
+ rounded: false,
29
+ },
30
+ {
31
+ href: 'https://ok.ru',
32
+ target: '_blank',
33
+ version: 'gray',
34
+ rounded: false,
35
+ },
21
36
  ];
22
37
 
23
38
  const items = ['Свежие новости', 'Акции и предложения', 'Ставки и котировки'];
@@ -21,6 +21,7 @@ export const CarouselRecommendationCard = JSX<RecommendationCardProps>(
21
21
  items = [],
22
22
  socialMedia = [],
23
23
  title,
24
+ version = 'primary',
24
25
  ...rest
25
26
  }) => {
26
27
  const tileTitle = title ? (
@@ -39,6 +40,7 @@ export const CarouselRecommendationCard = JSX<RecommendationCardProps>(
39
40
  BORDER_STYLE,
40
41
  className,
41
42
  )}
43
+ version={version}
42
44
  {...rest}
43
45
  >
44
46
  <BaseTile className="flex justify-between" title={tileTitle} image={tileImage}>
@@ -3,6 +3,13 @@
3
3
  "items": {
4
4
  "image": {
5
5
  "ui:field": "picture"
6
+ },
7
+ "socialMedia": {
8
+ "items": {
9
+ "icon": {
10
+ "ui:field": "picture"
11
+ }
12
+ }
6
13
  }
7
14
  }
8
15
  }
@@ -1,7 +1,7 @@
1
+ import type { BlockVersion } from '../../model/BlockVersion';
1
2
  import type { HeadlineCommonProps } from '../../model/HeadlineType';
2
- import type { LinkCommonProps } from '../../model/LinkProps';
3
3
  import type { Picture } from '../../model/Picture';
4
- import type { ButtonProps } from '../../ui-kit/Button/ButtonProps';
4
+ import type { ButtonWithIconProps, ButtonProps } from '../../ui-kit/Button/ButtonProps';
5
5
  import type { ListContent } from '../../ui-kit/List/ListContent';
6
6
 
7
7
  /**
@@ -10,14 +10,9 @@ import type { ListContent } from '../../ui-kit/List/ListContent';
10
10
  export interface CarouselRecommendationCardContent extends HeadlineCommonProps, ListContent {
11
11
  /**
12
12
  * @title Соц сети
13
- * @minItems 3
14
- * @default [
15
- * { "href": "https://t.me" },
16
- * { "href": "https://vk.com" },
17
- * { "href": "https://ok.ru" },
18
- * ]
13
+ * @minItems 1
19
14
  */
20
- socialMedia?: LinkCommonProps[];
15
+ socialMedia?: ButtonWithIconProps[];
21
16
  /**
22
17
  * @default {
23
18
  * "format": "webp",
@@ -40,4 +35,5 @@ export interface CarouselRecommendationCardContent extends HeadlineCommonProps,
40
35
  * }
41
36
  */
42
37
  button?: ButtonProps;
38
+ version?: BlockVersion;
43
39
  }
@@ -1,6 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { UniBlockProps } from '../../model/JSXBlock';
3
2
  import { projectSettings } from '../../ProjectSettings';
3
+ import type { UniBlockProps } from '../../model/JSXBlock';
4
4
  import type { SitemapDataProps } from '../../services/sitemap/SitemapProps';
5
5
  import { useSWRResource } from '../../services/sitemap/useSWRResource';
6
6
  import { Button } from '../../ui-kit/Button/Button';
@@ -20,7 +20,7 @@ export interface FooterProps extends FooterContent, UniBlockProps {}
20
20
  export const Footer = JSX<FooterProps>(({ className = '', ...rest }) => {
21
21
  const fallback = rest.options?.page?.fallback;
22
22
 
23
- const { documents, relatedEnterprises, contacts, socialMedia, mobileApps, topItems, logo } =
23
+ const { documents, relatedEnterprises, contacts, socialMedia, mobileApps, logo } =
24
24
  useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', fallback);
25
25
 
26
26
  return (
@@ -37,7 +37,7 @@ export const Footer = JSX<FooterProps>(({ className = '', ...rest }) => {
37
37
  Мобильное приложение
38
38
  </SocialMedia>
39
39
  </div>
40
- <Sitemap className="pt-[3px]" items={topItems} fallback={fallback} />
40
+ <Sitemap className="pt-[3px]" fallback={fallback} />
41
41
  </div>
42
42
  <HorizontalNavigation className="mt-[98px]" links={relatedEnterprises} />
43
43
  <TextInformation links={documents} />
@@ -1,10 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useLink } from '../../hooks/useLink';
3
2
  import { Img } from '../../ui-kit/Img/Img';
4
3
  import { getIconWithVersion } from '../../utils/getIconWithVersion';
5
4
  import { style } from '../../utils/style';
6
5
  import type { Picture } from '../../model/Picture';
7
6
  import type { IconVersion } from '../../model/IconVersion';
7
+ import { Button } from '../../ui-kit/Button/Button';
8
+ import type { ButtonProps } from '../../ui-kit/Button/ButtonProps';
8
9
 
9
10
  const ICONS_MAP: Array<{
10
11
  origins: string[];
@@ -45,11 +46,9 @@ const ICONS_MAP: Array<{
45
46
 
46
47
  export type ButtonSize = 'default' | 'small';
47
48
 
48
- interface MediaButtonProps {
49
- href?: string;
50
- isRounded?: boolean;
51
- buttonSize?: ButtonSize;
49
+ interface MediaButtonProps extends ButtonProps {
52
50
  iconVersion?: IconVersion;
51
+ buttonSize?: ButtonSize;
53
52
  }
54
53
 
55
54
  const buttonSizeStyles = {
@@ -58,29 +57,32 @@ const buttonSizeStyles = {
58
57
  };
59
58
 
60
59
  export const MediaButton = JSX<MediaButtonProps>(
61
- ({ isRounded = false, buttonSize = 'default', iconVersion = 'color', ...rest }) => {
62
- const link = useLink();
63
- const { href, onClick } = link(rest);
60
+ ({ iconVersion = 'color', buttonSize = 'default', rounded = false, ...rest }) => {
61
+ const { href, version } = rest;
64
62
 
65
63
  const { icon, label } =
66
64
  ICONS_MAP.find(({ origins }) => origins.some((_) => href?.includes(_))) || {};
67
65
  const iconWithVersion = icon ? { ...getIconWithVersion(icon), iconVersion } : null;
68
66
 
69
- return icon ? (
70
- <a
67
+ return (
68
+ <Button
71
69
  className={style(
72
70
  'group/media flex items-center justify-center box-border',
73
71
  buttonSizeStyles[buttonSize],
74
- isRounded ? 'rounded-full' : 'rounded-md',
75
- 'border-solid border border-main-divider hover:border-transparent',
72
+ rounded ? 'rounded-full' : 'rounded-md',
73
+ 'border border-solid hover:border-transparent',
74
+ 'group-data-primary:border-main-divider',
76
75
  'hover:bg-primary-main hover:text-black',
77
- 'group-data-secondary:bg-white group-data-secondary:hover:bg-secondary-hover',
76
+ 'group-data-secondary:bg-white border-main-divider group-data-secondary:hover:bg-secondary-hover',
77
+ 'group-data-gray:border-green',
78
+
79
+ buttonSizeStyles[buttonSize],
78
80
  )}
79
- href={href}
80
81
  aria-label={label}
81
82
  target="_blank"
82
83
  rel="noopener noreferrer"
83
- onClick={onClick}
84
+ version={version}
85
+ {...rest}
84
86
  >
85
87
  {iconWithVersion ? (
86
88
  <Img
@@ -91,7 +93,7 @@ export const MediaButton = JSX<MediaButtonProps>(
91
93
  asSVG
92
94
  />
93
95
  ) : null}
94
- </a>
95
- ) : null;
96
+ </Button>
97
+ );
96
98
  },
97
99
  );
@@ -1,20 +1,19 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { LinkProps } from '../../model/LinkProps';
2
+ import type { ButtonProps } from '../../ui-kit/Button/ButtonProps';
3
3
  import { MediaButton, type ButtonSize } from './MediaButton';
4
4
 
5
5
  export interface SocialMediaProps {
6
6
  className?: string;
7
- media?: LinkProps[];
8
- isRounded?: boolean;
7
+ media?: ButtonProps[];
9
8
  buttonSize?: ButtonSize;
10
9
  }
11
10
 
12
11
  export const SocialMedia = JSX<SocialMediaProps>(
13
- ({ className = '', media, isRounded = false, buttonSize, children }) => (
12
+ ({ className = '', media, children, buttonSize }) => (
14
13
  <div className="font-sans">
15
14
  <div className={`flex gap-2.5 ${className}`}>
16
15
  {media?.map((_, index) => (
17
- <MediaButton key={String(index)} isRounded={isRounded} buttonSize={buttonSize} {..._} />
16
+ <MediaButton key={String(index)} buttonSize={buttonSize} version={_.version} {..._} />
18
17
  ))}
19
18
  </div>
20
19
  <span className="text-s-light text-secondary-text">{children}</span>
@@ -3,6 +3,7 @@ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useLink } from '../../hooks/useLink';
4
4
  import { useOutsideClick } from '../../hooks/useOutsideClick';
5
5
  import type { LinkProps } from '../../model/LinkProps';
6
+ import { style } from '../../utils/style';
6
7
 
7
8
  interface DropdownMenuProps {
8
9
  className?: string;
@@ -21,7 +22,7 @@ export const DropdownMenu = JSX<DropdownMenuProps>(({ className = '', items, act
21
22
 
22
23
  return (
23
24
  <div
24
- className={`${visible ? 'bg-white rounded-md shadow-blue-gray' : ''} ${className}`}
25
+ className={style(visible ? 'bg-white rounded-md shadow-blue-gray' : '', className)}
25
26
  ref={ref}
26
27
  >
27
28
  <button
@@ -39,15 +40,16 @@ export const DropdownMenu = JSX<DropdownMenuProps>(({ className = '', items, act
39
40
  ))}
40
41
  </button>
41
42
  <div
42
- className={`flex flex-col rounded-md bg-white p-6 pb-2 ${visible ? '' : 'hidden'}`}
43
+ className={style('flex flex-col rounded-md bg-white p-6 pb-2', visible ? '' : 'hidden')}
43
44
  aria-hidden={!visible}
44
45
  >
45
46
  {items?.map((item, i) => (
46
47
  <a
47
48
  key={item.href || String(i)}
48
- className={`text-l-light pb-4 hover:text-primary-main ${
49
- item === activeItem ? 'text-primary-main' : ''
50
- }`}
49
+ className={style(
50
+ 'text-l-light pb-4 hover:text-primary-main',
51
+ item === activeItem ? 'text-primary-main' : '',
52
+ )}
51
53
  {...link(item)}
52
54
  >
53
55
  {item.text}
@@ -2,7 +2,7 @@ import '../../setup-fixture';
2
2
  import { Header } from './Header';
3
3
 
4
4
  export default {
5
- default: <Header />,
6
- transparent: <Header bgColor="transparent" />,
7
- 'no submenu': <Header showSubMenu={false} />,
5
+ default: <Header chat="personal" />,
6
+ transparent: <Header bgColor="transparent" chat="personal" />,
7
+ 'no submenu': <Header showSubMenu={false} chat="personal" />,
8
8
  };
@@ -10,6 +10,7 @@ import { useSWRResource } from '../../services/sitemap/useSWRResource';
10
10
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
11
11
  import { Logo } from '../../ui-kit/Logo/Logo';
12
12
  import { TopItem } from '../../ui-kit/TopItem/TopItem';
13
+ import { style } from '../../utils/style';
13
14
  import type { HeaderContent } from './HeaderContent';
14
15
  import { HeaderSecondaryMenu } from './HeaderSecondaryMenu';
15
16
  import { HeaderSubMenu } from './HeaderSubMenu';
@@ -24,9 +25,10 @@ const BG_COLOR_TO_BLOCK_VERSION: Record<BgColorVersion, BlockVersion> = {
24
25
  export const Header = JSX<HeaderProps>(
25
26
  ({
26
27
  bgColor = 'bg-white',
27
- className = '',
28
+ className,
28
29
  showSubMenu = true,
29
30
  version = BG_COLOR_TO_BLOCK_VERSION[bgColor],
31
+ chat,
30
32
  ...rest
31
33
  }) => {
32
34
  const router = useRouter();
@@ -46,9 +48,11 @@ export const Header = JSX<HeaderProps>(
46
48
  return (
47
49
  <BlockWrapper
48
50
  tag="header"
49
- className={`pt-6 px-20 ${className} ${
50
- showSubMenu && activeTopItem?.items?.length ? 'pb-4' : 'pb-5'
51
- }`}
51
+ className={style(
52
+ 'pt-6 px-20',
53
+ showSubMenu && activeTopItem?.items?.length ? 'pb-4' : 'pb-5',
54
+ className,
55
+ )}
52
56
  version={version}
53
57
  {...rest}
54
58
  >
@@ -62,10 +66,14 @@ export const Header = JSX<HeaderProps>(
62
66
  foreignOffices={foreignOffices}
63
67
  defaultLocation={defaultLocation}
64
68
  officesLink={officesLink}
69
+ chat={chat}
65
70
  />
66
71
  </div>
67
72
  <div
68
- className={`mt-6 h-px bg-main-divider${version === 'transparent' ? ' opacity-30' : ''}`}
73
+ className={style(
74
+ 'mt-6 h-px bg-main-divider',
75
+ version === 'transparent' ? 'opacity-30' : '',
76
+ )}
69
77
  />
70
78
  {showSubMenu && activeTopItem?.items?.length ? (
71
79
  <HeaderSubMenu subItems={activeTopItem.items} />
@@ -0,0 +1,45 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useBool } from '../../hooks/useBool';
3
+ import type { IconVersion } from '../../model/IconVersion';
4
+ import { style } from '../../utils/style';
5
+ import type { ChatBot as ChatBotWithEmptyOption } from './HeaderContent';
6
+ import { HeaderSecondaryMenuButton } from './HeaderSecondaryMenuButton';
7
+ import { useChatBot } from './useChatBot';
8
+
9
+ export type ChatBot = Exclude<ChatBotWithEmptyOption, ''>;
10
+
11
+ interface HeaderChatBotButtonProps {
12
+ className?: string;
13
+ iconVersion?: IconVersion;
14
+ chat?: ChatBot;
15
+ onClick?: () => void;
16
+ }
17
+
18
+ const CHAT_BUTTON_EXTERNAL_NAME = 'text-page__btn-chat';
19
+
20
+ export const HeaderChatBotButton = JSX<HeaderChatBotButtonProps>((props) => {
21
+ const [loadRequested, { setTrue: load }] = useBool();
22
+
23
+ return loadRequested ? (
24
+ <HeaderChatBotButtonWithLoader {...props} />
25
+ ) : (
26
+ renderChatBotButton({ ...props, onClick: load })
27
+ );
28
+ });
29
+
30
+ const HeaderChatBotButtonWithLoader = JSX<HeaderChatBotButtonProps>(
31
+ ({ chat = 'personal', ...rest }) => {
32
+ useChatBot(chat);
33
+
34
+ return renderChatBotButton(rest);
35
+ },
36
+ );
37
+
38
+ const renderChatBotButton = ({ className, iconVersion, onClick }: HeaderChatBotButtonProps) => (
39
+ <HeaderSecondaryMenuButton
40
+ className={style(CHAT_BUTTON_EXTERNAL_NAME, className)}
41
+ image={{ icon: 'HeadphonesIcon', iconVersion }}
42
+ ariaLabel="Чат"
43
+ onClick={onClick}
44
+ />
45
+ );
@@ -7,6 +7,12 @@ import type { IconProps, Picture } from '../../model/Picture';
7
7
  */
8
8
  export type SubMenuItem = LinkProps & IconProps;
9
9
 
10
+ /**
11
+ * @title Чат-бот
12
+ * @enumNames ["", "Для физических лиц", "Для юридических лиц"]
13
+ */
14
+ export type ChatBot = '' | 'personal' | 'business';
15
+
10
16
  /**
11
17
  * @title Ссылка дополнительного меню
12
18
  * @required ["text", "href"]
@@ -28,11 +34,11 @@ export interface Logo {
28
34
 
29
35
  /**
30
36
  * @title Шапка (для мобильных горизонтальная прокрутка shift+mouseScroll)
31
- * @required ["defaultLocation", "topItems"]
32
37
  */
33
38
  export interface HeaderContent {
34
39
  /** @hidden */
35
40
  showSubMenu?: boolean;
36
41
  /** @hidden */
37
42
  bgColor?: BgColorVersion;
43
+ chat?: ChatBot;
38
44
  }
@@ -1,12 +1,14 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useBool } from '../../hooks/useBool';
3
3
  import { useLocation } from '../../hooks/useLocation';
4
4
  import type { BlockVersion } from '../../model/BlockVersion';
5
5
  import type { IconVersion } from '../../model/IconVersion';
6
6
  import type { ForeignOffice } from '../../services/sitemap/SitemapProps';
7
- import { Img } from '../../ui-kit/Img/Img';
8
7
  import { Location } from '../../ui-kit/Location/Location';
9
8
  import { TopItem } from '../../ui-kit/TopItem/TopItem';
9
+ import { style } from '../../utils/style';
10
+ import { HeaderChatBotButton } from './HeaderChatBotButton';
11
+ import type { ChatBot } from './HeaderContent';
10
12
  import { HeaderSecondaryMenuButton } from './HeaderSecondaryMenuButton';
11
13
 
12
14
  interface HeaderSecondaryMenuContent {
@@ -14,6 +16,7 @@ interface HeaderSecondaryMenuContent {
14
16
  defaultLocation?: string;
15
17
  officesLink?: string;
16
18
  foreignOffices?: ForeignOffice[];
19
+ chat?: ChatBot;
17
20
  }
18
21
 
19
22
  export interface HeaderSecondaryMenuProps extends HeaderSecondaryMenuContent {
@@ -21,22 +24,16 @@ export interface HeaderSecondaryMenuProps extends HeaderSecondaryMenuContent {
21
24
  }
22
25
 
23
26
  export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
24
- ({ version, className, officesLink, defaultLocation = 'Москва', foreignOffices }) => {
25
- const [isShowLocationModal, setShowLocationModal] = useState<boolean>(false);
27
+ ({ version, className, officesLink, defaultLocation = 'Москва', foreignOffices, chat }) => {
28
+ const [isShowLocationModal, { setTrue: showLocationModal, setFalse: hideLocationModal }] =
29
+ useBool();
26
30
 
27
31
  const [location, onChangeLocation] = useLocation(defaultLocation);
28
32
 
29
- const showLocationModal = useCallback(() => {
30
- setShowLocationModal(true);
31
- }, []);
32
- const hideLocationModal = useCallback(() => {
33
- setShowLocationModal(false);
34
- }, []);
35
-
36
33
  const iconVersion: IconVersion = version === 'transparent' ? 'white' : 'black';
37
34
 
38
35
  return (
39
- <div className={`flex items-center ${className || ''}`}>
36
+ <div className={style('flex items-center', className)}>
40
37
  <TopItem
41
38
  className="mr-5"
42
39
  flat={true}
@@ -54,28 +51,21 @@ export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
54
51
  ariaLabel="Список всех доступных офисов и банкоматов"
55
52
  />
56
53
  ) : null}
54
+ {chat ? (
55
+ <HeaderChatBotButton className="mr-5" iconVersion={iconVersion} chat={chat} />
56
+ ) : null}
57
57
  <HeaderSecondaryMenuButton
58
- className="mr-5 group/btn text-primary-text hover:text-primary-main group-data-transparent:text-white"
58
+ className="mr-5"
59
+ image={{ icon: 'LoupeIcon', iconVersion }}
59
60
  ariaLabel="Поиск по сайту"
60
- >
61
- <Img
62
- image={{ icon: 'LoupeIcon', iconVersion }}
63
- className="h-full pointer-events-none"
64
- imageClassName="group-hover/btn:text-primary-hover group-hover/btn:invert-0 pointer-events-none"
65
- asSVG
66
- />
67
- </HeaderSecondaryMenuButton>
61
+ disabled={true}
62
+ />
68
63
  <HeaderSecondaryMenuButton
69
- className="group/btn min-w-8 min-h-8 text-secondary-light hover:text-secondary-hover group-data-transparent:text-white"
64
+ image={{ icon: 'GridIcon', iconVersion }}
70
65
  ariaLabel="Дополнительные ссылки"
71
- >
72
- <Img
73
- image={{ icon: 'GridIcon', iconVersion }}
74
- className="h-full bg-main-divider/20 rounded-full pointer-events-none"
75
- imageClassName="group-hover/btn:text-primary-hover group-hover/btn:invert-0"
76
- asSVG
77
- />
78
- </HeaderSecondaryMenuButton>
66
+ isRounded={true}
67
+ disabled={true}
68
+ />
79
69
  {isShowLocationModal ? (
80
70
  <Location
81
71
  currentLocation={location}
@@ -1,19 +1,38 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { Img } from '../../ui-kit/Img/Img';
3
+ import type { ImageContent } from '../../ui-kit/Img/ImgProps';
4
+ import { style } from '../../utils/style';
2
5
 
3
- interface HeaderSecondaryMenuButtonProps {
6
+ export interface HeaderSecondaryMenuButtonProps extends ImageContent {
4
7
  className?: string;
8
+ isRounded?: boolean;
9
+ disabled?: boolean;
5
10
  ariaLabel?: string;
11
+ onClick?: (ev?: { preventDefault: () => void }) => void;
6
12
  }
7
13
 
8
14
  export const HeaderSecondaryMenuButton = JSX<HeaderSecondaryMenuButtonProps>(
9
- ({ className = '', children, ariaLabel }) => (
15
+ ({ className, isRounded, disabled, ariaLabel, image, onClick }) => (
10
16
  <button
17
+ className={style(
18
+ 'group/btn border-0 p-0 flex items-center bg-inherit',
19
+ isRounded
20
+ ? 'w-8 h-8 text-secondary-light hover:text-secondary-hove'
21
+ : 'w-6 h-6 text-primary-text hover:text-primary-main',
22
+ 'group-data-transparent:text-white',
23
+ className,
24
+ )}
11
25
  type="button"
12
- className={`border-0 p-0 w-6 h-6 flex items-center bg-inherit cursor-pointer ${className}`}
13
- disabled={true}
26
+ disabled={disabled}
14
27
  aria-label={ariaLabel}
28
+ onClick={onClick}
15
29
  >
16
- {children}
30
+ <Img
31
+ image={image}
32
+ className={style('h-full', isRounded ? 'bg-main-divider/20 rounded-full' : '')}
33
+ imageClassName="group-hover/btn:text-primary-hover group-hover/btn:invert-0"
34
+ asSVG
35
+ />
17
36
  </button>
18
37
  ),
19
38
  );
@@ -0,0 +1,16 @@
1
+ import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useExternalNS } from '../../hooks/useExternalNS';
3
+ import { ChatBot } from './HeaderChatBotButton';
4
+
5
+ const CHATBOT_NAMESPACE = 'chatbot';
6
+
7
+ const CHATBOT_URL: Record<ChatBot, string> = {
8
+ personal: '//chat.mes.rshb.ru/assets/js/webchat_rshb',
9
+ business: '', //TODO: add url business chat
10
+ };
11
+
12
+ export const useChatBot = (chat: ChatBot) => {
13
+ useEffect(() => globalThis.localStorage?.setItem('webchat-keep-open', String(Date.now())), []);
14
+
15
+ return useExternalNS(CHATBOT_NAMESPACE, CHATBOT_URL[chat]);
16
+ };
@@ -0,0 +1,19 @@
1
+ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+
3
+ export function useBool(defaultValue = false): [
4
+ boolean,
5
+ {
6
+ setValue: (_: boolean) => void;
7
+ setTrue: () => void;
8
+ setFalse: () => void;
9
+ toggle: () => void;
10
+ },
11
+ ] {
12
+ const [value, setValue] = useState<boolean>(defaultValue);
13
+
14
+ const setTrue = useCallback(() => setValue(true), []);
15
+ const setFalse = useCallback(() => setValue(false), []);
16
+ const toggle = useCallback(() => setValue((_) => !_), []);
17
+
18
+ return [value, { setValue, setTrue, setFalse, toggle }];
19
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" name="Наушники" fill="none" viewBox="0 0 24 23">
2
+ <path fill="currentColor" fill-rule="evenodd"
3
+ d="M2.002 19.612a3.025 3.025 0 0 1-2-2.965V13.48a2.948 2.948 0 0 1 1.53-2.561v-.272C1.504 5.437 5.237.98 10.334.14c5.098-.841 10.044 2.182 11.664 7.128.124.34.058.718-.17.995a.997.997 0 0 1-1.71-.299 8.484 8.484 0 0 0-3.999-4.85 8.505 8.505 0 0 0-8.417.215 8.657 8.657 0 0 0-4.17 7.378v1.009c0 .557-.448 1.008-1 1.008-.17 0-.5.393-.5.767v3.267c0 .557.447 1.008 1 1.008.552 0 1-.451 1-1.008v-2.26c0-.556.447-1.007 1-1.007.551 0 .999.45.999 1.008v2.259c.004.99-.472 1.92-1.276 2.488a2.978 2.978 0 0 1-2.753.366Zm19.876.222a3.022 3.022 0 0 0 2.12-2.885v-2.924a3.025 3.025 0 0 0-2-2.965 2.978 2.978 0 0 0-2.74.388 3.034 3.034 0 0 0-1.259 2.486v2.017c0 .557.448 1.008 1 1.008s1-.451 1-1.008v-2.017c0-.557.447-1.008 1-1.008.552 0 1 .451 1 1.008v3.025c0 .557-.448 1.009-1 1.009a.996.996 0 0 0-.73.316c-.189.203-.287.475-.27.753a2.008 2.008 0 0 1-2 1.956h-4v-.716c0-.557-.447-1.008-1-1.008-.551 0-.999.451-.999 1.008v1.715c0 .556.448 1.008 1 1.008h4.999a4.007 4.007 0 0 0 3.91-3.166h-.03Z"
4
+ clip-rule="evenodd" />
5
+ </svg>