@redneckz/wildless-cms-uni-blocks 0.13.13 → 0.13.14

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 (173) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +17 -7
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +18 -15
  5. package/bundle/components/StickyBottomMenu/ActiveSubMenu.d.ts +1 -0
  6. package/bundle/components/StickyBottomMenu/ActiveSubMenuItem.d.ts +1 -1
  7. package/bundle/components/StickyBottomMenu/BurgerMenuDialog.d.ts +1 -1
  8. package/bundle/components/StickyBottomMenu/RenderItem.d.ts +1 -3
  9. package/bundle/components/StickyBottomMenu/TopItemMobile.d.ts +3 -2
  10. package/bundle/hooks/useSWRResource.d.ts +7 -1
  11. package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +18 -15
  12. package/dist/components/Footer/Footer.js +4 -2
  13. package/dist/components/Footer/Footer.js.map +1 -1
  14. package/dist/components/Footer/Footer.mobile.js +3 -3
  15. package/dist/components/Footer/Footer.mobile.js.map +1 -1
  16. package/dist/components/Header/Header.js +1 -1
  17. package/dist/components/Header/Header.js.map +1 -1
  18. package/dist/components/StickyBottomMenu/ActiveSubMenu.d.ts +1 -0
  19. package/dist/components/StickyBottomMenu/ActiveSubMenu.js +2 -2
  20. package/dist/components/StickyBottomMenu/ActiveSubMenu.js.map +1 -1
  21. package/dist/components/StickyBottomMenu/ActiveSubMenuItem.d.ts +1 -1
  22. package/dist/components/StickyBottomMenu/ActiveSubMenuItem.js +5 -3
  23. package/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
  24. package/dist/components/StickyBottomMenu/BurgerMenuDialog.d.ts +1 -1
  25. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +17 -12
  26. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  27. package/dist/components/StickyBottomMenu/RenderItem.d.ts +1 -3
  28. package/dist/components/StickyBottomMenu/RenderItem.js +11 -7
  29. package/dist/components/StickyBottomMenu/RenderItem.js.map +1 -1
  30. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +1 -1
  31. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
  32. package/dist/components/StickyBottomMenu/TopItemMobile.d.ts +3 -2
  33. package/dist/components/StickyBottomMenu/TopItemMobile.js +1 -6
  34. package/dist/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
  35. package/dist/components/StickyBottomMenu/renderMenuItems.js +1 -1
  36. package/dist/components/StickyBottomMenu/renderMenuItems.js.map +1 -1
  37. package/dist/hooks/useSWRResource.d.ts +7 -1
  38. package/dist/hooks/useSWRResource.js +8 -2
  39. package/dist/hooks/useSWRResource.js.map +1 -1
  40. package/dist/services/sitemap/useSitemap.js +1 -1
  41. package/dist/services/sitemap/useSitemap.js.map +1 -1
  42. package/dist/ui-kit/SwipeListControl/useSwipeListScroll.js +5 -1
  43. package/dist/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  44. package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +18 -15
  45. package/lib/components/Footer/Footer.js +4 -2
  46. package/lib/components/Footer/Footer.js.map +1 -1
  47. package/lib/components/Footer/Footer.mobile.js +3 -3
  48. package/lib/components/Footer/Footer.mobile.js.map +1 -1
  49. package/lib/components/Header/Header.js +1 -1
  50. package/lib/components/Header/Header.js.map +1 -1
  51. package/lib/components/StickyBottomMenu/ActiveSubMenu.d.ts +1 -0
  52. package/lib/components/StickyBottomMenu/ActiveSubMenu.js +2 -2
  53. package/lib/components/StickyBottomMenu/ActiveSubMenu.js.map +1 -1
  54. package/lib/components/StickyBottomMenu/ActiveSubMenuItem.d.ts +1 -1
  55. package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js +5 -3
  56. package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
  57. package/lib/components/StickyBottomMenu/BurgerMenuDialog.d.ts +1 -1
  58. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +17 -12
  59. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  60. package/lib/components/StickyBottomMenu/RenderItem.d.ts +1 -3
  61. package/lib/components/StickyBottomMenu/RenderItem.js +11 -7
  62. package/lib/components/StickyBottomMenu/RenderItem.js.map +1 -1
  63. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +1 -1
  64. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
  65. package/lib/components/StickyBottomMenu/TopItemMobile.d.ts +3 -2
  66. package/lib/components/StickyBottomMenu/TopItemMobile.js +1 -6
  67. package/lib/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
  68. package/lib/components/StickyBottomMenu/renderMenuItems.js +1 -1
  69. package/lib/components/StickyBottomMenu/renderMenuItems.js.map +1 -1
  70. package/lib/hooks/useSWRResource.d.ts +7 -1
  71. package/lib/hooks/useSWRResource.js +8 -2
  72. package/lib/hooks/useSWRResource.js.map +1 -1
  73. package/lib/services/sitemap/useSitemap.js +1 -1
  74. package/lib/services/sitemap/useSitemap.js.map +1 -1
  75. package/lib/ui-kit/SwipeListControl/useSwipeListScroll.js +5 -1
  76. package/lib/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  77. package/mobile/bundle/bundle.umd.js +124 -111
  78. package/mobile/bundle/bundle.umd.min.js +1 -1
  79. package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +18 -15
  80. package/mobile/bundle/components/StickyBottomMenu/ActiveSubMenu.d.ts +1 -0
  81. package/mobile/bundle/components/StickyBottomMenu/ActiveSubMenuItem.d.ts +1 -1
  82. package/mobile/bundle/components/StickyBottomMenu/BurgerMenuDialog.d.ts +1 -1
  83. package/mobile/bundle/components/StickyBottomMenu/RenderItem.d.ts +1 -3
  84. package/mobile/bundle/components/StickyBottomMenu/TopItemMobile.d.ts +3 -2
  85. package/mobile/bundle/hooks/useSWRResource.d.ts +7 -1
  86. package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +18 -15
  87. package/mobile/dist/components/Footer/Footer.js +3 -3
  88. package/mobile/dist/components/Footer/Footer.js.map +1 -1
  89. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenu.d.ts +1 -0
  90. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenu.js +2 -2
  91. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenu.js.map +1 -1
  92. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.d.ts +1 -1
  93. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.js +5 -3
  94. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
  95. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.d.ts +1 -1
  96. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +17 -12
  97. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  98. package/mobile/dist/components/StickyBottomMenu/RenderItem.d.ts +1 -3
  99. package/mobile/dist/components/StickyBottomMenu/RenderItem.js +11 -7
  100. package/mobile/dist/components/StickyBottomMenu/RenderItem.js.map +1 -1
  101. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +1 -1
  102. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
  103. package/mobile/dist/components/StickyBottomMenu/TopItemMobile.d.ts +3 -2
  104. package/mobile/dist/components/StickyBottomMenu/TopItemMobile.js +1 -6
  105. package/mobile/dist/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
  106. package/mobile/dist/components/StickyBottomMenu/renderMenuItems.js +1 -1
  107. package/mobile/dist/components/StickyBottomMenu/renderMenuItems.js.map +1 -1
  108. package/mobile/dist/hooks/useSWRResource.d.ts +7 -1
  109. package/mobile/dist/hooks/useSWRResource.js +8 -2
  110. package/mobile/dist/hooks/useSWRResource.js.map +1 -1
  111. package/mobile/dist/services/sitemap/useSitemap.js +1 -1
  112. package/mobile/dist/services/sitemap/useSitemap.js.map +1 -1
  113. package/mobile/dist/ui-kit/SwipeListControl/useSwipeListScroll.js +5 -1
  114. package/mobile/dist/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  115. package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +18 -15
  116. package/mobile/lib/components/Footer/Footer.js +3 -3
  117. package/mobile/lib/components/Footer/Footer.js.map +1 -1
  118. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenu.d.ts +1 -0
  119. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenu.js +2 -2
  120. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenu.js.map +1 -1
  121. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.d.ts +1 -1
  122. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js +5 -3
  123. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
  124. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.d.ts +1 -1
  125. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +17 -12
  126. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  127. package/mobile/lib/components/StickyBottomMenu/RenderItem.d.ts +1 -3
  128. package/mobile/lib/components/StickyBottomMenu/RenderItem.js +11 -7
  129. package/mobile/lib/components/StickyBottomMenu/RenderItem.js.map +1 -1
  130. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +1 -1
  131. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
  132. package/mobile/lib/components/StickyBottomMenu/TopItemMobile.d.ts +3 -2
  133. package/mobile/lib/components/StickyBottomMenu/TopItemMobile.js +1 -6
  134. package/mobile/lib/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
  135. package/mobile/lib/components/StickyBottomMenu/renderMenuItems.js +1 -1
  136. package/mobile/lib/components/StickyBottomMenu/renderMenuItems.js.map +1 -1
  137. package/mobile/lib/hooks/useSWRResource.d.ts +7 -1
  138. package/mobile/lib/hooks/useSWRResource.js +8 -2
  139. package/mobile/lib/hooks/useSWRResource.js.map +1 -1
  140. package/mobile/lib/services/sitemap/useSitemap.js +1 -1
  141. package/mobile/lib/services/sitemap/useSitemap.js.map +1 -1
  142. package/mobile/lib/ui-kit/SwipeListControl/useSwipeListScroll.js +5 -1
  143. package/mobile/lib/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  144. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +6 -3
  145. package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +40 -32
  146. package/mobile/src/components/Footer/Footer.tsx +3 -3
  147. package/mobile/src/components/StickyBottomMenu/ActiveSubMenu.tsx +3 -2
  148. package/mobile/src/components/StickyBottomMenu/ActiveSubMenuItem.tsx +8 -5
  149. package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +27 -15
  150. package/mobile/src/components/StickyBottomMenu/RenderItem.tsx +14 -11
  151. package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +1 -2
  152. package/mobile/src/components/StickyBottomMenu/TopItemMobile.tsx +12 -24
  153. package/mobile/src/components/StickyBottomMenu/renderMenuItems.tsx +1 -1
  154. package/mobile/src/hooks/useSWRResource.ts +19 -6
  155. package/mobile/src/services/sitemap/useSitemap.ts +1 -1
  156. package/mobile/src/ui-kit/SwipeListControl/useSwipeListScroll.ts +6 -2
  157. package/package.json +1 -1
  158. package/src/components/ApplicationForm/ApplicationForm.example.json +6 -3
  159. package/src/components/ApplicationForm/ApplicationFormContent.ts +40 -32
  160. package/src/components/Footer/Footer.mobile.tsx +3 -3
  161. package/src/components/Footer/Footer.tsx +4 -5
  162. package/src/components/Header/Header.tsx +1 -2
  163. package/src/components/StickyBottomMenu/ActiveSubMenu.tsx +3 -2
  164. package/src/components/StickyBottomMenu/ActiveSubMenuItem.tsx +8 -5
  165. package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +27 -15
  166. package/src/components/StickyBottomMenu/RenderItem.tsx +14 -11
  167. package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +1 -2
  168. package/src/components/StickyBottomMenu/TopItemMobile.tsx +12 -24
  169. package/src/components/StickyBottomMenu/renderMenuItems.tsx +1 -1
  170. package/src/hooks/useSWRResource.ts +19 -6
  171. package/src/icons/IconName.ts +2 -2
  172. package/src/services/sitemap/useSitemap.ts +1 -1
  173. package/src/ui-kit/SwipeListControl/useSwipeListScroll.ts +6 -2
@@ -2,12 +2,11 @@ import type { ButtonVersion } from '../../model/ButtonVersion';
2
2
  import type { TitleProps } from '../../model/HeadlineType';
3
3
  import type { UniBlockContent } from '../../model/JSXBlock';
4
4
  import type { LinkProps } from '../../model/LinkProps';
5
- import type { ButtonContent } from '../../ui-kit/Button/ButtonContent';
6
5
 
7
6
  /**
8
7
  * @title Кнопка
9
8
  */
10
- export interface SubmitButtonProps extends ButtonContent {
9
+ export interface SubmitButtonProps {
11
10
  /** @title Текст */
12
11
  text?: string;
13
12
  version?: ButtonVersion;
@@ -19,64 +18,73 @@ export type CommonApplicationFormProps = TitleProps & {
19
18
  link?: LinkProps;
20
19
  };
21
20
 
22
- export type ApplicationFormBlockDef =
23
- | BusinessCardFormParamsDef
24
- | WedFormParamsDef
25
- | DepositFormParamsDef
26
- | CreditFormParamsDef
27
- | AcquiringFormParamsDef
28
- | GrantSupportFormParamsDef;
29
-
30
21
  /**
31
22
  * @title Бизнес-карта
32
- * @default {"formType": "ApplicationFormBusinessCard"}
33
23
  */
34
- export type BusinessCardFormParamsDef = CommonApplicationFormProps & {
35
- formType: 'ApplicationFormBusinessCard';
36
- };
24
+ export type BusinessCardFormParamsDef = TitleProps &
25
+ CommonApplicationFormProps & {
26
+ /** @default ApplicationFormBusinessCard */
27
+ formType: 'ApplicationFormBusinessCard';
28
+ };
37
29
 
38
30
  /**
39
31
  * @title ВЭД
40
- * @default {"formType": "ApplicationFormWed"}
41
32
  */
42
- export type WedFormParamsDef = CommonApplicationFormProps & {
43
- formType: 'ApplicationFormWed';
44
- };
33
+ export type WedFormParamsDef = TitleProps &
34
+ CommonApplicationFormProps & {
35
+ /** @default ApplicationFormWed */
36
+ formType: 'ApplicationFormWed';
37
+ };
45
38
 
46
39
  /**
47
40
  * @title Депозит
48
- * @default {"formType": "ApplicationFormDeposit"}
49
41
  */
50
- export type DepositFormParamsDef = CommonApplicationFormProps & {
51
- formType: 'ApplicationFormDeposit';
52
- };
42
+ export type DepositFormParamsDef = TitleProps &
43
+ CommonApplicationFormProps & {
44
+ /** @default ApplicationFormDeposit */
45
+ formType: 'ApplicationFormDeposit';
46
+ };
53
47
 
54
48
  /**
55
49
  * @title Кредит
56
- * @default {"formType": "ApplicationFormCredit"}
57
50
  */
58
- export type CreditFormParamsDef = CommonApplicationFormProps & {
59
- formType: 'ApplicationFormCredit';
60
- };
51
+ export type CreditFormParamsDef = TitleProps &
52
+ CommonApplicationFormProps & {
53
+ /** @default ApplicationFormCredit */
54
+ formType: 'ApplicationFormCredit';
55
+ };
61
56
 
62
57
  /**
63
58
  * @title Эквайринг
64
- * @default {"formType": "ApplicationFormAcquiring"}
65
59
  */
66
- export type AcquiringFormParamsDef = CommonApplicationFormProps & {
67
- formType: 'ApplicationFormAcquiring';
68
- };
60
+ export type AcquiringFormParamsDef = TitleProps &
61
+ CommonApplicationFormProps & {
62
+ /** @default ApplicationFormAcquiring */
63
+ formType: 'ApplicationFormAcquiring';
64
+ };
69
65
 
70
66
  /**
71
67
  * @title Грантовая поддержка
72
- * @default {"formType": "ApplicationFormGrantSupport"}
73
68
  */
74
- export type GrantSupportFormParamsDef = CommonApplicationFormProps & {
69
+ export type GrantSupportFormParamsDef = TitleProps & {
70
+ /** @default ApplicationFormGrantSupport */
75
71
  formType: 'ApplicationFormGrantSupport';
72
+ button?: SubmitButtonProps;
76
73
  /** @title Адрес справочника */
77
74
  sourceBookDir?: string;
78
75
  };
79
76
 
77
+ /**
78
+ * @title Настройки формы
79
+ */
80
+ export type ApplicationFormBlockDef =
81
+ | BusinessCardFormParamsDef
82
+ | WedFormParamsDef
83
+ | DepositFormParamsDef
84
+ | CreditFormParamsDef
85
+ | AcquiringFormParamsDef
86
+ | GrantSupportFormParamsDef;
87
+
80
88
  /**
81
89
  * @title Форма заявки
82
90
  */
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { projectSettings } from '../../ProjectSettings';
2
3
  import { useSWRResource } from '../../hooks/useSWRResource';
3
4
  import type { LinkCommonProps } from '../../model/LinkProps';
4
- import { projectSettings } from '../../ProjectSettings';
5
5
  import { useSitemap } from '../../services/sitemap/useSitemap';
6
6
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
7
  import { Button } from '../../ui-kit/Button/Button';
@@ -9,12 +9,12 @@ import { LinkList } from '../../ui-kit/LinkList/LinkList';
9
9
  import { Text } from '../../ui-kit/Text/Text';
10
10
  import { RollupItem } from '../RollupItem/RollupItem';
11
11
  import { Contacts } from './Contacts';
12
- import { findIconByHref } from './findIconByHref';
13
12
  import type { FooterDataProps } from './FooterDataProps';
14
13
  import type { FooterProps } from './FooterProps';
15
14
  import { HorizontalNavigation } from './HorizontalNavigation';
16
15
  import { SocialMedia } from './SocialMedia';
17
16
  import { TextInformation } from './TextInformation';
17
+ import { findIconByHref } from './findIconByHref';
18
18
 
19
19
  export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
20
20
  const fallback = rest.options?.page?.fallback;
@@ -26,7 +26,7 @@ export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
26
26
  mobileApps,
27
27
  horizontalNavigationTitle,
28
28
  documents,
29
- } = useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', fallback);
29
+ } = useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', { fallback });
30
30
 
31
31
  return (
32
32
  <BlockWrapper tag="footer" className={className} {...rest}>
@@ -4,12 +4,13 @@ import { ActiveSubMenuItem } from './ActiveSubMenuItem';
4
4
 
5
5
  interface ActiveSubMenuProps {
6
6
  activeMenuSubItems?: LinkProps[];
7
+ basePath?: string;
7
8
  }
8
- export const ActiveSubMenu = JSX<ActiveSubMenuProps>(({ activeMenuSubItems }) => {
9
+ export const ActiveSubMenu = JSX<ActiveSubMenuProps>(({ activeMenuSubItems, basePath }) => {
9
10
  return activeMenuSubItems ? (
10
11
  <div className="mb-5">
11
12
  {activeMenuSubItems.map((_, i) => (
12
- <ActiveSubMenuItem item={_} i={i} />
13
+ <ActiveSubMenuItem item={_} key={String(i)} basePath={basePath} />
13
14
  ))}
14
15
  </div>
15
16
  ) : null;
@@ -1,20 +1,23 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { LinkProps } from '../../model/LinkProps';
2
+ import { projectSettings } from '../../ProjectSettings';
3
3
  import { useLink } from '../../hooks/useLink';
4
+ import type { LinkProps } from '../../model/LinkProps';
4
5
  import { Img } from '../../ui-kit/Img/Img';
5
6
 
6
7
  interface ActiveSubMenuItemProps {
7
8
  item: LinkProps;
8
- i: number;
9
+ basePath?: string;
9
10
  }
10
11
 
11
- export const ActiveSubMenuItem = JSX<ActiveSubMenuItemProps>(({ item, i }) => {
12
- const link = useLink();
12
+ export const ActiveSubMenuItem = JSX<ActiveSubMenuItemProps>(({ item, basePath }) => {
13
+ const isAnotherPortal =
14
+ projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
15
+
16
+ const link = useLink({ isRemote: isAnotherPortal, basePath });
13
17
  const { href, target, onClick } = link(item);
14
18
 
15
19
  return (
16
20
  <a
17
- key={`subItems-${String(i)}`}
18
21
  className="py-3 text-h5 font-light flex justify-between cursor-pointer"
19
22
  href={href}
20
23
  target={target}
@@ -1,20 +1,20 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback, useEffect, useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import type { RefObject } from 'react';
4
+ import { useActiveRoute } from '../../hooks/useActiveRoute';
2
5
  import { useLocation } from '../../hooks/useLocation';
3
- import { Img } from '../../ui-kit/Img/Img';
4
- import { SearchBar } from '../../ui-kit/SearchBar/SearchBar';
5
- import { Text } from '../../ui-kit/Text/Text';
6
- import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
6
+ import type { UniBlockProps } from '../../model/JSXBlock';
7
+ import { useSitemap } from '../../services/sitemap/useSitemap';
8
+ import { Dialog } from '../../ui-kit/DialogManager/Dialog';
7
9
  import { Heading } from '../../ui-kit/Heading/Heading';
10
+ import { Img } from '../../ui-kit/Img/Img';
8
11
  import { useLocationDialog } from '../../ui-kit/LocationDialog/useLocationDialog';
12
+ import { SearchBar } from '../../ui-kit/SearchBar/SearchBar';
9
13
  import { SwipeListContainer } from '../../ui-kit/SwipeListControl/SwipeListContainer';
10
14
  import { useSwipeListScroll } from '../../ui-kit/SwipeListControl/useSwipeListScroll';
11
- import { useSitemap } from '../../services/sitemap/useSitemap';
12
- import { TopItemMobile } from './TopItemMobile';
15
+ import { Text } from '../../ui-kit/Text/Text';
13
16
  import { ActiveSubMenu } from './ActiveSubMenu';
14
- import { Dialog } from '../../ui-kit/DialogManager/Dialog';
15
- import type { UniBlockProps } from '../../model/JSXBlock';
16
- import type { RefObject } from 'react';
17
- import { useActiveRoute } from '../../hooks/useActiveRoute';
17
+ import { TopItemMobile } from './TopItemMobile';
18
18
 
19
19
  interface BurgerMenuDialogProps extends UniBlockProps {
20
20
  containerRef?: RefObject<HTMLDivElement>;
@@ -25,19 +25,26 @@ export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>((props) => {
25
25
  const [location] = useLocation(defaultLocation);
26
26
  const locationDialog = useLocationDialog();
27
27
  const openLocationDialog = useCallback(() => locationDialog.open(), []);
28
- const itemCount = Array.isArray(topItems) ? topItems.length : 0;
29
28
  const [containerRef, scroll] = useSwipeListScroll<HTMLDivElement>({
30
- itemCount,
29
+ itemCount: topItems?.length ?? 0,
31
30
  });
32
- const [activeTopItemIndex, activeRoute] = useActiveRoute(topItems);
31
+ const [activeIndex] = useActiveRoute(topItems);
32
+ const [activeTopItemIndex, setActiveTopItemIndex] = useState(activeIndex);
33
+ const activeRoute = useMemo(() => topItems?.[activeTopItemIndex], [topItems, activeTopItemIndex]);
33
34
  const activeMenuSubItems = activeRoute?.items || [];
34
35
 
36
+ useEffect(() => {
37
+ setActiveTopItemIndex(activeIndex);
38
+ }, [activeIndex]);
39
+
35
40
  useEffect(() => {
36
41
  if (activeTopItemIndex > 0) {
37
42
  scroll.scrollTo(activeTopItemIndex);
38
43
  }
39
44
  }, [activeTopItemIndex, scroll]);
40
45
 
46
+ const handleTopItemClick = useCallback((idx: number) => setActiveTopItemIndex(idx), []);
47
+
41
48
  return (
42
49
  <Dialog
43
50
  head={
@@ -55,12 +62,17 @@ export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>((props) => {
55
62
  className="pb-3"
56
63
  >
57
64
  {topItems?.map((item, i) => (
58
- <TopItemMobile item={item} i={i} isActive={activeTopItemIndex === i} />
65
+ <TopItemMobile
66
+ item={item}
67
+ key={String(i)}
68
+ isActive={activeTopItemIndex === i}
69
+ onClick={() => handleTopItemClick(i)}
70
+ />
59
71
  ))}
60
72
  </SwipeListContainer>
61
73
  </div>
62
74
  <div className="relative grow overflow-auto">
63
- <ActiveSubMenu activeMenuSubItems={activeMenuSubItems} />
75
+ <ActiveSubMenu activeMenuSubItems={activeMenuSubItems} basePath={activeRoute?.href} />
64
76
  <SearchBar className="grow mb-5" />
65
77
  {renderOfficeLink(officesLink)}
66
78
  <div className="flex items-center text-s cursor-pointer" onClick={openLocationDialog}>
@@ -1,17 +1,21 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { MenuItemProps } from './StickyBottomMenuProps';
3
- import { style } from '../../utils/style';
4
- import { Img } from '../../ui-kit/Img/Img';
2
+ import { projectSettings } from '../../ProjectSettings';
5
3
  import { useLink } from '../../hooks/useLink';
6
- import type { UniBlockProps } from '../../model/JSXBlock';
4
+ import { Img } from '../../ui-kit/Img/Img';
5
+ import { style } from '../../utils/style';
6
+ import type { MenuItemProps } from './StickyBottomMenuProps';
7
7
 
8
- interface RenderItemProps extends UniBlockProps {
8
+ interface RenderItemProps {
9
9
  item: MenuItemProps;
10
- idx: number;
11
10
  onClick?: () => void;
12
11
  }
13
- export const RenderItem = JSX<RenderItemProps>(({ item, idx, onClick }) => {
14
- const link = useLink();
12
+
13
+ export const RenderItem = JSX<RenderItemProps>(({ item, onClick }) => {
14
+ const isAnotherPortal = projectSettings?.BASE_PATH
15
+ ? !item.url?.startsWith(projectSettings?.BASE_PATH)
16
+ : true;
17
+
18
+ const link = useLink({ isRemote: isAnotherPortal });
15
19
  const {
16
20
  href,
17
21
  target,
@@ -23,7 +27,6 @@ export const RenderItem = JSX<RenderItemProps>(({ item, idx, onClick }) => {
23
27
 
24
28
  return (
25
29
  <a
26
- key={`menuItems-${String(idx)}`}
27
30
  className={style(
28
31
  item.isActive ? 'text-primary-main' : 'text-primary-text',
29
32
  `w-10 m-4 flex justify-center items-center flex-col text-[10px] cursor-pointer`,
@@ -35,8 +38,8 @@ export const RenderItem = JSX<RenderItemProps>(({ item, idx, onClick }) => {
35
38
  <Img
36
39
  className="w-6 h-6"
37
40
  image={{
38
- icon: item.icon?.icon,
39
- iconVersion: item.icon?.iconVersion || 'black',
41
+ icon: item?.icon?.icon,
42
+ iconVersion: item?.icon?.iconVersion || 'black',
40
43
  }}
41
44
  />
42
45
  {item.title}
@@ -10,8 +10,7 @@ import { useBurgerMenuDialog } from './useBurgerMenuDialog';
10
10
  export const StickyBottomMenu = JSX<StickyBottomMenuProps>(({ ...rest }) => {
11
11
  const { menuItems = [] } = useSWRResource<StickyBottomMenuProps>(
12
12
  projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu',
13
- rest.options?.page?.fallback,
14
- 'portal-resources',
13
+ { fallback: rest.options?.page?.fallback, folderName: 'portal-resources', setBasePath: true },
15
14
  );
16
15
 
17
16
  const [isBurgerMenuDialogOpen, { toggle }] = useBurgerMenuDialog();
@@ -1,32 +1,20 @@
1
1
  import type { TopMenuItemProps } from '../../services/sitemap/SitemapData';
2
+ import { PreventableEvent } from '../../ui-kit/PreventableEvent';
2
3
  import { style } from '../../utils/style';
3
- import { useLink } from '../../hooks/useLink';
4
4
 
5
5
  interface TopItemProps {
6
6
  item: TopMenuItemProps;
7
- i: number;
8
7
  isActive: boolean;
8
+ onClick: (ev?: PreventableEvent) => void;
9
9
  }
10
10
 
11
- export const TopItemMobile = ({ item, i, isActive }: TopItemProps) => {
12
- const link = useLink();
13
- const { href, target, onClick } = link(item);
14
-
15
- return (
16
- <a
17
- key={String(i)}
18
- href={href}
19
- target={target}
20
- onClick={onClick}
21
- className="relative"
22
- aria-label={item.text}
23
- >
24
- <span className={style('whitespace-nowrap', isActive ? 'text-primary-main' : '')}>
25
- {item.text}
26
- </span>
27
- {isActive ? (
28
- <div className="absolute left-0 right-0 -bottom-3 h-0.5 bg-primary-main group-data-transparent:bg-transparent" />
29
- ) : null}
30
- </a>
31
- );
32
- };
11
+ export const TopItemMobile = ({ item, isActive, onClick }: TopItemProps) => (
12
+ <button type="button" onClick={onClick}>
13
+ <span className={style('whitespace-nowrap', isActive ? 'text-primary-main' : '')}>
14
+ {item.text}
15
+ </span>
16
+ {isActive ? (
17
+ <div className="absolute left-0 right-0 -bottom-3 h-0.5 bg-primary-main group-data-transparent:bg-transparent" />
18
+ ) : null}
19
+ </button>
20
+ );
@@ -6,7 +6,7 @@ export const renderMenuItems = (menuItems: MenuItemProps[], onClick?: () => void
6
6
  <BlockWrapper className="sticky bottom-0 left-0 right-0 bg-transparent z-[100]" padding="p-0">
7
7
  <div className="ml-auto container bg-white flex justify-center shadow-blue-gray">
8
8
  {menuItems.map((_, i) => (
9
- <RenderItem item={_} idx={i} onClick={onClick} />
9
+ <RenderItem item={_} key={String(i)} onClick={onClick} />
10
10
  ))}
11
11
  </div>
12
12
  </BlockWrapper>
@@ -1,20 +1,33 @@
1
1
  import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
2
+ import { projectSettings } from '../ProjectSettings';
2
3
  import type { Fallback } from '../model/Fallback';
3
4
  import { fetchJSONUnsafe } from '../utils/fetchJSON';
5
+ import { joinPath } from '../utils/url';
4
6
 
5
7
  const EMPTY_VALUE = {};
6
8
  const DEFAULT_FOLDER_NAME = 'wcms-resources';
7
9
 
10
+ interface SWRResourceOptions {
11
+ fallback?: Fallback;
12
+ folderName?: string;
13
+ setBasePath?: boolean;
14
+ }
15
+
8
16
  export function useSWRResource<Data>(
9
17
  filename: string | null | undefined,
10
- fallback: Fallback = EMPTY_VALUE,
11
- folderName: string = DEFAULT_FOLDER_NAME,
18
+ options: SWRResourceOptions = {},
12
19
  ): Data {
13
- const { data } = useAsyncData<Data, any, string | null>(
14
- filename ? `/${folderName}/${filename}.json` : null,
15
- fetchJSONUnsafe,
16
- { fallback },
20
+ const { fallback = EMPTY_VALUE, folderName = DEFAULT_FOLDER_NAME, setBasePath = false } = options;
21
+
22
+ const path = joinPath(
23
+ setBasePath ? projectSettings.BASE_PATH : '',
24
+ folderName,
25
+ `${filename}.json`,
17
26
  );
18
27
 
28
+ const { data } = useAsyncData<Data, any, string | null>(filename ? path : null, fetchJSONUnsafe, {
29
+ fallback,
30
+ });
31
+
19
32
  return data || (EMPTY_VALUE as Data);
20
33
  }
@@ -4,4 +4,4 @@ import { projectSettings } from '../../ProjectSettings';
4
4
  import type { SitemapData } from './SitemapData';
5
5
 
6
6
  export const useSitemap = (fallback?: Fallback) =>
7
- useSWRResource<SitemapData>(projectSettings.SITEMAP || 'sitemap', fallback);
7
+ useSWRResource<SitemapData>(projectSettings.SITEMAP || 'sitemap', { fallback });
@@ -70,9 +70,13 @@ export const useSwipeListScroll = <E extends HTMLElement>({
70
70
  }, [itemCount, canScrollRight]);
71
71
 
72
72
  const scrollTo = useCallback(
73
- (idx) => {
73
+ (idx: number) => {
74
74
  if (containerRef?.current) {
75
- containerRef.current.children[idx]?.scrollIntoView();
75
+ containerRef.current.children[idx]?.scrollIntoView({
76
+ behavior: 'smooth',
77
+ block: 'nearest',
78
+ inline: 'center',
79
+ });
76
80
  }
77
81
  },
78
82
  [containerRef],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.13.13",
3
+ "version": "0.13.14",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "content": {
3
- "button": {
4
- "text": "Отправить заявку"
3
+ "formBlock": {
4
+ "button": {
5
+ "text": "Отправить заявку",
6
+ "version": "primary"
7
+ },
8
+ "formType": "ApplicationFormBusinessCard"
5
9
  },
6
- "typeForm": "credit",
7
10
  "version": "primary"
8
11
  }
9
12
  }
@@ -2,12 +2,11 @@ import type { ButtonVersion } from '../../model/ButtonVersion';
2
2
  import type { TitleProps } from '../../model/HeadlineType';
3
3
  import type { UniBlockContent } from '../../model/JSXBlock';
4
4
  import type { LinkProps } from '../../model/LinkProps';
5
- import type { ButtonContent } from '../../ui-kit/Button/ButtonContent';
6
5
 
7
6
  /**
8
7
  * @title Кнопка
9
8
  */
10
- export interface SubmitButtonProps extends ButtonContent {
9
+ export interface SubmitButtonProps {
11
10
  /** @title Текст */
12
11
  text?: string;
13
12
  version?: ButtonVersion;
@@ -19,64 +18,73 @@ export type CommonApplicationFormProps = TitleProps & {
19
18
  link?: LinkProps;
20
19
  };
21
20
 
22
- export type ApplicationFormBlockDef =
23
- | BusinessCardFormParamsDef
24
- | WedFormParamsDef
25
- | DepositFormParamsDef
26
- | CreditFormParamsDef
27
- | AcquiringFormParamsDef
28
- | GrantSupportFormParamsDef;
29
-
30
21
  /**
31
22
  * @title Бизнес-карта
32
- * @default {"formType": "ApplicationFormBusinessCard"}
33
23
  */
34
- export type BusinessCardFormParamsDef = CommonApplicationFormProps & {
35
- formType: 'ApplicationFormBusinessCard';
36
- };
24
+ export type BusinessCardFormParamsDef = TitleProps &
25
+ CommonApplicationFormProps & {
26
+ /** @default ApplicationFormBusinessCard */
27
+ formType: 'ApplicationFormBusinessCard';
28
+ };
37
29
 
38
30
  /**
39
31
  * @title ВЭД
40
- * @default {"formType": "ApplicationFormWed"}
41
32
  */
42
- export type WedFormParamsDef = CommonApplicationFormProps & {
43
- formType: 'ApplicationFormWed';
44
- };
33
+ export type WedFormParamsDef = TitleProps &
34
+ CommonApplicationFormProps & {
35
+ /** @default ApplicationFormWed */
36
+ formType: 'ApplicationFormWed';
37
+ };
45
38
 
46
39
  /**
47
40
  * @title Депозит
48
- * @default {"formType": "ApplicationFormDeposit"}
49
41
  */
50
- export type DepositFormParamsDef = CommonApplicationFormProps & {
51
- formType: 'ApplicationFormDeposit';
52
- };
42
+ export type DepositFormParamsDef = TitleProps &
43
+ CommonApplicationFormProps & {
44
+ /** @default ApplicationFormDeposit */
45
+ formType: 'ApplicationFormDeposit';
46
+ };
53
47
 
54
48
  /**
55
49
  * @title Кредит
56
- * @default {"formType": "ApplicationFormCredit"}
57
50
  */
58
- export type CreditFormParamsDef = CommonApplicationFormProps & {
59
- formType: 'ApplicationFormCredit';
60
- };
51
+ export type CreditFormParamsDef = TitleProps &
52
+ CommonApplicationFormProps & {
53
+ /** @default ApplicationFormCredit */
54
+ formType: 'ApplicationFormCredit';
55
+ };
61
56
 
62
57
  /**
63
58
  * @title Эквайринг
64
- * @default {"formType": "ApplicationFormAcquiring"}
65
59
  */
66
- export type AcquiringFormParamsDef = CommonApplicationFormProps & {
67
- formType: 'ApplicationFormAcquiring';
68
- };
60
+ export type AcquiringFormParamsDef = TitleProps &
61
+ CommonApplicationFormProps & {
62
+ /** @default ApplicationFormAcquiring */
63
+ formType: 'ApplicationFormAcquiring';
64
+ };
69
65
 
70
66
  /**
71
67
  * @title Грантовая поддержка
72
- * @default {"formType": "ApplicationFormGrantSupport"}
73
68
  */
74
- export type GrantSupportFormParamsDef = CommonApplicationFormProps & {
69
+ export type GrantSupportFormParamsDef = TitleProps & {
70
+ /** @default ApplicationFormGrantSupport */
75
71
  formType: 'ApplicationFormGrantSupport';
72
+ button?: SubmitButtonProps;
76
73
  /** @title Адрес справочника */
77
74
  sourceBookDir?: string;
78
75
  };
79
76
 
77
+ /**
78
+ * @title Настройки формы
79
+ */
80
+ export type ApplicationFormBlockDef =
81
+ | BusinessCardFormParamsDef
82
+ | WedFormParamsDef
83
+ | DepositFormParamsDef
84
+ | CreditFormParamsDef
85
+ | AcquiringFormParamsDef
86
+ | GrantSupportFormParamsDef;
87
+
80
88
  /**
81
89
  * @title Форма заявки
82
90
  */
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { projectSettings } from '../../ProjectSettings';
2
3
  import { useSWRResource } from '../../hooks/useSWRResource';
3
4
  import type { LinkCommonProps } from '../../model/LinkProps';
4
- import { projectSettings } from '../../ProjectSettings';
5
5
  import { useSitemap } from '../../services/sitemap/useSitemap';
6
6
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
7
  import { Button } from '../../ui-kit/Button/Button';
@@ -9,12 +9,12 @@ import { LinkList } from '../../ui-kit/LinkList/LinkList';
9
9
  import { Text } from '../../ui-kit/Text/Text';
10
10
  import { RollupItem } from '../RollupItem/RollupItem';
11
11
  import { Contacts } from './Contacts';
12
- import { findIconByHref } from './findIconByHref';
13
12
  import type { FooterDataProps } from './FooterDataProps';
14
13
  import type { FooterProps } from './FooterProps';
15
14
  import { HorizontalNavigation } from './HorizontalNavigation';
16
15
  import { SocialMedia } from './SocialMedia';
17
16
  import { TextInformation } from './TextInformation';
17
+ import { findIconByHref } from './findIconByHref';
18
18
 
19
19
  export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
20
20
  const fallback = rest.options?.page?.fallback;
@@ -26,7 +26,7 @@ export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
26
26
  mobileApps,
27
27
  horizontalNavigationTitle,
28
28
  documents,
29
- } = useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', fallback);
29
+ } = useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', { fallback });
30
30
 
31
31
  return (
32
32
  <BlockWrapper tag="footer" className={className} {...rest}>
@@ -1,6 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useSWRResource } from '../../hooks/useSWRResource';
3
2
  import { projectSettings } from '../../ProjectSettings';
3
+ import { useSWRResource } from '../../hooks/useSWRResource';
4
4
  import { useSitemap } from '../../services/sitemap/useSitemap';
5
5
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
6
6
  import { Logo } from '../../ui-kit/Logo/Logo';
@@ -18,10 +18,9 @@ const LEFT_COL_WIDTH = 'w-52';
18
18
  export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
19
19
  const { topItems } = useSitemap(rest.options?.page?.fallback);
20
20
  const { documents, relatedEnterprises, contacts, socialMedia, mobileApps, logo } =
21
- useSWRResource<FooterDataProps>(
22
- projectSettings.FOOTER || 'footer',
23
- rest.options?.page?.fallback,
24
- );
21
+ useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', {
22
+ fallback: rest.options?.page?.fallback,
23
+ });
25
24
 
26
25
  return (
27
26
  <BlockWrapper tag="footer" className={className} {...rest}>