@redneckz/wildless-cms-uni-blocks 0.14.814 → 0.14.816

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 (127) hide show
  1. package/bundle/UniBlock/UniBlock.d.ts +3 -1
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +86 -19
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/GalleryLayout/GalleryLayout.d.ts +5 -0
  6. package/bundle/components/GalleryLayout/GalleryLayoutContent.d.ts +14 -0
  7. package/bundle/model/FormTypeFieldDef.d.ts +1 -1
  8. package/dist/BlockRenderer/renderBlock.js +1 -1
  9. package/dist/BlockRenderer/renderBlock.js.map +1 -1
  10. package/dist/UniBlock/UniBlock.d.ts +3 -1
  11. package/dist/UniBlock/UniBlock.js.map +1 -1
  12. package/dist/components/Blocks.js +2 -0
  13. package/dist/components/Blocks.js.map +1 -1
  14. package/dist/components/Blocks.mobile.js +2 -0
  15. package/dist/components/Blocks.mobile.js.map +1 -1
  16. package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  17. package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  18. package/dist/components/GalleryLayout/GalleryLayout.d.ts +5 -0
  19. package/dist/components/GalleryLayout/GalleryLayout.js +71 -0
  20. package/dist/components/GalleryLayout/GalleryLayout.js.map +1 -0
  21. package/dist/components/GalleryLayout/GalleryLayoutContent.d.ts +14 -0
  22. package/dist/components/GalleryLayout/GalleryLayoutContent.js +2 -0
  23. package/dist/components/GalleryLayout/GalleryLayoutContent.js.map +1 -0
  24. package/dist/model/FormTypeFieldDef.d.ts +1 -1
  25. package/dist/ui-kit/BaseProductTile/BaseProductTile.js +8 -1
  26. package/dist/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  27. package/dist/ui-kit/BaseTile/BaseTile.js +3 -3
  28. package/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
  29. package/lib/BlockRenderer/renderBlock.js +1 -1
  30. package/lib/BlockRenderer/renderBlock.js.map +1 -1
  31. package/lib/UniBlock/UniBlock.d.ts +3 -1
  32. package/lib/UniBlock/UniBlock.js.map +1 -1
  33. package/lib/common.css +1 -1
  34. package/lib/components/ApplicationForm/ApplicationForm.fixture.d.ts +1 -0
  35. package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
  36. package/lib/components/Blocks.js +2 -0
  37. package/lib/components/Blocks.js.map +1 -1
  38. package/lib/components/Blocks.mobile.js +2 -0
  39. package/lib/components/Blocks.mobile.js.map +1 -1
  40. package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  41. package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  42. package/lib/components/GalleryLayout/GalleryLayout.d.ts +5 -0
  43. package/lib/components/GalleryLayout/GalleryLayout.fixture.d.ts +5 -0
  44. package/lib/components/GalleryLayout/GalleryLayout.js +69 -0
  45. package/lib/components/GalleryLayout/GalleryLayout.js.map +1 -0
  46. package/lib/components/GalleryLayout/GalleryLayoutContent.d.ts +14 -0
  47. package/lib/components/GalleryLayout/GalleryLayoutContent.js +2 -0
  48. package/lib/components/GalleryLayout/GalleryLayoutContent.js.map +1 -0
  49. package/lib/model/FormTypeFieldDef.d.ts +1 -1
  50. package/lib/ui-kit/BaseProductTile/BaseProductTile.js +9 -2
  51. package/lib/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  52. package/lib/ui-kit/BaseTile/BaseTile.js +3 -3
  53. package/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
  54. package/mobile/bundle/UniBlock/UniBlock.d.ts +3 -1
  55. package/mobile/bundle/bundle.umd.js +86 -19
  56. package/mobile/bundle/bundle.umd.min.js +1 -1
  57. package/mobile/bundle/components/GalleryLayout/GalleryLayout.d.ts +5 -0
  58. package/mobile/bundle/components/GalleryLayout/GalleryLayoutContent.d.ts +14 -0
  59. package/mobile/bundle/model/FormTypeFieldDef.d.ts +1 -1
  60. package/mobile/dist/BlockRenderer/renderBlock.js +1 -1
  61. package/mobile/dist/BlockRenderer/renderBlock.js.map +1 -1
  62. package/mobile/dist/UniBlock/UniBlock.d.ts +3 -1
  63. package/mobile/dist/UniBlock/UniBlock.js.map +1 -1
  64. package/mobile/dist/components/Blocks.js +2 -0
  65. package/mobile/dist/components/Blocks.js.map +1 -1
  66. package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  67. package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  68. package/mobile/dist/components/GalleryLayout/GalleryLayout.d.ts +5 -0
  69. package/mobile/dist/components/GalleryLayout/GalleryLayout.js +71 -0
  70. package/mobile/dist/components/GalleryLayout/GalleryLayout.js.map +1 -0
  71. package/mobile/dist/components/GalleryLayout/GalleryLayoutContent.d.ts +14 -0
  72. package/mobile/dist/components/GalleryLayout/GalleryLayoutContent.js +2 -0
  73. package/mobile/dist/components/GalleryLayout/GalleryLayoutContent.js.map +1 -0
  74. package/mobile/dist/model/FormTypeFieldDef.d.ts +1 -1
  75. package/mobile/dist/ui-kit/BaseProductTile/BaseProductTile.js +8 -1
  76. package/mobile/dist/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  77. package/mobile/dist/ui-kit/BaseTile/BaseTile.js +3 -3
  78. package/mobile/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
  79. package/mobile/lib/BlockRenderer/renderBlock.js +1 -1
  80. package/mobile/lib/BlockRenderer/renderBlock.js.map +1 -1
  81. package/mobile/lib/UniBlock/UniBlock.d.ts +3 -1
  82. package/mobile/lib/UniBlock/UniBlock.js.map +1 -1
  83. package/mobile/lib/common.css +1 -1
  84. package/mobile/lib/components/Blocks.js +2 -0
  85. package/mobile/lib/components/Blocks.js.map +1 -1
  86. package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  87. package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  88. package/mobile/lib/components/GalleryLayout/GalleryLayout.d.ts +5 -0
  89. package/mobile/lib/components/GalleryLayout/GalleryLayout.js +69 -0
  90. package/mobile/lib/components/GalleryLayout/GalleryLayout.js.map +1 -0
  91. package/mobile/lib/components/GalleryLayout/GalleryLayoutContent.d.ts +14 -0
  92. package/mobile/lib/components/GalleryLayout/GalleryLayoutContent.js +2 -0
  93. package/mobile/lib/components/GalleryLayout/GalleryLayoutContent.js.map +1 -0
  94. package/mobile/lib/model/FormTypeFieldDef.d.ts +1 -1
  95. package/mobile/lib/ui-kit/BaseProductTile/BaseProductTile.js +9 -2
  96. package/mobile/lib/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  97. package/mobile/lib/ui-kit/BaseTile/BaseTile.js +3 -3
  98. package/mobile/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
  99. package/mobile/src/BlockRenderer/renderBlock.tsx +3 -3
  100. package/mobile/src/UniBlock/UniBlock.tsx +3 -1
  101. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +87 -0
  102. package/mobile/src/components/Blocks.ts +2 -0
  103. package/mobile/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +1 -0
  104. package/mobile/src/components/GalleryLayout/GalleryLayout.example.json +102 -0
  105. package/mobile/src/components/GalleryLayout/GalleryLayout.tsx +140 -0
  106. package/mobile/src/components/GalleryLayout/GalleryLayout.ui.json +1 -0
  107. package/mobile/src/components/GalleryLayout/GalleryLayoutContent.ts +16 -0
  108. package/mobile/src/model/FormTypeFieldDef.ts +2 -1
  109. package/mobile/src/ui-kit/BaseProductTile/BaseProductTile.tsx +60 -23
  110. package/mobile/src/ui-kit/BaseTile/BaseTile.tsx +11 -7
  111. package/package.json +2 -2
  112. package/src/BlockRenderer/renderBlock.tsx +3 -3
  113. package/src/UniBlock/UniBlock.tsx +3 -1
  114. package/src/components/ApplicationForm/ApplicationForm.example.json +87 -0
  115. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +60 -0
  116. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +60 -0
  117. package/src/components/Blocks.mobile.ts +2 -0
  118. package/src/components/Blocks.ts +2 -0
  119. package/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +1 -0
  120. package/src/components/GalleryLayout/GalleryLayout.example.json +102 -0
  121. package/src/components/GalleryLayout/GalleryLayout.fixture.tsx +61 -0
  122. package/src/components/GalleryLayout/GalleryLayout.tsx +140 -0
  123. package/src/components/GalleryLayout/GalleryLayout.ui.json +1 -0
  124. package/src/components/GalleryLayout/GalleryLayoutContent.ts +16 -0
  125. package/src/model/FormTypeFieldDef.ts +2 -1
  126. package/src/ui-kit/BaseProductTile/BaseProductTile.tsx +60 -23
  127. package/src/ui-kit/BaseTile/BaseTile.tsx +11 -7
@@ -1222,5 +1222,92 @@
1222
1222
  }
1223
1223
  }
1224
1224
  }
1225
+ ],
1226
+ [
1227
+ "Финансовый омбудсмен",
1228
+ {
1229
+ "content": {
1230
+ "version": "primary",
1231
+ "title": "Финансовый омбудсмен",
1232
+ "typeForm": "FINOMBUDSMAN",
1233
+ "endpoint": "lead",
1234
+ "sections": [
1235
+ {
1236
+ "inputs": [
1237
+ {
1238
+ "name": "serviceDirection"
1239
+ },
1240
+ {
1241
+ "name": "surname",
1242
+ "required": true
1243
+ },
1244
+ {
1245
+ "name": "name",
1246
+ "required": true
1247
+ },
1248
+ {
1249
+ "name": "inn",
1250
+ "required": true,
1251
+ "condition": {
1252
+ "name": "serviceDirection",
1253
+ "values": ["Юридическое лицо / ИП"]
1254
+ }
1255
+ },
1256
+ {
1257
+ "name": "fullName",
1258
+ "label": "Наименование организации",
1259
+ "condition": {
1260
+ "name": "serviceDirection",
1261
+ "values": ["Юридическое лицо / ИП"]
1262
+ }
1263
+ },
1264
+ {
1265
+ "name": "phone",
1266
+ "required": true
1267
+ },
1268
+ {
1269
+ "name": "email",
1270
+ "required": true
1271
+ },
1272
+ {
1273
+ "name": "comment",
1274
+ "required": true,
1275
+ "label": "Ваше сообщение",
1276
+ "condition": {
1277
+ "name": "serviceDirection",
1278
+ "values": ["Физическое лицо"]
1279
+ }
1280
+ },
1281
+ {
1282
+ "name": "partnerComments",
1283
+ "label": "Ваше сообщение",
1284
+ "required": true,
1285
+ "condition": {
1286
+ "name": "serviceDirection",
1287
+ "values": ["Юридическое лицо / ИП"]
1288
+ }
1289
+ }
1290
+ ]
1291
+ },
1292
+ {
1293
+ "inputs": [
1294
+ {
1295
+ "name": "consentDataProcessing",
1296
+ "required": true
1297
+ }
1298
+ ]
1299
+ }
1300
+ ],
1301
+ "button": {
1302
+ "text": "Отправить заявку",
1303
+ "version": "primary"
1304
+ },
1305
+ "link": {
1306
+ "text": "Согласен на обработку персональных данных",
1307
+ "href": "/privacy-policy",
1308
+ "target": "_blank"
1309
+ }
1310
+ }
1311
+ }
1225
1312
  ]
1226
1313
  ]
@@ -735,4 +735,64 @@ export default {
735
735
  <DialogManager />
736
736
  </div>
737
737
  ),
738
+ finOmbudsman: (
739
+ <div className="container grid grid-cols-12">
740
+ <ApplicationForm
741
+ className="col-span-12"
742
+ title="Финансовый омбудсмен"
743
+ typeForm="FINOMBUDSMAN"
744
+ endpoint="lead"
745
+ sections={[
746
+ {
747
+ inputs: [
748
+ { name: 'serviceDirection' },
749
+ { name: 'surname', required: true },
750
+ { name: 'name', required: true },
751
+ {
752
+ name: 'inn',
753
+ required: true,
754
+ condition: {
755
+ name: 'serviceDirection',
756
+ values: ['Юридическое лицо / ИП'],
757
+ },
758
+ },
759
+ {
760
+ name: 'fullName',
761
+ label: 'Наименование организации',
762
+ condition: {
763
+ name: 'serviceDirection',
764
+ values: ['Юридическое лицо / ИП'],
765
+ },
766
+ },
767
+ { name: 'phone', required: true },
768
+ { name: 'email', required: true },
769
+ {
770
+ name: 'comment',
771
+ required: true,
772
+ label: 'Ваше сообщение',
773
+ condition: {
774
+ name: 'serviceDirection',
775
+ values: ['Физическое лицо'],
776
+ },
777
+ },
778
+ {
779
+ name: 'partnerComments',
780
+ required: true,
781
+ label: 'Ваше сообщение',
782
+ condition: {
783
+ name: 'serviceDirection',
784
+ values: ['Юридическое лицо / ИП'],
785
+ },
786
+ },
787
+ ],
788
+ },
789
+ { inputs: [{ name: 'consentDataProcessing', required: true }] },
790
+ ]}
791
+ button={button}
792
+ link={link}
793
+ />
794
+ <PopupManager />
795
+ <DialogManager />
796
+ </div>
797
+ ),
738
798
  };
@@ -730,4 +730,64 @@ export default {
730
730
  <DialogManager />
731
731
  </div>
732
732
  ),
733
+ finOmbudsman: (
734
+ <div className="container grid grid-cols-12">
735
+ <ApplicationForm
736
+ className="col-span-12"
737
+ title="Финансовый омбудсмен"
738
+ typeForm="FINOMBUDSMAN"
739
+ endpoint="lead"
740
+ sections={[
741
+ {
742
+ inputs: [
743
+ { name: 'serviceDirection' },
744
+ { name: 'surname', required: true },
745
+ { name: 'name', required: true },
746
+ {
747
+ name: 'inn',
748
+ required: true,
749
+ condition: {
750
+ name: 'serviceDirection',
751
+ values: ['Юридическое лицо / ИП'],
752
+ },
753
+ },
754
+ {
755
+ name: 'fullName',
756
+ label: 'Наименование организации',
757
+ condition: {
758
+ name: 'serviceDirection',
759
+ values: ['Юридическое лицо / ИП'],
760
+ },
761
+ },
762
+ { name: 'phone', required: true },
763
+ { name: 'email', required: true },
764
+ {
765
+ name: 'comment',
766
+ required: true,
767
+ label: 'Ваше сообщение',
768
+ condition: {
769
+ name: 'serviceDirection',
770
+ values: ['Физическое лицо'],
771
+ },
772
+ },
773
+ {
774
+ name: 'partnerComments',
775
+ required: true,
776
+ label: 'Ваше сообщение',
777
+ condition: {
778
+ name: 'serviceDirection',
779
+ values: ['Юридическое лицо / ИП'],
780
+ },
781
+ },
782
+ ],
783
+ },
784
+ { inputs: [{ name: 'consentDataProcessing', required: true }] },
785
+ ]}
786
+ button={button}
787
+ link={link}
788
+ />
789
+ <PopupManager />
790
+ <DialogManager />
791
+ </div>
792
+ ),
733
793
  };
@@ -26,6 +26,7 @@ import { Depository } from './Depository/Depository';
26
26
  import { ErrorBlock } from './ErrorBlock/ErrorBlock';
27
27
  import { ExchangeRateTile } from './ExchangeRateTile/ExchangeRateTile';
28
28
  import { Footer } from './Footer/Footer';
29
+ import { GalleryLayout } from './GalleryLayout/GalleryLayout';
29
30
  import { GrantSupport } from './GrantSupport/GrantSupport';
30
31
  import { Header } from './Header/Header';
31
32
  import { Headline } from './Headline/Headline';
@@ -74,6 +75,7 @@ export const Blocks: BlocksRegistry = {
74
75
  ErrorBlock,
75
76
  ExchangeRateTile,
76
77
  Footer,
78
+ GalleryLayout,
77
79
  GrantSupport,
78
80
  Header,
79
81
  Headline,
@@ -28,6 +28,7 @@ import { Depository } from './Depository/Depository';
28
28
  import { ErrorBlock } from './ErrorBlock/ErrorBlock';
29
29
  import { ExchangeRateTile } from './ExchangeRateTile/ExchangeRateTile';
30
30
  import { Footer } from './Footer/Footer';
31
+ import { GalleryLayout } from './GalleryLayout/GalleryLayout';
31
32
  import { GracePeriod } from './GracePeriod/GracePeriod';
32
33
  import { GrantSupport } from './GrantSupport/GrantSupport';
33
34
  import { Header } from './Header/Header';
@@ -81,6 +82,7 @@ export const Blocks: BlocksRegistry = {
81
82
  ErrorBlock,
82
83
  ExchangeRateTile,
83
84
  Footer,
85
+ GalleryLayout,
84
86
  GracePeriod,
85
87
  GrantSupport,
86
88
  Header,
@@ -45,6 +45,7 @@ export const CarouselCatalogCard = JSX<CarouselCatalogCardProps>(
45
45
  headlineVersion="XS"
46
46
  isEmbedded={true}
47
47
  align={align}
48
+ className="min-h-24"
48
49
  />
49
50
  }
50
51
  rightImage={
@@ -0,0 +1,102 @@
1
+ {
2
+ "content": {
3
+ "gap": "L",
4
+ "version": "primary",
5
+ "padding": "p-xl"
6
+ },
7
+ "blocks": [
8
+ {
9
+ "content": {
10
+ "version": "secondary",
11
+ "title": "Продукт",
12
+ "description": "Описание",
13
+ "headlineVersion": "XL",
14
+ "backwardButton": false,
15
+ "isDotted": true,
16
+ "buttons": [
17
+ {
18
+ "text": "Кнопка",
19
+ "version": "secondary"
20
+ }
21
+ ],
22
+ "padding": "p-xl",
23
+ "benefitsVersion": "normal",
24
+ "benefits": [
25
+ {
26
+ "label": "Преимущество №1",
27
+ "icon": {
28
+ "icon": "SmallClockIcon"
29
+ }
30
+ },
31
+ {
32
+ "label": "Преимущество №2",
33
+ "icon": {
34
+ "icon": "SignDocsIcon"
35
+ }
36
+ }
37
+ ],
38
+ "imageOptions": {
39
+ "imageAlign": "end"
40
+ }
41
+ },
42
+ "style": ["col-span-12"],
43
+ "type": "ProductBlock"
44
+ },
45
+ {
46
+ "content": {
47
+ "version": "secondary",
48
+ "title": "Продукт",
49
+ "headlineVersion": "S",
50
+ "backwardButton": false,
51
+ "padding": "p-xl",
52
+ "imageOptions": {
53
+ "imageAlign": "end"
54
+ }
55
+ },
56
+ "style": ["col-span-12"],
57
+ "type": "ProductBlock"
58
+ },
59
+ {
60
+ "content": {
61
+ "version": "secondary",
62
+ "title": "Продукт",
63
+ "headlineVersion": "S",
64
+ "backwardButton": false,
65
+ "padding": "p-xl",
66
+ "imageOptions": {
67
+ "imageAlign": "end"
68
+ }
69
+ },
70
+ "style": ["col-span-12"],
71
+ "type": "ProductBlock"
72
+ },
73
+ {
74
+ "content": {
75
+ "version": "secondary",
76
+ "title": "Продукт",
77
+ "headlineVersion": "S",
78
+ "backwardButton": false,
79
+ "padding": "p-xl",
80
+ "imageOptions": {
81
+ "imageAlign": "end"
82
+ }
83
+ },
84
+ "style": ["col-span-12"],
85
+ "type": "ProductBlock"
86
+ },
87
+ {
88
+ "content": {
89
+ "version": "secondary",
90
+ "title": "Продукт",
91
+ "headlineVersion": "S",
92
+ "backwardButton": false,
93
+ "padding": "p-xl",
94
+ "imageOptions": {
95
+ "imageAlign": "end"
96
+ }
97
+ },
98
+ "style": ["col-span-12"],
99
+ "type": "ProductBlock"
100
+ }
101
+ ]
102
+ }
@@ -0,0 +1,61 @@
1
+ import type { BlockRendererOptions } from '../../BlockRenderer/BlockRendererOptions';
2
+ import type { LinkProps } from '../../model/LinkProps';
3
+ import '../../setup-fixture';
4
+ import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
5
+ import { Blocks } from '../Blocks';
6
+ import { PRODUCT_BLOCK_WITH_IMAGE } from '../ProductBlock/ProductBlock.fixture';
7
+ import { type ProductBlockContent } from '../ProductBlock/ProductBlockContent';
8
+ import { GalleryLayout } from './GalleryLayout';
9
+
10
+ const options: BlockRendererOptions = {
11
+ blocksRegistry: Blocks,
12
+ };
13
+
14
+ const PRODUCT_BLOCK_TYPE = 'ProductBlock';
15
+
16
+ const CONTENT: ProductBlockContent & UniBlockProps & { link?: LinkProps } = {
17
+ ...PRODUCT_BLOCK_WITH_IMAGE,
18
+ version: 'secondary',
19
+ padding: 'p-xl',
20
+ imageOptions: {
21
+ imageAlign: 'end',
22
+ },
23
+ className: 'rounded-xl', // for identity with maket
24
+ link: {
25
+ href: 'https://google.com',
26
+ },
27
+ };
28
+
29
+ const SHORT_TILE_CONTENT: ProductBlockContent & UniBlockProps = {
30
+ ...CONTENT,
31
+ image: {
32
+ ...CONTENT.image,
33
+ size: {
34
+ width: 130,
35
+ height: 130,
36
+ },
37
+ },
38
+ };
39
+
40
+ export default {
41
+ default: (
42
+ <div className="container grid grid-cols-12">
43
+ <GalleryLayout
44
+ className="col-span-12"
45
+ gap="L"
46
+ padding="p-xl"
47
+ block={{
48
+ type: 'GalleryLayout',
49
+ blocks: [
50
+ { type: PRODUCT_BLOCK_TYPE, content: CONTENT },
51
+ { type: PRODUCT_BLOCK_TYPE, content: SHORT_TILE_CONTENT },
52
+ { type: PRODUCT_BLOCK_TYPE, content: SHORT_TILE_CONTENT },
53
+ { type: PRODUCT_BLOCK_TYPE, content: SHORT_TILE_CONTENT },
54
+ { type: PRODUCT_BLOCK_TYPE, content: SHORT_TILE_CONTENT },
55
+ ],
56
+ }}
57
+ options={options}
58
+ />
59
+ </div>
60
+ ),
61
+ };
@@ -0,0 +1,140 @@
1
+ import { type JSONSchema7Definition } from 'json-schema';
2
+ import { renderBlock } from '../../BlockRenderer/renderBlock';
3
+ import { type ChildRenderProps } from '../../BlockRenderer/renderBlockList';
4
+ import { renderChildren } from '../../BlockRenderer/renderChildren';
5
+ import { type BlockDecorator } from '../../model/BlockDecorator';
6
+ import { type BlockDef } from '../../model/ContentPageDef';
7
+ import { type LinkProps } from '../../model/LinkProps';
8
+ import { BlockWrapper } from '../../ui-kit/BlockWrapper';
9
+ import { LinkWrapper } from '../../ui-kit/LinkWrapper/LinkWrapper';
10
+ import { UniBlock } from '../../UniBlock/UniBlock';
11
+ import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
12
+ import { getBorderStyle } from '../../utils/getBorderStyle';
13
+ import { getInnerPadding } from '../../utils/getInnerPadding';
14
+ import { style } from '../../utils/style';
15
+ import { gapStyles } from '../HorizontalLayout/gapStyles';
16
+ import { type ProductBlockContent } from '../ProductBlock/ProductBlockContent';
17
+ import { type GalleryLayoutContent } from './GalleryLayoutContent';
18
+
19
+ const MIN_LENGTH_CHILD = 5;
20
+ const SHORT_TILE_INDEXES = [1, 2, 3, 4];
21
+ const LINK_SCHEMA: Record<string, JSONSchema7Definition> = {
22
+ link: {
23
+ allOf: [
24
+ { $ref: `#/definitions/LinkCommonProps` },
25
+ {
26
+ type: 'object',
27
+ properties: {
28
+ data: {
29
+ type: 'array',
30
+ items: { $ref: '#/definitions/AspectsDef' },
31
+ title: 'Дополнительные атрибуты',
32
+ },
33
+ },
34
+ },
35
+ ],
36
+ title: 'Ссылка',
37
+ required: ['href'],
38
+ },
39
+ };
40
+
41
+ export interface GalleryLayoutProps extends GalleryLayoutContent, UniBlockProps {}
42
+
43
+ export const GalleryLayout = UniBlock<GalleryLayoutProps>(
44
+ ({
45
+ className = '',
46
+ padding = 'p-0',
47
+ gap = '',
48
+ isInnerPadding = true,
49
+ version = 'transparent',
50
+ isTheme = false,
51
+ isCardBorder = false,
52
+ ...rest
53
+ }) => (
54
+ <BlockWrapper
55
+ className={style(
56
+ 'grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-4 lg:auto-rows-fr',
57
+ gapStyles[gap],
58
+ className,
59
+ )}
60
+ padding={padding}
61
+ version={version}
62
+ isTheme={isTheme}
63
+ {...rest}
64
+ >
65
+ {renderChildren({
66
+ ...rest,
67
+ renderProps: getRenderProps({ isInnerPadding, isCardBorder }),
68
+ })}
69
+ </BlockWrapper>
70
+ ),
71
+ {
72
+ childrenTypes: ['ProductBlock'],
73
+ childSchema: () => LINK_SCHEMA,
74
+ allowRemoveChild: (slot) => (slot?.blocks ?? []).length > MIN_LENGTH_CHILD,
75
+ },
76
+ );
77
+
78
+ const getRenderProps =
79
+ ({
80
+ isInnerPadding,
81
+ isCardBorder,
82
+ }: {
83
+ isInnerPadding: boolean;
84
+ isCardBorder: boolean;
85
+ }): ChildRenderProps =>
86
+ (childBlock, childOptions, i) =>
87
+ renderBlock(
88
+ childBlock,
89
+ {
90
+ ...childOptions,
91
+ blockDecorator: blockDecoratorWrapper(childOptions.blockDecorator, i),
92
+ },
93
+ {
94
+ className: style('w-full', getBorderStyle(isCardBorder)),
95
+ ...getInnerPadding(isInnerPadding),
96
+ },
97
+ );
98
+
99
+ const blockDecoratorWrapper =
100
+ (blockDecorator?: BlockDecorator, idx = 0): BlockDecorator =>
101
+ (props, i) =>
102
+ blockDecorator?.(
103
+ {
104
+ ...props,
105
+ render: (renderProps) => productBlockDecorator(idx)({ ...props, ...renderProps }, i),
106
+ },
107
+ `wrap_${i}`,
108
+ ) ?? productBlockDecorator(idx)(props, i);
109
+
110
+ const productBlockDecorator =
111
+ (idx: number): BlockDecorator =>
112
+ ({ blockClassName, block, render }, i) =>
113
+ (
114
+ <LinkWrapper key={i} {...block.content?.link} className={getChildStyle(idx)}>
115
+ {render({
116
+ blockClassName: style(blockClassName, 'h-full'),
117
+ block: modifyBlock(block, idx),
118
+ })}
119
+ </LinkWrapper>
120
+ );
121
+
122
+ const getChildStyle = (index: number) =>
123
+ SHORT_TILE_INDEXES.includes(index)
124
+ ? 'lg:col-span-1 lg:row-span-1'
125
+ : 'lg:col-span-2 lg:row-span-2';
126
+
127
+ const modifyBlock = (block: BlockDef, i: number) => {
128
+ const content: ProductBlockContent & { link?: LinkProps } = { ...block.content };
129
+
130
+ if (SHORT_TILE_INDEXES.includes(i)) {
131
+ delete content.description;
132
+ delete content.benefits;
133
+ }
134
+
135
+ if (content.link?.href) {
136
+ delete content.buttons;
137
+ }
138
+
139
+ return { ...block, content };
140
+ };
@@ -0,0 +1,16 @@
1
+ import { type ImageContent } from '../../ui-kit/Img/ImgProps';
2
+ import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
3
+ import { type GapVersion } from '../HorizontalLayout/HorizontalLayoutContent';
4
+
5
+ export type LayoutCommitProps = {
6
+ gap?: GapVersion;
7
+ /** @title контур на дочерних элементах */
8
+ isCardBorder?: boolean;
9
+ /** @title Отступы вложенных компонентов */
10
+ isInnerPadding?: boolean;
11
+ };
12
+
13
+ /**
14
+ * @title Компоновщик галереи
15
+ */
16
+ export type GalleryLayoutContent = UniBlockContent & LayoutCommitProps & ImageContent;
@@ -20,4 +20,5 @@ export type FormTypeFieldDef =
20
20
  | 'OUTSERVICE'
21
21
  | 'RFB'
22
22
  | 'SUPPORT'
23
- | 'INVESTADVISER';
23
+ | 'INVESTADVISER'
24
+ | 'FINOMBUDSMAN';