@gravity-ui/page-constructor 4.29.0 → 4.29.1-alpha.0

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 (140) hide show
  1. package/build/cjs/blocks/Banner/schema.d.ts +9 -0
  2. package/build/cjs/blocks/CardLayout/schema.d.ts +12 -0
  3. package/build/cjs/blocks/ContentLayout/schema.d.ts +6 -0
  4. package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +9 -0
  5. package/build/cjs/blocks/FilterBlock/schema.d.ts +12 -0
  6. package/build/cjs/blocks/Form/Form.css +136 -0
  7. package/build/cjs/blocks/Form/Form.d.ts +4 -0
  8. package/build/cjs/blocks/Form/Form.js +61 -0
  9. package/build/cjs/blocks/Form/HubspotInlineForm.d.ts +7 -0
  10. package/build/cjs/blocks/Form/HubspotInlineForm.js +14 -0
  11. package/build/cjs/blocks/Form/InnerForm/InnerForm.d.ts +9 -0
  12. package/build/cjs/blocks/Form/InnerForm/InnerForm.js +28 -0
  13. package/build/cjs/blocks/Form/schema.d.ts +202 -0
  14. package/build/cjs/blocks/Form/schema.js +44 -0
  15. package/build/cjs/blocks/Header/Header.js +2 -2
  16. package/build/cjs/blocks/Header/schema.d.ts +3 -0
  17. package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
  18. package/build/cjs/blocks/Icons/schema.d.ts +6 -0
  19. package/build/cjs/blocks/Info/schema.d.ts +6 -0
  20. package/build/cjs/blocks/Map/schema.d.ts +9 -0
  21. package/build/cjs/blocks/Media/schema.d.ts +18 -0
  22. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
  23. package/build/cjs/blocks/Questions/schema.d.ts +6 -0
  24. package/build/cjs/blocks/Slider/schema.d.ts +6 -0
  25. package/build/cjs/blocks/Table/schema.d.ts +3 -0
  26. package/build/cjs/blocks/Tabs/schema.d.ts +12 -0
  27. package/build/cjs/blocks/index.d.ts +1 -0
  28. package/build/cjs/blocks/index.js +3 -1
  29. package/build/cjs/components/Button/Button.d.ts +1 -0
  30. package/build/cjs/components/Button/Button.js +2 -2
  31. package/build/cjs/components/Media/Image/Image.js +4 -4
  32. package/build/cjs/components/ReactPlayer/ReactPlayer.d.ts +1 -2
  33. package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -17
  34. package/build/cjs/components/YandexForm/YandexForm.js +6 -4
  35. package/build/cjs/components/YandexForm/schema.d.ts +16 -0
  36. package/build/cjs/components/YandexForm/schema.js +13 -0
  37. package/build/cjs/constructor-items.d.ts +1 -0
  38. package/build/cjs/constructor-items.js +1 -0
  39. package/build/cjs/editor/data/templates/form-block.json +20 -0
  40. package/build/cjs/models/components.d.ts +1 -2
  41. package/build/cjs/models/constructor-items/blocks.d.ts +33 -5
  42. package/build/cjs/models/constructor-items/blocks.js +13 -1
  43. package/build/cjs/models/constructor-items/common.d.ts +21 -1
  44. package/build/cjs/models/constructor-items/common.js +6 -1
  45. package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -1
  46. package/build/cjs/models/guards.d.ts +3 -1
  47. package/build/cjs/models/guards.js +9 -1
  48. package/build/cjs/schema/constants.d.ts +22 -0
  49. package/build/cjs/schema/constants.js +2 -1
  50. package/build/cjs/schema/validators/blocks.d.ts +1 -0
  51. package/build/cjs/schema/validators/blocks.js +1 -0
  52. package/build/cjs/schema/validators/common.d.ts +23 -1
  53. package/build/cjs/schema/validators/common.js +13 -1
  54. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +6 -0
  55. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
  56. package/build/cjs/sub-blocks/BasicCard/schema.d.ts +6 -0
  57. package/build/cjs/sub-blocks/BasicCard/schema.js +2 -0
  58. package/build/cjs/sub-blocks/Content/schema.d.ts +6 -0
  59. package/build/cjs/sub-blocks/HubspotForm/schema.d.ts +22 -0
  60. package/build/cjs/sub-blocks/HubspotForm/schema.js +17 -0
  61. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +3 -0
  62. package/build/cjs/sub-blocks/Quote/Quote.css +12 -3
  63. package/build/cjs/sub-blocks/Quote/Quote.js +3 -3
  64. package/build/cjs/sub-blocks/Quote/schema.d.ts +7 -0
  65. package/build/cjs/sub-blocks/Quote/schema.js +6 -1
  66. package/build/esm/blocks/Banner/schema.d.ts +9 -0
  67. package/build/esm/blocks/CardLayout/schema.d.ts +12 -0
  68. package/build/esm/blocks/ContentLayout/schema.d.ts +6 -0
  69. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +9 -0
  70. package/build/esm/blocks/FilterBlock/schema.d.ts +12 -0
  71. package/build/esm/blocks/Form/Form.css +136 -0
  72. package/build/esm/blocks/Form/Form.d.ts +5 -0
  73. package/build/esm/blocks/Form/Form.js +59 -0
  74. package/build/esm/blocks/Form/HubspotInlineForm.d.ts +7 -0
  75. package/build/esm/blocks/Form/HubspotInlineForm.js +12 -0
  76. package/build/esm/blocks/Form/InnerForm/InnerForm.d.ts +9 -0
  77. package/build/esm/blocks/Form/InnerForm/InnerForm.js +26 -0
  78. package/build/esm/blocks/Form/schema.d.ts +202 -0
  79. package/build/esm/blocks/Form/schema.js +40 -0
  80. package/build/esm/blocks/Header/Header.js +2 -2
  81. package/build/esm/blocks/Header/schema.d.ts +3 -0
  82. package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
  83. package/build/esm/blocks/Icons/schema.d.ts +6 -0
  84. package/build/esm/blocks/Info/schema.d.ts +6 -0
  85. package/build/esm/blocks/Map/schema.d.ts +9 -0
  86. package/build/esm/blocks/Media/schema.d.ts +18 -0
  87. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
  88. package/build/esm/blocks/Questions/schema.d.ts +6 -0
  89. package/build/esm/blocks/Slider/schema.d.ts +6 -0
  90. package/build/esm/blocks/Table/schema.d.ts +3 -0
  91. package/build/esm/blocks/Tabs/schema.d.ts +12 -0
  92. package/build/esm/blocks/index.d.ts +1 -0
  93. package/build/esm/blocks/index.js +1 -0
  94. package/build/esm/components/Button/Button.d.ts +1 -0
  95. package/build/esm/components/Button/Button.js +2 -2
  96. package/build/esm/components/Media/Image/Image.js +1 -1
  97. package/build/esm/components/ReactPlayer/ReactPlayer.d.ts +1 -2
  98. package/build/esm/components/YandexForm/YandexForm.d.ts +2 -17
  99. package/build/esm/components/YandexForm/YandexForm.js +5 -3
  100. package/build/esm/components/YandexForm/schema.d.ts +16 -0
  101. package/build/esm/components/YandexForm/schema.js +10 -0
  102. package/build/esm/constructor-items.d.ts +1 -0
  103. package/build/esm/constructor-items.js +2 -1
  104. package/build/esm/editor/data/templates/form-block.json +20 -0
  105. package/build/esm/models/components.d.ts +1 -2
  106. package/build/esm/models/constructor-items/blocks.d.ts +33 -5
  107. package/build/esm/models/constructor-items/blocks.js +12 -0
  108. package/build/esm/models/constructor-items/common.d.ts +21 -1
  109. package/build/esm/models/constructor-items/common.js +5 -0
  110. package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -1
  111. package/build/esm/models/guards.d.ts +3 -1
  112. package/build/esm/models/guards.js +7 -1
  113. package/build/esm/schema/constants.d.ts +22 -0
  114. package/build/esm/schema/constants.js +3 -2
  115. package/build/esm/schema/validators/blocks.d.ts +1 -0
  116. package/build/esm/schema/validators/blocks.js +1 -0
  117. package/build/esm/schema/validators/common.d.ts +23 -1
  118. package/build/esm/schema/validators/common.js +13 -1
  119. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +6 -0
  120. package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
  121. package/build/esm/sub-blocks/BasicCard/schema.d.ts +6 -0
  122. package/build/esm/sub-blocks/BasicCard/schema.js +2 -0
  123. package/build/esm/sub-blocks/Content/schema.d.ts +6 -0
  124. package/build/esm/sub-blocks/HubspotForm/schema.d.ts +22 -0
  125. package/build/esm/sub-blocks/HubspotForm/schema.js +14 -0
  126. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +3 -0
  127. package/build/esm/sub-blocks/Quote/Quote.css +12 -3
  128. package/build/esm/sub-blocks/Quote/Quote.js +4 -4
  129. package/build/esm/sub-blocks/Quote/schema.d.ts +7 -0
  130. package/build/esm/sub-blocks/Quote/schema.js +7 -2
  131. package/package.json +2 -2
  132. package/server/models/components.d.ts +1 -2
  133. package/server/models/constructor-items/blocks.d.ts +33 -5
  134. package/server/models/constructor-items/blocks.js +13 -1
  135. package/server/models/constructor-items/common.d.ts +21 -1
  136. package/server/models/constructor-items/common.js +6 -1
  137. package/server/models/constructor-items/sub-blocks.d.ts +4 -1
  138. package/server/models/guards.d.ts +3 -1
  139. package/server/models/guards.js +9 -1
  140. package/widget/index.js +1 -1
@@ -58,6 +58,9 @@ export declare const BannerCardProps: {
58
58
  url: {
59
59
  type: string;
60
60
  };
61
+ urlTitle: {
62
+ type: string;
63
+ };
61
64
  primary: {
62
65
  type: string;
63
66
  };
@@ -354,6 +357,9 @@ export declare const BannerBlock: {
354
357
  url: {
355
358
  type: string;
356
359
  };
360
+ urlTitle: {
361
+ type: string;
362
+ };
357
363
  primary: {
358
364
  type: string;
359
365
  };
@@ -651,6 +657,9 @@ export declare const BannerCard: {
651
657
  url: {
652
658
  type: string;
653
659
  };
660
+ urlTitle: {
661
+ type: string;
662
+ };
654
663
  primary: {
655
664
  type: string;
656
665
  };
@@ -34,6 +34,9 @@ export declare const CardLayoutProps: {
34
34
  url: {
35
35
  type: string;
36
36
  };
37
+ urlTitle: {
38
+ type: string;
39
+ };
37
40
  resetMargin: {
38
41
  type: string;
39
42
  };
@@ -60,6 +63,9 @@ export declare const CardLayoutProps: {
60
63
  url: {
61
64
  type: string;
62
65
  };
66
+ urlTitle: {
67
+ type: string;
68
+ };
63
69
  };
64
70
  };
65
71
  visible: {
@@ -115,6 +121,9 @@ export declare const CardLayoutBlock: {
115
121
  url: {
116
122
  type: string;
117
123
  };
124
+ urlTitle: {
125
+ type: string;
126
+ };
118
127
  resetMargin: {
119
128
  type: string;
120
129
  };
@@ -141,6 +150,9 @@ export declare const CardLayoutBlock: {
141
150
  url: {
142
151
  type: string;
143
152
  };
153
+ urlTitle: {
154
+ type: string;
155
+ };
144
156
  };
145
157
  };
146
158
  visible: {
@@ -83,6 +83,9 @@ export declare const ContentLayoutBlock: {
83
83
  url: {
84
84
  type: string;
85
85
  };
86
+ urlTitle: {
87
+ type: string;
88
+ };
86
89
  resetMargin: {
87
90
  type: string;
88
91
  };
@@ -224,6 +227,9 @@ export declare const ContentLayoutBlock: {
224
227
  url: {
225
228
  type: string;
226
229
  };
230
+ urlTitle: {
231
+ type: string;
232
+ };
227
233
  };
228
234
  };
229
235
  visible: {
@@ -26,6 +26,9 @@ export declare const ExtendedFeaturesItem: {
26
26
  url: {
27
27
  type: string;
28
28
  };
29
+ urlTitle: {
30
+ type: string;
31
+ };
29
32
  arrow: {
30
33
  type: string;
31
34
  };
@@ -196,6 +199,9 @@ export declare const ExtendedFeaturesBlock: {
196
199
  url: {
197
200
  type: string;
198
201
  };
202
+ urlTitle: {
203
+ type: string;
204
+ };
199
205
  resetMargin: {
200
206
  type: string;
201
207
  };
@@ -222,6 +228,9 @@ export declare const ExtendedFeaturesBlock: {
222
228
  url: {
223
229
  type: string;
224
230
  };
231
+ urlTitle: {
232
+ type: string;
233
+ };
225
234
  };
226
235
  };
227
236
  visible: {
@@ -90,6 +90,9 @@ export declare const FilterProps: {
90
90
  url: {
91
91
  type: string;
92
92
  };
93
+ urlTitle: {
94
+ type: string;
95
+ };
93
96
  resetMargin: {
94
97
  type: string;
95
98
  };
@@ -116,6 +119,9 @@ export declare const FilterProps: {
116
119
  url: {
117
120
  type: string;
118
121
  };
122
+ urlTitle: {
123
+ type: string;
124
+ };
119
125
  };
120
126
  };
121
127
  visible: {
@@ -200,6 +206,9 @@ export declare const FilterBlock: {
200
206
  url: {
201
207
  type: string;
202
208
  };
209
+ urlTitle: {
210
+ type: string;
211
+ };
203
212
  resetMargin: {
204
213
  type: string;
205
214
  };
@@ -226,6 +235,9 @@ export declare const FilterBlock: {
226
235
  url: {
227
236
  type: string;
228
237
  };
238
+ urlTitle: {
239
+ type: string;
240
+ };
229
241
  };
230
242
  };
231
243
  visible: {
@@ -0,0 +1,136 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-form-block {
4
+ border-radius: 32px;
5
+ position: relative;
6
+ }
7
+ .pc-form-block__title {
8
+ margin: 0 0 24px 10px;
9
+ }
10
+ .pc-form-block__title_mobile {
11
+ margin-left: 4px;
12
+ }
13
+ .pc-form-block__full-form {
14
+ background-color: var(--g-color-base-background);
15
+ padding: 48px 64px 48px calc(64px - 10px);
16
+ border-radius: var(--pc-border-radius);
17
+ }
18
+ .pc-form-block__media {
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ bottom: 0;
23
+ right: 0;
24
+ border-radius: 32px;
25
+ }
26
+ .pc-form-block__image {
27
+ height: 100%;
28
+ width: 100%;
29
+ object-fit: cover;
30
+ }
31
+ .pc-form-block__row_direction_form-content {
32
+ flex-direction: row-reverse;
33
+ }
34
+ .pc-form-block__row_direction_center {
35
+ padding-top: 64px;
36
+ padding-bottom: 48px;
37
+ flex-direction: column;
38
+ }
39
+ .pc-form-block__row_direction_center .pc-form-block__content-wrapper {
40
+ margin-bottom: 32px;
41
+ }
42
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__full-form {
43
+ box-shadow: 0 4px 24px var(--pc-color-sfx-shadow), 0 2px 8px var(--pc-color-sfx-shadow);
44
+ }
45
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row_direction_form-content .pc-form-block__content-wrapper {
46
+ padding: 48px 0 64px 64px;
47
+ }
48
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row_direction_content-form .pc-form-block__content-wrapper {
49
+ padding: 48px 64px 64px 0;
50
+ }
51
+ .pc-form-block_with-background .pc-form-block__row_direction_form-content .pc-form-block__form-wrapper {
52
+ padding: 16px 0 24px 16px;
53
+ }
54
+ .pc-form-block_with-background .pc-form-block__row_direction_content-form .pc-form-block__form-wrapper {
55
+ padding: 16px 16px 24px 0;
56
+ }
57
+ .pc-form-block_with-background .pc-form-block__row_direction_form-content .pc-form-block__content-wrapper, .pc-form-block_with-background .pc-form-block__row_direction_content-form .pc-form-block__content-wrapper {
58
+ padding: 64px;
59
+ }
60
+ @media (min-width: 1081px) {
61
+ .pc-form-block_form-type_yandex .pc-form-block__row_direction_form-content .pc-form-block__content-col, .pc-form-block_form-type_yandex .pc-form-block__row_direction_content-form .pc-form-block__content-col {
62
+ flex: 1 0 0;
63
+ }
64
+ .pc-form-block_form-type_yandex .pc-form-block__row_direction_form-content .pc-form-block__form, .pc-form-block_form-type_yandex .pc-form-block__row_direction_content-form .pc-form-block__form, .pc-form-block_form-type_yandex .pc-form-block__row_direction_center .pc-form-block__form {
65
+ min-width: 475px;
66
+ }
67
+ .pc-form-block_form-type_yandex .pc-form-block__row_direction_form-content .pc-form-block__form-col, .pc-form-block_form-type_yandex .pc-form-block__row_direction_content-form .pc-form-block__form-col, .pc-form-block_form-type_yandex .pc-form-block__row_direction_center .pc-form-block__form-col {
68
+ max-width: initial;
69
+ width: fit-content;
70
+ }
71
+ }
72
+ @media (max-width: 1081px) and (min-width: 769px) {
73
+ .pc-form-block__row {
74
+ flex-direction: column;
75
+ }
76
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__form-wrapper,
77
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__form-wrapper,
78
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
79
+ max-width: 609px;
80
+ }
81
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__center,
82
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__form-wrapper,
83
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__center,
84
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__form-wrapper,
85
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
86
+ margin: 0 auto;
87
+ padding-right: 0;
88
+ padding-left: 0;
89
+ }
90
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__form-wrapper, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__form-wrapper {
91
+ padding-top: 0;
92
+ }
93
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
94
+ text-align: center;
95
+ padding-bottom: 32px;
96
+ }
97
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
98
+ padding: 0 0 32px 0;
99
+ }
100
+ }
101
+ @media (max-width: 769px) {
102
+ .pc-form-block__full-form {
103
+ padding: 32px;
104
+ }
105
+ .pc-form-block_with-background .pc-form-block__row, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row {
106
+ padding: 0;
107
+ }
108
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__form-wrapper,
109
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__form-wrapper,
110
+ .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
111
+ padding: 0;
112
+ }
113
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
114
+ padding-bottom: 32px;
115
+ margin-bottom: 0;
116
+ }
117
+ .pc-form-block_with-background {
118
+ padding: 0 8px;
119
+ }
120
+ .pc-form-block_with-background .pc-form-block__row {
121
+ padding-top: 48px;
122
+ }
123
+ .pc-form-block_with-background .pc-form-block__row_padding-bottom_m {
124
+ padding-bottom: 32px;
125
+ }
126
+ .pc-form-block_with-background .pc-form-block__row_padding-bottom_l {
127
+ padding-bottom: 48px;
128
+ }
129
+ .pc-form-block_with-background .pc-form-block__row_direction_form-content .pc-form-block__content-wrapper, .pc-form-block_with-background .pc-form-block__row_direction_content-form .pc-form-block__content-wrapper, .pc-form-block_with-background .pc-form-block__row_direction_center .pc-form-block__content-wrapper {
130
+ padding-right: 16px;
131
+ padding-left: 16px;
132
+ }
133
+ .pc-form-block_with-background .pc-form-block__row_direction_form-content, .pc-form-block_with-background .pc-form-block__row_direction_content-form {
134
+ padding-top: 32px;
135
+ }
136
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { FormBlockProps } from '../../models';
3
+ declare const FormBlock: React.FC<FormBlockProps>;
4
+ export default FormBlock;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const components_1 = require("../../components");
6
+ const mobileContext_1 = require("../../context/mobileContext");
7
+ const grid_1 = require("../../grid");
8
+ const models_1 = require("../../models");
9
+ const sub_blocks_1 = require("../../sub-blocks");
10
+ const utils_1 = require("../../utils");
11
+ const InnerForm_1 = tslib_1.__importDefault(require("./InnerForm/InnerForm"));
12
+ const b = (0, utils_1.block)('form-block');
13
+ const colSizes = { [grid_1.GridColumnSize.Lg]: 6, [grid_1.GridColumnSize.All]: 12 };
14
+ const FormBlock = (props) => {
15
+ var _a;
16
+ const { formData, title, textContent, direction = models_1.FormBlockDirection.Center, background } = props;
17
+ const [contentLoaded, setContentLoaded] = (0, react_1.useState)(false);
18
+ const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
19
+ const hasImage = background && (background.src || background.desktop);
20
+ const paddingBottom = background && ((_a = background.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) && !hasImage ? 'l' : 'm'; // bigger padding for case with background color and no image
21
+ const onContentLoad = (0, react_1.useCallback)(() => {
22
+ setContentLoaded(true);
23
+ }, []);
24
+ const formType = (0, react_1.useMemo)(() => {
25
+ if ((0, models_1.isYandexDataForm)(formData)) {
26
+ return models_1.FormBlockDataTypes.YANDEX;
27
+ }
28
+ if ((0, models_1.isHubspotDataForm)(formData)) {
29
+ return models_1.FormBlockDataTypes.HUBSPOT_INLINE;
30
+ }
31
+ return undefined;
32
+ }, [formData]);
33
+ if (!formData) {
34
+ return null;
35
+ }
36
+ return (react_1.default.createElement("div", { className: b({
37
+ 'with-background': Boolean(background),
38
+ 'form-type': formType,
39
+ }) },
40
+ background && (react_1.default.createElement(components_1.BackgroundImage, Object.assign({}, background, { className: b('media'), imageClassName: b('image') }))),
41
+ react_1.default.createElement(grid_1.Grid, null,
42
+ react_1.default.createElement(grid_1.Row, { alignItems: direction === models_1.FormBlockDirection.Center
43
+ ? grid_1.GridAlignItems.Center
44
+ : grid_1.GridAlignItems.Start, className: b('row', {
45
+ direction,
46
+ 'padding-bottom': paddingBottom,
47
+ }) },
48
+ react_1.default.createElement(grid_1.Col, { sizes: colSizes, className: b('content-col') }, textContent && (react_1.default.createElement("div", { className: b('content-wrapper') },
49
+ react_1.default.createElement(sub_blocks_1.Content, Object.assign({ theme: "default" }, textContent, { centered: direction === models_1.FormBlockDirection.Center, colSizes: { all: 12 }, className: b('content') }))))),
50
+ react_1.default.createElement(grid_1.Col, { sizes: colSizes, className: b('form-col') },
51
+ react_1.default.createElement("div", { className: b('form-wrapper') },
52
+ react_1.default.createElement("div", { className: b('full-form', {
53
+ hidden: !contentLoaded,
54
+ }) },
55
+ title && (react_1.default.createElement(components_1.Title, { title: {
56
+ text: title,
57
+ textSize: 's',
58
+ }, className: b('title', { mobile: isMobile }), colSizes: { all: 12 } })),
59
+ react_1.default.createElement(InnerForm_1.default, { className: b('form'), formData: formData, onContentLoad: onContentLoad }))))))));
60
+ };
61
+ exports.default = FormBlock;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { HubspotFormProps } from '../../models';
3
+ type Props = HubspotFormProps & {
4
+ onReady?: () => void;
5
+ };
6
+ declare const HubspotInlineForm: React.FC<Props>;
7
+ export default HubspotInlineForm;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ const useMount_1 = tslib_1.__importDefault(require("../../hooks/useMount"));
6
+ const sub_blocks_1 = require("../../sub-blocks");
7
+ const HubspotInlineForm = (props) => {
8
+ const { onReady } = props, rest = tslib_1.__rest(props, ["onReady"]);
9
+ (0, useMount_1.default)(() => {
10
+ onReady === null || onReady === void 0 ? void 0 : onReady();
11
+ });
12
+ return react_1.default.createElement(sub_blocks_1.HubspotForm, Object.assign({}, rest, { createDOMElement: true }));
13
+ };
14
+ exports.default = HubspotInlineForm;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { FormBlockData } from '../../../models';
3
+ interface InnerFormProps {
4
+ formData: FormBlockData;
5
+ onContentLoad: () => void;
6
+ className?: string;
7
+ }
8
+ declare const InnerForm: React.FC<InnerFormProps>;
9
+ export default InnerForm;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const components_1 = require("../../../components");
6
+ const models_1 = require("../../../models");
7
+ const sub_blocks_1 = require("../../../sub-blocks");
8
+ const InnerForm = (props) => {
9
+ const { formData, onContentLoad, className } = props;
10
+ (0, react_1.useEffect)(() => {
11
+ if ((0, models_1.isHubspotDataForm)(formData)) {
12
+ onContentLoad();
13
+ }
14
+ }, [onContentLoad, formData]);
15
+ if ((0, models_1.isYandexDataForm)(formData)) {
16
+ const _a = formData.yandex, { onLoad } = _a, rest = tslib_1.__rest(_a, ["onLoad"]);
17
+ return (react_1.default.createElement("div", { className: className },
18
+ react_1.default.createElement(components_1.YandexForm, Object.assign({}, rest, { onLoad: () => {
19
+ onContentLoad();
20
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad();
21
+ } }))));
22
+ }
23
+ if ((0, models_1.isHubspotDataForm)(formData)) {
24
+ return react_1.default.createElement(sub_blocks_1.HubspotForm, Object.assign({}, formData.hubspot));
25
+ }
26
+ return null;
27
+ };
28
+ exports.default = InnerForm;
@@ -0,0 +1,202 @@
1
+ export declare const FormBlock: {
2
+ 'form-block': {
3
+ additionalProperties: boolean;
4
+ required: string[];
5
+ properties: {
6
+ title: {
7
+ type: string;
8
+ };
9
+ formData: {
10
+ oneOf: ({
11
+ type: string;
12
+ optionName: string;
13
+ properties: {
14
+ yandex: {
15
+ type: string;
16
+ required: string[];
17
+ properties: {
18
+ id: {
19
+ type: string;
20
+ };
21
+ containerId: {
22
+ type: string;
23
+ };
24
+ type: {};
25
+ when: {
26
+ type: string;
27
+ };
28
+ };
29
+ };
30
+ hubspot?: undefined;
31
+ };
32
+ } | {
33
+ type: string;
34
+ optionName: string;
35
+ properties: {
36
+ hubspot: {
37
+ type: string;
38
+ required: string[];
39
+ properties: {
40
+ region: {
41
+ type: string;
42
+ };
43
+ portalId: {
44
+ type: string;
45
+ };
46
+ formId: {
47
+ type: string;
48
+ };
49
+ formInstanceId: {
50
+ type: string;
51
+ };
52
+ type: {};
53
+ when: {
54
+ type: string;
55
+ };
56
+ };
57
+ };
58
+ yandex?: undefined;
59
+ };
60
+ })[];
61
+ };
62
+ textContent: {
63
+ additionalProperties: boolean;
64
+ properties: Partial<{
65
+ title: {
66
+ oneOf: ({
67
+ type: string;
68
+ contentType: string;
69
+ optionName: string;
70
+ } | {
71
+ optionName: string;
72
+ type: string;
73
+ additionalProperties: boolean;
74
+ required: string[];
75
+ properties: {
76
+ text: {
77
+ type: string;
78
+ contentType: string;
79
+ };
80
+ textSize: {
81
+ type: string;
82
+ enum: string[];
83
+ };
84
+ url: {
85
+ type: string;
86
+ };
87
+ urlTitle: {
88
+ type: string;
89
+ };
90
+ resetMargin: {
91
+ type: string;
92
+ };
93
+ };
94
+ contentType?: undefined;
95
+ })[];
96
+ };
97
+ text: {
98
+ type: string;
99
+ contentType: string;
100
+ inputType: string;
101
+ };
102
+ additionalInfo: {
103
+ type: string;
104
+ contentType: string;
105
+ };
106
+ size: {
107
+ type: string;
108
+ enum: string[];
109
+ };
110
+ links: {
111
+ type: string;
112
+ items: {
113
+ type: string;
114
+ properties: {
115
+ when: {
116
+ type: string;
117
+ };
118
+ };
119
+ };
120
+ };
121
+ buttons: {
122
+ type: string;
123
+ items: {
124
+ type: string;
125
+ properties: {
126
+ when: {
127
+ type: string;
128
+ };
129
+ };
130
+ };
131
+ };
132
+ theme: {
133
+ type: string;
134
+ enum: string[];
135
+ };
136
+ list: {
137
+ type: string;
138
+ items: {
139
+ type: string;
140
+ properties: {
141
+ when: {
142
+ type: string;
143
+ };
144
+ };
145
+ };
146
+ };
147
+ }>;
148
+ };
149
+ direction: {
150
+ enum: string[];
151
+ };
152
+ image: {
153
+ oneOf: ({
154
+ type: string;
155
+ properties: {
156
+ when: {
157
+ type: string;
158
+ };
159
+ };
160
+ } | {
161
+ type: string;
162
+ pattern: string;
163
+ optionName: string;
164
+ })[];
165
+ };
166
+ backgroundColor: {
167
+ type: string;
168
+ };
169
+ anchor: {
170
+ type: string;
171
+ additionalProperties: boolean;
172
+ required: string[];
173
+ properties: {
174
+ text: {
175
+ type: string;
176
+ contentType: string;
177
+ };
178
+ url: {
179
+ type: string;
180
+ };
181
+ urlTitle: {
182
+ type: string;
183
+ };
184
+ };
185
+ };
186
+ visible: {
187
+ type: string;
188
+ enum: string[];
189
+ };
190
+ resetPaddings: {
191
+ type: string;
192
+ };
193
+ context: {
194
+ type: string;
195
+ };
196
+ type: {};
197
+ when: {
198
+ type: string;
199
+ };
200
+ };
201
+ };
202
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormBlock = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
6
+ const schema_1 = require("../../components/Image/schema");
7
+ const schema_2 = require("../../components/YandexForm/schema");
8
+ const common_1 = require("../../schema/validators/common");
9
+ const schema_3 = require("../../sub-blocks/Content/schema");
10
+ const schema_4 = require("../../sub-blocks/HubspotForm/schema");
11
+ const FormBlockContentProps = (0, omit_1.default)(schema_3.ContentBase, ['size', 'centered', 'colSizes']);
12
+ exports.FormBlock = {
13
+ 'form-block': {
14
+ additionalProperties: false,
15
+ required: ['formData'],
16
+ properties: Object.assign(Object.assign({}, common_1.BlockBaseProps), { title: {
17
+ type: 'string',
18
+ }, formData: {
19
+ oneOf: [
20
+ {
21
+ type: 'object',
22
+ optionName: 'yandex',
23
+ properties: {
24
+ yandex: schema_2.YandexFormProps,
25
+ },
26
+ },
27
+ {
28
+ type: 'object',
29
+ optionName: 'hubspot-inline',
30
+ properties: {
31
+ hubspot: schema_4.HubspotFormProps,
32
+ },
33
+ },
34
+ ],
35
+ }, textContent: {
36
+ additionalProperties: false,
37
+ properties: FormBlockContentProps,
38
+ }, direction: {
39
+ enum: ['content-form', 'form-content', 'center'],
40
+ }, image: schema_1.ImageProps, backgroundColor: {
41
+ type: 'string',
42
+ } }),
43
+ },
44
+ };