@redneckz/wildless-cms-uni-blocks 0.9.14 → 0.9.16

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 (212) hide show
  1. package/bundle/bundle.umd.js +35 -24
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/Calculator/constants.d.ts +3 -2
  4. package/bundle/components/Calculator/useDepositCalculatorParams.d.ts +1 -0
  5. package/bundle/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +1 -1
  6. package/bundle/hooks/useLink.d.ts +5 -1
  7. package/bundle/services/sitemap/SitemapData.d.ts +2 -2
  8. package/bundle/ui-kit/SearchDialog/SearchDialog.d.ts +2 -2
  9. package/bundle/ui-kit/Sitemap/Sitemap.d.ts +2 -2
  10. package/bundle/utils/adjustHref.d.ts +1 -1
  11. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
  12. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
  13. package/dist/components/Calculator/CreditCalculatorForm.js +1 -1
  14. package/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
  15. package/dist/components/Calculator/DepositCalculatorForm.js +6 -3
  16. package/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
  17. package/dist/components/Calculator/constants.d.ts +3 -2
  18. package/dist/components/Calculator/constants.js +7 -6
  19. package/dist/components/Calculator/constants.js.map +1 -1
  20. package/dist/components/Calculator/useDepositCalculatorParams.d.ts +1 -0
  21. package/dist/components/Calculator/useDepositCalculatorParams.js +6 -1
  22. package/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  23. package/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +1 -1
  24. package/dist/components/Footer/TextInformationLink.js +1 -1
  25. package/dist/components/Footer/TextInformationLink.js.map +1 -1
  26. package/dist/components/LinkDocs/LinkDocsListItemBase.js +1 -1
  27. package/dist/components/LinkDocs/LinkDocsListItemBase.js.map +1 -1
  28. package/dist/components/TariffsTable/TableTileHeader.js +1 -1
  29. package/dist/components/TariffsTable/TableTileHeader.js.map +1 -1
  30. package/dist/components/TariffsTable/TariffsTableRow.js +1 -1
  31. package/dist/components/TariffsTable/TariffsTableRow.js.map +1 -1
  32. package/dist/hooks/useLink.d.ts +5 -1
  33. package/dist/hooks/useLink.js +3 -2
  34. package/dist/hooks/useLink.js.map +1 -1
  35. package/dist/services/sitemap/SitemapData.d.ts +2 -2
  36. package/dist/ui-kit/SearchDialog/SearchDialog.d.ts +2 -2
  37. package/dist/ui-kit/SearchDialog/SearchDialog.js.map +1 -1
  38. package/dist/ui-kit/Sitemap/Sitemap.d.ts +2 -2
  39. package/dist/ui-kit/Sitemap/Sitemap.js +3 -4
  40. package/dist/ui-kit/Sitemap/Sitemap.js.map +1 -1
  41. package/dist/ui-kit/TopItem/TopItem.js +1 -1
  42. package/dist/ui-kit/TopItem/TopItem.js.map +1 -1
  43. package/dist/utils/adjustHref.d.ts +1 -1
  44. package/dist/utils/adjustHref.js +4 -3
  45. package/dist/utils/adjustHref.js.map +1 -1
  46. package/lib/common.css +1 -1
  47. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
  48. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
  49. package/lib/components/Calculator/CreditCalculatorForm.js +2 -2
  50. package/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
  51. package/lib/components/Calculator/DepositCalculatorForm.js +8 -5
  52. package/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
  53. package/lib/components/Calculator/constants.d.ts +3 -2
  54. package/lib/components/Calculator/constants.js +6 -5
  55. package/lib/components/Calculator/constants.js.map +1 -1
  56. package/lib/components/Calculator/useDepositCalculatorParams.d.ts +1 -0
  57. package/lib/components/Calculator/useDepositCalculatorParams.js +6 -1
  58. package/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  59. package/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +1 -1
  60. package/lib/components/Footer/TextInformationLink.js +1 -1
  61. package/lib/components/Footer/TextInformationLink.js.map +1 -1
  62. package/lib/components/LinkDocs/LinkDocsListItemBase.js +1 -1
  63. package/lib/components/LinkDocs/LinkDocsListItemBase.js.map +1 -1
  64. package/lib/components/TariffsTable/TableTileHeader.js +1 -1
  65. package/lib/components/TariffsTable/TableTileHeader.js.map +1 -1
  66. package/lib/components/TariffsTable/TariffsTableRow.js +1 -1
  67. package/lib/components/TariffsTable/TariffsTableRow.js.map +1 -1
  68. package/lib/hooks/useLink.d.ts +5 -1
  69. package/lib/hooks/useLink.js +3 -2
  70. package/lib/hooks/useLink.js.map +1 -1
  71. package/lib/services/sitemap/SitemapData.d.ts +2 -2
  72. package/lib/ui-kit/SearchDialog/SearchDialog.d.ts +2 -2
  73. package/lib/ui-kit/SearchDialog/SearchDialog.js.map +1 -1
  74. package/lib/ui-kit/Sitemap/Sitemap.d.ts +2 -2
  75. package/lib/ui-kit/Sitemap/Sitemap.js +3 -4
  76. package/lib/ui-kit/Sitemap/Sitemap.js.map +1 -1
  77. package/lib/ui-kit/TopItem/TopItem.js +1 -1
  78. package/lib/ui-kit/TopItem/TopItem.js.map +1 -1
  79. package/lib/utils/adjustHref.d.ts +1 -1
  80. package/lib/utils/adjustHref.js +4 -3
  81. package/lib/utils/adjustHref.js.map +1 -1
  82. package/mobile/bundle/bundle.umd.js +14 -12
  83. package/mobile/bundle/bundle.umd.min.js +1 -1
  84. package/mobile/bundle/components/Calculator/constants.d.ts +3 -2
  85. package/mobile/bundle/components/Calculator/useDepositCalculatorParams.d.ts +1 -0
  86. package/mobile/bundle/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +1 -1
  87. package/mobile/bundle/hooks/useLink.d.ts +5 -1
  88. package/mobile/bundle/services/sitemap/SitemapData.d.ts +2 -2
  89. package/mobile/bundle/ui-kit/SearchDialog/SearchDialog.d.ts +2 -2
  90. package/mobile/bundle/ui-kit/Sitemap/Sitemap.d.ts +2 -2
  91. package/mobile/bundle/utils/adjustHref.d.ts +1 -1
  92. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
  93. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
  94. package/mobile/dist/components/Calculator/CreditCalculatorForm.js +1 -1
  95. package/mobile/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
  96. package/mobile/dist/components/Calculator/DepositCalculatorForm.js +6 -3
  97. package/mobile/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
  98. package/mobile/dist/components/Calculator/constants.d.ts +3 -2
  99. package/mobile/dist/components/Calculator/constants.js +7 -6
  100. package/mobile/dist/components/Calculator/constants.js.map +1 -1
  101. package/mobile/dist/components/Calculator/useDepositCalculatorParams.d.ts +1 -0
  102. package/mobile/dist/components/Calculator/useDepositCalculatorParams.js +6 -1
  103. package/mobile/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  104. package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +1 -1
  105. package/mobile/dist/components/Footer/TextInformationLink.js +1 -1
  106. package/mobile/dist/components/Footer/TextInformationLink.js.map +1 -1
  107. package/mobile/dist/components/LinkDocs/LinkDocsListItemBase.js +1 -1
  108. package/mobile/dist/components/LinkDocs/LinkDocsListItemBase.js.map +1 -1
  109. package/mobile/dist/components/TariffsTable/TableTileHeader.js +1 -1
  110. package/mobile/dist/components/TariffsTable/TableTileHeader.js.map +1 -1
  111. package/mobile/dist/components/TariffsTable/TariffsTableRow.js +1 -1
  112. package/mobile/dist/components/TariffsTable/TariffsTableRow.js.map +1 -1
  113. package/mobile/dist/hooks/useLink.d.ts +5 -1
  114. package/mobile/dist/hooks/useLink.js +3 -2
  115. package/mobile/dist/hooks/useLink.js.map +1 -1
  116. package/mobile/dist/services/sitemap/SitemapData.d.ts +2 -2
  117. package/mobile/dist/ui-kit/SearchDialog/SearchDialog.d.ts +2 -2
  118. package/mobile/dist/ui-kit/SearchDialog/SearchDialog.js.map +1 -1
  119. package/mobile/dist/ui-kit/Sitemap/Sitemap.d.ts +2 -2
  120. package/mobile/dist/ui-kit/Sitemap/Sitemap.js +3 -4
  121. package/mobile/dist/ui-kit/Sitemap/Sitemap.js.map +1 -1
  122. package/mobile/dist/ui-kit/TopItem/TopItem.js +1 -1
  123. package/mobile/dist/ui-kit/TopItem/TopItem.js.map +1 -1
  124. package/mobile/dist/utils/adjustHref.d.ts +1 -1
  125. package/mobile/dist/utils/adjustHref.js +4 -3
  126. package/mobile/dist/utils/adjustHref.js.map +1 -1
  127. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
  128. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
  129. package/mobile/lib/components/Calculator/CreditCalculatorForm.js +2 -2
  130. package/mobile/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
  131. package/mobile/lib/components/Calculator/DepositCalculatorForm.js +8 -5
  132. package/mobile/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
  133. package/mobile/lib/components/Calculator/constants.d.ts +3 -2
  134. package/mobile/lib/components/Calculator/constants.js +6 -5
  135. package/mobile/lib/components/Calculator/constants.js.map +1 -1
  136. package/mobile/lib/components/Calculator/useDepositCalculatorParams.d.ts +1 -0
  137. package/mobile/lib/components/Calculator/useDepositCalculatorParams.js +6 -1
  138. package/mobile/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  139. package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +1 -1
  140. package/mobile/lib/components/Footer/TextInformationLink.js +1 -1
  141. package/mobile/lib/components/Footer/TextInformationLink.js.map +1 -1
  142. package/mobile/lib/components/LinkDocs/LinkDocsListItemBase.js +1 -1
  143. package/mobile/lib/components/LinkDocs/LinkDocsListItemBase.js.map +1 -1
  144. package/mobile/lib/components/TariffsTable/TableTileHeader.js +1 -1
  145. package/mobile/lib/components/TariffsTable/TableTileHeader.js.map +1 -1
  146. package/mobile/lib/components/TariffsTable/TariffsTableRow.js +1 -1
  147. package/mobile/lib/components/TariffsTable/TariffsTableRow.js.map +1 -1
  148. package/mobile/lib/hooks/useLink.d.ts +5 -1
  149. package/mobile/lib/hooks/useLink.js +3 -2
  150. package/mobile/lib/hooks/useLink.js.map +1 -1
  151. package/mobile/lib/services/sitemap/SitemapData.d.ts +2 -2
  152. package/mobile/lib/ui-kit/SearchDialog/SearchDialog.d.ts +2 -2
  153. package/mobile/lib/ui-kit/SearchDialog/SearchDialog.js.map +1 -1
  154. package/mobile/lib/ui-kit/Sitemap/Sitemap.d.ts +2 -2
  155. package/mobile/lib/ui-kit/Sitemap/Sitemap.js +3 -4
  156. package/mobile/lib/ui-kit/Sitemap/Sitemap.js.map +1 -1
  157. package/mobile/lib/ui-kit/TopItem/TopItem.js +1 -1
  158. package/mobile/lib/ui-kit/TopItem/TopItem.js.map +1 -1
  159. package/mobile/lib/utils/adjustHref.d.ts +1 -1
  160. package/mobile/lib/utils/adjustHref.js +4 -3
  161. package/mobile/lib/utils/adjustHref.js.map +1 -1
  162. package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +2 -2
  163. package/mobile/src/components/Calculator/CreditCalculatorForm.tsx +2 -2
  164. package/mobile/src/components/Calculator/DepositCalculatorForm.tsx +8 -5
  165. package/mobile/src/components/Calculator/constants.ts +6 -5
  166. package/mobile/src/components/Calculator/useDepositCalculatorParams.ts +9 -1
  167. package/mobile/src/components/CarouselProgramsCard/CarouselProgramsCard.example.json +6 -6
  168. package/mobile/src/components/CarouselRichTextCard/CarouselRichTextCardContent.ts +1 -1
  169. package/mobile/src/components/Footer/TextInformationLink.tsx +1 -1
  170. package/mobile/src/components/LinkDocs/LinkDocsListItemBase.tsx +2 -2
  171. package/mobile/src/components/TariffsTable/TableTileHeader.tsx +1 -3
  172. package/mobile/src/components/TariffsTable/TariffsTableRow.tsx +3 -3
  173. package/mobile/src/hooks/useLink.ts +9 -2
  174. package/mobile/src/services/sitemap/SitemapData.ts +2 -2
  175. package/mobile/src/ui-kit/SearchDialog/SearchDialog.tsx +5 -5
  176. package/mobile/src/ui-kit/Sitemap/Sitemap.tsx +6 -7
  177. package/mobile/src/ui-kit/TopItem/TopItem.tsx +1 -1
  178. package/mobile/src/utils/adjustHref.ts +16 -11
  179. package/package.json +1 -1
  180. package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +2 -2
  181. package/src/components/Calculator/CreditCalculatorForm.tsx +2 -2
  182. package/src/components/Calculator/DepositCalculatorForm.tsx +8 -5
  183. package/src/components/Calculator/constants.ts +6 -5
  184. package/src/components/Calculator/useDepositCalculatorParams.ts +9 -1
  185. package/src/components/CarouselProgramsCard/CarouselProgramsCard.example.json +6 -6
  186. package/src/components/CarouselRichTextCard/CarouselRichTextCardContent.ts +1 -1
  187. package/src/components/Footer/TextInformationLink.tsx +1 -1
  188. package/src/components/LinkDocs/LinkDocsListItemBase.tsx +2 -2
  189. package/src/components/TariffsTable/TableTileHeader.tsx +1 -3
  190. package/src/components/TariffsTable/TariffsTableRow.tsx +3 -3
  191. package/src/hooks/useLink.ts +9 -2
  192. package/src/services/sitemap/SitemapData.ts +2 -2
  193. package/src/ui-kit/SearchDialog/SearchDialog.tsx +5 -5
  194. package/src/ui-kit/Sitemap/Sitemap.tsx +6 -7
  195. package/src/ui-kit/TopItem/TopItem.tsx +1 -1
  196. package/src/utils/adjustHref.ts +16 -11
  197. package/bundle/components/Calculator/getDefaultSum.d.ts +0 -1
  198. package/dist/components/Calculator/getDefaultSum.d.ts +0 -1
  199. package/dist/components/Calculator/getDefaultSum.js +0 -6
  200. package/dist/components/Calculator/getDefaultSum.js.map +0 -1
  201. package/lib/components/Calculator/getDefaultSum.d.ts +0 -1
  202. package/lib/components/Calculator/getDefaultSum.js +0 -3
  203. package/lib/components/Calculator/getDefaultSum.js.map +0 -1
  204. package/mobile/bundle/components/Calculator/getDefaultSum.d.ts +0 -1
  205. package/mobile/dist/components/Calculator/getDefaultSum.d.ts +0 -1
  206. package/mobile/dist/components/Calculator/getDefaultSum.js +0 -6
  207. package/mobile/dist/components/Calculator/getDefaultSum.js.map +0 -1
  208. package/mobile/lib/components/Calculator/getDefaultSum.d.ts +0 -1
  209. package/mobile/lib/components/Calculator/getDefaultSum.js +0 -3
  210. package/mobile/lib/components/Calculator/getDefaultSum.js.map +0 -1
  211. package/mobile/src/components/Calculator/getDefaultSum.ts +0 -4
  212. package/src/components/Calculator/getDefaultSum.ts +0 -4
@@ -10,16 +10,16 @@
10
10
  "title": "Заголовок",
11
11
  "list": [
12
12
  {
13
- "title": "Ячейка 1-1",
14
- "description": "Описание 1-1"
13
+ "title": "Заголовок 1",
14
+ "description": "Описание 1"
15
15
  },
16
16
  {
17
- "title": "Ячейка 1-2",
18
- "description": "Описание 1-2"
17
+ "title": "Заголовок 2",
18
+ "description": "Описание 2"
19
19
  },
20
20
  {
21
- "title": "Ячейка 1-3",
22
- "description": "Описание 1-3"
21
+ "title": "Заголовок 3",
22
+ "description": "Описание 3"
23
23
  }
24
24
  ]
25
25
  }
@@ -4,4 +4,4 @@ import type { RichTextProps } from '../../ui-kit/RichText/RichTextProps';
4
4
  /**
5
5
  * @title Карточка c форматированным вводом
6
6
  */
7
- export type CarouselRichTextCardContent = UniBlockContent & RichTextProps & {};
7
+ export type CarouselRichTextCardContent = UniBlockContent & RichTextProps;
@@ -10,7 +10,7 @@ interface TextInformationLinkProps extends LinkProps {
10
10
 
11
11
  export const TextInformationLink = JSX<Partial<TextInformationLinkProps>>(
12
12
  ({ className = '', index, ...rest }) => {
13
- const link = useLink();
13
+ const link = useLink({ isRemote: true });
14
14
  const { href, target, text, onClick } = link(rest);
15
15
 
16
16
  return (
@@ -26,8 +26,8 @@ export const LinkDocsListItemBase = JSX<LinkDocsListItemBaseProps>(
26
26
  <Img
27
27
  className={iconClassName}
28
28
  image={getIconWithVersion(icon)}
29
- width="24px"
30
- height="24px"
29
+ width="24"
30
+ height="24"
31
31
  asSVG
32
32
  />
33
33
  ) : null}
@@ -6,8 +6,6 @@ import type { TariffsTableRowHeader } from './TariffsTableContent';
6
6
  export const TableTileHeader = JSX<TariffsTableRowHeader>(({ title, icon }) => (
7
7
  <div className="flex gap-2.5 mb-2">
8
8
  {title ? <Heading headingType="h3" className="font-medium" title={title} /> : null}
9
- {icon ? (
10
- <Img className="ml-auto max-w-6 max-h-6" image={icon} width="24px" height="24px" />
11
- ) : null}
9
+ {icon ? <Img className="ml-auto min-w-6" image={icon} width="24" height="24" /> : null}
12
10
  </div>
13
11
  ));
@@ -40,10 +40,10 @@ export const TariffsTableRow = JSX<TariffsTableRowProps>(
40
40
  <div className="flex items-center text-primary-text" role="cell">
41
41
  {header?.icon ? (
42
42
  <Img
43
- className="mr-3.5 max-w-6 max-h-6"
43
+ className="mr-3.5 max-w-6"
44
44
  image={getIconWithVersion(header.icon)}
45
- width="24px"
46
- height="24px"
45
+ width="24"
46
+ height="24"
47
47
  asSVG
48
48
  />
49
49
  ) : null}
@@ -10,13 +10,20 @@ interface Clickable {
10
10
  onClick(ev?: PreventableEvent): void;
11
11
  }
12
12
 
13
- export function useLink(isRemote = false) {
13
+ interface UseLinkParams {
14
+ isRemote?: boolean;
15
+ basePath?: string;
16
+ }
17
+
18
+ export function useLink(params: UseLinkParams = {}) {
19
+ const { isRemote, basePath } = params;
20
+
14
21
  const router = useRouter();
15
22
  const { close } = useDialog();
16
23
 
17
24
  return <L extends Partial<LinkProps & Clickable>>(props: L): L & Clickable => ({
18
25
  ...props,
19
- href: isRemote ? props.href : adjustHref(router)(props.href),
26
+ href: isRemote ? props.href : adjustHref(router)(props.href, basePath),
20
27
  'aria-label': props.text,
21
28
  onClick: handlerDecorator(handleHref(props), props),
22
29
  });
@@ -6,7 +6,7 @@ import type { IconProps, Picture } from '../../model/Picture';
6
6
  * @title Ссылка
7
7
  * @required ["text", "href"]
8
8
  */
9
- export interface TopMenuItem extends LinkProps {
9
+ export interface TopMenuItemProps extends LinkProps {
10
10
  /** @hidden */
11
11
  items?: LinkProps[];
12
12
  }
@@ -27,7 +27,7 @@ export interface DispositionItem extends LinkProps {
27
27
  export type ForeignOffice = LinkProps & IconProps;
28
28
 
29
29
  export interface SitemapData {
30
- topItems?: TopMenuItem[];
30
+ topItems?: TopMenuItemProps[];
31
31
  dispositions?: DispositionItem[];
32
32
  logo?: LogoType;
33
33
  foreignOffices?: ForeignOffice[];
@@ -2,7 +2,7 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useEffect, useMemo } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import type { LinkProps } from '../../model/LinkProps';
4
4
  import { useSearch, type SearchResult } from '../../services/search/useSearch';
5
- import type { TopMenuItem } from '../../services/sitemap/SitemapData';
5
+ import type { TopMenuItemProps } from '../../services/sitemap/SitemapData';
6
6
  import { joinPath } from '../../utils/url';
7
7
  import { zip } from '../../utils/zip';
8
8
  import { Dialog } from '../Dialog/Dialog';
@@ -11,7 +11,7 @@ import { Sitemap } from '../Sitemap/Sitemap';
11
11
  import { SearchInput } from './SearchInput';
12
12
 
13
13
  export interface SearchDialogProps {
14
- topItems?: TopMenuItem[];
14
+ topItems?: TopMenuItemProps[];
15
15
  }
16
16
 
17
17
  export const SEARCH_DIALOG_ID = 'search';
@@ -44,8 +44,8 @@ export const SearchDialog = JSX<SearchDialogProps>(({ topItems }) => {
44
44
  });
45
45
 
46
46
  const combineTopItemsAndSearchResult =
47
- (topItems: TopMenuItem[] | undefined) =>
48
- (searchResult: SearchResult | null | undefined): TopMenuItem[] =>
47
+ (topItems: TopMenuItemProps[] | undefined) =>
48
+ (searchResult: SearchResult | null | undefined): TopMenuItemProps[] =>
49
49
  topItems?.length && searchResult?.length
50
50
  ? zip(topItems, searchResult).map(([_, portalSearchResult]) => ({
51
51
  ..._,
@@ -56,7 +56,7 @@ const combineTopItemsAndSearchResult =
56
56
  : [];
57
57
 
58
58
  // Temp
59
- function printSearchItems(topItems: TopMenuItem[]) {
59
+ function printSearchItems(topItems: TopMenuItemProps[]) {
60
60
  for (const _ of topItems.filter(({ items }) => items?.length)) {
61
61
  console.group(_.text);
62
62
  console.table(_.items, ['text', 'href']);
@@ -2,17 +2,16 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useLink } from '../../hooks/useLink';
3
3
  import type { LinkProps } from '../../model/LinkProps';
4
4
  import { projectSettings } from '../../ProjectSettings';
5
- import type { TopMenuItem } from '../../services/sitemap/SitemapData';
5
+ import type { TopMenuItemProps } from '../../services/sitemap/SitemapData';
6
6
  import { style } from '../../utils/style';
7
- import { joinPath } from '../../utils/url';
8
7
 
9
8
  export interface SitemapProps {
10
9
  className?: string;
11
- topItems?: TopMenuItem[];
10
+ topItems?: TopMenuItemProps[];
12
11
  }
13
12
 
14
13
  export const Sitemap = JSX<SitemapProps>(({ className, topItems }) => {
15
- const link = useLink(true);
14
+ const link = useLink({ isRemote: true });
16
15
 
17
16
  return (
18
17
  <div className={style('flex items-start justify-between', className)}>
@@ -21,7 +20,7 @@ export const Sitemap = JSX<SitemapProps>(({ className, topItems }) => {
21
20
  );
22
21
  });
23
22
 
24
- const renderColumn = (menuItem: TopMenuItem & { onClick: () => void }, index: number) => {
23
+ const renderColumn = (menuItem: TopMenuItemProps & { onClick: () => void }, index: number) => {
25
24
  const { text, items, href, target, onClick } = menuItem;
26
25
 
27
26
  return (
@@ -50,7 +49,7 @@ const ColumnItem = JSX<ColumnItemProps>(({ text, index, basePath, ...rest }) =>
50
49
  const isAnotherPortal =
51
50
  projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
52
51
 
53
- const link = useLink(isAnotherPortal);
52
+ const link = useLink({ isRemote: isAnotherPortal });
54
53
  const { href, target, onClick } = link(rest);
55
54
 
56
55
  return (
@@ -59,7 +58,7 @@ const ColumnItem = JSX<ColumnItemProps>(({ text, index, basePath, ...rest }) =>
59
58
  'text-l-light text-secondary-text hover:text-primary-main no-underline',
60
59
  'overflow-x-hidden overflow-ellipsis whitespace-nowrap',
61
60
  )}
62
- href={isAnotherPortal ? joinPath(basePath, href) : href}
61
+ href={href}
63
62
  target={target || '_self'}
64
63
  onClick={onClick}
65
64
  >
@@ -15,7 +15,7 @@ export interface TopItemProps extends TopItemContent {
15
15
  }
16
16
 
17
17
  export const TopItem = JSX<TopItemProps>(({ className = '', active, flat, children, ...rest }) => {
18
- const link = useLink(true);
18
+ const link = useLink({ isRemote: true });
19
19
  const { href, target, text, onClick } = link(rest);
20
20
 
21
21
  return (
@@ -2,16 +2,21 @@ import { projectSettings } from '../ProjectSettings';
2
2
  import { dirname } from './dirname';
3
3
  import { isURL, joinPath } from './url';
4
4
 
5
- export const adjustHref = (router: { pathname: string }) => (href: string | undefined) => {
6
- if (!href || isURL(href) || (projectSettings.CDN && href.startsWith(projectSettings.CDN))) {
7
- return href;
8
- }
5
+ export const adjustHref =
6
+ (router: { pathname: string }) =>
7
+ (href: string | undefined, basePath = projectSettings.BASE_PATH) => {
8
+ if (!href || isURL(href) || hasPrefix(href, projectSettings.CDN)) {
9
+ return href;
10
+ }
9
11
 
10
- const isRelativeToBase = href.startsWith('/');
12
+ const isRelativeToBase = href.startsWith('/');
11
13
 
12
- return joinPath(
13
- projectSettings.BASE_PATH,
14
- isRelativeToBase ? '/' : dirname(router.pathname),
15
- href,
16
- );
17
- };
14
+ return joinPath(
15
+ hasPrefix(href, basePath) ? '' : basePath,
16
+ isRelativeToBase ? '/' : dirname(router.pathname),
17
+ href,
18
+ );
19
+ };
20
+
21
+ const hasPrefix = (href: string, prefix: string | undefined) =>
22
+ prefix && href && href.startsWith(prefix);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.9.14",
3
+ "version": "0.9.16",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -3,13 +3,13 @@ import { AlignText } from '../../model/AlignText';
3
3
  import type { UniBlockProps } from '../../model/JSXBlock';
4
4
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
5
5
  import { Img } from '../../ui-kit/Img/Img';
6
+ import { style } from '../../utils/style';
6
7
  import { Headline } from '../Headline/Headline';
7
8
  import type {
8
9
  BonusBenefit,
9
10
  BonusBenefitsBlockContent,
10
11
  ColumnsCount,
11
12
  } from './BonusBenefitsBlockContent';
12
- import { style } from '../../utils/style';
13
13
 
14
14
  export interface BenefitsBlockProps extends BonusBenefitsBlockContent, UniBlockProps {}
15
15
 
@@ -49,7 +49,7 @@ const renderBonusBenefit = ({ icon, title, description }: BonusBenefit, i: numbe
49
49
  )}
50
50
  >
51
51
  {title ? <span>{title}</span> : null}
52
- {icon ? <Img image={icon} height="180" width="auto" className="w-auto" /> : null}
52
+ {icon ? <Img image={icon} height="180" className="w-auto" /> : null}
53
53
  {description ? <span>{description}</span> : null}
54
54
  </div>
55
55
  );
@@ -8,7 +8,7 @@ import type {
8
8
  CreditCalculatorProps,
9
9
  } from './CalculatorContent';
10
10
  import { CalculatorValueBlock } from './CalculatorValueBlock';
11
- import { DEFAULT_MONTHS, DEFAULT_SUM } from './constants';
11
+ import { CREDIT_DEFAULT_SUM, DEFAULT_MONTHS } from './constants';
12
12
  import { Rate } from './Rate';
13
13
  import { renderFootnote } from './renderFootnote';
14
14
  import { renderMonthsInput } from './renderMonthsInput';
@@ -31,7 +31,7 @@ export const CreditCalculatorForm = JSX<CreditCalculatorProp>(
31
31
  const handleIsPensionClient = useCallback((_: boolean) => toggleIsPensionClient(_), []);
32
32
  const [isInsurance, toggleIsInsurance] = useState(true);
33
33
  const handleIsInsurance = useCallback((_: boolean) => toggleIsInsurance(_), []);
34
- const [moneyValue, setMoneyValue] = useState(DEFAULT_SUM);
34
+ const [moneyValue, setMoneyValue] = useState(CREDIT_DEFAULT_SUM);
35
35
  const handleMoneyValue = useCallback((_: number) => setMoneyValue(_), []);
36
36
  const [monthsValue, setMonthsValue] = useState(DEFAULT_MONTHS);
37
37
  const handleMonthsValue = useCallback((_: number) => setMonthsValue(_), []);
@@ -1,12 +1,12 @@
1
1
  // TEMP
2
2
 
3
3
  import { JSX } from '@redneckz/uni-jsx';
4
- import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
4
+ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
5
5
  import { renderButtonsSection } from '../../ui-kit/Button/renderButtonsSection';
6
6
  import { style } from '../../utils/style';
7
7
  import { DepositCalculatorParamsViewSettings, DepositCalculatorProps } from './CalculatorContent';
8
8
  import { CalculatorValueBlock } from './CalculatorValueBlock';
9
- import { DEFAULT_MONTHS, DEFAULT_SUM } from './constants';
9
+ import { DEPOSIT_DEFAULT_SUM } from './constants';
10
10
  import { Rate } from './Rate';
11
11
  import { renderFootnote } from './renderFootnote';
12
12
  import { renderInterestPayment } from './renderInterestPayment';
@@ -21,9 +21,9 @@ export interface DepositCalculatorProp extends DepositCalculatorProps {
21
21
 
22
22
  export const DepositCalculatorForm = JSX<DepositCalculatorProp>(
23
23
  ({ className = '', sourceBookDir, buttons, footnote, paramsViewSettings }) => {
24
- const [moneyValue, setMoneyValue] = useState(DEFAULT_SUM);
24
+ const [moneyValue, setMoneyValue] = useState(DEPOSIT_DEFAULT_SUM);
25
25
  const handleMoneyValue = useCallback((_: number) => setMoneyValue(_), []);
26
- const [monthsValue, setMonthsValue] = useState(DEFAULT_MONTHS);
26
+ const [monthsValue, setMonthsValue] = useState(0);
27
27
  const [isMonthlyInterestPayment, toggleIsMonthlyInterestPayment] = useState(false);
28
28
  const handleIsMonthlyInterestPayment = useCallback(
29
29
  (_: boolean) => toggleIsMonthlyInterestPayment(_),
@@ -47,7 +47,10 @@ export const DepositCalculatorForm = JSX<DepositCalculatorProp>(
47
47
  sourceBookDir,
48
48
  paramsViewSettings,
49
49
  );
50
- const { income, finalSum, rate } = calculatorParams;
50
+ const { defaultMonth, income, finalSum, rate } = calculatorParams;
51
+ useEffect(() => {
52
+ setMonthsValue(defaultMonth);
53
+ }, [defaultMonth]);
51
54
 
52
55
  return (
53
56
  <section className={style('flex justify-between', className)}>
@@ -3,9 +3,10 @@ import { BusinessDepositCalculatorSourceBookParams } from './useBusinessDepositC
3
3
  import { CreditCalculatorSourceBookParams } from './useCreditCalculatorParams';
4
4
  import { DepositCalculatorSourceBookParams } from './useDepositCalculatorParams';
5
5
 
6
- export const DEFAULT_MIN_SUM = 30000;
6
+ export const DEFAULT_MIN_SUM = 10000;
7
7
  export const DEFAULT_MAX_SUM = 5000000;
8
- export const DEFAULT_SUM = (DEFAULT_MAX_SUM - DEFAULT_MIN_SUM) / 2;
8
+ export const CREDIT_DEFAULT_SUM = 200000;
9
+ export const DEPOSIT_DEFAULT_SUM = 20000;
9
10
  export const DEFAULT_MIN_MONTHS = 13;
10
11
  export const DEFAULT_MAX_MONTHS = 60;
11
12
  export const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
@@ -25,10 +26,10 @@ export const DEFAULT_CREDIT_CALCULATOR_PARAMS: CreditCalculatorSourceBookParams
25
26
  maxSum: DEFAULT_MAX_SUM,
26
27
  minMonths: DEFAULT_MIN_MONTHS,
27
28
  maxMonths: DEFAULT_MAX_MONTHS,
28
- rate: 0,
29
- isSalaryClient: true,
29
+ rate: 12.5,
30
+ isSalaryClient: false,
30
31
  isPensionClient: false,
31
- isStateEmployee: true,
32
+ isStateEmployee: false,
32
33
  isInsurance: true,
33
34
  };
34
35
 
@@ -27,6 +27,7 @@ export interface DepositCalculatorParams
27
27
  extends DepositCalculatorSourceBookParams,
28
28
  DepositCalculatorUserInputParams {
29
29
  availableMonths: number[];
30
+ defaultMonth: number;
30
31
  income: number;
31
32
  finalSum: number;
32
33
  }
@@ -44,6 +45,9 @@ export const useDepositCalculatorParams = (
44
45
  const data = useCalculatorParams<DepositCalculatorData>(
45
46
  sourceBookDir || DEPOSIT_CALC_DEFAULT_DIR,
46
47
  );
48
+ const defaultMonth = data?.rows[0]
49
+ ? getMiddleMonth(data.rows[0].minMonths, data.rows[0].maxMonths)
50
+ : 1;
47
51
  const isExcludeMonthlyInterestPayment = !paramsViewSettings?.isShowMonthlyInterestPayment;
48
52
  const isExcludeRemoteRegistration = !paramsViewSettings?.isShowRemoteRegistration;
49
53
  const depositCalculatorSourceBookParams =
@@ -62,7 +66,7 @@ export const useDepositCalculatorParams = (
62
66
  isExclude: isExcludeRemoteRegistration,
63
67
  }) &&
64
68
  checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
65
- checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row),
69
+ checkRangeByKeys(monthsValue || defaultMonth, ['minMonths', 'maxMonths'], row),
66
70
  ) || DEFAULT_DEPOSIT_CALCULATOR_PARAMS;
67
71
 
68
72
  const { rate } = depositCalculatorSourceBookParams;
@@ -78,6 +82,7 @@ export const useDepositCalculatorParams = (
78
82
  sourceBookRows.map((row) => [row['minMonths'], row['maxMonths']]),
79
83
  ).flatMap(([start, end]) => arrayByRange(start, end)),
80
84
  ...userInputParams,
85
+ defaultMonth,
81
86
  income,
82
87
  finalSum,
83
88
  };
@@ -105,3 +110,6 @@ interface CheckRowByParamProps {
105
110
 
106
111
  const checkRowByParam = ({ row, userInputParams, paramKey, isExclude }: CheckRowByParamProps) =>
107
112
  isExclude || userInputParams[paramKey] === row[paramKey];
113
+
114
+ const getMiddleMonth = (minMonths: number, maxMonths: number): number =>
115
+ minMonths + Math.round((maxMonths - minMonths) / 2);
@@ -10,16 +10,16 @@
10
10
  "title": "Заголовок",
11
11
  "list": [
12
12
  {
13
- "title": "Ячейка 1-1",
14
- "description": "Описание 1-1"
13
+ "title": "Заголовок 1",
14
+ "description": "Описание 1"
15
15
  },
16
16
  {
17
- "title": "Ячейка 1-2",
18
- "description": "Описание 1-2"
17
+ "title": "Заголовок 2",
18
+ "description": "Описание 2"
19
19
  },
20
20
  {
21
- "title": "Ячейка 1-3",
22
- "description": "Описание 1-3"
21
+ "title": "Заголовок 3",
22
+ "description": "Описание 3"
23
23
  }
24
24
  ]
25
25
  }
@@ -4,4 +4,4 @@ import type { RichTextProps } from '../../ui-kit/RichText/RichTextProps';
4
4
  /**
5
5
  * @title Карточка c форматированным вводом
6
6
  */
7
- export type CarouselRichTextCardContent = UniBlockContent & RichTextProps & {};
7
+ export type CarouselRichTextCardContent = UniBlockContent & RichTextProps;
@@ -10,7 +10,7 @@ interface TextInformationLinkProps extends LinkProps {
10
10
 
11
11
  export const TextInformationLink = JSX<Partial<TextInformationLinkProps>>(
12
12
  ({ className = '', index, ...rest }) => {
13
- const link = useLink();
13
+ const link = useLink({ isRemote: true });
14
14
  const { href, target, text, onClick } = link(rest);
15
15
 
16
16
  return (
@@ -26,8 +26,8 @@ export const LinkDocsListItemBase = JSX<LinkDocsListItemBaseProps>(
26
26
  <Img
27
27
  className={iconClassName}
28
28
  image={getIconWithVersion(icon)}
29
- width="24px"
30
- height="24px"
29
+ width="24"
30
+ height="24"
31
31
  asSVG
32
32
  />
33
33
  ) : null}
@@ -6,8 +6,6 @@ import type { TariffsTableRowHeader } from './TariffsTableContent';
6
6
  export const TableTileHeader = JSX<TariffsTableRowHeader>(({ title, icon }) => (
7
7
  <div className="flex gap-2.5 mb-2">
8
8
  {title ? <Heading headingType="h3" className="font-medium" title={title} /> : null}
9
- {icon ? (
10
- <Img className="ml-auto max-w-6 max-h-6" image={icon} width="24px" height="24px" />
11
- ) : null}
9
+ {icon ? <Img className="ml-auto min-w-6" image={icon} width="24" height="24" /> : null}
12
10
  </div>
13
11
  ));
@@ -40,10 +40,10 @@ export const TariffsTableRow = JSX<TariffsTableRowProps>(
40
40
  <div className="flex items-center text-primary-text" role="cell">
41
41
  {header?.icon ? (
42
42
  <Img
43
- className="mr-3.5 max-w-6 max-h-6"
43
+ className="mr-3.5 max-w-6"
44
44
  image={getIconWithVersion(header.icon)}
45
- width="24px"
46
- height="24px"
45
+ width="24"
46
+ height="24"
47
47
  asSVG
48
48
  />
49
49
  ) : null}
@@ -10,13 +10,20 @@ interface Clickable {
10
10
  onClick(ev?: PreventableEvent): void;
11
11
  }
12
12
 
13
- export function useLink(isRemote = false) {
13
+ interface UseLinkParams {
14
+ isRemote?: boolean;
15
+ basePath?: string;
16
+ }
17
+
18
+ export function useLink(params: UseLinkParams = {}) {
19
+ const { isRemote, basePath } = params;
20
+
14
21
  const router = useRouter();
15
22
  const { close } = useDialog();
16
23
 
17
24
  return <L extends Partial<LinkProps & Clickable>>(props: L): L & Clickable => ({
18
25
  ...props,
19
- href: isRemote ? props.href : adjustHref(router)(props.href),
26
+ href: isRemote ? props.href : adjustHref(router)(props.href, basePath),
20
27
  'aria-label': props.text,
21
28
  onClick: handlerDecorator(handleHref(props), props),
22
29
  });
@@ -6,7 +6,7 @@ import type { IconProps, Picture } from '../../model/Picture';
6
6
  * @title Ссылка
7
7
  * @required ["text", "href"]
8
8
  */
9
- export interface TopMenuItem extends LinkProps {
9
+ export interface TopMenuItemProps extends LinkProps {
10
10
  /** @hidden */
11
11
  items?: LinkProps[];
12
12
  }
@@ -27,7 +27,7 @@ export interface DispositionItem extends LinkProps {
27
27
  export type ForeignOffice = LinkProps & IconProps;
28
28
 
29
29
  export interface SitemapData {
30
- topItems?: TopMenuItem[];
30
+ topItems?: TopMenuItemProps[];
31
31
  dispositions?: DispositionItem[];
32
32
  logo?: LogoType;
33
33
  foreignOffices?: ForeignOffice[];
@@ -2,7 +2,7 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useEffect, useMemo } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import type { LinkProps } from '../../model/LinkProps';
4
4
  import { useSearch, type SearchResult } from '../../services/search/useSearch';
5
- import type { TopMenuItem } from '../../services/sitemap/SitemapData';
5
+ import type { TopMenuItemProps } from '../../services/sitemap/SitemapData';
6
6
  import { joinPath } from '../../utils/url';
7
7
  import { zip } from '../../utils/zip';
8
8
  import { Dialog } from '../Dialog/Dialog';
@@ -11,7 +11,7 @@ import { Sitemap } from '../Sitemap/Sitemap';
11
11
  import { SearchInput } from './SearchInput';
12
12
 
13
13
  export interface SearchDialogProps {
14
- topItems?: TopMenuItem[];
14
+ topItems?: TopMenuItemProps[];
15
15
  }
16
16
 
17
17
  export const SEARCH_DIALOG_ID = 'search';
@@ -44,8 +44,8 @@ export const SearchDialog = JSX<SearchDialogProps>(({ topItems }) => {
44
44
  });
45
45
 
46
46
  const combineTopItemsAndSearchResult =
47
- (topItems: TopMenuItem[] | undefined) =>
48
- (searchResult: SearchResult | null | undefined): TopMenuItem[] =>
47
+ (topItems: TopMenuItemProps[] | undefined) =>
48
+ (searchResult: SearchResult | null | undefined): TopMenuItemProps[] =>
49
49
  topItems?.length && searchResult?.length
50
50
  ? zip(topItems, searchResult).map(([_, portalSearchResult]) => ({
51
51
  ..._,
@@ -56,7 +56,7 @@ const combineTopItemsAndSearchResult =
56
56
  : [];
57
57
 
58
58
  // Temp
59
- function printSearchItems(topItems: TopMenuItem[]) {
59
+ function printSearchItems(topItems: TopMenuItemProps[]) {
60
60
  for (const _ of topItems.filter(({ items }) => items?.length)) {
61
61
  console.group(_.text);
62
62
  console.table(_.items, ['text', 'href']);
@@ -2,17 +2,16 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useLink } from '../../hooks/useLink';
3
3
  import type { LinkProps } from '../../model/LinkProps';
4
4
  import { projectSettings } from '../../ProjectSettings';
5
- import type { TopMenuItem } from '../../services/sitemap/SitemapData';
5
+ import type { TopMenuItemProps } from '../../services/sitemap/SitemapData';
6
6
  import { style } from '../../utils/style';
7
- import { joinPath } from '../../utils/url';
8
7
 
9
8
  export interface SitemapProps {
10
9
  className?: string;
11
- topItems?: TopMenuItem[];
10
+ topItems?: TopMenuItemProps[];
12
11
  }
13
12
 
14
13
  export const Sitemap = JSX<SitemapProps>(({ className, topItems }) => {
15
- const link = useLink(true);
14
+ const link = useLink({ isRemote: true });
16
15
 
17
16
  return (
18
17
  <div className={style('flex items-start justify-between', className)}>
@@ -21,7 +20,7 @@ export const Sitemap = JSX<SitemapProps>(({ className, topItems }) => {
21
20
  );
22
21
  });
23
22
 
24
- const renderColumn = (menuItem: TopMenuItem & { onClick: () => void }, index: number) => {
23
+ const renderColumn = (menuItem: TopMenuItemProps & { onClick: () => void }, index: number) => {
25
24
  const { text, items, href, target, onClick } = menuItem;
26
25
 
27
26
  return (
@@ -50,7 +49,7 @@ const ColumnItem = JSX<ColumnItemProps>(({ text, index, basePath, ...rest }) =>
50
49
  const isAnotherPortal =
51
50
  projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
52
51
 
53
- const link = useLink(isAnotherPortal);
52
+ const link = useLink({ isRemote: isAnotherPortal });
54
53
  const { href, target, onClick } = link(rest);
55
54
 
56
55
  return (
@@ -59,7 +58,7 @@ const ColumnItem = JSX<ColumnItemProps>(({ text, index, basePath, ...rest }) =>
59
58
  'text-l-light text-secondary-text hover:text-primary-main no-underline',
60
59
  'overflow-x-hidden overflow-ellipsis whitespace-nowrap',
61
60
  )}
62
- href={isAnotherPortal ? joinPath(basePath, href) : href}
61
+ href={href}
63
62
  target={target || '_self'}
64
63
  onClick={onClick}
65
64
  >
@@ -15,7 +15,7 @@ export interface TopItemProps extends TopItemContent {
15
15
  }
16
16
 
17
17
  export const TopItem = JSX<TopItemProps>(({ className = '', active, flat, children, ...rest }) => {
18
- const link = useLink(true);
18
+ const link = useLink({ isRemote: true });
19
19
  const { href, target, text, onClick } = link(rest);
20
20
 
21
21
  return (