@redneckz/wildless-cms-uni-blocks 0.14.5 → 0.14.7

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 (252) hide show
  1. package/bin/migration-scripts/0.13.5.js +14 -11
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +168 -92
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/Depository/Depository.d.ts +6 -0
  6. package/bundle/components/Depository/DepositoryContent.d.ts +5 -0
  7. package/bundle/components/Depository/DepositoryItem.d.ts +3 -0
  8. package/bundle/components/Depository/useDepository.d.ts +9 -0
  9. package/bundle/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -0
  10. package/bundle/components/SwipeListControlBlock/SwipeListControlBlockContent.d.ts +3 -0
  11. package/bundle/ui-kit/Pagination/Pagination.d.ts +8 -0
  12. package/bundle/ui-kit/Pagination/renderPages.d.ts +3 -0
  13. package/bundle/ui-kit/Pagination/shouldRenderPage.d.ts +1 -0
  14. package/bundle/utils/convertTimestampToDate.d.ts +1 -0
  15. package/dist/components/ApplicationForm/renderRegion.js +1 -1
  16. package/dist/components/ApplicationForm/renderRegionDepartment.js +1 -1
  17. package/dist/components/ApplicationForm/renderWedDataOrganization.js +2 -2
  18. package/dist/components/ApplicationForm/renderWedDataOrganization.js.map +1 -1
  19. package/dist/components/BenefitsBlock/BenefitsBlock.js +7 -7
  20. package/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  21. package/dist/components/Blocks.js +2 -0
  22. package/dist/components/Blocks.js.map +1 -1
  23. package/dist/components/ContentPage/ContentPage.js +1 -1
  24. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  25. package/dist/components/Depository/Depository.d.ts +6 -0
  26. package/dist/components/Depository/Depository.js +19 -0
  27. package/dist/components/Depository/Depository.js.map +1 -0
  28. package/dist/components/Depository/DepositoryContent.d.ts +5 -0
  29. package/dist/components/Depository/DepositoryContent.js +2 -0
  30. package/dist/components/Depository/DepositoryContent.js.map +1 -0
  31. package/dist/components/Depository/DepositoryItem.d.ts +3 -0
  32. package/dist/components/Depository/DepositoryItem.js +12 -0
  33. package/dist/components/Depository/DepositoryItem.js.map +1 -0
  34. package/dist/components/Depository/useDepository.d.ts +9 -0
  35. package/dist/components/Depository/useDepository.js +10 -0
  36. package/dist/components/Depository/useDepository.js.map +1 -0
  37. package/dist/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -0
  38. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +1 -1
  39. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
  40. package/dist/components/SwipeListControlBlock/SwipeListControlBlockContent.d.ts +3 -0
  41. package/dist/ui-kit/Input/Input.js +7 -1
  42. package/dist/ui-kit/Input/Input.js.map +1 -1
  43. package/dist/ui-kit/Pagination/Pagination.d.ts +8 -0
  44. package/dist/ui-kit/Pagination/Pagination.js +31 -0
  45. package/dist/ui-kit/Pagination/Pagination.js.map +1 -0
  46. package/dist/ui-kit/Pagination/renderPages.d.ts +3 -0
  47. package/dist/ui-kit/Pagination/renderPages.js +18 -0
  48. package/dist/ui-kit/Pagination/renderPages.js.map +1 -0
  49. package/dist/ui-kit/Pagination/shouldRenderPage.d.ts +1 -0
  50. package/dist/ui-kit/Pagination/shouldRenderPage.js +9 -0
  51. package/dist/ui-kit/Pagination/shouldRenderPage.js.map +1 -0
  52. package/dist/ui-kit/Select/filterOptions.js +1 -10
  53. package/dist/ui-kit/Select/filterOptions.js.map +1 -1
  54. package/dist/utils/convertTimestampToDate.d.ts +1 -0
  55. package/dist/utils/convertTimestampToDate.js +16 -0
  56. package/dist/utils/convertTimestampToDate.js.map +1 -0
  57. package/dist/utils/fetchMultitudeJSON.js +1 -1
  58. package/dist/utils/fetchMultitudeJSON.js.map +1 -1
  59. package/lib/common.css +1 -1
  60. package/lib/components/ApplicationForm/renderRegion.js +1 -1
  61. package/lib/components/ApplicationForm/renderRegionDepartment.js +1 -1
  62. package/lib/components/ApplicationForm/renderWedDataOrganization.js +2 -2
  63. package/lib/components/ApplicationForm/renderWedDataOrganization.js.map +1 -1
  64. package/lib/components/BenefitsBlock/BenefitsBlock.js +7 -7
  65. package/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  66. package/lib/components/Blocks.js +2 -0
  67. package/lib/components/Blocks.js.map +1 -1
  68. package/lib/components/ContentPage/ContentPage.js +1 -1
  69. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  70. package/lib/components/Depository/Depository.d.ts +6 -0
  71. package/lib/components/Depository/Depository.fixture.d.ts +6 -0
  72. package/lib/components/Depository/Depository.js +17 -0
  73. package/lib/components/Depository/Depository.js.map +1 -0
  74. package/lib/components/Depository/DepositoryContent.d.ts +5 -0
  75. package/lib/components/Depository/DepositoryContent.js +2 -0
  76. package/lib/components/Depository/DepositoryContent.js.map +1 -0
  77. package/lib/components/Depository/DepositoryItem.d.ts +3 -0
  78. package/lib/components/Depository/DepositoryItem.js +9 -0
  79. package/lib/components/Depository/DepositoryItem.js.map +1 -0
  80. package/lib/components/Depository/useDepository.d.ts +9 -0
  81. package/lib/components/Depository/useDepository.js +7 -0
  82. package/lib/components/Depository/useDepository.js.map +1 -0
  83. package/lib/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -0
  84. package/lib/components/ProductBlock/ProductBlock.fixture.mobile.d.ts +1 -0
  85. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +1 -1
  86. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
  87. package/lib/components/SwipeListControlBlock/SwipeListControlBlockContent.d.ts +3 -0
  88. package/lib/ui-kit/Input/Input.js +8 -2
  89. package/lib/ui-kit/Input/Input.js.map +1 -1
  90. package/lib/ui-kit/Pagination/Pagination.d.ts +8 -0
  91. package/lib/ui-kit/Pagination/Pagination.js +28 -0
  92. package/lib/ui-kit/Pagination/Pagination.js.map +1 -0
  93. package/lib/ui-kit/Pagination/renderPages.d.ts +3 -0
  94. package/lib/ui-kit/Pagination/renderPages.js +15 -0
  95. package/lib/ui-kit/Pagination/renderPages.js.map +1 -0
  96. package/lib/ui-kit/Pagination/shouldRenderPage.d.ts +1 -0
  97. package/lib/ui-kit/Pagination/shouldRenderPage.js +6 -0
  98. package/lib/ui-kit/Pagination/shouldRenderPage.js.map +1 -0
  99. package/lib/ui-kit/Select/filterOptions.js +1 -10
  100. package/lib/ui-kit/Select/filterOptions.js.map +1 -1
  101. package/lib/utils/convertTimestampToDate.d.ts +1 -0
  102. package/lib/utils/convertTimestampToDate.js +13 -0
  103. package/lib/utils/convertTimestampToDate.js.map +1 -0
  104. package/lib/utils/fetchMultitudeJSON.js +1 -1
  105. package/lib/utils/fetchMultitudeJSON.js.map +1 -1
  106. package/mobile/bundle/bundle.umd.js +93 -93
  107. package/mobile/bundle/bundle.umd.min.js +1 -1
  108. package/mobile/bundle/components/Depository/Depository.d.ts +6 -0
  109. package/mobile/bundle/components/Depository/DepositoryContent.d.ts +5 -0
  110. package/mobile/bundle/components/Depository/DepositoryItem.d.ts +3 -0
  111. package/mobile/bundle/components/Depository/useDepository.d.ts +9 -0
  112. package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -0
  113. package/mobile/bundle/components/SwipeListControlBlock/SwipeListControlBlockContent.d.ts +3 -0
  114. package/mobile/bundle/ui-kit/Pagination/Pagination.d.ts +8 -0
  115. package/mobile/bundle/ui-kit/Pagination/renderPages.d.ts +3 -0
  116. package/mobile/bundle/ui-kit/Pagination/shouldRenderPage.d.ts +1 -0
  117. package/mobile/bundle/utils/convertTimestampToDate.d.ts +1 -0
  118. package/mobile/dist/components/ApplicationForm/renderRegion.js +1 -1
  119. package/mobile/dist/components/ApplicationForm/renderRegionDepartment.js +1 -1
  120. package/mobile/dist/components/ApplicationForm/renderWedDataOrganization.js +2 -2
  121. package/mobile/dist/components/ApplicationForm/renderWedDataOrganization.js.map +1 -1
  122. package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js +7 -7
  123. package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  124. package/mobile/dist/components/ContentPage/ContentPage.js +1 -1
  125. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  126. package/mobile/dist/components/Depository/Depository.d.ts +6 -0
  127. package/mobile/dist/components/Depository/Depository.js +19 -0
  128. package/mobile/dist/components/Depository/Depository.js.map +1 -0
  129. package/mobile/dist/components/Depository/DepositoryContent.d.ts +5 -0
  130. package/mobile/dist/components/Depository/DepositoryContent.js +2 -0
  131. package/mobile/dist/components/Depository/DepositoryContent.js.map +1 -0
  132. package/mobile/dist/components/Depository/DepositoryItem.d.ts +3 -0
  133. package/mobile/dist/components/Depository/DepositoryItem.js +12 -0
  134. package/mobile/dist/components/Depository/DepositoryItem.js.map +1 -0
  135. package/mobile/dist/components/Depository/useDepository.d.ts +9 -0
  136. package/mobile/dist/components/Depository/useDepository.js +10 -0
  137. package/mobile/dist/components/Depository/useDepository.js.map +1 -0
  138. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -0
  139. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +1 -1
  140. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
  141. package/mobile/dist/components/SwipeListControlBlock/SwipeListControlBlockContent.d.ts +3 -0
  142. package/mobile/dist/ui-kit/Input/Input.js +7 -1
  143. package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
  144. package/mobile/dist/ui-kit/Pagination/Pagination.d.ts +8 -0
  145. package/mobile/dist/ui-kit/Pagination/Pagination.js +31 -0
  146. package/mobile/dist/ui-kit/Pagination/Pagination.js.map +1 -0
  147. package/mobile/dist/ui-kit/Pagination/renderPages.d.ts +3 -0
  148. package/mobile/dist/ui-kit/Pagination/renderPages.js +18 -0
  149. package/mobile/dist/ui-kit/Pagination/renderPages.js.map +1 -0
  150. package/mobile/dist/ui-kit/Pagination/shouldRenderPage.d.ts +1 -0
  151. package/mobile/dist/ui-kit/Pagination/shouldRenderPage.js +9 -0
  152. package/mobile/dist/ui-kit/Pagination/shouldRenderPage.js.map +1 -0
  153. package/mobile/dist/ui-kit/Select/filterOptions.js +1 -10
  154. package/mobile/dist/ui-kit/Select/filterOptions.js.map +1 -1
  155. package/mobile/dist/utils/convertTimestampToDate.d.ts +1 -0
  156. package/mobile/dist/utils/convertTimestampToDate.js +16 -0
  157. package/mobile/dist/utils/convertTimestampToDate.js.map +1 -0
  158. package/mobile/dist/utils/fetchMultitudeJSON.js +1 -1
  159. package/mobile/dist/utils/fetchMultitudeJSON.js.map +1 -1
  160. package/mobile/lib/common.css +1 -1
  161. package/mobile/lib/components/ApplicationForm/renderRegion.js +1 -1
  162. package/mobile/lib/components/ApplicationForm/renderRegionDepartment.js +1 -1
  163. package/mobile/lib/components/ApplicationForm/renderWedDataOrganization.js +2 -2
  164. package/mobile/lib/components/ApplicationForm/renderWedDataOrganization.js.map +1 -1
  165. package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js +7 -7
  166. package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
  167. package/mobile/lib/components/ContentPage/ContentPage.js +1 -1
  168. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  169. package/mobile/lib/components/Depository/Depository.d.ts +6 -0
  170. package/mobile/lib/components/Depository/Depository.js +17 -0
  171. package/mobile/lib/components/Depository/Depository.js.map +1 -0
  172. package/mobile/lib/components/Depository/DepositoryContent.d.ts +5 -0
  173. package/mobile/lib/components/Depository/DepositoryContent.js +2 -0
  174. package/mobile/lib/components/Depository/DepositoryContent.js.map +1 -0
  175. package/mobile/lib/components/Depository/DepositoryItem.d.ts +3 -0
  176. package/mobile/lib/components/Depository/DepositoryItem.js +9 -0
  177. package/mobile/lib/components/Depository/DepositoryItem.js.map +1 -0
  178. package/mobile/lib/components/Depository/useDepository.d.ts +9 -0
  179. package/mobile/lib/components/Depository/useDepository.js +7 -0
  180. package/mobile/lib/components/Depository/useDepository.js.map +1 -0
  181. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -0
  182. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +1 -1
  183. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
  184. package/mobile/lib/components/SwipeListControlBlock/SwipeListControlBlockContent.d.ts +3 -0
  185. package/mobile/lib/ui-kit/Input/Input.js +8 -2
  186. package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
  187. package/mobile/lib/ui-kit/Pagination/Pagination.d.ts +8 -0
  188. package/mobile/lib/ui-kit/Pagination/Pagination.js +28 -0
  189. package/mobile/lib/ui-kit/Pagination/Pagination.js.map +1 -0
  190. package/mobile/lib/ui-kit/Pagination/renderPages.d.ts +3 -0
  191. package/mobile/lib/ui-kit/Pagination/renderPages.js +15 -0
  192. package/mobile/lib/ui-kit/Pagination/renderPages.js.map +1 -0
  193. package/mobile/lib/ui-kit/Pagination/shouldRenderPage.d.ts +1 -0
  194. package/mobile/lib/ui-kit/Pagination/shouldRenderPage.js +6 -0
  195. package/mobile/lib/ui-kit/Pagination/shouldRenderPage.js.map +1 -0
  196. package/mobile/lib/ui-kit/Select/filterOptions.js +1 -10
  197. package/mobile/lib/ui-kit/Select/filterOptions.js.map +1 -1
  198. package/mobile/lib/utils/convertTimestampToDate.d.ts +1 -0
  199. package/mobile/lib/utils/convertTimestampToDate.js +13 -0
  200. package/mobile/lib/utils/convertTimestampToDate.js.map +1 -0
  201. package/mobile/lib/utils/fetchMultitudeJSON.js +1 -1
  202. package/mobile/lib/utils/fetchMultitudeJSON.js.map +1 -1
  203. package/mobile/src/components/ApplicationForm/ApplicationFormGrantSupport.tsx +1 -1
  204. package/mobile/src/components/ApplicationForm/renderRegion.tsx +2 -2
  205. package/mobile/src/components/ApplicationForm/renderRegionDepartment.tsx +2 -2
  206. package/mobile/src/components/ApplicationForm/renderWedDataOrganization.tsx +5 -5
  207. package/mobile/src/components/BenefitsBlock/BenefitsBlock.tsx +24 -22
  208. package/mobile/src/components/ContentPage/ContentPage.tsx +1 -1
  209. package/mobile/src/components/Depository/Depository.tsx +43 -0
  210. package/mobile/src/components/Depository/DepositoryContent.ts +6 -0
  211. package/mobile/src/components/Depository/DepositoryItem.tsx +21 -0
  212. package/mobile/src/components/Depository/useDepository.ts +23 -0
  213. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMap.example.json +1 -0
  214. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapContent.ts +3 -0
  215. package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +8 -6
  216. package/mobile/src/components/SwipeListControlBlock/SwipeListControlBlockContent.ts +3 -0
  217. package/mobile/src/ui-kit/Input/Input.tsx +9 -2
  218. package/mobile/src/ui-kit/Pagination/Pagination.tsx +87 -0
  219. package/mobile/src/ui-kit/Pagination/renderPages.tsx +33 -0
  220. package/mobile/src/ui-kit/Pagination/shouldRenderPage.ts +8 -0
  221. package/mobile/src/ui-kit/Select/filterOptions.ts +1 -11
  222. package/mobile/src/utils/convertTimestampToDate.ts +15 -0
  223. package/mobile/src/utils/fetchMultitudeJSON.ts +1 -1
  224. package/package.json +1 -1
  225. package/src/components/ApplicationForm/ApplicationFormGrantSupport.tsx +1 -1
  226. package/src/components/ApplicationForm/renderRegion.tsx +2 -2
  227. package/src/components/ApplicationForm/renderRegionDepartment.tsx +2 -2
  228. package/src/components/ApplicationForm/renderWedDataOrganization.tsx +5 -5
  229. package/src/components/BenefitsBlock/BenefitsBlock.tsx +24 -22
  230. package/src/components/Blocks.ts +2 -0
  231. package/src/components/ContentPage/ContentPage.tsx +1 -1
  232. package/src/components/Depository/Depository.example.json +1 -0
  233. package/src/components/Depository/Depository.fixture.tsx +10 -0
  234. package/src/components/Depository/Depository.tsx +43 -0
  235. package/src/components/Depository/Depository.ui.json +1 -0
  236. package/src/components/Depository/DepositoryContent.ts +6 -0
  237. package/src/components/Depository/DepositoryItem.tsx +21 -0
  238. package/src/components/Depository/useDepository.ts +23 -0
  239. package/src/components/OfficesAtmsMap/OfficesAtmsMap.example.json +1 -0
  240. package/src/components/OfficesAtmsMap/OfficesAtmsMapContent.ts +3 -0
  241. package/src/components/ProductBlock/ProductBlock.fixture.mobile.tsx +23 -3
  242. package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +8 -6
  243. package/src/components/SwipeListControlBlock/SwipeListControlBlockContent.ts +3 -0
  244. package/src/ui-kit/Input/Input.tsx +9 -2
  245. package/src/ui-kit/Pagination/Pagination.tsx +87 -0
  246. package/src/ui-kit/Pagination/renderPages.tsx +33 -0
  247. package/src/ui-kit/Pagination/shouldRenderPage.ts +8 -0
  248. package/src/ui-kit/Select/filterOptions.ts +1 -11
  249. package/src/utils/convertTimestampToDate.ts +15 -0
  250. package/src/utils/fetchMultitudeJSON.ts +1 -1
  251. /package/mobile/src/components/{OfficesAtmsMap/OfficesAtmsMaps.example.json → Depository/Depository.example.json} +0 -0
  252. /package/{src/components/OfficesAtmsMap/OfficesAtmsMaps.example.json → mobile/src/components/Depository/Depository.ui.json} +0 -0
@@ -0,0 +1,6 @@
1
+ const checkPageRange = (page, currentPage, totalPages) => (currentPage <= 3 && page <= currentPage + 3) ||
2
+ (currentPage >= totalPages - 1 && page >= totalPages - 4);
3
+ export const shouldRenderPage = (page, currentPage, totalPages) => (page < currentPage && page >= currentPage - 2) ||
4
+ (page <= currentPage + 2 && page > currentPage) ||
5
+ checkPageRange(page, currentPage, totalPages);
6
+ //# sourceMappingURL=shouldRenderPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shouldRenderPage.js","sourceRoot":"","sources":["../../../src/ui-kit/Pagination/shouldRenderPage.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,UAAkB,EAAE,EAAE,CAC/E,CAAC,WAAW,IAAI,CAAC,IAAI,IAAI,IAAI,WAAW,GAAG,CAAC,CAAC;IAC7C,CAAC,WAAW,IAAI,UAAU,GAAG,CAAC,IAAI,IAAI,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,UAAkB,EAAE,EAAE,CACxF,CAAC,IAAI,GAAG,WAAW,IAAI,IAAI,IAAI,WAAW,GAAG,CAAC,CAAC;IAC/C,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC,IAAI,IAAI,GAAG,WAAW,CAAC;IAC/C,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC"}
@@ -1,16 +1,7 @@
1
- import { compareBy, desc } from '../../utils/Comparator.js';
2
- import { jaroWinklerDistance } from '../../utils/jaroWinklerDistance.js';
3
- import { zip } from '../../utils/zip.js';
4
1
  export const filterOptions = (options, query) => {
5
2
  if (!options?.length || !query?.trim()) {
6
3
  return options;
7
4
  }
8
- const ranking = options
9
- .map((_) => _.text?.toLowerCase())
10
- .map(jaroWinklerDistance(query?.trim().toLowerCase()));
11
- return zip(options, ranking)
12
- .filter(([, rank]) => rank >= 0.5)
13
- .sort(desc(compareBy(([, rank]) => rank)))
14
- .map(([option]) => option);
5
+ return options.filter((_) => _.text?.toLocaleLowerCase().includes(query?.trim().toLocaleLowerCase()));
15
6
  };
16
7
  //# sourceMappingURL=filterOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterOptions.js","sourceRoot":"","sources":["../../../src/ui-kit/Select/filterOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAiB,EAAE,KAAyB,EAAY,EAAE;IACtF,IAAI,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACtC,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,OAAO,GAAG,OAAO;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;SACjC,GAAG,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAEzD,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC;SACjC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACzC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC"}
1
+ {"version":3,"file":"filterOptions.js","sourceRoot":"","sources":["../../../src/ui-kit/Select/filterOptions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAiB,EAAE,KAAyB,EAAY,EAAE;IACtF,IAAI,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACtC,OAAO,OAAO,CAAC;KAChB;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;AACvG,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const convertTimestampToDate: (timestamp: number) => string;
@@ -0,0 +1,13 @@
1
+ export const convertTimestampToDate = (timestamp) => {
2
+ const date = new Date(timestamp * 1000);
3
+ let dd = date.getDate();
4
+ if (dd < 10) {
5
+ dd = '0' + dd;
6
+ }
7
+ let mm = date.getMonth() + 1;
8
+ if (mm < 10) {
9
+ mm = '0' + mm;
10
+ }
11
+ return dd + '.' + mm + '.' + date.getFullYear();
12
+ };
13
+ //# sourceMappingURL=convertTimestampToDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertTimestampToDate.js","sourceRoot":"","sources":["../../src/utils/convertTimestampToDate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC1D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAExC,IAAI,EAAE,GAAoB,IAAI,CAAC,OAAO,EAAE,CAAC;IACzC,IAAI,EAAE,GAAG,EAAE,EAAE;QACX,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;KACf;IAED,IAAI,EAAE,GAAoB,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC9C,IAAI,EAAE,GAAG,EAAE,EAAE;QACX,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;KACf;IAED,OAAO,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;AAClD,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { fetchJSON } from './fetchJSON.js';
2
2
  export async function fetchMultitudeJSON(...urls) {
3
3
  const fetchPromises = urls.map((url) => fetchJSON(url));
4
- return await Promise.all(fetchPromises);
4
+ return Promise.all(fetchPromises);
5
5
  }
6
6
  //# sourceMappingURL=fetchMultitudeJSON.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchMultitudeJSON.js","sourceRoot":"","sources":["../../src/utils/fetchMultitudeJSON.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAG,IAAc;IAEjB,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAI,GAAG,CAAC,CAAC,CAAC;IAE3D,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"fetchMultitudeJSON.js","sourceRoot":"","sources":["../../src/utils/fetchMultitudeJSON.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAG,IAAc;IAEjB,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAI,GAAG,CAAC,CAAC,CAAC;IAE3D,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACpC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useSWRResource } from '../../hooks/useSWRResource';
4
- import { RegionsGrantSupportData } from '../../services/regionsGrantSupport/RegionsGrantSupportData';
4
+ import type { RegionsGrantSupportData } from '../../services/regionsGrantSupport/RegionsGrantSupportData';
5
5
  import { Button } from '../../ui-kit/Button/Button';
6
6
  import { getRegularButtonClasses } from '../../ui-kit/Button/getRegularButtonClasses';
7
7
  import { style } from '../../utils/style';
@@ -13,8 +13,8 @@ interface RegionProps {
13
13
  export const renderRegion = ({ regions, field }: RegionProps) => (
14
14
  <SelectControl
15
15
  className="w-full"
16
- label="Регион"
17
- placeholder="Выберите регион"
16
+ label="Филиал"
17
+ placeholder="Выберите филиал"
18
18
  isSearch={true}
19
19
  options={regions.map(({ code = '', name = '' }) => ({ key: code, text: name }))}
20
20
  {...withValidator(field('region'), defaultValidator)}
@@ -16,8 +16,8 @@ export const renderRegionDepartment = ({ regions, branches, field }: RegionDepar
16
16
  <div className="@xl:flex @xl:justify-between @xl:gap-lg @xl:mb-2xl @xl:border-none @xl:pb-0">
17
17
  <div className="@xl:w-1/2">
18
18
  <SelectControl
19
- label="Регион"
20
- placeholder="Выберите регион"
19
+ label="Филиал"
20
+ placeholder="Выберите филиал"
21
21
  isSearch={true}
22
22
  options={regions.map(({ code = '', name = '' }) => ({ key: code, text: name }))}
23
23
  {...withValidator(field('region'), defaultValidator)}
@@ -2,10 +2,10 @@ import { FormFieldRegisterer } from '../../hooks/useForm';
2
2
  import { withValidator } from '../../validation/withValidator';
3
3
  import { InputControl } from './InputControl';
4
4
  import { PhoneInputControl } from './PhoneInputControl';
5
- import { defaultValidator, innValidator, nameValidator, phoneValidator } from './validators';
6
- import type { WedFormState } from './WedFormState';
7
5
  import { SelectControl } from './SelectControl';
6
+ import type { WedFormState } from './WedFormState';
8
7
  import type { Select } from './models';
8
+ import { defaultValidator, innValidator, nameValidator, phoneValidator } from './validators';
9
9
 
10
10
  export const renderWedDataOrganization = (
11
11
  field: FormFieldRegisterer<WedFormState>,
@@ -15,11 +15,11 @@ export const renderWedDataOrganization = (
15
15
 
16
16
  return (
17
17
  <div>
18
- {regions.length && isCurrencyControl ? (
18
+ {isCurrencyControl ? (
19
19
  <SelectControl
20
20
  className="mb-s"
21
- label="Регион"
22
- placeholder="Выберите регион"
21
+ label="Филиал"
22
+ placeholder="Выберите филиал"
23
23
  isSearch={true}
24
24
  options={regions.map(({ code = '', name = '' }) => ({ key: code, text: name }))}
25
25
  {...withValidator(field('region'), defaultValidator)}
@@ -4,6 +4,7 @@ import { BlockWrapper } from '../../ui-kit/BlockWrapper';
4
4
  import { Heading } from '../../ui-kit/Heading/Heading';
5
5
  import { RoundedIcon } from '../../ui-kit/Icon/RoundedIcon';
6
6
  import { Img } from '../../ui-kit/Img/Img';
7
+ import { Text } from '../../ui-kit/Text/Text';
7
8
  import type {
8
9
  BenefitBlockItemProps,
9
10
  BenefitsBlockContent,
@@ -12,19 +13,19 @@ import type {
12
13
  TextBenefitDef,
13
14
  } from './BenefitsBlockContent';
14
15
  import { defaultIconSize } from './defaultIconSize';
15
- import { style } from '../../utils/style';
16
- import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
16
+ import { AlignStyles } from '../../model/AlignStyles';
17
17
 
18
18
  interface BenefitsBlockProps extends BenefitsBlockContent, UniBlockProps {}
19
19
 
20
20
  export const BenefitsBlock = JSX<BenefitsBlockProps>(
21
21
  ({ className = '', title, benefitList, ...rest }) => (
22
- <BlockWrapper className={style('space-y-x', className)} defaultPadding="p-6xl" {...rest}>
23
- {title ? (
24
- <Heading headingType="h3" as="h2" className="text-left sm:text-center" title={title} />
25
- ) : null}
22
+ <BlockWrapper className={className} defaultPadding="p-6xl" {...rest}>
23
+ {title ? <Heading headingType="h3" as="h2" className={AlignStyles} title={title} /> : null}
26
24
  {benefitList?.length ? (
27
- <div className="flex flex-wrap w-full sm:justify-center mt-xl gap-5xl" role="list">
25
+ <div
26
+ className="flex flex-col @md:flex-row flex-wrap w-full @md:justify-center mt-xl gap-5xl"
27
+ role="list"
28
+ >
28
29
  {benefitList.map(renderBenefit)}
29
30
  </div>
30
31
  ) : null}
@@ -35,7 +36,7 @@ export const BenefitsBlock = JSX<BenefitsBlockProps>(
35
36
  const renderBenefit = (benefit: BenefitBlockItemProps, i: number) => (
36
37
  <div
37
38
  key={String(i)}
38
- className="flex gap-m items-center md:basis-1/2 md:max-w-[500px]"
39
+ className="flex gap-m items-center @md:basis-1/2 @md:max-w-[500px]"
39
40
  role="listitem"
40
41
  >
41
42
  {benefit?.icon?.icon ? (
@@ -48,7 +49,7 @@ const renderBenefit = (benefit: BenefitBlockItemProps, i: number) => (
48
49
  ) : null}
49
50
  {benefit?.icon?.src ? <Img className="shrink-0" image={benefit.icon} /> : null}
50
51
  {benefit?.label ? (
51
- <div className="sm:h-full">
52
+ <div className="@sm:h-full">
52
53
  <Heading headingType="h6">{benefit.label}</Heading>
53
54
  {renderDescription(benefit.description)}
54
55
  </div>
@@ -60,7 +61,7 @@ const renderDescription = (description: DescriptionDef | undefined) => {
60
61
  const benefitType = description?.benefitType || null;
61
62
 
62
63
  return description && benefitType ? (
63
- <div className="mt-2xs sm:mt-xs">
64
+ <div className="mt-xs text-l font-light text-secondary-text group-data-secondary:text-white/80">
64
65
  {benefitType === 'list'
65
66
  ? renderListBenefit(description as ListBenefitDef)
66
67
  : renderTextBenefit(description as TextBenefitDef)}
@@ -70,13 +71,13 @@ const renderDescription = (description: DescriptionDef | undefined) => {
70
71
 
71
72
  const renderTextBenefit = (description?: TextBenefitDef) =>
72
73
  description?.name ? (
73
- <Paragraph
74
- font="font-light"
74
+ <Text
75
75
  size="text-l"
76
- color="text-secondary-text group-data-secondary:text-white"
76
+ color="text-secondary-text group-data-secondary:text-white/80"
77
+ font="font-light"
77
78
  >
78
79
  {description.name}
79
- </Paragraph>
80
+ </Text>
80
81
  ) : null;
81
82
 
82
83
  const renderListBenefit = (description?: ListBenefitDef) => {
@@ -85,14 +86,15 @@ const renderListBenefit = (description?: ListBenefitDef) => {
85
86
  return description?.items && description.items.length > 0 ? (
86
87
  <ul className={listStyleType}>
87
88
  {description.items.map((_, i) => (
88
- <Paragraph
89
- key={`benefitListItem-${i}`}
90
- font="font-light"
91
- size="text-l"
92
- color="text-secondary-text group-data-secondary:text-white"
93
- >
94
- {_}
95
- </Paragraph>
89
+ <li key={`benefitListItem-${i}`}>
90
+ <Text
91
+ size="text-l"
92
+ color="text-secondary-text group-data-secondary:text-white/80"
93
+ font="font-light"
94
+ >
95
+ {_}
96
+ </Text>
97
+ </li>
96
98
  ))}
97
99
  </ul>
98
100
  ) : null;
@@ -35,7 +35,7 @@ export const ContentPage: JSXBlock<ContentPageProps> = JSX<ContentPageProps>(
35
35
  useBlockRouterProvider();
36
36
 
37
37
  return (
38
- <div className="@container" data-theme={colorPalette}>
38
+ <div data-theme={colorPalette}>
39
39
  <section className={style('relative', pageStyle, className)}>
40
40
  {slots?.header ? (
41
41
  <div className="relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]">
@@ -0,0 +1,43 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import type { JSXBlock, UniBlockProps } from '../../model/JSXBlock';
4
+ import { BlockWrapper } from '../../ui-kit/BlockWrapper';
5
+ import { Pagination } from '../../ui-kit/Pagination/Pagination';
6
+ import { style } from '../../utils/style';
7
+ import type { DepositoryContent } from './DepositoryContent';
8
+ import { DepositoryItem } from './DepositoryItem';
9
+ import { useDepository } from './useDepository';
10
+
11
+ const DEFAULT_ITEMS_COUNT = 10;
12
+
13
+ interface DepositoryProps extends DepositoryContent, UniBlockProps {}
14
+
15
+ export const Depository: JSXBlock<DepositoryProps> = JSX<DepositoryProps>(
16
+ ({ className, ...rest }) => {
17
+ const [currentPage, setCurrentPage] = useState(0);
18
+ const [itemCount] = useState(DEFAULT_ITEMS_COUNT);
19
+
20
+ const { totalPages = 0, items } = useDepository(itemCount, currentPage);
21
+
22
+ const handleChangePage = useCallback((page) => setCurrentPage(page - 1), []);
23
+
24
+ return (
25
+ <BlockWrapper className={style(className, 'container p-4xl')} {...rest}>
26
+ <div className="flex flex-col">
27
+ <div className="grid grid-cols-12 pb-lg border-gray border-opacity-50 border-b">
28
+ <span className="col-span-2 text-gray text-m">Дата</span>
29
+ <span className="col-span-10 text-gray text-m">Тема</span>
30
+ </div>
31
+ {items?.map((params) => (
32
+ <DepositoryItem key={String(params.publicId)} {...params} />
33
+ ))}
34
+ <Pagination
35
+ currentPage={currentPage + 1}
36
+ onPageChange={handleChangePage}
37
+ totalPages={totalPages + 1}
38
+ />
39
+ </div>
40
+ </BlockWrapper>
41
+ );
42
+ },
43
+ );
@@ -0,0 +1,6 @@
1
+ import type { UniBlockContent } from '../../model/JSXBlock';
2
+
3
+ /**
4
+ * @title Депозитарий
5
+ */
6
+ export type DepositoryContent = UniBlockContent;
@@ -0,0 +1,21 @@
1
+ import { useLink } from '../../hooks/useLink';
2
+ import { convertTimestampToDate } from '../../utils/convertTimestampToDate';
3
+ import { DepositoryDataItem } from './useDepository';
4
+
5
+ export const DepositoryItem = ({ title, timestamp = 0, publicId }: DepositoryDataItem) => {
6
+ const link = useLink();
7
+ const { href } = link({ href: `/api/v1/depository/${publicId}/file` });
8
+
9
+ return (
10
+ <div className="grid grid-cols-12 py-lg border-gray border-opacity-50 border-b" key={publicId}>
11
+ <div className="col-span-2 text-m">
12
+ <span>{convertTimestampToDate(timestamp)}</span>
13
+ </div>
14
+ <div className="col-span-10 text-h6 hover:text-primary-active">
15
+ <a href={href} download aria-label="Скачать">
16
+ {title}
17
+ </a>
18
+ </div>
19
+ </div>
20
+ );
21
+ };
@@ -0,0 +1,23 @@
1
+ import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
2
+ import { fetchJSONUnsafe } from '../../utils/fetchJSON';
3
+
4
+ export interface DepositoryDataItem {
5
+ publicId?: number;
6
+ timestamp?: number;
7
+ title?: number;
8
+ }
9
+
10
+ interface DepositoryData {
11
+ content?: DepositoryDataItem[];
12
+ totalPages?: number;
13
+ totalElements?: number;
14
+ }
15
+
16
+ export const useDepository = (size: number, page: number) => {
17
+ const { data } = useAsyncData<DepositoryData>(
18
+ `/api/v1/depository?page=${page}&size=${size}`,
19
+ fetchJSONUnsafe,
20
+ );
21
+
22
+ return { items: data?.content, totalPages: data?.totalPages };
23
+ };
@@ -35,6 +35,9 @@ export type AtmsDef = {
35
35
  */
36
36
  export type OfficesAtmsBlockDef = EmptyOption | OfficesDef | AtmsDef;
37
37
 
38
+ /**
39
+ * @title Блок офисов и банкоматов
40
+ */
38
41
  export type OfficesAtmsMapContent = UniBlockContent & {
39
42
  data?: OfficesAtmsBlockDef;
40
43
  };
@@ -35,11 +35,13 @@ export const StickyBottomMenu = JSX<StickyBottomMenuProps>(({ ...rest }) => {
35
35
  );
36
36
 
37
37
  return (
38
- <BlockWrapper
39
- className="fixed bottom-0 left-0 right-0 my-0 mx-auto w-full bg-transparent z-[100]"
40
- padding="p-0"
41
- >
42
- {<RenderMenuItems menuItems={menuItemsWithButton} onClick={toggle} />}
43
- </BlockWrapper>
38
+ <div className="w-full mb-5">
39
+ <BlockWrapper
40
+ className="@container-normal fixed w-full h-[74] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]"
41
+ padding="p-0"
42
+ >
43
+ <RenderMenuItems menuItems={menuItemsWithButton} onClick={toggle} />
44
+ </BlockWrapper>
45
+ </div>
44
46
  );
45
47
  });
@@ -1,3 +1,6 @@
1
1
  import type { SwipeListControlContent } from '../../ui-kit/SwipeListControl/SwipeListControlContent';
2
2
 
3
+ /**
4
+ * @title Swipe-контроллер
5
+ */
3
6
  export type SwipeListControlBlockContent = SwipeListControlContent;
@@ -1,5 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { style } from '../../utils/style';
4
4
  import { Text } from '../Text/Text';
5
5
  import type { InputProps } from './InputProps';
@@ -23,6 +23,7 @@ export const Input = JSX<InputProps>(
23
23
  pattern,
24
24
  autoFocus = false,
25
25
  }) => {
26
+ const inputRef = useRef<HTMLInputElement | null>(null);
26
27
  const handleChange = useCallback(
27
28
  (e: { target?: { value?: string } }) => {
28
29
  onChange && onChange(e.target?.value || '');
@@ -30,6 +31,12 @@ export const Input = JSX<InputProps>(
30
31
  [onChange],
31
32
  );
32
33
 
34
+ useEffect(() => {
35
+ if (autoFocus) {
36
+ inputRef.current?.focus();
37
+ }
38
+ }, [autoFocus, inputRef]);
39
+
33
40
  const paddingStyle = children ? 'pr-3xl' : '';
34
41
  const validStyle = valid
35
42
  ? 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'
@@ -46,6 +53,7 @@ export const Input = JSX<InputProps>(
46
53
  </div>
47
54
  ) : null}
48
55
  <input
56
+ ref={inputRef}
49
57
  key={key}
50
58
  className={style(
51
59
  'w-full border rounded-md text-primary-text outline-none p-m',
@@ -62,7 +70,6 @@ export const Input = JSX<InputProps>(
62
70
  onFocus={onFocus}
63
71
  onBlur={onBlur}
64
72
  pattern={pattern}
65
- autoFocus={autoFocus}
66
73
  />
67
74
  </label>
68
75
  {children}
@@ -0,0 +1,87 @@
1
+ import { useCallback, useMemo } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { Icon } from '../Icon/Icon';
3
+ import { renderPages } from './renderPages';
4
+
5
+ export const paginationBlockStyle =
6
+ 'py-m px-lg rounded-md cursor-pointer hover:bg-green-more-dark hover:text-white';
7
+
8
+ export interface PaginationProps {
9
+ currentPage: number;
10
+ onPageChange: (page: number) => void;
11
+ totalPages: number;
12
+ }
13
+
14
+ const ICON_SIZE = { width: '24', height: '24' };
15
+
16
+ export const Pagination = ({ currentPage, onPageChange, totalPages }: PaginationProps) => {
17
+ const handlePrevPage = useCallback(() => {
18
+ if (currentPage > 1) {
19
+ onPageChange(currentPage - 1);
20
+ }
21
+ }, [currentPage]);
22
+
23
+ const handleNextPage = useCallback(() => {
24
+ if (currentPage < totalPages - 1) {
25
+ onPageChange(currentPage + 1);
26
+ }
27
+ }, [currentPage, totalPages]);
28
+
29
+ const handleFirstPage = useCallback(() => onPageChange(1), []);
30
+ const handleLastPage = useCallback(() => onPageChange(totalPages), [totalPages]);
31
+
32
+ const pages = useMemo(
33
+ () =>
34
+ new Array(totalPages).fill({
35
+ currentPage,
36
+ onPageChange,
37
+ totalPages,
38
+ }),
39
+ [totalPages, currentPage],
40
+ );
41
+
42
+ return (
43
+ <div className="mt-3xl flex items-center select-none" role="navigation" aria-label="Пагинация">
44
+ <div className="flex gap-m items-center">
45
+ <div onClick={handlePrevPage}>
46
+ <Icon
47
+ name="ArrowLeftIcon"
48
+ iconVersion="black"
49
+ imageClassName={getIconStyle(currentPage === 1)}
50
+ {...ICON_SIZE}
51
+ />
52
+ </div>
53
+ <div className="flex gap-xs">
54
+ {currentPage > 1 ? (
55
+ <div onClick={handleFirstPage} className={paginationBlockStyle} aria-label="Страница 1">
56
+ 1
57
+ </div>
58
+ ) : null}
59
+ {currentPage > 4 ? <div className="py-m px-s">...</div> : null}
60
+ {pages.map(renderPages)}
61
+ {currentPage < totalPages - 3 ? <div className="py-m px-s">...</div> : null}
62
+ {currentPage < totalPages ? (
63
+ <div
64
+ onClick={handleLastPage}
65
+ className={paginationBlockStyle}
66
+ aria-label={`Страница ${totalPages}}`}
67
+ >
68
+ {totalPages}
69
+ </div>
70
+ ) : null}
71
+ </div>
72
+ <div onClick={handleNextPage}>
73
+ <Icon
74
+ className="rotate-180"
75
+ name="ArrowLeftIcon"
76
+ iconVersion="black"
77
+ imageClassName={getIconStyle(currentPage === totalPages)}
78
+ {...ICON_SIZE}
79
+ />
80
+ </div>
81
+ </div>
82
+ </div>
83
+ );
84
+ };
85
+
86
+ const getIconStyle = (condition: boolean) =>
87
+ condition ? 'opacity-20' : 'cursor-pointer hover:opacity-60';
@@ -0,0 +1,33 @@
1
+ import { paginationBlockStyle, PaginationProps } from './Pagination';
2
+ import { shouldRenderPage } from './shouldRenderPage';
3
+
4
+ export const renderPages = (pagesParams: PaginationProps, index: number) => {
5
+ const { currentPage, onPageChange, totalPages } = pagesParams;
6
+ const page = index + 1;
7
+ if (page === currentPage) {
8
+ return (
9
+ <div
10
+ key={String(index)}
11
+ aria-current="true"
12
+ className="py-m px-lg bg-green-light text-white rounded-md"
13
+ >
14
+ {page}
15
+ </div>
16
+ );
17
+ }
18
+
19
+ if (page !== 1 && page !== totalPages && shouldRenderPage(page, currentPage, totalPages)) {
20
+ return (
21
+ <div
22
+ key={String(index)}
23
+ onClick={() => onPageChange(page)}
24
+ className={paginationBlockStyle}
25
+ aria-label={`Страница ${page}`}
26
+ >
27
+ {page}
28
+ </div>
29
+ );
30
+ }
31
+
32
+ return null;
33
+ };
@@ -0,0 +1,8 @@
1
+ const checkPageRange = (page: number, currentPage: number, totalPages: number) =>
2
+ (currentPage <= 3 && page <= currentPage + 3) ||
3
+ (currentPage >= totalPages - 1 && page >= totalPages - 4);
4
+
5
+ export const shouldRenderPage = (page: number, currentPage: number, totalPages: number) =>
6
+ (page < currentPage && page >= currentPage - 2) ||
7
+ (page <= currentPage + 2 && page > currentPage) ||
8
+ checkPageRange(page, currentPage, totalPages);
@@ -1,6 +1,3 @@
1
- import { compareBy, desc } from '../../utils/Comparator';
2
- import { jaroWinklerDistance } from '../../utils/jaroWinklerDistance';
3
- import { zip } from '../../utils/zip';
4
1
  import type { Option } from './Option';
5
2
 
6
3
  export const filterOptions = (options: Option[], query: string | undefined): Option[] => {
@@ -8,12 +5,5 @@ export const filterOptions = (options: Option[], query: string | undefined): Opt
8
5
  return options;
9
6
  }
10
7
 
11
- const ranking = options
12
- .map((_) => _.text?.toLowerCase())
13
- .map(jaroWinklerDistance(query?.trim().toLowerCase()));
14
-
15
- return zip(options, ranking)
16
- .filter(([, rank]) => rank >= 0.5)
17
- .sort(desc(compareBy(([, rank]) => rank)))
18
- .map(([option]) => option);
8
+ return options.filter((_) => _.text?.toLocaleLowerCase().includes(query?.trim().toLocaleLowerCase()))
19
9
  };
@@ -0,0 +1,15 @@
1
+ export const convertTimestampToDate = (timestamp: number) => {
2
+ const date = new Date(timestamp * 1000);
3
+
4
+ let dd: string | number = date.getDate();
5
+ if (dd < 10) {
6
+ dd = '0' + dd;
7
+ }
8
+
9
+ let mm: string | number = date.getMonth() + 1;
10
+ if (mm < 10) {
11
+ mm = '0' + mm;
12
+ }
13
+
14
+ return dd + '.' + mm + '.' + date.getFullYear();
15
+ };
@@ -5,5 +5,5 @@ export async function fetchMultitudeJSON<R = unknown>(
5
5
  ): Promise<Awaited<R | null>[]> {
6
6
  const fetchPromises = urls.map((url) => fetchJSON<R>(url));
7
7
 
8
- return await Promise.all(fetchPromises);
8
+ return Promise.all(fetchPromises);
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.5",
3
+ "version": "0.14.7",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useSWRResource } from '../../hooks/useSWRResource';
4
- import { RegionsGrantSupportData } from '../../services/regionsGrantSupport/RegionsGrantSupportData';
4
+ import type { RegionsGrantSupportData } from '../../services/regionsGrantSupport/RegionsGrantSupportData';
5
5
  import { Button } from '../../ui-kit/Button/Button';
6
6
  import { getRegularButtonClasses } from '../../ui-kit/Button/getRegularButtonClasses';
7
7
  import { style } from '../../utils/style';
@@ -13,8 +13,8 @@ interface RegionProps {
13
13
  export const renderRegion = ({ regions, field }: RegionProps) => (
14
14
  <SelectControl
15
15
  className="w-full"
16
- label="Регион"
17
- placeholder="Выберите регион"
16
+ label="Филиал"
17
+ placeholder="Выберите филиал"
18
18
  isSearch={true}
19
19
  options={regions.map(({ code = '', name = '' }) => ({ key: code, text: name }))}
20
20
  {...withValidator(field('region'), defaultValidator)}