@redneckz/wildless-cms-uni-blocks 0.3.62 → 0.3.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +87 -26
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/cosmos-static/icons/AirPlane.svg +1 -0
  5. package/cosmos-static/icons/CarIcon.svg +1 -0
  6. package/cosmos-static/icons/CinemaIcon.svg +1 -0
  7. package/cosmos-static/icons/DocsIcon.svg +1 -0
  8. package/cosmos-static/icons/PowerIcon.svg +1 -0
  9. package/cosmos-static/icons/PumpkinIcon.svg +1 -0
  10. package/cosmos-static/icons/SoundIcon.svg +1 -0
  11. package/cosmos-static/icons/WateringCan.svg +1 -0
  12. package/dist/components/Accordion/Accordion.js +7 -2
  13. package/dist/components/Accordion/Accordion.js.map +1 -1
  14. package/dist/components/Accordion/AccordionContent.d.ts +3 -0
  15. package/dist/components/BaseTile/BaseTileProps.d.ts +1 -9
  16. package/dist/components/BenefitsBlock/BenefitsBlock.js +3 -3
  17. package/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  18. package/dist/components/BlockContent.d.ts +2 -1
  19. package/dist/components/Blocks.d.ts +1 -0
  20. package/dist/components/Blocks.js +2 -0
  21. package/dist/components/Blocks.js.map +1 -1
  22. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
  23. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +14 -0
  24. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
  25. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
  26. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
  27. package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
  28. package/dist/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
  29. package/dist/components/BonusBenefitsBlock/getElementsColsValue.js +17 -0
  30. package/dist/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
  31. package/dist/components/Headline/HeadlineContent.d.ts +1 -1
  32. package/dist/components/Headline/constants.d.ts +1 -1
  33. package/dist/components/LinkDocs/LinkDocsContent.d.ts +1 -1
  34. package/dist/components/OtherProducts/OtherProductsContent.d.ts +1 -1
  35. package/dist/components/OtherProducts/OtherProductsItem.d.ts +1 -2
  36. package/dist/components/OtherProducts/OtherProductsItem.js +10 -7
  37. package/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
  38. package/dist/components/TariffsTable/TariffsTable.js +8 -3
  39. package/dist/components/TariffsTable/TariffsTable.js.map +1 -1
  40. package/dist/components/TariffsTable/TariffsTableContent.d.ts +7 -5
  41. package/dist/content-page-repository/ContentPageRepository.js +1 -1
  42. package/dist/content-page-repository/ContentPageRepository.js.map +1 -1
  43. package/dist/icons/IconName.d.ts +22 -6
  44. package/dist/icons/IconName.js +18 -2
  45. package/dist/icons/IconName.js.map +1 -1
  46. package/dist/model/AlignType.d.ts +9 -0
  47. package/dist/model/AlignType.js +2 -0
  48. package/dist/model/AlignType.js.map +1 -0
  49. package/dist/model/VNode.d.ts +1 -0
  50. package/dist/model/VNode.js +2 -0
  51. package/dist/model/VNode.js.map +1 -0
  52. package/dist/types.d.ts +1 -0
  53. package/dist/ui-kit/Foldable/Foldable.d.ts +20 -0
  54. package/dist/ui-kit/Foldable/Foldable.js +22 -0
  55. package/dist/ui-kit/Foldable/Foldable.js.map +1 -0
  56. package/dist/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
  57. package/dist/ui-kit/Foldable/useActiveHandler.js +22 -0
  58. package/dist/ui-kit/Foldable/useActiveHandler.js.map +1 -0
  59. package/lib/common.css +1 -1
  60. package/lib/components/Accordion/Accordion.fixture.d.ts +1 -0
  61. package/lib/components/Accordion/Accordion.js +7 -2
  62. package/lib/components/Accordion/Accordion.js.map +1 -1
  63. package/lib/components/Accordion/AccordionContent.d.ts +3 -0
  64. package/lib/components/BaseTile/BaseTileProps.d.ts +1 -9
  65. package/lib/components/BenefitsBlock/BenefitsBlock.js +3 -3
  66. package/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  67. package/lib/components/BlockContent.d.ts +2 -1
  68. package/lib/components/Blocks.d.ts +1 -0
  69. package/lib/components/Blocks.js +2 -0
  70. package/lib/components/Blocks.js.map +1 -1
  71. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
  72. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.fixture.d.ts +4 -0
  73. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +12 -0
  74. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
  75. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
  76. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
  77. package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
  78. package/lib/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
  79. package/lib/components/BonusBenefitsBlock/getElementsColsValue.js +14 -0
  80. package/lib/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
  81. package/lib/components/Headline/HeadlineContent.d.ts +1 -1
  82. package/lib/components/Headline/constants.d.ts +1 -1
  83. package/lib/components/LinkDocs/LinkDocsContent.d.ts +1 -1
  84. package/lib/components/OtherProducts/OtherProductsContent.d.ts +1 -1
  85. package/lib/components/OtherProducts/OtherProductsItem.d.ts +1 -2
  86. package/lib/components/OtherProducts/OtherProductsItem.js +11 -8
  87. package/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
  88. package/lib/components/TariffsTable/TariffsTable.js +8 -3
  89. package/lib/components/TariffsTable/TariffsTable.js.map +1 -1
  90. package/lib/components/TariffsTable/TariffsTableContent.d.ts +7 -5
  91. package/lib/content-page-repository/ContentPageRepository.js +1 -1
  92. package/lib/content-page-repository/ContentPageRepository.js.map +1 -1
  93. package/lib/icons/IconName.d.ts +22 -6
  94. package/lib/icons/IconName.js +18 -2
  95. package/lib/icons/IconName.js.map +1 -1
  96. package/lib/model/AlignType.d.ts +9 -0
  97. package/lib/model/AlignType.js +2 -0
  98. package/lib/model/AlignType.js.map +1 -0
  99. package/lib/model/VNode.d.ts +1 -0
  100. package/lib/model/VNode.js +2 -0
  101. package/lib/model/VNode.js.map +1 -0
  102. package/lib/types.d.ts +1 -0
  103. package/lib/ui-kit/Foldable/Foldable.d.ts +20 -0
  104. package/lib/ui-kit/Foldable/Foldable.js +20 -0
  105. package/lib/ui-kit/Foldable/Foldable.js.map +1 -0
  106. package/lib/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
  107. package/lib/ui-kit/Foldable/useActiveHandler.js +19 -0
  108. package/lib/ui-kit/Foldable/useActiveHandler.js.map +1 -0
  109. package/mobile/bundle/bundle.umd.js +18 -2
  110. package/mobile/bundle/bundle.umd.min.js +1 -1
  111. package/mobile/dist/components/Accordion/AccordionContent.d.ts +3 -0
  112. package/mobile/dist/components/BaseTile/BaseTileProps.d.ts +1 -9
  113. package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js +3 -3
  114. package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  115. package/mobile/dist/components/BlockContent.d.ts +2 -1
  116. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
  117. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +14 -0
  118. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
  119. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
  120. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
  121. package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
  122. package/mobile/dist/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
  123. package/mobile/dist/components/BonusBenefitsBlock/getElementsColsValue.js +17 -0
  124. package/mobile/dist/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
  125. package/mobile/dist/components/Headline/HeadlineContent.d.ts +1 -1
  126. package/mobile/dist/components/Headline/constants.d.ts +1 -1
  127. package/mobile/dist/components/LinkDocs/LinkDocsContent.d.ts +1 -1
  128. package/mobile/dist/components/OtherProducts/OtherProductsContent.d.ts +1 -1
  129. package/mobile/dist/components/OtherProducts/OtherProductsItem.d.ts +1 -2
  130. package/mobile/dist/components/OtherProducts/OtherProductsItem.js +10 -7
  131. package/mobile/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
  132. package/mobile/dist/components/TariffsTable/TariffsTableContent.d.ts +7 -5
  133. package/mobile/dist/content-page-repository/ContentPageRepository.js +1 -1
  134. package/mobile/dist/content-page-repository/ContentPageRepository.js.map +1 -1
  135. package/mobile/dist/icons/IconName.d.ts +22 -6
  136. package/mobile/dist/icons/IconName.js +18 -2
  137. package/mobile/dist/icons/IconName.js.map +1 -1
  138. package/mobile/dist/model/AlignType.d.ts +9 -0
  139. package/mobile/dist/model/AlignType.js +2 -0
  140. package/mobile/dist/model/AlignType.js.map +1 -0
  141. package/mobile/dist/model/VNode.d.ts +1 -0
  142. package/mobile/dist/model/VNode.js +2 -0
  143. package/mobile/dist/model/VNode.js.map +1 -0
  144. package/mobile/dist/types.d.ts +1 -0
  145. package/mobile/dist/ui-kit/Foldable/Foldable.d.ts +20 -0
  146. package/mobile/dist/ui-kit/Foldable/Foldable.js +22 -0
  147. package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -0
  148. package/mobile/dist/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
  149. package/mobile/dist/ui-kit/Foldable/useActiveHandler.js +22 -0
  150. package/mobile/dist/ui-kit/Foldable/useActiveHandler.js.map +1 -0
  151. package/mobile/lib/components/Accordion/AccordionContent.d.ts +3 -0
  152. package/mobile/lib/components/BaseTile/BaseTileProps.d.ts +1 -9
  153. package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js +3 -3
  154. package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  155. package/mobile/lib/components/BlockContent.d.ts +2 -1
  156. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
  157. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +12 -0
  158. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
  159. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
  160. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
  161. package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
  162. package/mobile/lib/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
  163. package/mobile/lib/components/BonusBenefitsBlock/getElementsColsValue.js +14 -0
  164. package/mobile/lib/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
  165. package/mobile/lib/components/Headline/HeadlineContent.d.ts +1 -1
  166. package/mobile/lib/components/Headline/constants.d.ts +1 -1
  167. package/mobile/lib/components/LinkDocs/LinkDocsContent.d.ts +1 -1
  168. package/mobile/lib/components/OtherProducts/OtherProductsContent.d.ts +1 -1
  169. package/mobile/lib/components/OtherProducts/OtherProductsItem.d.ts +1 -2
  170. package/mobile/lib/components/OtherProducts/OtherProductsItem.js +11 -8
  171. package/mobile/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
  172. package/mobile/lib/components/TariffsTable/TariffsTableContent.d.ts +7 -5
  173. package/mobile/lib/content-page-repository/ContentPageRepository.js +1 -1
  174. package/mobile/lib/content-page-repository/ContentPageRepository.js.map +1 -1
  175. package/mobile/lib/icons/IconName.d.ts +22 -6
  176. package/mobile/lib/icons/IconName.js +18 -2
  177. package/mobile/lib/icons/IconName.js.map +1 -1
  178. package/mobile/lib/model/AlignType.d.ts +9 -0
  179. package/mobile/lib/model/AlignType.js +2 -0
  180. package/mobile/lib/model/AlignType.js.map +1 -0
  181. package/mobile/lib/model/VNode.d.ts +1 -0
  182. package/mobile/lib/model/VNode.js +2 -0
  183. package/mobile/lib/model/VNode.js.map +1 -0
  184. package/mobile/lib/types.d.ts +1 -0
  185. package/mobile/lib/ui-kit/Foldable/Foldable.d.ts +20 -0
  186. package/mobile/lib/ui-kit/Foldable/Foldable.js +20 -0
  187. package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -0
  188. package/mobile/lib/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
  189. package/mobile/lib/ui-kit/Foldable/useActiveHandler.js +19 -0
  190. package/mobile/lib/ui-kit/Foldable/useActiveHandler.js.map +1 -0
  191. package/mobile/src/components/Accordion/AccordionContent.ts +3 -0
  192. package/mobile/src/components/BaseTile/BaseTileProps.ts +1 -10
  193. package/mobile/src/components/BenefitsBlock/BenefitsBlock.tsx +6 -8
  194. package/mobile/src/components/BlockContent.ts +3 -1
  195. package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +54 -0
  196. package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +49 -0
  197. package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +23 -0
  198. package/mobile/src/components/BonusBenefitsBlock/getElementsColsValue.ts +12 -0
  199. package/mobile/src/components/Headline/HeadlineContent.ts +1 -1
  200. package/mobile/src/components/Headline/constants.ts +1 -1
  201. package/mobile/src/components/LinkDocs/LinkDocsContent.ts +1 -1
  202. package/mobile/src/components/OtherProducts/OtherProductsContent.ts +1 -1
  203. package/mobile/src/components/OtherProducts/OtherProductsItem.tsx +33 -23
  204. package/mobile/src/components/TariffsTable/TariffsTableContent.ts +7 -5
  205. package/mobile/src/content-page-repository/ContentPageRepository.ts +1 -1
  206. package/mobile/src/icons/AirPlane.svg +98 -0
  207. package/mobile/src/icons/ArrowUpIcon.svg +1 -1
  208. package/mobile/src/icons/ArrowsRewindRight.svg +1 -1
  209. package/mobile/src/icons/CarIcon.svg +466 -0
  210. package/mobile/src/icons/CinemaIcon.svg +274 -0
  211. package/mobile/src/icons/DocsIcon.svg +238 -0
  212. package/mobile/src/icons/IconName.ts +4 -4
  213. package/mobile/src/icons/PowerIcon.svg +135 -0
  214. package/mobile/src/icons/PumpkinIcon.svg +236 -0
  215. package/mobile/src/icons/SoundIcon.svg +113 -0
  216. package/mobile/src/icons/WateringCan.svg +497 -0
  217. package/mobile/src/model/AlignType.ts +9 -0
  218. package/mobile/src/model/VNode.ts +1 -0
  219. package/mobile/src/types.ts +1 -0
  220. package/mobile/src/ui-kit/Foldable/Foldable.tsx +81 -0
  221. package/mobile/src/ui-kit/Foldable/useActiveHandler.ts +34 -0
  222. package/package.json +1 -1
  223. package/src/components/Accordion/Accordion.fixture.tsx +24 -2
  224. package/src/components/Accordion/Accordion.tsx +23 -2
  225. package/src/components/Accordion/AccordionContent.ts +3 -0
  226. package/src/components/BaseTile/BaseTileProps.ts +1 -10
  227. package/src/components/BenefitsBlock/BenefitsBlock.tsx +6 -8
  228. package/src/components/BlockContent.ts +3 -1
  229. package/src/components/Blocks.ts +2 -0
  230. package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +54 -0
  231. package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.fixture.tsx +50 -0
  232. package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +49 -0
  233. package/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +23 -0
  234. package/src/components/BonusBenefitsBlock/getElementsColsValue.ts +12 -0
  235. package/src/components/Headline/HeadlineContent.ts +1 -1
  236. package/src/components/Headline/constants.ts +1 -1
  237. package/src/components/LinkDocs/LinkDocs.tsx +1 -1
  238. package/src/components/LinkDocs/LinkDocsContent.ts +1 -1
  239. package/src/components/OtherProducts/OtherProductsContent.ts +1 -1
  240. package/src/components/OtherProducts/OtherProductsItem.tsx +33 -23
  241. package/src/components/TariffsTable/TariffsTable.fixture.tsx +4 -1
  242. package/src/components/TariffsTable/TariffsTable.tsx +55 -18
  243. package/src/components/TariffsTable/TariffsTableContent.ts +7 -5
  244. package/src/content-page-repository/ContentPageRepository.ts +1 -1
  245. package/src/icons/AirPlane.svg +98 -0
  246. package/src/icons/ArrowUpIcon.svg +1 -1
  247. package/src/icons/ArrowsRewindRight.svg +1 -1
  248. package/src/icons/CarIcon.svg +466 -0
  249. package/src/icons/CinemaIcon.svg +274 -0
  250. package/src/icons/DocsIcon.svg +238 -0
  251. package/src/icons/IconName.ts +28 -4
  252. package/src/icons/PowerIcon.svg +135 -0
  253. package/src/icons/PumpkinIcon.svg +236 -0
  254. package/src/icons/SoundIcon.svg +113 -0
  255. package/src/icons/WateringCan.svg +497 -0
  256. package/src/model/AlignType.ts +9 -0
  257. package/src/model/VNode.ts +1 -0
  258. package/src/types.ts +1 -0
  259. package/src/ui-kit/Foldable/Foldable.tsx +81 -0
  260. package/src/ui-kit/Foldable/useActiveHandler.ts +34 -0
  261. package/dist/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
  262. package/dist/components/OtherProducts/OtherProductsItemInner.js +0 -10
  263. package/dist/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
  264. package/dist/components/OtherProducts/useActiveHandler.d.ts +0 -7
  265. package/dist/components/OtherProducts/useActiveHandler.js +0 -21
  266. package/dist/components/OtherProducts/useActiveHandler.js.map +0 -1
  267. package/lib/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
  268. package/lib/components/OtherProducts/OtherProductsItemInner.js +0 -8
  269. package/lib/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
  270. package/lib/components/OtherProducts/useActiveHandler.d.ts +0 -7
  271. package/lib/components/OtherProducts/useActiveHandler.js +0 -18
  272. package/lib/components/OtherProducts/useActiveHandler.js.map +0 -1
  273. package/mobile/dist/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
  274. package/mobile/dist/components/OtherProducts/OtherProductsItemInner.js +0 -10
  275. package/mobile/dist/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
  276. package/mobile/dist/components/OtherProducts/useActiveHandler.d.ts +0 -7
  277. package/mobile/dist/components/OtherProducts/useActiveHandler.js +0 -21
  278. package/mobile/dist/components/OtherProducts/useActiveHandler.js.map +0 -1
  279. package/mobile/lib/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
  280. package/mobile/lib/components/OtherProducts/OtherProductsItemInner.js +0 -8
  281. package/mobile/lib/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
  282. package/mobile/lib/components/OtherProducts/useActiveHandler.d.ts +0 -7
  283. package/mobile/lib/components/OtherProducts/useActiveHandler.js +0 -18
  284. package/mobile/lib/components/OtherProducts/useActiveHandler.js.map +0 -1
  285. package/mobile/src/components/OtherProducts/OtherProductsItemInner.tsx +0 -14
  286. package/mobile/src/components/OtherProducts/useActiveHandler.ts +0 -24
  287. package/src/components/OtherProducts/OtherProductsItemInner.tsx +0 -14
  288. package/src/components/OtherProducts/useActiveHandler.ts +0 -24
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @title Выравнивание
3
+ * @enumNames [
4
+ * "По левому краю",
5
+ * "По центру",
6
+ * "По правому краю"
7
+ * ]
8
+ */
9
+ export type AlignType = 'left' | 'center' | 'right';
@@ -0,0 +1 @@
1
+ export type VNode = unknown;
@@ -50,6 +50,7 @@ export interface ContentPageDef extends ContentPageMeta {
50
50
  slots?: SlotsMap;
51
51
  likeControl?: boolean;
52
52
  colorPalette?: ColorPalette;
53
+ _customPageType?: string;
53
54
  }
54
55
 
55
56
  export interface UniBlockProps {
@@ -0,0 +1,81 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
3
+ import type { VNode } from '../../model/VNode';
4
+ import { ColorPalette } from '../../types';
5
+ import { clamp } from '../../utils/clamp';
6
+ import { Icon } from '../Icon/Icon';
7
+ import { foldableBlockClassNames, useActiveHandler } from './useActiveHandler';
8
+
9
+ export type FoldableBlocks = VNode[];
10
+ export type Render = (_: VNode, isActive: boolean) => VNode;
11
+ export interface FoldableProps {
12
+ context: ContentPageContext;
13
+ foldButtonLabel?: string;
14
+ hiddenBlocksNum?: number;
15
+ blocks?: FoldableBlocks;
16
+ foldButtonClasses?: string;
17
+ foldButtonDataTheme?: ColorPalette;
18
+ isUnfolded?: boolean;
19
+ render?: Render;
20
+ }
21
+
22
+ export interface RenderBlocksParams {
23
+ blocksToHide: number;
24
+ isActive: boolean;
25
+ }
26
+
27
+ export const Foldable = JSX<FoldableProps>(
28
+ ({
29
+ blocks = [],
30
+ context,
31
+ hiddenBlocksNum = 0,
32
+ foldButtonClasses,
33
+ foldButtonLabel,
34
+ foldButtonDataTheme,
35
+ isUnfolded,
36
+ render = (_) => _,
37
+ }) => {
38
+ const blocksToHide = clamp(hiddenBlocksNum, 0, blocks.length);
39
+
40
+ const { icon, handleToggle, isActive } = useActiveHandler({
41
+ context,
42
+ initialState: isUnfolded,
43
+ });
44
+
45
+ return blocks ? (
46
+ <div>
47
+ {renderBlocks(blocks, render, { blocksToHide, isActive })}
48
+ {hiddenBlocksNum ? (
49
+ <button
50
+ className={
51
+ foldButtonClasses ||
52
+ 'border-none bg-primary-main px-0 py-[26px] mb-[1px] w-full font-sans text-white text-base flex justify-center cursor-pointer'
53
+ }
54
+ data-theme={foldButtonDataTheme}
55
+ onClick={handleToggle}
56
+ >
57
+ <span className="pr-3">{isActive ? 'Скрыть' : foldButtonLabel}</span>
58
+ <Icon name={icon} width="20" height="20" asSVG />
59
+ </button>
60
+ ) : null}
61
+ </div>
62
+ ) : null;
63
+ },
64
+ );
65
+
66
+ const renderBlocks = (
67
+ blocks: FoldableBlocks,
68
+ render: Render,
69
+ { blocksToHide, isActive }: RenderBlocksParams,
70
+ ) => {
71
+ const visibleBlocks = blocks.slice(0, blocks.length - blocksToHide);
72
+ const hiddenBlocks = blocks.slice(-blocksToHide);
73
+
74
+ return render(
75
+ <div>
76
+ {visibleBlocks}
77
+ <div className={foldableBlockClassNames}>{hiddenBlocks}</div>
78
+ </div>,
79
+ isActive,
80
+ );
81
+ };
@@ -0,0 +1,34 @@
1
+ import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
2
+ import type { IconName } from '../../icons/IconName';
3
+
4
+ export const foldableBlockClassNames = 'transition-all duration-300 max-h-0 overflow-hidden';
5
+
6
+ export interface ActiveHandler {
7
+ context: ContentPageContext;
8
+ initialState?: boolean;
9
+ }
10
+
11
+ export const useActiveHandler = ({ context, initialState = false }: ActiveHandler) => {
12
+ const [isActive, setIsActive] = context.useState(initialState);
13
+ const icon: IconName = isActive ? 'ArrowUpIcon' : 'ArrowDownIcon';
14
+
15
+ const handleToggle = (e: MouseEvent) => {
16
+ const currentTarget = e.currentTarget as HTMLElement;
17
+
18
+ if (!currentTarget) {
19
+ return;
20
+ }
21
+
22
+ setIsActive(!isActive);
23
+ const wrapperBlock = currentTarget.previousSibling as HTMLElement;
24
+ const contentBlock = wrapperBlock.getElementsByClassName(
25
+ foldableBlockClassNames,
26
+ )[0] as HTMLElement;
27
+
28
+ contentBlock.style.maxHeight = contentBlock.style.maxHeight
29
+ ? ''
30
+ : `${contentBlock.scrollHeight}px`;
31
+ };
32
+
33
+ return { icon, handleToggle, isActive };
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.3.62",
3
+ "version": "0.3.64",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -61,7 +61,7 @@ const MINI_GALLERY_ACCORDION_BLOCK: MiniGalleryBlockListDef = {
61
61
  ...MINI_GALLERY,
62
62
  };
63
63
 
64
- const propsBlock: AccordionProps = {
64
+ const propsDefaultBlock: AccordionProps = {
65
65
  context,
66
66
  title: 'Accordion title',
67
67
  description: 'Accordion description',
@@ -101,10 +101,32 @@ const propsBlock: AccordionProps = {
101
101
  ],
102
102
  };
103
103
 
104
+ const propsRightAlignTitleBlock: AccordionProps = {
105
+ context,
106
+ title: 'Accordion title',
107
+ accordionAlignTitle: 'right',
108
+ description: 'Accordion description',
109
+ accordionItems: [
110
+ {
111
+ label: 'Accordion label 1',
112
+ blocks: [TEXT_BLOCK_ACCORDION_BLOCK, TEXT_BLOCK_ACCORDION_BLOCK],
113
+ },
114
+ {
115
+ label: 'Accordion label 2',
116
+ blocks: [PICTURE_TEXT_ACCORDION_BLOCK],
117
+ },
118
+ ],
119
+ };
120
+
104
121
  export default {
105
122
  default: (
106
123
  <div className="container grid grid-cols-12">
107
- <Accordion className="col-span-12" {...propsBlock} />
124
+ <Accordion className="col-span-12" {...propsDefaultBlock} />
125
+ </div>
126
+ ),
127
+ 'right-align-title': (
128
+ <div className="container grid grid-cols-12">
129
+ <Accordion className="col-span-12" {...propsRightAlignTitleBlock} />
108
130
  </div>
109
131
  ),
110
132
  };
@@ -3,14 +3,35 @@ import type { UniBlockProps } from '../../types';
3
3
  import { Heading } from '../../ui-kit/Heading/Heading';
4
4
  import type { AccordionContent } from './AccordionContent';
5
5
  import { AccordionItem } from './AccordionItem';
6
+ import { AlignType } from '../../model/AlignType';
7
+
8
+ const ALIGN_TITLE: Record<AlignType, string> = {
9
+ left: 'text-left',
10
+ center: 'text-center',
11
+ right: 'text-right',
12
+ };
6
13
 
7
14
  export interface AccordionProps extends AccordionContent, UniBlockProps {}
8
15
 
9
16
  export const Accordion = JSX<AccordionProps>(
10
- ({ title, description, accordionItems, context, className = '', anchor = null }) => {
17
+ ({
18
+ title,
19
+ description,
20
+ accordionItems,
21
+ context,
22
+ className = '',
23
+ anchor = null,
24
+ accordionAlignTitle = 'center',
25
+ }) => {
11
26
  return (
12
27
  <section className={`p-[50px] font-sans bg-white text-primary-text ${className}`} id={anchor}>
13
- {title ? <Heading headingType="h4" className="mb-2.5" title={title} /> : null}
28
+ {title ? (
29
+ <Heading
30
+ headingType="h4"
31
+ className={`mb-2.5 ${ALIGN_TITLE[accordionAlignTitle]}`}
32
+ title={title}
33
+ />
34
+ ) : null}
14
35
  {description ? <div className="mb-2.5 text-base">{description}</div> : null}
15
36
  {accordionItems?.length ? (
16
37
  <ul className="list-none m-0 p-0">
@@ -1,6 +1,7 @@
1
1
  import type { BlockDef } from '../../ui-kit/BlocksList/BlocksListProps';
2
2
  import type { BlockVersion } from '../../model/BlockVersion';
3
3
  import type { Picture } from '../../model/Picture';
4
+ import type { AlignType } from '../../model/AlignType';
4
5
  /**
5
6
  * @title Элемент списка
6
7
  */
@@ -30,6 +31,8 @@ export interface AccordionItemCommonProps {
30
31
  export interface AccordionContent {
31
32
  /** @title Заголовок */
32
33
  title?: string;
34
+ /** @title Выравнивание заголовка */
35
+ accordionAlignTitle?: AlignType;
33
36
  version?: BlockVersion;
34
37
  /** @title Список */
35
38
  accordionItems?: AccordionItemCommonProps[];
@@ -2,16 +2,7 @@ import type { BlockVersion } from '../../model/BlockVersion';
2
2
  import type { Picture } from '../../model/Picture';
3
3
  import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
4
4
  import type { HeadingType } from '../../ui-kit/Heading/HeadingContent';
5
-
6
- /**
7
- * @title Выравнивание
8
- * @enumNames [
9
- * "По левому краю",
10
- * "По центру",
11
- * "По правому краю"
12
- * ]
13
- */
14
- export type AlignType = 'left' | 'center' | 'right';
5
+ import type { AlignType } from '../../model/AlignType';
15
6
 
16
7
  /**
17
8
  * @title Общий компонент плиток
@@ -7,12 +7,10 @@ import type { Benefit, BenefitsBlockContent } from './BenefitsBlockContent';
7
7
  export interface BenefitsBlockProps extends BenefitsBlockContent, UniBlockProps {}
8
8
 
9
9
  export const BenefitsBlock = JSX<BenefitsBlockProps>(
10
- ({ className, title, benefits, anchor = null }) => {
10
+ ({ className = '', title, benefits, anchor = null }) => {
11
11
  return (
12
12
  <section
13
- className={`font-sans text-primary-text bg-white p-12 flex flex-col items-center ${
14
- className || ''
15
- }`}
13
+ className={`font-sans text-primary-text bg-white p-12 flex flex-col items-center ${className}`}
16
14
  id={anchor}
17
15
  >
18
16
  {title ? (
@@ -29,7 +27,7 @@ export const BenefitsBlock = JSX<BenefitsBlockProps>(
29
27
  const renderStep = (benefit: Benefit, i: number) => {
30
28
  return (
31
29
  <div key={String(i)} className="flex items-center gap-5 max-w-[500px]">
32
- {benefit.icon ? (
30
+ {benefit?.icon ? (
33
31
  <Img
34
32
  className="h-[70px] w-[70px] min-w-[70px] min-h-[70px]"
35
33
  image={benefit.icon}
@@ -38,10 +36,10 @@ const renderStep = (benefit: Benefit, i: number) => {
38
36
  />
39
37
  ) : null}
40
38
  <div>
41
- <h3 className="font-medium text-xl m-0">{benefit.label}</h3>
42
- {benefit.description && (
39
+ {benefit?.label ? <h3 className="font-medium text-xl m-0">{benefit.label}</h3> : null}
40
+ {benefit?.description ? (
43
41
  <div className="font-normal text-sm mt-2">{benefit.description}</div>
44
- )}
42
+ ) : null}
45
43
  </div>
46
44
  </div>
47
45
  );
@@ -22,6 +22,7 @@ import type { StepsBlockContent } from './StepsBlock/StepsBlockContent';
22
22
  import type { TariffsTableContent } from './TariffsTable/TariffsTableContent';
23
23
  import type { TextBlockContent } from './TextBlock/TextBlockContent';
24
24
  import type { TileContent } from './Tile/TileContent';
25
+ import type { BonusBenefitsBlockContent } from './BonusBenefitsBlock/BonusBenefitsBlockContent';
25
26
 
26
27
  /**
27
28
  * @hidden
@@ -50,4 +51,5 @@ export type BlockContent =
50
51
  | TileContent
51
52
  | NavigationContent
52
53
  | LinkListContent
53
- | GroupBlockContent;
54
+ | GroupBlockContent
55
+ | BonusBenefitsBlockContent;
@@ -29,6 +29,7 @@ import { TariffsTable } from './TariffsTable/TariffsTable';
29
29
  import { TextBlock } from './TextBlock/TextBlock';
30
30
  import { Tile } from './Tile/Tile';
31
31
  import { GroupBlock } from './GroupBlock/GroupBlock';
32
+ import { BonusBenefitsBlock } from './BonusBenefitsBlock/BonusBenefitsBlock';
32
33
 
33
34
  export const Blocks = {
34
35
  Accordion,
@@ -62,4 +63,5 @@ export const Blocks = {
62
63
  Navigation,
63
64
  Placeholder,
64
65
  GroupBlock,
66
+ BonusBenefitsBlock,
65
67
  };
@@ -0,0 +1,54 @@
1
+ {
2
+ "title": "Вы можете оплатить бонусными баллами",
3
+ "subtitle": "Удобный каталог с большим ассортиментом товаров и сервисов",
4
+ "bonusBenefits": [
5
+ {
6
+ "label": "Более 5000 товаров",
7
+ "icon": {
8
+ "icon": "WateringCan"
9
+ }
10
+ },
11
+ {
12
+ "label": "750 авиакомпаний, 1,2 млн отелей, билеты РЖД",
13
+ "icon": {
14
+ "icon": "SignDocsIcon"
15
+ }
16
+ },
17
+ {
18
+ "label": "Аренда автомобилей",
19
+ "icon": {
20
+ "icon": "SignDocsIcon"
21
+ }
22
+ },
23
+ {
24
+ "label": "Болеее 1000 развлечений",
25
+ "icon": {
26
+ "icon": "SignDocsIcon"
27
+ }
28
+ },
29
+ {
30
+ "label": "Платежные гаджеты Pay Ring",
31
+ "icon": {
32
+ "icon": "SignDocsIcon"
33
+ }
34
+ },
35
+ {
36
+ "label": "Цифровые сервисы",
37
+ "icon": {
38
+ "icon": "SignDocsIcon"
39
+ }
40
+ },
41
+ {
42
+ "label": "Фермерские продукты",
43
+ "icon": {
44
+ "icon": "SignDocsIcon"
45
+ }
46
+ },
47
+ {
48
+ "label": "Страхование",
49
+ "icon": {
50
+ "icon": "SignDocsIcon"
51
+ }
52
+ }
53
+ ]
54
+ }
@@ -0,0 +1,50 @@
1
+ import { context } from '../../setup-fixture';
2
+
3
+ import { BonusBenefitsBlock } from './BonusBenefitsBlock';
4
+
5
+ export default {
6
+ default: (
7
+ <div className="container grid grid-cols-12">
8
+ <BonusBenefitsBlock
9
+ context={context}
10
+ className="col-span-12"
11
+ title="Преимущества кредита"
12
+ subtitle="Удобный каталог с большим ассортиментом товаров и сервисов"
13
+ bonusBenefits={[
14
+ {
15
+ label: 'Более 5000 товаров',
16
+ icon: { icon: 'WateringCan' },
17
+ },
18
+ {
19
+ label: '750 авиакомпаний, 1,2 млн отелей, билеты РЖД',
20
+ icon: { icon: 'AirPlane' },
21
+ },
22
+ {
23
+ label: 'Аренда автомобилей',
24
+ icon: { icon: 'CarIcon' },
25
+ },
26
+ {
27
+ label: 'Болеее 1000 развлечений',
28
+ icon: { icon: 'CinemaIcon' },
29
+ },
30
+ {
31
+ label: 'Платежные гаджеты Pay Ring',
32
+ icon: { icon: 'SoundIcon' },
33
+ },
34
+ {
35
+ label: 'Цифровые сервисы',
36
+ icon: { icon: 'DocsIcon' },
37
+ },
38
+ {
39
+ label: 'Фермерские продукты',
40
+ icon: { icon: 'PumpkinIcon' },
41
+ },
42
+ {
43
+ label: 'Страхование',
44
+ icon: { icon: 'PowerIcon' },
45
+ },
46
+ ]}
47
+ />
48
+ </div>
49
+ ),
50
+ };
@@ -0,0 +1,49 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { UniBlockProps } from '../../types';
3
+ import { Heading } from '../../ui-kit/Heading/Heading';
4
+ import { Img } from '../../ui-kit/Img/Img';
5
+ import type { BonusBenefit, BonusBenefitsBlockContent } from './BonusBenefitsBlockContent';
6
+ import { getElementsColsValue } from './getElementsColsValue';
7
+
8
+ export interface BenefitsBlockProps extends BonusBenefitsBlockContent, UniBlockProps {}
9
+
10
+ export const BonusBenefitsBlock = JSX<BenefitsBlockProps>(
11
+ ({ className = '', title, subtitle, bonusBenefits, anchor = null }) => {
12
+ return (
13
+ <section
14
+ className={`font-sans text-primary-text bg-white p-50 flex flex-col ${className}`}
15
+ id={anchor}
16
+ >
17
+ {title ? (
18
+ <Heading headingType="h3" className="text-center mb-[10px]" title={title} />
19
+ ) : null}
20
+ {subtitle ? <span className="text-md font-normal text-center">{subtitle}</span> : null}
21
+ {bonusBenefits?.length ? (
22
+ <div className={`grid gap-1 ${getElementsColsValue(className)}`}>
23
+ {bonusBenefits.map(renderBonusBenefit)}
24
+ </div>
25
+ ) : null}
26
+ </section>
27
+ );
28
+ },
29
+ );
30
+
31
+ const renderBonusBenefit = (bonusBenefit: BonusBenefit, i: number) => {
32
+ return (
33
+ <div key={String(i)} className="flex flex-col items-center max-w-[292px]">
34
+ {bonusBenefit?.icon ? (
35
+ <Img
36
+ className="h-[180px] w-[160px] min-w-[160px] min-h-[160px]"
37
+ image={bonusBenefit.icon}
38
+ width="160"
39
+ height="180"
40
+ />
41
+ ) : null}
42
+ <div>
43
+ {bonusBenefit?.label ? (
44
+ <span className="title-2xs text-center m-0">{bonusBenefit.label}</span>
45
+ ) : null}
46
+ </div>
47
+ </div>
48
+ );
49
+ };
@@ -0,0 +1,23 @@
1
+ import type { Picture } from '../../model/Picture';
2
+
3
+ export interface BonusBenefit {
4
+ /** @title Название */
5
+ label?: string;
6
+ /** @title Бонус и преимущество */
7
+ icon?: Picture;
8
+ }
9
+
10
+ /**
11
+ * @title Блок бонусов и преимуществ
12
+ */
13
+ export interface BonusBenefitsBlockContent {
14
+ /** @title Заголовок */
15
+ title?: string;
16
+ /** @title Подзаголовок */
17
+ subtitle?: string;
18
+ /**
19
+ * @title Список бонусов
20
+ * @maxItems 8
21
+ */
22
+ bonusBenefits?: BonusBenefit[];
23
+ }
@@ -0,0 +1,12 @@
1
+ import { getColSpan } from '../../utils/getColSpan';
2
+
3
+ export function getElementsColsValue(className = '') {
4
+ const colSpan = getColSpan(className);
5
+ if (colSpan <= 6) {
6
+ return 'grid-cols-2';
7
+ } else if (colSpan <= 8) {
8
+ return 'grid-cols-3';
9
+ } else {
10
+ return 'grid-cols-4';
11
+ }
12
+ }
@@ -2,7 +2,7 @@ import type { BlockVersionWithTransparent } from '../../model/BlockVersion';
2
2
  import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
3
3
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
4
4
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
5
- import type { AlignType } from '../BaseTile/BaseTileProps';
5
+ import type { AlignType } from '../../model/AlignType';
6
6
 
7
7
  /**
8
8
  * @title Заголовок
@@ -1,4 +1,4 @@
1
- import type { AlignType } from '../BaseTile/BaseTileProps';
1
+ import type { AlignType } from '../../model/AlignType';
2
2
  import type { BlockVersionWithTransparent } from '../../model/BlockVersion';
3
3
 
4
4
  export const ALIGN_TEXT: Record<AlignType, string> = {
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { UniBlockProps } from '../../types';
3
3
  import { Heading } from '../../ui-kit/Heading/Heading';
4
- import type { AlignType } from '../BaseTile/BaseTileProps';
4
+ import type { AlignType } from '../../model/AlignType';
5
5
  import type { LinkColumnsMode, LinkDocsContent } from './LinkDocsContent';
6
6
  import { LinkDocsList } from './LinkDocsList';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import type { LinkProps } from '../../model/LinkProps';
2
- import type { AlignType } from '../BaseTile/BaseTileProps';
2
+ import type { AlignType } from '../../model/AlignType';
3
3
  import type { ListOrientation } from '../../model/ListOrientation';
4
4
  import type { Picture } from '../../model/Picture';
5
5
 
@@ -13,7 +13,7 @@ export interface BlockItemCommonProps {
13
13
  /**
14
14
  * @title Отображать в раскрытом виде
15
15
  */
16
- isExpanded?: boolean;
16
+ isUnfolded?: boolean;
17
17
  /**
18
18
  * @title Блоки
19
19
  * @maxItems 10
@@ -1,42 +1,52 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { UniBlockProps } from '../../types';
3
- import { Icon } from '../../ui-kit/Icon/Icon';
2
+ import type { VNode } from '../../model/VNode';
3
+ import type { ColorPalette, UniBlockProps } from '../../types';
4
+ import { renderBlocksList } from '../../ui-kit/BlocksList/renderBlocksList';
5
+ import { Foldable } from '../../ui-kit/Foldable/Foldable';
4
6
  import type { BlockItemCommonProps } from './OtherProductsContent';
5
- import { OtherProductsItemInner } from './OtherProductsItemInner';
6
- import { useActiveHandler } from './useActiveHandler';
7
- import { ColorPalette } from '../../types';
8
7
 
9
8
  export interface BlockItemProps extends BlockItemCommonProps, UniBlockProps {
10
9
  dataTheme?: ColorPalette;
11
10
  }
12
11
 
13
12
  export const OtherProductsItem = JSX<BlockItemProps>(
14
- ({ label, isExpanded, blocks, columns, dataTheme = null, context }) => {
15
- const { hasContent, icon, handleToggle, isActive } = useActiveHandler({
13
+ ({ label, blocks, columns = 1, context, dataTheme, isUnfolded }) => {
14
+ const foldableBlocks = renderBlocksList({
16
15
  context,
16
+ className: 'box-border p-5',
17
+ columns,
17
18
  blocks,
18
- initialState: isExpanded,
19
- });
20
-
19
+ }) as VNode[];
21
20
  return (
22
21
  <div className="border-0 border-b border-solid border-main-divider">
23
- {hasContent ? (
24
- <OtherProductsItemInner
25
- isExpanded={isActive}
26
- columns={columns}
27
- blocks={blocks}
22
+ {blocks?.length ? (
23
+ <Foldable
24
+ foldButtonDataTheme={dataTheme}
25
+ hiddenBlocksNum={blocks?.length}
26
+ blocks={foldableBlocks}
27
+ isUnfolded={isUnfolded}
28
28
  context={context}
29
+ foldButtonLabel={label}
30
+ render={(children, isActive) => (
31
+ <Wrapper columns={columns} isActive={isActive}>
32
+ {children}
33
+ </Wrapper>
34
+ )}
29
35
  />
30
36
  ) : null}
31
- <button
32
- className="border-none bg-primary-main px-0 py-[26px] mb-[1px] w-full font-sans text-white text-base flex justify-center cursor-pointer"
33
- data-theme={dataTheme}
34
- onClick={handleToggle}
35
- >
36
- <span className="pr-3">{isActive ? 'Скрыть' : label}</span>
37
- {hasContent ? <Icon name={icon} width="20" height="20" asSVG /> : null}
38
- </button>
39
37
  </div>
40
38
  );
41
39
  },
42
40
  );
41
+
42
+ const Wrapper = JSX<{ columns: number; isActive: boolean }>(({ columns, children, isActive }) => {
43
+ return (
44
+ <div
45
+ className={`box-border w-full ${isActive ? 'p-9' : ''} ${
46
+ columns > 1 ? 'flex flex-wrap' : ''
47
+ }`}
48
+ >
49
+ {children}
50
+ </div>
51
+ );
52
+ });