@redneckz/wildless-cms-uni-blocks 0.4.4 → 0.4.6

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 (351) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +114 -34
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/cosmos-static/icons/{AirPlane.svg → AirPlaneIcon.svg} +0 -0
  5. package/cosmos-static/icons/{DocDownload.svg → DocDownloadIcon.svg} +0 -0
  6. package/cosmos-static/icons/{Logo.svg → LogoIcon.svg} +0 -0
  7. package/cosmos-static/icons/{PackA4.svg → PackA4Icon.svg} +0 -0
  8. package/cosmos-static/icons/{WateringCan.svg → WateringCanIcon.svg} +0 -0
  9. package/dist/components/BenefitsBlock/BenefitsBlock.js +32 -9
  10. package/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  11. package/dist/components/BenefitsBlock/BenefitsBlockContent.d.ts +9 -2
  12. package/dist/components/BlockContent.d.ts +3 -2
  13. package/dist/components/Blocks.d.ts +1 -0
  14. package/dist/components/Blocks.js +2 -0
  15. package/dist/components/Blocks.js.map +1 -1
  16. package/dist/components/CardTransfer/CardTransfer.d.ts +5 -0
  17. package/dist/components/CardTransfer/CardTransfer.js +28 -0
  18. package/dist/components/CardTransfer/CardTransfer.js.map +1 -0
  19. package/dist/components/CardTransfer/CardTransferContent.d.ts +10 -0
  20. package/dist/components/CardTransfer/CardTransferContent.js +2 -0
  21. package/dist/components/CardTransfer/CardTransferContent.js.map +1 -0
  22. package/dist/components/SafeDepositRental/SafeDepositRentalTotal.js +1 -1
  23. package/dist/components/SafeDepositRental/SafeDepositRentalTotal.js.map +1 -1
  24. package/dist/components/TariffsTable/EmbeddableCellData.js +1 -0
  25. package/dist/components/TariffsTable/EmbeddableCellData.js.map +1 -1
  26. package/dist/components/TariffsTable/TariffsTableRowContainer.js +3 -3
  27. package/dist/components/TariffsTable/TariffsTableRowContainer.js.map +1 -1
  28. package/dist/components/TariffsTable/dataFixture.js +1 -0
  29. package/dist/components/TariffsTable/dataFixture.js.map +1 -1
  30. package/dist/content-page-repository/transformContentPage.js +9 -3
  31. package/dist/content-page-repository/transformContentPage.js.map +1 -1
  32. package/dist/content-page-repository/transformImg.d.ts +11 -0
  33. package/dist/content-page-repository/transformImg.js +100 -0
  34. package/dist/content-page-repository/transformImg.js.map +1 -0
  35. package/dist/content-page-repository/transformPicture.js +15 -40
  36. package/dist/content-page-repository/transformPicture.js.map +1 -1
  37. package/dist/content-page-repository/transformSrc.d.ts +3 -0
  38. package/dist/content-page-repository/transformSrc.js +20 -0
  39. package/dist/content-page-repository/transformSrc.js.map +1 -0
  40. package/dist/icons/IconName.d.ts +12 -12
  41. package/dist/icons/IconName.js +10 -10
  42. package/dist/icons/IconName.js.map +1 -1
  43. package/dist/model/ImageSize.d.ts +6 -0
  44. package/dist/model/ImageSize.js +2 -0
  45. package/dist/model/ImageSize.js.map +1 -0
  46. package/dist/model/Picture.d.ts +19 -6
  47. package/dist/ui-kit/Button/Button.js +6 -15
  48. package/dist/ui-kit/Button/Button.js.map +1 -1
  49. package/dist/ui-kit/Button/GetButtonClassParams.d.ts +6 -0
  50. package/dist/ui-kit/Button/GetButtonClassParams.js +2 -0
  51. package/dist/ui-kit/Button/GetButtonClassParams.js.map +1 -0
  52. package/dist/ui-kit/Button/buttonClassNameConstants.d.ts +4 -0
  53. package/dist/ui-kit/Button/buttonClassNameConstants.js +14 -0
  54. package/dist/ui-kit/Button/buttonClassNameConstants.js.map +1 -0
  55. package/dist/ui-kit/Button/getDisabledButtonClasses.d.ts +2 -0
  56. package/dist/ui-kit/Button/getDisabledButtonClasses.js +12 -0
  57. package/dist/ui-kit/Button/getDisabledButtonClasses.js.map +1 -0
  58. package/dist/ui-kit/Button/getRegularButtonClasses.d.ts +2 -0
  59. package/dist/ui-kit/Button/getRegularButtonClasses.js +12 -0
  60. package/dist/ui-kit/Button/getRegularButtonClasses.js.map +1 -0
  61. package/dist/ui-kit/CurrencyInput/CurrencyInput.d.ts +19 -0
  62. package/dist/ui-kit/CurrencyInput/CurrencyInput.js +21 -0
  63. package/dist/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -0
  64. package/dist/ui-kit/Img/ImgAsPicture.js +6 -2
  65. package/dist/ui-kit/Img/ImgAsPicture.js.map +1 -1
  66. package/dist/ui-kit/InnerTable/InnerTable.js +1 -1
  67. package/dist/ui-kit/InnerTable/InnerTable.js.map +1 -1
  68. package/dist/ui-kit/InnerTable/InnerTableButton.js +2 -2
  69. package/dist/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  70. package/dist/ui-kit/InnerTable/InnerTableHeader.js +1 -1
  71. package/dist/ui-kit/InnerTable/InnerTableHeader.js.map +1 -1
  72. package/dist/ui-kit/Logo/Logo.js +1 -1
  73. package/dist/ui-kit/Logo/Logo.js.map +1 -1
  74. package/dist/ui-kit/Logo/Logo.mobile.js +1 -1
  75. package/dist/ui-kit/Logo/Logo.mobile.js.map +1 -1
  76. package/dist/utils/isPictureSizeEmpty.d.ts +2 -0
  77. package/dist/utils/isPictureSizeEmpty.js +7 -0
  78. package/dist/utils/isPictureSizeEmpty.js.map +1 -0
  79. package/lib/common.css +1 -1
  80. package/lib/components/BenefitsBlock/BenefitsBlock.fixture.d.ts +2 -0
  81. package/lib/components/BenefitsBlock/BenefitsBlock.js +32 -9
  82. package/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  83. package/lib/components/BenefitsBlock/BenefitsBlockContent.d.ts +9 -2
  84. package/lib/components/BlockContent.d.ts +3 -2
  85. package/lib/components/Blocks.d.ts +1 -0
  86. package/lib/components/Blocks.js +2 -0
  87. package/lib/components/Blocks.js.map +1 -1
  88. package/lib/components/CardTransfer/CardTransfer.d.ts +5 -0
  89. package/lib/components/CardTransfer/CardTransfer.fixture.d.ts +5 -0
  90. package/lib/components/CardTransfer/CardTransfer.js +26 -0
  91. package/lib/components/CardTransfer/CardTransfer.js.map +1 -0
  92. package/lib/components/CardTransfer/CardTransferContent.d.ts +10 -0
  93. package/lib/components/CardTransfer/CardTransferContent.js +2 -0
  94. package/lib/components/CardTransfer/CardTransferContent.js.map +1 -0
  95. package/lib/components/SafeDepositRental/SafeDepositRentalTotal.js +1 -1
  96. package/lib/components/SafeDepositRental/SafeDepositRentalTotal.js.map +1 -1
  97. package/lib/components/TariffsTable/EmbeddableCellData.js +1 -0
  98. package/lib/components/TariffsTable/EmbeddableCellData.js.map +1 -1
  99. package/lib/components/TariffsTable/TariffsTableRowContainer.js +3 -3
  100. package/lib/components/TariffsTable/TariffsTableRowContainer.js.map +1 -1
  101. package/lib/components/TariffsTable/dataFixture.js +1 -0
  102. package/lib/components/TariffsTable/dataFixture.js.map +1 -1
  103. package/lib/content-page-repository/transformContentPage.js +9 -3
  104. package/lib/content-page-repository/transformContentPage.js.map +1 -1
  105. package/lib/content-page-repository/transformImg.d.ts +11 -0
  106. package/lib/content-page-repository/transformImg.js +94 -0
  107. package/lib/content-page-repository/transformImg.js.map +1 -0
  108. package/lib/content-page-repository/transformPicture.js +15 -40
  109. package/lib/content-page-repository/transformPicture.js.map +1 -1
  110. package/lib/content-page-repository/transformSrc.d.ts +3 -0
  111. package/lib/content-page-repository/transformSrc.js +14 -0
  112. package/lib/content-page-repository/transformSrc.js.map +1 -0
  113. package/lib/icons/IconName.d.ts +12 -12
  114. package/lib/icons/IconName.js +10 -10
  115. package/lib/icons/IconName.js.map +1 -1
  116. package/lib/model/ImageSize.d.ts +6 -0
  117. package/lib/model/ImageSize.js +2 -0
  118. package/lib/model/ImageSize.js.map +1 -0
  119. package/lib/model/Picture.d.ts +19 -6
  120. package/lib/ui-kit/Button/Button.js +6 -15
  121. package/lib/ui-kit/Button/Button.js.map +1 -1
  122. package/lib/ui-kit/Button/GetButtonClassParams.d.ts +6 -0
  123. package/lib/ui-kit/Button/GetButtonClassParams.js +2 -0
  124. package/lib/ui-kit/Button/GetButtonClassParams.js.map +1 -0
  125. package/lib/ui-kit/Button/buttonClassNameConstants.d.ts +4 -0
  126. package/lib/ui-kit/Button/buttonClassNameConstants.js +12 -0
  127. package/lib/ui-kit/Button/buttonClassNameConstants.js.map +1 -0
  128. package/lib/ui-kit/Button/getDisabledButtonClasses.d.ts +2 -0
  129. package/lib/ui-kit/Button/getDisabledButtonClasses.js +9 -0
  130. package/lib/ui-kit/Button/getDisabledButtonClasses.js.map +1 -0
  131. package/lib/ui-kit/Button/getRegularButtonClasses.d.ts +2 -0
  132. package/lib/ui-kit/Button/getRegularButtonClasses.js +9 -0
  133. package/lib/ui-kit/Button/getRegularButtonClasses.js.map +1 -0
  134. package/lib/ui-kit/CurrencyInput/CurrencyInput.d.ts +19 -0
  135. package/lib/ui-kit/CurrencyInput/CurrencyInput.js +19 -0
  136. package/lib/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -0
  137. package/lib/ui-kit/Img/ImgAsPicture.js +6 -2
  138. package/lib/ui-kit/Img/ImgAsPicture.js.map +1 -1
  139. package/lib/ui-kit/InnerTable/InnerTable.js +1 -1
  140. package/lib/ui-kit/InnerTable/InnerTable.js.map +1 -1
  141. package/lib/ui-kit/InnerTable/InnerTableButton.js +2 -2
  142. package/lib/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  143. package/lib/ui-kit/InnerTable/InnerTableHeader.js +1 -1
  144. package/lib/ui-kit/InnerTable/InnerTableHeader.js.map +1 -1
  145. package/lib/ui-kit/Logo/Logo.js +1 -1
  146. package/lib/ui-kit/Logo/Logo.js.map +1 -1
  147. package/lib/ui-kit/Logo/Logo.mobile.js +1 -1
  148. package/lib/ui-kit/Logo/Logo.mobile.js.map +1 -1
  149. package/lib/utils/isPictureSizeEmpty.d.ts +2 -0
  150. package/lib/utils/isPictureSizeEmpty.js +4 -0
  151. package/lib/utils/isPictureSizeEmpty.js.map +1 -0
  152. package/mobile/bundle/bundle.umd.js +17 -13
  153. package/mobile/bundle/bundle.umd.min.js +1 -1
  154. package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js +32 -9
  155. package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  156. package/mobile/dist/components/BenefitsBlock/BenefitsBlockContent.d.ts +9 -2
  157. package/mobile/dist/components/BlockContent.d.ts +3 -2
  158. package/mobile/dist/components/CardTransfer/CardTransfer.d.ts +5 -0
  159. package/mobile/dist/components/CardTransfer/CardTransfer.js +28 -0
  160. package/mobile/dist/components/CardTransfer/CardTransfer.js.map +1 -0
  161. package/mobile/dist/components/CardTransfer/CardTransferContent.d.ts +10 -0
  162. package/mobile/dist/components/CardTransfer/CardTransferContent.js +2 -0
  163. package/mobile/dist/components/CardTransfer/CardTransferContent.js.map +1 -0
  164. package/mobile/dist/components/SafeDepositRental/SafeDepositRentalTotal.js +1 -1
  165. package/mobile/dist/components/SafeDepositRental/SafeDepositRentalTotal.js.map +1 -1
  166. package/mobile/dist/components/TariffsTable/TariffsTableRowContainer.js +3 -3
  167. package/mobile/dist/components/TariffsTable/TariffsTableRowContainer.js.map +1 -1
  168. package/mobile/dist/components/TariffsTable/dataFixture.js +1 -0
  169. package/mobile/dist/components/TariffsTable/dataFixture.js.map +1 -1
  170. package/mobile/dist/content-page-repository/transformContentPage.js +9 -3
  171. package/mobile/dist/content-page-repository/transformContentPage.js.map +1 -1
  172. package/mobile/dist/content-page-repository/transformImg.d.ts +11 -0
  173. package/mobile/dist/content-page-repository/transformImg.js +100 -0
  174. package/mobile/dist/content-page-repository/transformImg.js.map +1 -0
  175. package/mobile/dist/content-page-repository/transformPicture.js +15 -40
  176. package/mobile/dist/content-page-repository/transformPicture.js.map +1 -1
  177. package/mobile/dist/content-page-repository/transformSrc.d.ts +3 -0
  178. package/mobile/dist/content-page-repository/transformSrc.js +20 -0
  179. package/mobile/dist/content-page-repository/transformSrc.js.map +1 -0
  180. package/mobile/dist/icons/IconName.d.ts +12 -12
  181. package/mobile/dist/icons/IconName.js +10 -10
  182. package/mobile/dist/icons/IconName.js.map +1 -1
  183. package/mobile/dist/model/ImageSize.d.ts +6 -0
  184. package/mobile/dist/model/ImageSize.js +2 -0
  185. package/mobile/dist/model/ImageSize.js.map +1 -0
  186. package/mobile/dist/model/Picture.d.ts +19 -6
  187. package/mobile/dist/ui-kit/Button/GetButtonClassParams.d.ts +6 -0
  188. package/mobile/dist/ui-kit/Button/GetButtonClassParams.js +2 -0
  189. package/mobile/dist/ui-kit/Button/GetButtonClassParams.js.map +1 -0
  190. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.d.ts +4 -0
  191. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.js +14 -0
  192. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.js.map +1 -0
  193. package/mobile/dist/ui-kit/Button/getDisabledButtonClasses.d.ts +2 -0
  194. package/mobile/dist/ui-kit/Button/getDisabledButtonClasses.js +12 -0
  195. package/mobile/dist/ui-kit/Button/getDisabledButtonClasses.js.map +1 -0
  196. package/mobile/dist/ui-kit/Button/getRegularButtonClasses.d.ts +2 -0
  197. package/mobile/dist/ui-kit/Button/getRegularButtonClasses.js +12 -0
  198. package/mobile/dist/ui-kit/Button/getRegularButtonClasses.js.map +1 -0
  199. package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.d.ts +19 -0
  200. package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.js +21 -0
  201. package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -0
  202. package/mobile/dist/ui-kit/Img/ImgAsPicture.js +6 -2
  203. package/mobile/dist/ui-kit/Img/ImgAsPicture.js.map +1 -1
  204. package/mobile/dist/ui-kit/InnerTable/InnerTable.js +1 -1
  205. package/mobile/dist/ui-kit/InnerTable/InnerTable.js.map +1 -1
  206. package/mobile/dist/ui-kit/InnerTable/InnerTableButton.js +2 -2
  207. package/mobile/dist/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  208. package/mobile/dist/ui-kit/InnerTable/InnerTableHeader.js +1 -1
  209. package/mobile/dist/ui-kit/InnerTable/InnerTableHeader.js.map +1 -1
  210. package/mobile/dist/ui-kit/Logo/Logo.js +1 -1
  211. package/mobile/dist/ui-kit/Logo/Logo.js.map +1 -1
  212. package/mobile/dist/utils/isPictureSizeEmpty.d.ts +2 -0
  213. package/mobile/dist/utils/isPictureSizeEmpty.js +7 -0
  214. package/mobile/dist/utils/isPictureSizeEmpty.js.map +1 -0
  215. package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js +32 -9
  216. package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  217. package/mobile/lib/components/BenefitsBlock/BenefitsBlockContent.d.ts +9 -2
  218. package/mobile/lib/components/BlockContent.d.ts +3 -2
  219. package/mobile/lib/components/CardTransfer/CardTransfer.d.ts +5 -0
  220. package/mobile/lib/components/CardTransfer/CardTransfer.js +26 -0
  221. package/mobile/lib/components/CardTransfer/CardTransfer.js.map +1 -0
  222. package/mobile/lib/components/CardTransfer/CardTransferContent.d.ts +10 -0
  223. package/mobile/lib/components/CardTransfer/CardTransferContent.js +2 -0
  224. package/mobile/lib/components/CardTransfer/CardTransferContent.js.map +1 -0
  225. package/mobile/lib/components/SafeDepositRental/SafeDepositRentalTotal.js +1 -1
  226. package/mobile/lib/components/SafeDepositRental/SafeDepositRentalTotal.js.map +1 -1
  227. package/mobile/lib/components/TariffsTable/TariffsTableRowContainer.js +3 -3
  228. package/mobile/lib/components/TariffsTable/TariffsTableRowContainer.js.map +1 -1
  229. package/mobile/lib/components/TariffsTable/dataFixture.js +1 -0
  230. package/mobile/lib/components/TariffsTable/dataFixture.js.map +1 -1
  231. package/mobile/lib/content-page-repository/transformContentPage.js +9 -3
  232. package/mobile/lib/content-page-repository/transformContentPage.js.map +1 -1
  233. package/mobile/lib/content-page-repository/transformImg.d.ts +11 -0
  234. package/mobile/lib/content-page-repository/transformImg.js +94 -0
  235. package/mobile/lib/content-page-repository/transformImg.js.map +1 -0
  236. package/mobile/lib/content-page-repository/transformPicture.js +15 -40
  237. package/mobile/lib/content-page-repository/transformPicture.js.map +1 -1
  238. package/mobile/lib/content-page-repository/transformSrc.d.ts +3 -0
  239. package/mobile/lib/content-page-repository/transformSrc.js +14 -0
  240. package/mobile/lib/content-page-repository/transformSrc.js.map +1 -0
  241. package/mobile/lib/icons/IconName.d.ts +12 -12
  242. package/mobile/lib/icons/IconName.js +10 -10
  243. package/mobile/lib/icons/IconName.js.map +1 -1
  244. package/mobile/lib/model/ImageSize.d.ts +6 -0
  245. package/mobile/lib/model/ImageSize.js +2 -0
  246. package/mobile/lib/model/ImageSize.js.map +1 -0
  247. package/mobile/lib/model/Picture.d.ts +19 -6
  248. package/mobile/lib/ui-kit/Button/GetButtonClassParams.d.ts +6 -0
  249. package/mobile/lib/ui-kit/Button/GetButtonClassParams.js +2 -0
  250. package/mobile/lib/ui-kit/Button/GetButtonClassParams.js.map +1 -0
  251. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.d.ts +4 -0
  252. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.js +12 -0
  253. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.js.map +1 -0
  254. package/mobile/lib/ui-kit/Button/getDisabledButtonClasses.d.ts +2 -0
  255. package/mobile/lib/ui-kit/Button/getDisabledButtonClasses.js +9 -0
  256. package/mobile/lib/ui-kit/Button/getDisabledButtonClasses.js.map +1 -0
  257. package/mobile/lib/ui-kit/Button/getRegularButtonClasses.d.ts +2 -0
  258. package/mobile/lib/ui-kit/Button/getRegularButtonClasses.js +9 -0
  259. package/mobile/lib/ui-kit/Button/getRegularButtonClasses.js.map +1 -0
  260. package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.d.ts +19 -0
  261. package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.js +19 -0
  262. package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -0
  263. package/mobile/lib/ui-kit/Img/ImgAsPicture.js +6 -2
  264. package/mobile/lib/ui-kit/Img/ImgAsPicture.js.map +1 -1
  265. package/mobile/lib/ui-kit/InnerTable/InnerTable.js +1 -1
  266. package/mobile/lib/ui-kit/InnerTable/InnerTable.js.map +1 -1
  267. package/mobile/lib/ui-kit/InnerTable/InnerTableButton.js +2 -2
  268. package/mobile/lib/ui-kit/InnerTable/InnerTableButton.js.map +1 -1
  269. package/mobile/lib/ui-kit/InnerTable/InnerTableHeader.js +1 -1
  270. package/mobile/lib/ui-kit/InnerTable/InnerTableHeader.js.map +1 -1
  271. package/mobile/lib/ui-kit/Logo/Logo.js +1 -1
  272. package/mobile/lib/ui-kit/Logo/Logo.js.map +1 -1
  273. package/mobile/lib/utils/isPictureSizeEmpty.d.ts +2 -0
  274. package/mobile/lib/utils/isPictureSizeEmpty.js +4 -0
  275. package/mobile/lib/utils/isPictureSizeEmpty.js.map +1 -0
  276. package/mobile/src/components/BenefitsBlock/BenefitsBlock.example.json +1 -0
  277. package/mobile/src/components/BenefitsBlock/BenefitsBlock.tsx +78 -28
  278. package/mobile/src/components/BenefitsBlock/BenefitsBlockContent.ts +10 -2
  279. package/mobile/src/components/BlockContent.ts +3 -1
  280. package/mobile/src/components/CardTransfer/CardTransfer.tsx +59 -0
  281. package/mobile/src/components/CardTransfer/CardTransferContent.ts +10 -0
  282. package/mobile/src/components/ContentPage/ContentPage.page.json +5 -2
  283. package/mobile/src/components/SafeDepositRental/SafeDepositRentalTotal.tsx +1 -1
  284. package/mobile/src/components/TariffsTable/TariffsTableRowContainer.tsx +9 -4
  285. package/mobile/src/components/TariffsTable/dataFixture.ts +5 -4
  286. package/mobile/src/components/__snapshots__/Blocks.spec.tsx.snap +61 -9
  287. package/mobile/src/content-page-repository/transformContentPage.ts +10 -3
  288. package/mobile/src/content-page-repository/transformImg.ts +157 -0
  289. package/mobile/src/content-page-repository/transformPicture.ts +24 -58
  290. package/mobile/src/content-page-repository/transformSrc.ts +21 -0
  291. package/mobile/src/icons/{AirPlane.svg → AirPlaneIcon.svg} +0 -0
  292. package/mobile/src/icons/{DocDownload.svg → DocDownloadIcon.svg} +0 -0
  293. package/mobile/src/icons/IconName.ts +4 -4
  294. package/mobile/src/icons/{Logo.svg → LogoIcon.svg} +0 -0
  295. package/mobile/src/icons/{PackA4.svg → PackA4Icon.svg} +0 -0
  296. package/mobile/src/icons/{WateringCan.svg → WateringCanIcon.svg} +0 -0
  297. package/mobile/src/model/ImageSize.ts +6 -0
  298. package/mobile/src/model/Picture.ts +29 -6
  299. package/mobile/src/ui-kit/Button/GetButtonClassParams.ts +7 -0
  300. package/mobile/src/ui-kit/Button/buttonClassNameConstants.ts +16 -0
  301. package/mobile/src/ui-kit/Button/getDisabledButtonClasses.ts +15 -0
  302. package/mobile/src/ui-kit/Button/getRegularButtonClasses.ts +15 -0
  303. package/mobile/src/ui-kit/CurrencyInput/CurrencyInput.tsx +70 -0
  304. package/mobile/src/ui-kit/Img/ImgAsPicture.tsx +8 -2
  305. package/mobile/src/ui-kit/InnerTable/InnerTable.tsx +1 -1
  306. package/mobile/src/ui-kit/InnerTable/InnerTableButton.tsx +2 -2
  307. package/mobile/src/ui-kit/InnerTable/InnerTableHeader.tsx +1 -1
  308. package/mobile/src/ui-kit/Logo/Logo.tsx +1 -1
  309. package/mobile/src/utils/isPictureSizeEmpty.ts +5 -0
  310. package/package.json +2 -1
  311. package/src/components/BenefitsBlock/BenefitsBlock.example.json +1 -0
  312. package/src/components/BenefitsBlock/BenefitsBlock.fixture.tsx +94 -1
  313. package/src/components/BenefitsBlock/BenefitsBlock.tsx +78 -28
  314. package/src/components/BenefitsBlock/BenefitsBlockContent.ts +10 -2
  315. package/src/components/BlockContent.ts +3 -1
  316. package/src/components/Blocks.ts +2 -0
  317. package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.fixture.tsx +2 -2
  318. package/src/components/CardTransfer/CardTransfer.fixture.tsx +6 -0
  319. package/src/components/CardTransfer/CardTransfer.tsx +59 -0
  320. package/src/components/CardTransfer/CardTransferContent.ts +10 -0
  321. package/src/components/ContentPage/ContentPage.page.json +5 -2
  322. package/src/components/SafeDepositRental/SafeDepositRentalTotal.tsx +1 -1
  323. package/src/components/TariffsTable/EmbeddableCellData.tsx +3 -2
  324. package/src/components/TariffsTable/TariffsTableRowContainer.tsx +9 -4
  325. package/src/components/TariffsTable/dataFixture.ts +5 -4
  326. package/src/components/__snapshots__/Blocks.spec.tsx.snap +61 -9
  327. package/src/content-page-repository/transformContentPage.ts +10 -3
  328. package/src/content-page-repository/transformImg.ts +157 -0
  329. package/src/content-page-repository/transformPicture.ts +24 -58
  330. package/src/content-page-repository/transformSrc.ts +21 -0
  331. package/src/icons/{AirPlane.svg → AirPlaneIcon.svg} +0 -0
  332. package/src/icons/{DocDownload.svg → DocDownloadIcon.svg} +0 -0
  333. package/src/icons/IconName.ts +16 -16
  334. package/src/icons/{Logo.svg → LogoIcon.svg} +0 -0
  335. package/src/icons/{PackA4.svg → PackA4Icon.svg} +0 -0
  336. package/src/icons/{WateringCan.svg → WateringCanIcon.svg} +0 -0
  337. package/src/model/ImageSize.ts +6 -0
  338. package/src/model/Picture.ts +29 -6
  339. package/src/ui-kit/Button/Button.tsx +6 -34
  340. package/src/ui-kit/Button/GetButtonClassParams.ts +7 -0
  341. package/src/ui-kit/Button/buttonClassNameConstants.ts +16 -0
  342. package/src/ui-kit/Button/getDisabledButtonClasses.ts +15 -0
  343. package/src/ui-kit/Button/getRegularButtonClasses.ts +15 -0
  344. package/src/ui-kit/CurrencyInput/CurrencyInput.tsx +70 -0
  345. package/src/ui-kit/Img/ImgAsPicture.tsx +8 -2
  346. package/src/ui-kit/InnerTable/InnerTable.tsx +1 -1
  347. package/src/ui-kit/InnerTable/InnerTableButton.tsx +2 -2
  348. package/src/ui-kit/InnerTable/InnerTableHeader.tsx +1 -1
  349. package/src/ui-kit/Logo/Logo.mobile.tsx +1 -1
  350. package/src/ui-kit/Logo/Logo.tsx +1 -1
  351. package/src/utils/isPictureSizeEmpty.ts +5 -0
@@ -18,11 +18,16 @@ export async function transformContentPage(
18
18
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
19
19
  return mapJSON<ContentPageDef>(JSON.parse(content), async (value: any, [key]) => {
20
20
  const isMarkdown = typeof value === 'string' && key?.endsWith('__md');
21
- const isPicture = value && isLocalPath(value?.src);
21
+
22
22
  if (isMarkdown) {
23
23
  return await transformMarkdown(value);
24
- } else if (isPicture) {
25
- return await transformPicture(pagePath, value as Picture, options);
24
+ } else if (isPicture(value)) {
25
+ try {
26
+ return await transformPicture(pagePath, value, options);
27
+ } catch (ex) {
28
+ console.warn('Error while transforming picture on page: %s', pagePath);
29
+ console.error(ex);
30
+ }
26
31
  }
27
32
 
28
33
  return value;
@@ -34,3 +39,5 @@ const isLocalPath = (_: any): boolean => isString(_) && _.length < 512 && !isURL
34
39
  const isString = (_: any): _ is string => Boolean(_ && typeof _ === 'string');
35
40
 
36
41
  const isURL = (src: string) => ['data:', 'https:', 'http:'].some((proto) => src.startsWith(proto));
42
+
43
+ const isPicture = (_: any): _ is Picture => Boolean(_ && isLocalPath(_?.src));
@@ -0,0 +1,157 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import util from 'util';
4
+ import sharp from 'sharp';
5
+ import type { ResizeOptions, Sharp } from 'sharp';
6
+ import type { ImageSize } from '../model/ImageSize';
7
+ import type { TransformationOptions } from './TransformationOptions';
8
+ import type { ImgAlignment, ImgSource, Picture } from '../model/Picture';
9
+ import { transformSrc } from './transformSrc';
10
+ import { isPictureSizeEmpty } from '../utils/isPictureSizeEmpty';
11
+
12
+ const mkdir = util.promisify(fs.mkdir);
13
+
14
+ type TransformImgParams = {
15
+ pagePath: string;
16
+ src: string;
17
+ containerSize?: ImageSize;
18
+ transformationOptions: TransformationOptions & ImgSource;
19
+ };
20
+
21
+ export async function transformImg({
22
+ pagePath,
23
+ src,
24
+ containerSize,
25
+ transformationOptions,
26
+ }: TransformImgParams): Promise<string> {
27
+ if (!src) {
28
+ return '';
29
+ }
30
+
31
+ const { contentDir, publicDir, format, options, size, alignment } = transformationOptions;
32
+
33
+ const pageDir = path.dirname(pagePath);
34
+ const imgPath = `${pageDir}/${src}`;
35
+ let chain = sharp(imgPath);
36
+
37
+ const targetSize = getPictureSize(size, containerSize);
38
+
39
+ if (targetSize) {
40
+ chain = resizeImg(chain, targetSize, getResizeFit(targetSize));
41
+ }
42
+
43
+ if (containerSize) {
44
+ chain = resizeImg(chain, containerSize);
45
+
46
+ // Save intermediate transform result to modify further
47
+ const { data } = await chain.toBuffer({ resolveWithObject: true });
48
+
49
+ chain = resizeImg(
50
+ sharp(data),
51
+ getCompositionResizeSize(containerSize, targetSize),
52
+ getResizeFit(targetSize),
53
+ );
54
+
55
+ chain = await compositeImg({ chain, containerSize, alignment });
56
+ }
57
+
58
+ if (format) {
59
+ chain = chain.toFormat(format, options);
60
+ }
61
+
62
+ const transformedSrc = transformSrc(src, transformationOptions);
63
+ const transformedImgPath = `${publicDir}/${path.relative(
64
+ contentDir,
65
+ `${path.dirname(pagePath)}/${transformedSrc}`,
66
+ )}`;
67
+
68
+ await mkdir(path.dirname(transformedImgPath), { recursive: true });
69
+
70
+ try {
71
+ await chain.toFile(transformedImgPath);
72
+ } catch (e) {
73
+ console.error(e);
74
+ }
75
+
76
+ return transformedSrc;
77
+ }
78
+
79
+ function createBackgroundImageChain({ width, height }: ImageSize) {
80
+ const channels = 4;
81
+ const rgbaColor = 0x00000000;
82
+
83
+ const canvas = Buffer.alloc(width * height * channels, rgbaColor);
84
+
85
+ return sharp(canvas, { raw: { width, height, channels } });
86
+ }
87
+
88
+ function resizeImg(chain: Sharp, size: Picture['size'], options?: ResizeOptions) {
89
+ return chain.resize(size?.width, size?.height, {
90
+ fit: sharp.fit.fill,
91
+ background: { r: 0, g: 0, b: 0, alpha: 0 },
92
+ ...options,
93
+ });
94
+ }
95
+
96
+ type CompositeImgParams = {
97
+ chain: Sharp;
98
+ containerSize: ImageSize;
99
+ alignment?: ImgAlignment;
100
+ };
101
+
102
+ async function compositeImg({
103
+ chain,
104
+ containerSize,
105
+ alignment,
106
+ }: CompositeImgParams): Promise<Sharp> {
107
+ const { data } = await chain.toBuffer({ resolveWithObject: true });
108
+
109
+ return createBackgroundImageChain(containerSize).composite([
110
+ {
111
+ input: data,
112
+ gravity: alignment,
113
+ },
114
+ ]);
115
+ }
116
+
117
+ function getPictureSize(size: Picture['size'], containerSize?: ImageSize) {
118
+ // If containerSize is undefined intrinsic dimensions of image will be used then.
119
+ return isPictureSizeEmpty(size) ? containerSize : size;
120
+ }
121
+
122
+ function getCompositionResizeSize(
123
+ containerSize: ImageSize,
124
+ size: Picture['size'] = {},
125
+ ): Picture['size'] {
126
+ const { width, height } = size;
127
+ const { width: containerWidth, height: containerHeight } = containerSize;
128
+
129
+ let widthRatio = 0;
130
+ let heightRatio = 0;
131
+
132
+ if (!(width || height)) {
133
+ return undefined;
134
+ }
135
+
136
+ if (width) {
137
+ widthRatio = containerWidth / width;
138
+ }
139
+
140
+ if (height) {
141
+ heightRatio = containerHeight / height;
142
+ }
143
+
144
+ return widthRatio > heightRatio
145
+ ? { width: Math.min(Number(width), containerWidth) }
146
+ : { height: Math.min(Number(height), containerHeight) };
147
+ }
148
+
149
+ function getResizeFit(size: Picture['size']): ResizeOptions {
150
+ /*
151
+ Editor behaviour with one dimension present: resize by given dimension maintaining aspect ratio. (fit: contain)
152
+ With two dimensions present: resize trying to fill given dimensions (fit: fill)
153
+ */
154
+ return {
155
+ fit: size?.width && size?.height ? sharp.fit.fill : sharp.fit.contain,
156
+ };
157
+ }
@@ -1,11 +1,8 @@
1
- import fs from 'fs';
2
1
  import path from 'path';
3
2
  import sharp from 'sharp';
4
- import util from 'util';
5
- import type { ImgSource, Picture } from '../model/Picture';
3
+ import type { Picture } from '../model/Picture';
6
4
  import type { TransformationOptions } from './TransformationOptions';
7
-
8
- const mkdir = util.promisify(fs.mkdir);
5
+ import { transformImg } from './transformImg';
9
6
 
10
7
  export async function transformPicture(
11
8
  pagePath: string,
@@ -14,8 +11,27 @@ export async function transformPicture(
14
11
  ): Promise<Picture> {
15
12
  const sources = picture.sources || [];
16
13
  const src = picture?.src || '';
17
- const [transformedPicture, ...transformedSources] = await Promise.all(
18
- [picture].concat(sources).map((_) => transformImg(pagePath, src, { ...options, ..._ })),
14
+
15
+ const transformedPicture = await transformImg({
16
+ pagePath,
17
+ src,
18
+ transformationOptions: { ...options, ...picture },
19
+ });
20
+
21
+ const { width, height } = await sharp(
22
+ path.resolve(options.publicDir, transformedPicture),
23
+ ).metadata();
24
+ const containerSize = width && height ? { width, height } : undefined;
25
+
26
+ const transformedSources = await Promise.all(
27
+ sources.map((_) =>
28
+ transformImg({
29
+ pagePath,
30
+ src,
31
+ containerSize,
32
+ transformationOptions: { ...options, ..._ },
33
+ }),
34
+ ),
19
35
  );
20
36
 
21
37
  return {
@@ -24,57 +40,7 @@ export async function transformPicture(
24
40
  sources: transformedSources.map((_, i) => ({
25
41
  ...sources[i],
26
42
  src: _,
43
+ size: { width, height },
27
44
  })),
28
45
  };
29
46
  }
30
-
31
- async function transformImg(
32
- pagePath: string,
33
- src: string,
34
- transformationOptions: TransformationOptions & ImgSource,
35
- ): Promise<string> {
36
- const { contentDir, publicDir, format, options, size } = transformationOptions;
37
-
38
- const pageDir = path.dirname(pagePath);
39
- const imgPath = `${pageDir}/${src}`;
40
- let chain = sharp(imgPath);
41
- if (size) {
42
- chain = chain.resize(size?.width, size?.height, {
43
- fit: sharp.fit.contain,
44
- background: [0, 0, 0, 0],
45
- });
46
- }
47
- if (format) {
48
- chain = chain.toFormat(format, options);
49
- }
50
-
51
- const transformedSrc = transformSrc(src, transformationOptions);
52
- const transformedImgPath = `${publicDir}/${path.relative(
53
- contentDir,
54
- `${path.dirname(pagePath)}/${transformedSrc}`,
55
- )}`;
56
-
57
- await mkdir(path.dirname(transformedImgPath), { recursive: true });
58
-
59
- try {
60
- await chain.toFile(transformedImgPath);
61
- } catch (e) {
62
- console.error(e);
63
- }
64
-
65
- return transformedSrc;
66
- }
67
-
68
- function transformSrc(src: string, { format, size }: TransformationOptions & ImgSource): string {
69
- const noTransform = !format && !size;
70
- if (noTransform) {
71
- return src;
72
- }
73
-
74
- const fileName = path.basename(src, path.extname(src));
75
- const fileSizes = [size?.width, size?.height].filter(Boolean);
76
- const suffix = fileSizes.length ? `-${fileSizes.join('-')}` : '';
77
- const ext = String(format) || path.extname(src);
78
-
79
- return `${fileName}${suffix}.${ext}`;
80
- }
@@ -0,0 +1,21 @@
1
+ import path from 'path';
2
+ import type { ImgSource } from '../model/Picture';
3
+ import type { TransformationOptions } from './TransformationOptions';
4
+ import { isPictureSizeEmpty } from '../utils/isPictureSizeEmpty';
5
+
6
+ export function transformSrc(
7
+ src: string,
8
+ { format, size }: TransformationOptions & ImgSource,
9
+ ): string {
10
+ const noTransform = isPictureSizeEmpty(size) && !format;
11
+ if (noTransform) {
12
+ return src;
13
+ }
14
+
15
+ const fileName = path.basename(src, path.extname(src));
16
+ const fileSizes = [size?.width, size?.height].filter(Boolean);
17
+ const suffix = fileSizes.length ? `-${fileSizes.join('-')}` : '';
18
+ const ext = format ? String(format) : 'webp';
19
+
20
+ return `${fileName}${suffix}.${ext}`;
21
+ }
File without changes
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable max-len, max-lines */
3
3
  export enum IconMap {
4
4
  ActualBalanceIcon = 'ActualBalanceIcon',
5
- AirPlane = 'AirPlane',
5
+ AirPlaneIcon = 'AirPlaneIcon',
6
6
  AppleIcon = 'AppleIcon',
7
7
  ArrowDownIcon = 'ArrowDownIcon',
8
8
  ArrowLeftIcon = 'ArrowLeftIcon',
@@ -26,7 +26,7 @@ export enum IconMap {
26
26
  ComfortableCompIcon = 'ComfortableCompIcon',
27
27
  CreditCardsIcon = 'CreditCardsIcon',
28
28
  DiscountShapeIcon = 'DiscountShapeIcon',
29
- DocDownload = 'DocDownload',
29
+ DocDownloadIcon = 'DocDownloadIcon',
30
30
  DocIcon = 'DocIcon',
31
31
  DocIconMonoColor = 'DocIconMonoColor',
32
32
  DocsIcon = 'DocsIcon',
@@ -45,7 +45,7 @@ export enum IconMap {
45
45
  InterestGrowthIcon = 'InterestGrowthIcon',
46
46
  InterestIcon = 'InterestIcon',
47
47
  JCBIcon = 'JCBIcon',
48
- Logo = 'Logo',
48
+ LogoIcon = 'LogoIcon',
49
49
  LoupeIcon = 'LoupeIcon',
50
50
  MasterCardIcon = 'MasterCardIcon',
51
51
  MinusIcon = 'MinusIcon',
@@ -56,7 +56,7 @@ export enum IconMap {
56
56
  NewDocIcon = 'NewDocIcon',
57
57
  OfficeIcon = 'OfficeIcon',
58
58
  OkIcon = 'OkIcon',
59
- PackA4 = 'PackA4',
59
+ PackA4Icon = 'PackA4Icon',
60
60
  PassSendIcon = 'PassSendIcon',
61
61
  PercentageRoundIcon = 'PercentageRoundIcon',
62
62
  PercentageSquareIcon = 'PercentageSquareIcon',
@@ -83,12 +83,12 @@ export enum IconMap {
83
83
  WalletAddIcon = 'WalletAddIcon',
84
84
  WalletIcon = 'WalletIcon',
85
85
  WalletWithMoneyIcon = 'WalletWithMoneyIcon',
86
- WateringCan = 'WateringCan',
86
+ WateringCanIcon = 'WateringCanIcon',
87
87
  }
88
88
 
89
89
  export enum IconTitleMap {
90
90
  ActualBalanceIcon = 'Деньги',
91
- AirPlane = 'Самолет',
91
+ AirPlaneIcon = 'Самолет',
92
92
  AppleIcon = 'Лого «Apple»',
93
93
  ArrowDownIcon = "Стрелка 'Вниз'",
94
94
  ArrowLeftIcon = 'Стрелка',
@@ -112,7 +112,7 @@ export enum IconTitleMap {
112
112
  ComfortableCompIcon = 'Кресло',
113
113
  CreditCardsIcon = 'Кредитные карты',
114
114
  DiscountShapeIcon = 'Скидка',
115
- DocDownload = 'Скачать документ',
115
+ DocDownloadIcon = 'Скачать документ',
116
116
  DocIcon = 'Документ',
117
117
  DocIconMonoColor = 'Документ (одноцветный)',
118
118
  DocsIcon = 'Документы',
@@ -131,7 +131,7 @@ export enum IconTitleMap {
131
131
  InterestGrowthIcon = 'Диаграмма роста',
132
132
  InterestIcon = 'Скидка',
133
133
  JCBIcon = 'JCB',
134
- Logo = 'Logo',
134
+ LogoIcon = 'Logo',
135
135
  LoupeIcon = 'Лупа',
136
136
  MasterCardIcon = 'MasterCard',
137
137
  MinusIcon = 'Минус',
@@ -142,7 +142,7 @@ export enum IconTitleMap {
142
142
  NewDocIcon = 'Новый документ',
143
143
  OfficeIcon = 'Офис',
144
144
  OkIcon = 'Лого «Одноклассники»',
145
- PackA4 = 'PackA4',
145
+ PackA4Icon = 'PackA4Icon',
146
146
  PassSendIcon = 'Бизнес',
147
147
  PercentageRoundIcon = 'Проценты (круг.)',
148
148
  PercentageSquareIcon = 'Проценты',
@@ -169,7 +169,7 @@ export enum IconTitleMap {
169
169
  WalletAddIcon = 'Кошелёк с плюсом',
170
170
  WalletIcon = 'Кошелёк',
171
171
  WalletWithMoneyIcon = 'Кошелёк с деньгами',
172
- WateringCan = 'Добавить продукт',
172
+ WateringCanIcon = 'Добавить продукт',
173
173
  }
174
174
 
175
175
  /**
@@ -177,13 +177,13 @@ export enum IconTitleMap {
177
177
  * @title Иконка
178
178
  * @enumNames [
179
179
  * "",
180
- * 'Деньги', 'Самолет', 'Лого «Apple»', 'Стрелка \'Вниз\'', 'Стрелка', 'Стрелка вверх', 'Банкомат', 'Банк', 'Бургер', 'Календарь 2', 'Скруглённый календарь', 'Календарь', 'Календарь с галочкой', 'Кред. карта', 'Кред. карта под наклоном', 'Кред. карта с галочкой', 'Карта с драгоценностями', 'Машина', 'Деньги внутри кошелька', 'Кино', 'Часы', 'Крестик', 'Кресло', 'Кредитные карты', 'Скидка', 'Скачать документ', 'Документ', 'Документ (одноцветный)', 'Документы', 'Документ с текстом', 'Доллар', 'Зелёная \'галочка\'', 'Земля', 'Пустой кошелёк с возвратом', 'Пустой кошелёк', 'Евро', 'Геолокация', 'Зеркало', 'Глобус', 'Gps', 'Сетка (белая)', 'Диаграмма роста', 'Скидка', 'JCB', 'Logo', 'Лупа', 'MasterCard', 'Минус', 'МИР', 'Деньги', 'Денежное страхование', 'Монитор и мобильный', 'Новый документ', 'Офис', 'Лого «Одноклассники»', 'PackA4', 'Бизнес', 'Проценты (круг.)', 'Проценты', 'Персональная карта', 'Лого «PlayMarket»', 'Плюс', 'Щит', 'Профиль, 2 персоны', 'Профиль', 'Тыква', 'Рубль (круг.)', 'Сейф', 'Безопасность', 'Подписанные документы', 'Маленькие часы', 'Звук', 'StateMortgageIcon', 'Лого «Telegram»', 'UnionPay', 'Пользователь', 'Visa', 'Лого «VK»', 'Пополнение карты', 'Кошелёк с плюсом', 'Кошелёк', 'Кошелёк с деньгами', 'Добавить продукт'
180
+ * 'Деньги', 'Самолет', 'Лого «Apple»', 'Стрелка \'Вниз\'', 'Стрелка', 'Стрелка вверх', 'Банкомат', 'Банк', 'Бургер', 'Календарь 2', 'Скруглённый календарь', 'Календарь', 'Календарь с галочкой', 'Кред. карта', 'Кред. карта под наклоном', 'Кред. карта с галочкой', 'Карта с драгоценностями', 'Машина', 'Деньги внутри кошелька', 'Кино', 'Часы', 'Крестик', 'Кресло', 'Кредитные карты', 'Скидка', 'Скачать документ', 'Документ', 'Документ (одноцветный)', 'Документы', 'Документ с текстом', 'Доллар', 'Зелёная \'галочка\'', 'Земля', 'Пустой кошелёк с возвратом', 'Пустой кошелёк', 'Евро', 'Геолокация', 'Зеркало', 'Глобус', 'Gps', 'Сетка (белая)', 'Диаграмма роста', 'Скидка', 'JCB', 'Logo', 'Лупа', 'MasterCard', 'Минус', 'МИР', 'Деньги', 'Денежное страхование', 'Монитор и мобильный', 'Новый документ', 'Офис', 'Лого «Одноклассники»', 'PackA4Icon', 'Бизнес', 'Проценты (круг.)', 'Проценты', 'Персональная карта', 'Лого «PlayMarket»', 'Плюс', 'Щит', 'Профиль, 2 персоны', 'Профиль', 'Тыква', 'Рубль (круг.)', 'Сейф', 'Безопасность', 'Подписанные документы', 'Маленькие часы', 'Звук', 'StateMortgageIcon', 'Лого «Telegram»', 'UnionPay', 'Пользователь', 'Visa', 'Лого «VK»', 'Пополнение карты', 'Кошелёк с плюсом', 'Кошелёк', 'Кошелёк с деньгами', 'Добавить продукт'
181
181
  * ]
182
182
  */
183
183
  export type IconName =
184
184
  | ''
185
185
  | 'ActualBalanceIcon'
186
- | 'AirPlane'
186
+ | 'AirPlaneIcon'
187
187
  | 'AppleIcon'
188
188
  | 'ArrowDownIcon'
189
189
  | 'ArrowLeftIcon'
@@ -207,7 +207,7 @@ export type IconName =
207
207
  | 'ComfortableCompIcon'
208
208
  | 'CreditCardsIcon'
209
209
  | 'DiscountShapeIcon'
210
- | 'DocDownload'
210
+ | 'DocDownloadIcon'
211
211
  | 'DocIcon'
212
212
  | 'DocIconMonoColor'
213
213
  | 'DocsIcon'
@@ -226,7 +226,7 @@ export type IconName =
226
226
  | 'InterestGrowthIcon'
227
227
  | 'InterestIcon'
228
228
  | 'JCBIcon'
229
- | 'Logo'
229
+ | 'LogoIcon'
230
230
  | 'LoupeIcon'
231
231
  | 'MasterCardIcon'
232
232
  | 'MinusIcon'
@@ -237,7 +237,7 @@ export type IconName =
237
237
  | 'NewDocIcon'
238
238
  | 'OfficeIcon'
239
239
  | 'OkIcon'
240
- | 'PackA4'
240
+ | 'PackA4Icon'
241
241
  | 'PassSendIcon'
242
242
  | 'PercentageRoundIcon'
243
243
  | 'PercentageSquareIcon'
@@ -264,4 +264,4 @@ export type IconName =
264
264
  | 'WalletAddIcon'
265
265
  | 'WalletIcon'
266
266
  | 'WalletWithMoneyIcon'
267
- | 'WateringCan';
267
+ | 'WateringCanIcon';
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ export type ImageSize = {
2
+ /** @title Ширина */
3
+ width: number;
4
+ /** @title Высота */
5
+ height: number;
6
+ };
@@ -1,8 +1,35 @@
1
1
  import type { IconName } from '../icons/IconName';
2
2
  import type { IconVersion } from './IconVersion';
3
+ import { ImageSize } from './ImageSize';
3
4
 
4
5
  export type ImgFormats = 'jpeg' | 'jpg' | 'png' | 'gif' | 'webp' | 'heif' | 'avif';
5
6
 
7
+ /**
8
+ * @title Позиционирование
9
+ * @enumNames [
10
+ * "Сверху слева",
11
+ * "Сверху по центру",
12
+ * "Сверху справа",
13
+ * "Посередине слева",
14
+ * "Посередине по центру",
15
+ * "Посередине справа",
16
+ * "Снизу слева",
17
+ * "Снизу по центру",
18
+ * "Снизу справа"
19
+ * ]
20
+ * @default "center"
21
+ */
22
+ export type ImgAlignment =
23
+ | 'northwest'
24
+ | 'north'
25
+ | 'northeast'
26
+ | 'west'
27
+ | 'center'
28
+ | 'east'
29
+ | 'southwest'
30
+ | 'south'
31
+ | 'southeast';
32
+
6
33
  export interface Img {
7
34
  /** @title Картинка */
8
35
  src?: string;
@@ -19,6 +46,7 @@ export interface Img {
19
46
  export type MediaQuery = 1919 | 1439 | 1279;
20
47
 
21
48
  export interface ImgSource {
49
+ alignment?: ImgAlignment;
22
50
  /** @title Иконка */
23
51
  icon?: IconName;
24
52
  iconVersion?: IconVersion;
@@ -30,12 +58,7 @@ export interface ImgSource {
30
58
  options?: Record<string, any>;
31
59
  media?: MediaQuery;
32
60
  /** @title Размер изображения */
33
- size?: {
34
- /** @title Ширина */
35
- width?: number;
36
- /** @title Высота */
37
- height?: number;
38
- };
61
+ size?: Partial<ImageSize>;
39
62
  }
40
63
 
41
64
  /** @title Изображение */
@@ -1,22 +1,8 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { ButtonVersion } from '../../model/ButtonVersion';
3
2
  import { ButtonInner } from './ButtonInner';
4
3
  import type { ButtonWithIconProps } from './ButtonProps';
5
-
6
- const buttonStyleMap: Record<ButtonVersion, string> = {
7
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
8
- secondary:
9
- 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
10
- link: '',
11
- };
12
-
13
- const buttonDisabledStyleMap: Record<ButtonVersion, string> = {
14
- primary: 'bg-secondary-dark text-secondary-text',
15
- secondary: 'bg-secondary-light text-secondary-text',
16
- link: '',
17
- };
18
-
19
- const buttonStyle = 'text-center font-sans select-none';
4
+ import { getRegularButtonClasses } from './getRegularButtonClasses';
5
+ import { getDisabledButtonClasses } from './getDisabledButtonClasses';
20
6
 
21
7
  export const Button = JSX<ButtonWithIconProps>((props) => {
22
8
  const { text, aboveText, appendLeft, appendRight, children, disabled, rounded, ...rest } = props;
@@ -43,22 +29,10 @@ export const Button = JSX<ButtonWithIconProps>((props) => {
43
29
  });
44
30
 
45
31
  const RegularButton = JSX<ButtonWithIconProps>(
46
- ({
47
- className = '',
48
- ariaLabel,
49
- version = 'none',
50
- rounded,
51
- href,
52
- target,
53
- children,
54
- onClick,
55
- ...rest
56
- }) => {
32
+ ({ className = '', ariaLabel, version, rounded, href, target, children, onClick, ...rest }) => {
57
33
  return (
58
34
  <a
59
- className={`${buttonStyle} border border-transparent inline-block cursor-pointer no-underline focus:border-primary-focus focus:border ${
60
- buttonStyleMap[version] || ''
61
- } ${rounded ? 'rounded-full' : 'rounded-md'} ${className}`}
35
+ className={getRegularButtonClasses({ className, version, rounded })}
62
36
  href={href}
63
37
  target={target}
64
38
  onClick={onClick}
@@ -73,16 +47,14 @@ const RegularButton = JSX<ButtonWithIconProps>(
73
47
  );
74
48
 
75
49
  const DisabledButton = JSX<ButtonWithIconProps>(
76
- ({ className, children, ariaLabel, version = 'none', rounded }) => {
50
+ ({ className, children, ariaLabel, version, rounded }) => {
77
51
  return (
78
52
  <div
79
53
  role="button"
80
54
  aria-disabled="true"
81
55
  aria-label={ariaLabel}
82
56
  tabIndex={-1}
83
- className={`inline-block ${buttonStyle} ${buttonDisabledStyleMap[version] || ''} ${
84
- rounded ? 'rounded-full' : 'rounded-md'
85
- } ${className || ''}`}
57
+ className={getDisabledButtonClasses({ className, rounded, version })}
86
58
  >
87
59
  {children}
88
60
  </div>
@@ -0,0 +1,7 @@
1
+ import type { ButtonVersion } from '../../model/ButtonVersion';
2
+
3
+ export type GetButtonClassParams = {
4
+ className?: string;
5
+ rounded?: boolean;
6
+ version?: ButtonVersion;
7
+ };
@@ -0,0 +1,16 @@
1
+ import type { ButtonVersion } from '../../model/ButtonVersion';
2
+
3
+ export const buttonStyleMap: Record<ButtonVersion, string> = {
4
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
5
+ secondary:
6
+ 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
7
+ link: '',
8
+ };
9
+
10
+ export const buttonDisabledStyleMap: Record<ButtonVersion, string> = {
11
+ primary: 'bg-secondary-dark text-secondary-text',
12
+ secondary: 'bg-secondary-light text-secondary-text',
13
+ link: '',
14
+ };
15
+
16
+ export const buttonStyle = 'text-center font-sans select-none';
@@ -0,0 +1,15 @@
1
+ import type { GetButtonClassParams } from './GetButtonClassParams';
2
+ import { buttonDisabledStyleMap, buttonStyle } from './buttonClassNameConstants';
3
+
4
+ export const getDisabledButtonClasses = ({
5
+ className,
6
+ rounded,
7
+ version,
8
+ }: GetButtonClassParams): string =>
9
+ [
10
+ 'inline-block',
11
+ buttonStyle,
12
+ version ? buttonDisabledStyleMap[version] : '',
13
+ rounded ? 'rounded-full' : 'rounded-md',
14
+ className,
15
+ ].join(' ');
@@ -0,0 +1,15 @@
1
+ import type { GetButtonClassParams } from './GetButtonClassParams';
2
+ import { buttonStyle, buttonStyleMap } from './buttonClassNameConstants';
3
+
4
+ export const getRegularButtonClasses = ({
5
+ className,
6
+ rounded,
7
+ version,
8
+ }: GetButtonClassParams): string =>
9
+ [
10
+ buttonStyle,
11
+ 'border border-transparent inline-block cursor-pointer no-underline focus:border-primary-focus focus:border',
12
+ version ? buttonStyleMap[version] : '',
13
+ rounded ? 'rounded-full' : 'rounded-md',
14
+ className,
15
+ ].join(' ');