@redneckz/wildless-cms-uni-blocks 0.14.147 → 0.14.149

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 (217) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +67 -14
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +2 -3
  5. package/bundle/components/TabsLayout/TabsLayout.d.ts +5 -0
  6. package/bundle/components/TabsLayout/TabsLayoutButton.d.ts +10 -0
  7. package/bundle/components/TabsLayout/TabsLayoutContent.d.ts +21 -0
  8. package/bundle/components/TabsLayout/TabsLayoutRedirectTab.d.ts +6 -0
  9. package/bundle/components/TabsLayout/alignTabStyle.d.ts +2 -0
  10. package/bundle/ui-kit/Shimmer/Shimmer.d.ts +5 -0
  11. package/bundle/ui-kit/SwipeListControl/SwipeListContainer.d.ts +2 -2
  12. package/bundle/ui-kit/SwipeListControl/useSwipeListScroll.d.ts +1 -1
  13. package/dist/components/Blocks.js +3 -1
  14. package/dist/components/Blocks.js.map +1 -1
  15. package/dist/components/Blocks.mobile.js +3 -1
  16. package/dist/components/Blocks.mobile.js.map +1 -1
  17. package/dist/components/ContentPage/ContentPage.page.json +0 -37
  18. package/dist/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +2 -3
  19. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -2
  20. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  21. package/dist/components/Placeholder/Placeholder.js +2 -7
  22. package/dist/components/Placeholder/Placeholder.js.map +1 -1
  23. package/dist/components/TabsLayout/TabsLayout.d.ts +5 -0
  24. package/dist/components/TabsLayout/TabsLayout.js +32 -0
  25. package/dist/components/TabsLayout/TabsLayout.js.map +1 -0
  26. package/dist/components/TabsLayout/TabsLayoutButton.d.ts +10 -0
  27. package/dist/components/TabsLayout/TabsLayoutButton.js +23 -0
  28. package/dist/components/TabsLayout/TabsLayoutButton.js.map +1 -0
  29. package/dist/components/TabsLayout/TabsLayoutContent.d.ts +21 -0
  30. package/dist/components/TabsLayout/TabsLayoutContent.js +2 -0
  31. package/dist/components/TabsLayout/TabsLayoutContent.js.map +1 -0
  32. package/dist/components/TabsLayout/TabsLayoutRedirectTab.d.ts +6 -0
  33. package/dist/components/TabsLayout/TabsLayoutRedirectTab.js +17 -0
  34. package/dist/components/TabsLayout/TabsLayoutRedirectTab.js.map +1 -0
  35. package/dist/components/TabsLayout/alignTabStyle.d.ts +2 -0
  36. package/dist/components/TabsLayout/alignTabStyle.js +8 -0
  37. package/dist/components/TabsLayout/alignTabStyle.js.map +1 -0
  38. package/dist/setup-fixture.js +1 -1
  39. package/dist/setup-fixture.js.map +1 -1
  40. package/dist/ui-kit/Shimmer/Shimmer.d.ts +5 -0
  41. package/dist/ui-kit/Shimmer/Shimmer.js +13 -0
  42. package/dist/ui-kit/Shimmer/Shimmer.js.map +1 -0
  43. package/dist/ui-kit/SwipeListControl/SwipeListContainer.d.ts +2 -2
  44. package/dist/ui-kit/SwipeListControl/SwipeListContainer.js +2 -2
  45. package/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  46. package/dist/ui-kit/SwipeListControl/SwipeListItem.js +3 -2
  47. package/dist/ui-kit/SwipeListControl/SwipeListItem.js.map +1 -1
  48. package/dist/ui-kit/SwipeListControl/useSwipeListScroll.d.ts +1 -1
  49. package/dist/ui-kit/SwipeListControl/useSwipeListScroll.js +6 -6
  50. package/dist/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  51. package/lib/common.css +1 -1
  52. package/lib/components/Blocks.js +3 -1
  53. package/lib/components/Blocks.js.map +1 -1
  54. package/lib/components/Blocks.mobile.js +3 -1
  55. package/lib/components/Blocks.mobile.js.map +1 -1
  56. package/lib/components/ContentPage/ContentPage.page.json +0 -37
  57. package/lib/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +2 -3
  58. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -2
  59. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  60. package/lib/components/Placeholder/Placeholder.js +2 -7
  61. package/lib/components/Placeholder/Placeholder.js.map +1 -1
  62. package/lib/components/TabsLayout/TabsLayout.d.ts +5 -0
  63. package/lib/components/TabsLayout/TabsLayout.fixture.d.ts +6 -0
  64. package/lib/components/TabsLayout/TabsLayout.fixture.mobile.d.ts +6 -0
  65. package/lib/components/TabsLayout/TabsLayout.js +30 -0
  66. package/lib/components/TabsLayout/TabsLayout.js.map +1 -0
  67. package/lib/components/TabsLayout/TabsLayoutButton.d.ts +10 -0
  68. package/lib/components/TabsLayout/TabsLayoutButton.js +21 -0
  69. package/lib/components/TabsLayout/TabsLayoutButton.js.map +1 -0
  70. package/lib/components/TabsLayout/TabsLayoutContent.d.ts +21 -0
  71. package/lib/components/TabsLayout/TabsLayoutContent.js +2 -0
  72. package/lib/components/TabsLayout/TabsLayoutContent.js.map +1 -0
  73. package/lib/components/TabsLayout/TabsLayoutRedirectTab.d.ts +6 -0
  74. package/lib/components/TabsLayout/TabsLayoutRedirectTab.js +15 -0
  75. package/lib/components/TabsLayout/TabsLayoutRedirectTab.js.map +1 -0
  76. package/lib/components/TabsLayout/alignTabStyle.d.ts +2 -0
  77. package/lib/components/TabsLayout/alignTabStyle.js +6 -0
  78. package/lib/components/TabsLayout/alignTabStyle.js.map +1 -0
  79. package/lib/setup-fixture.js +1 -1
  80. package/lib/setup-fixture.js.map +1 -1
  81. package/lib/ui-kit/Shimmer/Shimmer.d.ts +5 -0
  82. package/lib/ui-kit/Shimmer/Shimmer.js +11 -0
  83. package/lib/ui-kit/Shimmer/Shimmer.js.map +1 -0
  84. package/lib/ui-kit/SwipeListControl/SwipeListContainer.d.ts +2 -2
  85. package/lib/ui-kit/SwipeListControl/SwipeListContainer.js +2 -2
  86. package/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  87. package/lib/ui-kit/SwipeListControl/SwipeListItem.js +3 -2
  88. package/lib/ui-kit/SwipeListControl/SwipeListItem.js.map +1 -1
  89. package/lib/ui-kit/SwipeListControl/useSwipeListScroll.d.ts +1 -1
  90. package/lib/ui-kit/SwipeListControl/useSwipeListScroll.js +6 -6
  91. package/lib/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  92. package/mobile/bundle/bundle.umd.js +76 -23
  93. package/mobile/bundle/bundle.umd.min.js +1 -1
  94. package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +2 -3
  95. package/mobile/bundle/components/TabsLayout/TabsLayout.d.ts +5 -0
  96. package/mobile/bundle/components/TabsLayout/TabsLayoutButton.d.ts +10 -0
  97. package/mobile/bundle/components/TabsLayout/TabsLayoutContent.d.ts +21 -0
  98. package/mobile/bundle/components/TabsLayout/TabsLayoutRedirectTab.d.ts +6 -0
  99. package/mobile/bundle/components/TabsLayout/alignTabStyle.d.ts +2 -0
  100. package/mobile/bundle/ui-kit/Shimmer/Shimmer.d.ts +5 -0
  101. package/mobile/bundle/ui-kit/SwipeListControl/SwipeListContainer.d.ts +2 -2
  102. package/mobile/bundle/ui-kit/SwipeListControl/useSwipeListScroll.d.ts +1 -1
  103. package/mobile/dist/components/Blocks.js +3 -1
  104. package/mobile/dist/components/Blocks.js.map +1 -1
  105. package/mobile/dist/components/ContentPage/ContentPage.page.json +0 -37
  106. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +2 -3
  107. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -2
  108. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  109. package/mobile/dist/components/Placeholder/Placeholder.js +2 -7
  110. package/mobile/dist/components/Placeholder/Placeholder.js.map +1 -1
  111. package/mobile/dist/components/TabsLayout/TabsLayout.d.ts +5 -0
  112. package/mobile/dist/components/TabsLayout/TabsLayout.js +32 -0
  113. package/mobile/dist/components/TabsLayout/TabsLayout.js.map +1 -0
  114. package/mobile/dist/components/TabsLayout/TabsLayoutButton.d.ts +10 -0
  115. package/mobile/dist/components/TabsLayout/TabsLayoutButton.js +23 -0
  116. package/mobile/dist/components/TabsLayout/TabsLayoutButton.js.map +1 -0
  117. package/mobile/dist/components/TabsLayout/TabsLayoutContent.d.ts +21 -0
  118. package/mobile/dist/components/TabsLayout/TabsLayoutContent.js +2 -0
  119. package/mobile/dist/components/TabsLayout/TabsLayoutContent.js.map +1 -0
  120. package/mobile/dist/components/TabsLayout/TabsLayoutRedirectTab.d.ts +6 -0
  121. package/mobile/dist/components/TabsLayout/TabsLayoutRedirectTab.js +17 -0
  122. package/mobile/dist/components/TabsLayout/TabsLayoutRedirectTab.js.map +1 -0
  123. package/mobile/dist/components/TabsLayout/alignTabStyle.d.ts +2 -0
  124. package/mobile/dist/components/TabsLayout/alignTabStyle.js +8 -0
  125. package/mobile/dist/components/TabsLayout/alignTabStyle.js.map +1 -0
  126. package/mobile/dist/setup-fixture.js +1 -1
  127. package/mobile/dist/setup-fixture.js.map +1 -1
  128. package/mobile/dist/ui-kit/Shimmer/Shimmer.d.ts +5 -0
  129. package/mobile/dist/ui-kit/Shimmer/Shimmer.js +13 -0
  130. package/mobile/dist/ui-kit/Shimmer/Shimmer.js.map +1 -0
  131. package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.d.ts +2 -2
  132. package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js +2 -2
  133. package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  134. package/mobile/dist/ui-kit/SwipeListControl/SwipeListItem.js +3 -2
  135. package/mobile/dist/ui-kit/SwipeListControl/SwipeListItem.js.map +1 -1
  136. package/mobile/dist/ui-kit/SwipeListControl/useSwipeListScroll.d.ts +1 -1
  137. package/mobile/dist/ui-kit/SwipeListControl/useSwipeListScroll.js +6 -6
  138. package/mobile/dist/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  139. package/mobile/lib/common.css +1 -1
  140. package/mobile/lib/components/Blocks.js +3 -1
  141. package/mobile/lib/components/Blocks.js.map +1 -1
  142. package/mobile/lib/components/ContentPage/ContentPage.page.json +0 -37
  143. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +2 -3
  144. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -2
  145. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  146. package/mobile/lib/components/Placeholder/Placeholder.js +2 -7
  147. package/mobile/lib/components/Placeholder/Placeholder.js.map +1 -1
  148. package/mobile/lib/components/TabsLayout/TabsLayout.d.ts +5 -0
  149. package/mobile/lib/components/TabsLayout/TabsLayout.js +30 -0
  150. package/mobile/lib/components/TabsLayout/TabsLayout.js.map +1 -0
  151. package/mobile/lib/components/TabsLayout/TabsLayoutButton.d.ts +10 -0
  152. package/mobile/lib/components/TabsLayout/TabsLayoutButton.js +21 -0
  153. package/mobile/lib/components/TabsLayout/TabsLayoutButton.js.map +1 -0
  154. package/mobile/lib/components/TabsLayout/TabsLayoutContent.d.ts +21 -0
  155. package/mobile/lib/components/TabsLayout/TabsLayoutContent.js +2 -0
  156. package/mobile/lib/components/TabsLayout/TabsLayoutContent.js.map +1 -0
  157. package/mobile/lib/components/TabsLayout/TabsLayoutRedirectTab.d.ts +6 -0
  158. package/mobile/lib/components/TabsLayout/TabsLayoutRedirectTab.js +15 -0
  159. package/mobile/lib/components/TabsLayout/TabsLayoutRedirectTab.js.map +1 -0
  160. package/mobile/lib/components/TabsLayout/alignTabStyle.d.ts +2 -0
  161. package/mobile/lib/components/TabsLayout/alignTabStyle.js +6 -0
  162. package/mobile/lib/components/TabsLayout/alignTabStyle.js.map +1 -0
  163. package/mobile/lib/setup-fixture.js +1 -1
  164. package/mobile/lib/setup-fixture.js.map +1 -1
  165. package/mobile/lib/ui-kit/Shimmer/Shimmer.d.ts +5 -0
  166. package/mobile/lib/ui-kit/Shimmer/Shimmer.js +11 -0
  167. package/mobile/lib/ui-kit/Shimmer/Shimmer.js.map +1 -0
  168. package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.d.ts +2 -2
  169. package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js +2 -2
  170. package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  171. package/mobile/lib/ui-kit/SwipeListControl/SwipeListItem.js +3 -2
  172. package/mobile/lib/ui-kit/SwipeListControl/SwipeListItem.js.map +1 -1
  173. package/mobile/lib/ui-kit/SwipeListControl/useSwipeListScroll.d.ts +1 -1
  174. package/mobile/lib/ui-kit/SwipeListControl/useSwipeListScroll.js +6 -6
  175. package/mobile/lib/ui-kit/SwipeListControl/useSwipeListScroll.js.map +1 -1
  176. package/mobile/src/components/Blocks.ts +3 -1
  177. package/mobile/src/components/ContentPage/ContentPage.page.json +0 -37
  178. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMap.ui.json +3 -0
  179. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapContent.ts +2 -3
  180. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +4 -8
  181. package/mobile/src/components/Placeholder/Placeholder.tsx +2 -19
  182. package/mobile/src/components/TabsLayout/TabsLayout.example.json +8 -0
  183. package/mobile/src/components/TabsLayout/TabsLayout.tsx +88 -0
  184. package/mobile/src/components/TabsLayout/TabsLayout.ui.json +11 -0
  185. package/mobile/src/components/TabsLayout/TabsLayoutButton.tsx +60 -0
  186. package/mobile/src/components/TabsLayout/TabsLayoutContent.ts +26 -0
  187. package/mobile/src/components/TabsLayout/TabsLayoutRedirectTab.tsx +26 -0
  188. package/mobile/src/components/TabsLayout/alignTabStyle.ts +7 -0
  189. package/mobile/src/setup-fixture.ts +1 -1
  190. package/mobile/src/ui-kit/Shimmer/Shimmer.tsx +29 -0
  191. package/mobile/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +5 -4
  192. package/mobile/src/ui-kit/SwipeListControl/SwipeListItem.tsx +12 -3
  193. package/mobile/src/ui-kit/SwipeListControl/useSwipeListScroll.ts +10 -7
  194. package/package.json +2 -2
  195. package/src/components/Blocks.mobile.ts +3 -1
  196. package/src/components/Blocks.ts +3 -1
  197. package/src/components/ContentPage/ContentPage.page.json +0 -37
  198. package/src/components/OfficesAtmsMap/OfficesAtmsMap.fixture.mobile.tsx +4 -2
  199. package/src/components/OfficesAtmsMap/OfficesAtmsMap.fixture.tsx +4 -2
  200. package/src/components/OfficesAtmsMap/OfficesAtmsMap.ui.json +3 -0
  201. package/src/components/OfficesAtmsMap/OfficesAtmsMapContent.ts +2 -3
  202. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +4 -8
  203. package/src/components/Placeholder/Placeholder.tsx +2 -19
  204. package/src/components/TabsLayout/TabsLayout.example.json +8 -0
  205. package/src/components/TabsLayout/TabsLayout.fixture.mobile.tsx +53 -0
  206. package/src/components/TabsLayout/TabsLayout.fixture.tsx +53 -0
  207. package/src/components/TabsLayout/TabsLayout.tsx +88 -0
  208. package/src/components/TabsLayout/TabsLayout.ui.json +11 -0
  209. package/src/components/TabsLayout/TabsLayoutButton.tsx +60 -0
  210. package/src/components/TabsLayout/TabsLayoutContent.ts +26 -0
  211. package/src/components/TabsLayout/TabsLayoutRedirectTab.tsx +26 -0
  212. package/src/components/TabsLayout/alignTabStyle.ts +7 -0
  213. package/src/setup-fixture.ts +1 -1
  214. package/src/ui-kit/Shimmer/Shimmer.tsx +29 -0
  215. package/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +5 -4
  216. package/src/ui-kit/SwipeListControl/SwipeListItem.tsx +12 -3
  217. package/src/ui-kit/SwipeListControl/useSwipeListScroll.ts +10 -7
@@ -4,6 +4,7 @@ import {
4
4
  useIntersectionObserver,
5
5
  type IntersectionObserverOptions,
6
6
  } from '../../hooks/useIntersectionObserver';
7
+ import { style } from '../../utils/style';
7
8
 
8
9
  /**
9
10
  * @title Элемент списка
@@ -18,7 +19,15 @@ interface SwipeListControlItemProps {
18
19
  }
19
20
 
20
21
  export const SwipeListItem = JSX<SwipeListControlItemProps>(
21
- ({ className = '', style, idx, activeIndex, observerOptions, children, onIntersection }) => {
22
+ ({
23
+ className,
24
+ style: inlineStyle,
25
+ idx,
26
+ activeIndex,
27
+ observerOptions,
28
+ children,
29
+ onIntersection,
30
+ }) => {
22
31
  const observerCallback = useCallback(
23
32
  (entries: IntersectionObserverEntry[]) => {
24
33
  if (entries.length && onIntersection) {
@@ -31,8 +40,8 @@ export const SwipeListItem = JSX<SwipeListControlItemProps>(
31
40
 
32
41
  return (
33
42
  <div
34
- className={`inline-block snap-always box-border ${className}`}
35
- style={style}
43
+ className={style('inline-block snap-always box-border', className)}
44
+ style={inlineStyle}
36
45
  aria-current={Boolean(idx === activeIndex)}
37
46
  ref={ref}
38
47
  >
@@ -9,7 +9,7 @@ import { scrollToStart } from './scrollToStart';
9
9
  export interface SwipeListScroll {
10
10
  scrollLeft: () => void;
11
11
  scrollRight: () => void;
12
- scrollTo: (idx: number) => void;
12
+ scrollTo: (idx: number, options?: ScrollIntoViewOptions) => void;
13
13
  canScrollLeft: boolean;
14
14
  canScrollRight: boolean;
15
15
  visibleIndicesRange: [number, number];
@@ -70,13 +70,16 @@ export const useSwipeListScroll = <E extends HTMLElement>({
70
70
  }, [itemCount, canScrollRight]);
71
71
 
72
72
  const scrollTo = useCallback(
73
- (idx: number) => {
73
+ (
74
+ idx: number,
75
+ options = {
76
+ behavior: 'smooth',
77
+ block: 'nearest',
78
+ inline: 'center',
79
+ } as ScrollIntoViewOptions,
80
+ ) => {
74
81
  if (containerRef?.current) {
75
- containerRef.current.children[idx]?.scrollIntoView({
76
- behavior: 'smooth',
77
- block: 'nearest',
78
- inline: 'center',
79
- });
82
+ containerRef.current.children[idx]?.scrollIntoView(options);
80
83
  }
81
84
  },
82
85
  [containerRef],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.147",
3
+ "version": "0.14.149",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -209,7 +209,7 @@
209
209
  "path": "lib/common.css"
210
210
  },
211
211
  {
212
- "limit": "63 kB",
212
+ "limit": "64 kB",
213
213
  "path": "bundle/bundle.umd.min.js"
214
214
  }
215
215
  ],
@@ -36,6 +36,7 @@ import { RollupItem } from './RollupItem/RollupItem';
36
36
  import { SafeDepositRental } from './SafeDepositRental/SafeDepositRental';
37
37
  import { StepsBlock } from './StepsBlock/StepsBlock';
38
38
  import { Tabs } from './Tabs/Tabs';
39
+ import { TabsLayout } from './TabsLayout/TabsLayout';
39
40
  import { TariffsTable } from './TariffsTable/TariffsTable';
40
41
  import { TextBlock } from './TextBlock/TextBlock';
41
42
  import { UnitBlock } from './UnitBlock/UnitBlock';
@@ -72,14 +73,15 @@ export const Blocks: BlocksRegistry = {
72
73
  Placeholder,
73
74
  ProductBlock,
74
75
  ProductGallery,
75
- UnitBlock,
76
76
  RepresentativeOfficeInfo,
77
77
  RichTextBlock,
78
78
  RollupItem,
79
79
  SafeDepositRental,
80
80
  StepsBlock,
81
81
  Tabs,
82
+ TabsLayout,
82
83
  TariffsTable,
83
84
  TextBlock,
85
+ UnitBlock,
84
86
  VerticalLayout,
85
87
  };
@@ -42,6 +42,7 @@ import { SafeDepositRental } from './SafeDepositRental/SafeDepositRental';
42
42
  import { StepsBlock } from './StepsBlock/StepsBlock';
43
43
  import { SwipeListControlBlock } from './SwipeListControlBlock/SwipeListControlBlock';
44
44
  import { Tabs } from './Tabs/Tabs';
45
+ import { TabsLayout } from './TabsLayout/TabsLayout';
45
46
  import { TariffsTable } from './TariffsTable/TariffsTable';
46
47
  import { TextBlock } from './TextBlock/TextBlock';
47
48
  import { UnitBlock } from './UnitBlock/UnitBlock';
@@ -84,7 +85,6 @@ export const Blocks: BlocksRegistry = {
84
85
  Placeholder,
85
86
  ProductBlock,
86
87
  ProductGallery,
87
- UnitBlock,
88
88
  RepresentativeOfficeInfo,
89
89
  RichTextBlock,
90
90
  RollupItem,
@@ -92,8 +92,10 @@ export const Blocks: BlocksRegistry = {
92
92
  StepsBlock,
93
93
  SwipeListControlBlock,
94
94
  Tabs,
95
+ TabsLayout,
95
96
  TariffsTable,
96
97
  TextBlock,
98
+ UnitBlock,
97
99
  VerticalLayout,
98
100
  Video,
99
101
  };
@@ -28,43 +28,6 @@
28
28
  "type": "Footer",
29
29
  "style": ["col-span-12"]
30
30
  }
31
- ],
32
- "stickyBottomMenu": [
33
- {
34
- "type": "StickyBottomMenu",
35
- "content": {
36
- "menuItems": [
37
- {
38
- "title": "Кредиты",
39
- "url": "#EmptyWalletIcon",
40
- "icon": {
41
- "icon": "EmptyWalletIcon"
42
- }
43
- },
44
- {
45
- "title": "Карты",
46
- "url": "#CardIcon",
47
- "icon": {
48
- "icon": "CardIcon"
49
- }
50
- },
51
- {
52
- "title": "Вклады",
53
- "url": "#SafeIcon",
54
- "icon": {
55
- "icon": "SafeIcon"
56
- }
57
- },
58
- {
59
- "title": "Инвестиции",
60
- "url": "#ChartIcon",
61
- "icon": {
62
- "icon": "ChartIcon"
63
- }
64
- }
65
- ]
66
- }
67
- }
68
31
  ]
69
32
  },
70
33
  "blocks": []
@@ -12,8 +12,10 @@ const OFFICE_MAP: OfficesAtmsMapContent = {
12
12
  const ATM_MAP: OfficesAtmsMapContent = {
13
13
  data: {
14
14
  dataType: 'atms',
15
- description:
16
- 'Держатели платежных карт Visa, MasterCard и МИР АО «Россельхозбанк» могут снимать без дополнительных комиссий наличные денежные средства в банкоматах банков-партнеров:',
15
+ __html:
16
+ '<p>' +
17
+ 'Держатели платежных карт Visa, MasterCard и МИР АО «Россельхозбанк» могут снимать без дополнительных комиссий наличные денежные средства в банкоматах банков-партнеров:' +
18
+ '</p>',
17
19
  list: [
18
20
  {
19
21
  text: 'ПАО «Промсвязьбанк»',
@@ -12,8 +12,10 @@ const OFFICE_MAP: OfficesAtmsMapContent = {
12
12
  const ATM_MAP: OfficesAtmsMapContent = {
13
13
  data: {
14
14
  dataType: 'atms',
15
- description:
16
- 'Держатели платежных карт Visa, MasterCard и МИР АО «Россельхозбанк» могут снимать без дополнительных комиссий наличные денежные средства в банкоматах банков-партнеров:',
15
+ __html:
16
+ '<p>' +
17
+ 'Держатели платежных карт Visa, MasterCard и МИР АО «Россельхозбанк» могут снимать без дополнительных комиссий наличные денежные средства в банкоматах банков-партнеров:' +
18
+ '</p>',
17
19
  list: [
18
20
  { text: 'АО «Альфа-Банк»', image: { src: 'alphabank.svg', size: { width: 24, height: 24 } } },
19
21
  {
@@ -4,6 +4,9 @@
4
4
  "dataType": {
5
5
  "ui:widget": "hidden"
6
6
  },
7
+ "__html": {
8
+ "ui:widget": "html"
9
+ },
7
10
  "list": {
8
11
  "items": {
9
12
  "image": {
@@ -1,5 +1,6 @@
1
1
  import { type UniBlockContent } from '../../model/JSXBlock';
2
2
  import { type Picture } from '../../model/Picture';
3
+ import { type RichTextProps } from '../../ui-kit/RichText/RichTextProps';
3
4
 
4
5
  /**
5
6
  * @title Пункт
@@ -22,10 +23,8 @@ export type OfficesDef = {
22
23
  * @title Банкоматам
23
24
  * @default {"dataType": "atms"}
24
25
  */
25
- export type AtmsDef = {
26
+ export type AtmsDef = RichTextProps & {
26
27
  dataType: 'atms';
27
- /** @title Описание */
28
- description: string;
29
28
  /** @title Список */
30
29
  list?: ItemList[];
31
30
  };
@@ -5,7 +5,7 @@ import { type VNode } from '../../model/VNode';
5
5
  import { ClientOnly } from '../../ui-kit/ClientOnly';
6
6
  import { Heading } from '../../ui-kit/Heading/Heading';
7
7
  import { Img } from '../../ui-kit/Img/Img';
8
- import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
8
+ import { RichText } from '../../ui-kit/RichText/RichText';
9
9
  import { Text } from '../../ui-kit/Text/Text';
10
10
  import { YandexMap } from '../../ui-kit/YandexMap/YandexMap';
11
11
  import { style } from '../../utils/style';
@@ -75,14 +75,10 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm>>
75
75
  },
76
76
  );
77
77
 
78
- const renderDescriptionBlock = ({ description, list }: AtmsDef) =>
79
- description || list?.length ? (
78
+ const renderDescriptionBlock = ({ __html, list }: AtmsDef) =>
79
+ __html || list?.length ? (
80
80
  <div className="p-xl mb-2xl border-b sm:border border-main-divider sm:rounded-md">
81
- {description ? (
82
- <Paragraph size="text-l" font="font-light">
83
- {description}
84
- </Paragraph>
85
- ) : null}
81
+ {__html ? <RichText __html={__html} /> : null}
86
82
  {list?.length ? (
87
83
  <div className="flex flex-col sm:flex-row gap-2xl sm:flex-wrap pt-xs">
88
84
  {list.map((item, i) => (
@@ -1,14 +1,13 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { type UniBlockProps } from '../../model/JSXBlock';
3
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
4
+ import { Shimmer } from '../../ui-kit/Shimmer/Shimmer';
4
5
  import { style } from '../../utils/style';
5
6
  import { Headline } from '../Headline/Headline';
6
7
  import { type PlaceholderContent } from './PlaceholderContent';
7
8
 
8
9
  export interface PlaceholderProps extends PlaceholderContent, UniBlockProps {}
9
10
 
10
- const GOLDEN_RATIO = 1.618;
11
-
12
11
  export const Placeholder = JSX<PlaceholderProps>(
13
12
  ({ className, title, description = 'Блок в разработке...', ...rest }) => (
14
13
  <BlockWrapper className={style('box-border', className)} {...rest}>
@@ -20,23 +19,7 @@ export const Placeholder = JSX<PlaceholderProps>(
20
19
  align="text-left"
21
20
  isEmbedded={true}
22
21
  />
23
- <figure className="m-0 mt-xl min-w-[80%]">{renderShimmer()}</figure>
22
+ <Shimmer />
24
23
  </BlockWrapper>
25
24
  ),
26
25
  );
27
-
28
- const renderShimmer = (size = 3) =>
29
- goldenSequence(100, size)
30
- .map((_) => Math.floor(_))
31
- .map(renderShimmerItem);
32
-
33
- const renderShimmerItem = (width: number, index: number) => (
34
- <div
35
- key={String(index)}
36
- style={{ width: `${width || 100}%` }}
37
- className="h-4 mt-xs bg-secondary-light"
38
- />
39
- );
40
-
41
- const goldenSequence = (first: number, size: number): number[] =>
42
- [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
@@ -0,0 +1,8 @@
1
+ {
2
+ "content": {
3
+ "tabs": [
4
+ { "title": "Первый таб", "description": "Описание первого таба" },
5
+ { "title": "Второй таб", "description": "Описание второго таба" }
6
+ ]
7
+ }
8
+ }
@@ -0,0 +1,53 @@
1
+ import { type BlockRendererOptions } from '../../BlockRenderer/BlockRendererOptions';
2
+ import '../../setup-fixture';
3
+ import { Blocks } from '../Blocks';
4
+ import { TabsLayout } from './TabsLayout';
5
+ import example from './TabsLayout.example.json';
6
+
7
+ const options: BlockRendererOptions = {
8
+ blocksRegistry: Blocks,
9
+ };
10
+
11
+ export default {
12
+ default: (
13
+ <div className="container grid grid-cols-12">
14
+ <TabsLayout
15
+ className="col-span-12"
16
+ tabs={example.content.tabs}
17
+ options={options}
18
+ block={{
19
+ slots: {
20
+ 'Первый таб': [
21
+ {
22
+ type: 'TextBlock',
23
+ content: {
24
+ title: 'Текстовый блок',
25
+ description: 'Описание',
26
+ },
27
+ style: ['col-span-12'],
28
+ },
29
+ {
30
+ type: 'TextBlock',
31
+ content: {
32
+ title: 'Текстовый блок',
33
+ description: 'Описание',
34
+ },
35
+ style: ['col-span-12'],
36
+ },
37
+ ],
38
+ 'Второй таб': [
39
+ {
40
+ type: 'TextBlock',
41
+ content: {
42
+ title: 'Текстовый блок',
43
+ description: 'Описание',
44
+ },
45
+ style: ['col-span-12'],
46
+ },
47
+ ],
48
+ },
49
+ }}
50
+ />
51
+ </div>
52
+ ),
53
+ };
@@ -0,0 +1,53 @@
1
+ import { type BlockRendererOptions } from '../../BlockRenderer/BlockRendererOptions';
2
+ import '../../setup-fixture';
3
+ import { Blocks } from '../Blocks';
4
+ import { TabsLayout } from './TabsLayout';
5
+ import example from './TabsLayout.example.json';
6
+
7
+ const options: BlockRendererOptions = {
8
+ blocksRegistry: Blocks,
9
+ };
10
+
11
+ export default {
12
+ default: (
13
+ <div className="container grid grid-cols-12">
14
+ <TabsLayout
15
+ className="col-span-12"
16
+ tabs={example.content.tabs}
17
+ options={options}
18
+ block={{
19
+ slots: {
20
+ 'Первый таб': [
21
+ {
22
+ type: 'TextBlock',
23
+ content: {
24
+ title: 'Текстовый блок',
25
+ description: 'Описание',
26
+ },
27
+ style: ['col-span-12'],
28
+ },
29
+ {
30
+ type: 'TextBlock',
31
+ content: {
32
+ title: 'Текстовый блок',
33
+ description: 'Описание',
34
+ },
35
+ style: ['col-span-12'],
36
+ },
37
+ ],
38
+ 'Второй таб': [
39
+ {
40
+ type: 'TextBlock',
41
+ content: {
42
+ title: 'Текстовый блок',
43
+ description: 'Описание',
44
+ },
45
+ style: ['col-span-12'],
46
+ },
47
+ ],
48
+ },
49
+ }}
50
+ />
51
+ </div>
52
+ ),
53
+ };
@@ -0,0 +1,88 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { renderBlocksList } from '../../BlockRenderer/renderBlockList';
4
+ import { useCarouselControls } from '../../hooks/useCarouselControls';
5
+ import { type Align } from '../../model/Align';
6
+ import type { JSXBlock, UniBlockProps } from '../../model/JSXBlock';
7
+ import { BlockWrapper } from '../../ui-kit/BlockWrapper';
8
+ import { SwipeListContainer } from '../../ui-kit/SwipeListControl/SwipeListContainer';
9
+ import { useSwipeListScroll } from '../../ui-kit/SwipeListControl/useSwipeListScroll';
10
+ import { style } from '../../utils/style';
11
+ import { CarouselScrollButtons } from '../Carousel/CarouselScrollButtons';
12
+ import { alignTabStyle } from './alignTabStyle';
13
+ import { TabsLayoutButton } from './TabsLayoutButton';
14
+ import { type Tab, type TabsLayoutContent } from './TabsLayoutContent';
15
+ import { TabsLayoutRedirectTab } from './TabsLayoutRedirectTab';
16
+
17
+ export interface TabsLayoutProps extends TabsLayoutContent, UniBlockProps {}
18
+
19
+ export const TabsLayout: JSXBlock<TabsLayoutProps> = JSX<TabsLayoutProps>(
20
+ ({ className = '', tabs = [], block, tabAlign, ...rest }) => {
21
+ const [activeTabIndex, setActiveTabIndex] = useState(getInitSelectedIndex(tabs));
22
+
23
+ const slotName = getSlotName(tabs[activeTabIndex], activeTabIndex);
24
+
25
+ const itemCount = tabs.length;
26
+
27
+ const [activeSlideIndex, { inc: incActiveSlideIndex, dec: decActiveSlideIndex }] =
28
+ useCarouselControls({ itemCount }, activeTabIndex);
29
+
30
+ const [containerRef, scroll] = useSwipeListScroll<HTMLDivElement>({ itemCount });
31
+
32
+ useEffect(() => {
33
+ scroll.scrollTo(activeTabIndex, { behavior: 'auto' });
34
+ }, []);
35
+
36
+ return (
37
+ <BlockWrapper className={style(className)} defaultPadding="p-0" {...rest}>
38
+ <div className="relative border-b-8 border-primary-main">
39
+ <SwipeListContainer
40
+ itemClassName="flex"
41
+ containerRef={containerRef}
42
+ snapAlign="snap-end"
43
+ gap={8}
44
+ onVisibleIndicesChange={scroll.handleVisibleIndicesChange}
45
+ >
46
+ {tabs.map(renderTabButton(activeTabIndex, setActiveTabIndex, tabAlign))}
47
+ </SwipeListContainer>
48
+ <CarouselScrollButtons
49
+ scroll={scroll}
50
+ arrowsPadded={true}
51
+ onScrollLeft={decActiveSlideIndex}
52
+ onScrollRight={incActiveSlideIndex}
53
+ activeIndex={activeSlideIndex}
54
+ itemCount={itemCount}
55
+ />
56
+ </div>
57
+ <div className="space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs">
58
+ {tabs[activeTabIndex]?.href ? (
59
+ <TabsLayoutRedirectTab tab={tabs[activeTabIndex]} />
60
+ ) : (
61
+ renderBlocksList(block?.slots?.[slotName], { ...rest?.options, slotName })
62
+ )}
63
+ </div>
64
+ </BlockWrapper>
65
+ );
66
+ },
67
+ );
68
+
69
+ TabsLayout.slots = ({ tabs }) => tabs?.filter((_) => !_.href).map(getSlotName) || [];
70
+ TabsLayout.childrenTypes = { exclude: ['TabsLayout'] };
71
+
72
+ const getSlotName = (tab: Tab, index: number): string => tab?.title || `Слот №${index}`;
73
+
74
+ const getInitSelectedIndex = (tabs: Tab[]) =>
75
+ tabs.reduce((selectedIndex, tab, i) => (tab.selected ? i : selectedIndex), 0);
76
+
77
+ const renderTabButton =
78
+ (activeTabIndex: number, onClick: (i: number) => void, tabAlign: Align = 'start') =>
79
+ (tab: Tab, i: number) =>
80
+ (
81
+ <TabsLayoutButton
82
+ key={String(i)}
83
+ className={alignTabStyle[tabAlign]}
84
+ tab={tab}
85
+ isActive={activeTabIndex === i}
86
+ onClick={() => onClick(i)}
87
+ />
88
+ );
@@ -0,0 +1,11 @@
1
+ {
2
+ "content": {
3
+ "tabs": {
4
+ "items": {
5
+ "icon": {
6
+ "ui:field": "picture"
7
+ }
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,60 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { type IconVersion } from '../../model/IconVersion';
3
+ import { Img } from '../../ui-kit/Img/Img';
4
+ import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
5
+ import { style } from '../../utils/style';
6
+ import { type Tab } from './TabsLayoutContent';
7
+
8
+ const getButtonClassNames = (isActive: boolean) => ({
9
+ btn: `w-96 ${
10
+ isActive
11
+ ? 'p-m border-none bg-primary-main text-white'
12
+ : 'p-s ease-in duration-300 bg-white text-primary-text'
13
+ }`,
14
+ title: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l',
15
+ desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
16
+ icon: isActive ? '' : 'text-primary-main',
17
+ iconVersion: (isActive ? 'white' : 'normal') as IconVersion,
18
+ });
19
+
20
+ interface TabsLayoutButtonProps {
21
+ tab: Tab;
22
+ className?: string;
23
+ onClick: (ev?: PreventableEvent) => void;
24
+ isActive: boolean;
25
+ }
26
+
27
+ export const TabsLayoutButton = JSX<TabsLayoutButtonProps>(
28
+ ({ tab, className, onClick, isActive }) => {
29
+ const buttonClassNames = getButtonClassNames(isActive);
30
+
31
+ return (
32
+ <button
33
+ type="button"
34
+ onClick={onClick}
35
+ aria-label={tab?.title}
36
+ className={style(
37
+ 'border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
38
+ buttonClassNames.btn,
39
+ className,
40
+ )}
41
+ >
42
+ {tab?.icon ? (
43
+ <Img
44
+ className={style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon)}
45
+ image={{
46
+ ...tab?.icon,
47
+ iconVersion: tab?.icon?.iconVersion ?? buttonClassNames.iconVersion,
48
+ }}
49
+ width="24"
50
+ height="24"
51
+ />
52
+ ) : null}
53
+ <div className="border-0">
54
+ {tab?.title ? <div className={buttonClassNames.title}>{tab.title}</div> : null}
55
+ {tab?.description ? <div className={buttonClassNames.desc}>{tab.description}</div> : null}
56
+ </div>
57
+ </button>
58
+ );
59
+ },
60
+ );
@@ -0,0 +1,26 @@
1
+ import { type Align } from '../../model/Align';
2
+ import { type DescriptionProps, type TitleProps } from '../../model/HeadlineType';
3
+ import { type UniBlockContent } from '../../model/JSXBlock';
4
+ import { type LinkCommonProps } from '../../model/LinkProps';
5
+ import { type IconProps } from '../../model/Picture';
6
+
7
+ /**
8
+ * @title Таб
9
+ */
10
+ export type Tab = TitleProps &
11
+ DescriptionProps &
12
+ IconProps &
13
+ LinkCommonProps & {
14
+ /** @title Вкладка выбрана по-умолчанию */
15
+ selected?: boolean;
16
+ };
17
+
18
+ /**
19
+ * @title Табы
20
+ */
21
+ export type TabsLayoutContent = UniBlockContent & {
22
+ /** @title Выравнивание табов */
23
+ tabAlign?: Align;
24
+ /** @title Список табов */
25
+ tabs?: Tab[];
26
+ };
@@ -0,0 +1,26 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useDebouncedEffect } from '@redneckz/uni-jsx/lib/hooks/useDebouncedEffect';
3
+ import { useLink } from '../../hooks/useLink';
4
+ import { Shimmer } from '../../ui-kit/Shimmer/Shimmer';
5
+ import { type Tab } from './TabsLayoutContent';
6
+
7
+ const REDIRECT_DELAY = 0.5 * 1000;
8
+
9
+ interface TabsLayoutRedirectTabProps {
10
+ tab: Tab;
11
+ }
12
+
13
+ export const TabsLayoutRedirectTab = JSX<TabsLayoutRedirectTabProps>(({ tab }) => {
14
+ const link = useLink();
15
+
16
+ useDebouncedEffect(
17
+ () => {
18
+ const { onClick } = link(tab);
19
+ onClick();
20
+ },
21
+ [tab],
22
+ REDIRECT_DELAY,
23
+ );
24
+
25
+ return <Shimmer className="col-span-12 p-xl" size={5} />;
26
+ });
@@ -0,0 +1,7 @@
1
+ import { type Align } from '../../model/Align';
2
+
3
+ export const alignTabStyle: Record<Align, string> = {
4
+ start: 'text-start',
5
+ center: 'text-center',
6
+ end: 'text-end',
7
+ };
@@ -48,7 +48,7 @@ handlerDecorator.setup((handler): any => (ev) => {
48
48
  const shouldNotPrevent = ev?.target?.type === 'submit';
49
49
 
50
50
  if (!shouldNotPrevent) {
51
- ev.preventDefault();
51
+ ev?.preventDefault();
52
52
  }
53
53
 
54
54
  handler(ev);