@gravity-ui/page-constructor 4.28.1 → 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 (167) 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/Share/Share.js +5 -1
  25. package/build/cjs/blocks/Share/i18n/en.json +11 -1
  26. package/build/cjs/blocks/Share/i18n/ru.json +11 -1
  27. package/build/cjs/blocks/Slider/schema.d.ts +6 -0
  28. package/build/cjs/blocks/Table/schema.d.ts +3 -0
  29. package/build/cjs/blocks/Tabs/schema.d.ts +12 -0
  30. package/build/cjs/blocks/index.d.ts +1 -0
  31. package/build/cjs/blocks/index.js +3 -1
  32. package/build/cjs/components/Author/Author.js +7 -1
  33. package/build/cjs/components/Author/schema.d.ts +12 -2
  34. package/build/cjs/components/Button/Button.d.ts +1 -0
  35. package/build/cjs/components/Button/Button.js +2 -2
  36. package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
  37. package/build/cjs/components/CardBase/CardBase.js +2 -5
  38. package/build/cjs/components/Image/Image.js +1 -2
  39. package/build/cjs/components/Media/Image/Image.js +4 -4
  40. package/build/cjs/components/ReactPlayer/ReactPlayer.d.ts +1 -2
  41. package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -17
  42. package/build/cjs/components/YandexForm/YandexForm.js +6 -4
  43. package/build/cjs/components/YandexForm/schema.d.ts +16 -0
  44. package/build/cjs/components/YandexForm/schema.js +13 -0
  45. package/build/cjs/constructor-items.d.ts +1 -0
  46. package/build/cjs/constructor-items.js +1 -0
  47. package/build/cjs/editor/data/templates/form-block.json +20 -0
  48. package/build/cjs/models/components.d.ts +1 -2
  49. package/build/cjs/models/constructor-items/blocks.d.ts +33 -5
  50. package/build/cjs/models/constructor-items/blocks.js +13 -1
  51. package/build/cjs/models/constructor-items/common.d.ts +22 -2
  52. package/build/cjs/models/constructor-items/common.js +6 -1
  53. package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -2
  54. package/build/cjs/models/guards.d.ts +3 -1
  55. package/build/cjs/models/guards.js +9 -1
  56. package/build/cjs/schema/constants.d.ts +46 -4
  57. package/build/cjs/schema/constants.js +2 -1
  58. package/build/cjs/schema/validators/blocks.d.ts +1 -0
  59. package/build/cjs/schema/validators/blocks.js +1 -0
  60. package/build/cjs/schema/validators/common.d.ts +35 -3
  61. package/build/cjs/schema/validators/common.js +14 -5
  62. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +6 -0
  63. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
  64. package/build/cjs/sub-blocks/BasicCard/schema.d.ts +6 -0
  65. package/build/cjs/sub-blocks/BasicCard/schema.js +2 -0
  66. package/build/cjs/sub-blocks/Content/schema.d.ts +6 -0
  67. package/build/cjs/sub-blocks/HubspotForm/schema.d.ts +22 -0
  68. package/build/cjs/sub-blocks/HubspotForm/schema.js +17 -0
  69. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +3 -0
  70. package/build/cjs/sub-blocks/Quote/Quote.css +12 -3
  71. package/build/cjs/sub-blocks/Quote/Quote.js +5 -4
  72. package/build/cjs/sub-blocks/Quote/schema.d.ts +31 -4
  73. package/build/cjs/sub-blocks/Quote/schema.js +7 -5
  74. package/build/cjs/text-transform/transformers.js +3 -1
  75. package/build/esm/blocks/Banner/schema.d.ts +9 -0
  76. package/build/esm/blocks/CardLayout/schema.d.ts +12 -0
  77. package/build/esm/blocks/ContentLayout/schema.d.ts +6 -0
  78. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +9 -0
  79. package/build/esm/blocks/FilterBlock/schema.d.ts +12 -0
  80. package/build/esm/blocks/Form/Form.css +136 -0
  81. package/build/esm/blocks/Form/Form.d.ts +5 -0
  82. package/build/esm/blocks/Form/Form.js +59 -0
  83. package/build/esm/blocks/Form/HubspotInlineForm.d.ts +7 -0
  84. package/build/esm/blocks/Form/HubspotInlineForm.js +12 -0
  85. package/build/esm/blocks/Form/InnerForm/InnerForm.d.ts +9 -0
  86. package/build/esm/blocks/Form/InnerForm/InnerForm.js +26 -0
  87. package/build/esm/blocks/Form/schema.d.ts +202 -0
  88. package/build/esm/blocks/Form/schema.js +40 -0
  89. package/build/esm/blocks/Header/Header.js +2 -2
  90. package/build/esm/blocks/Header/schema.d.ts +3 -0
  91. package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
  92. package/build/esm/blocks/Icons/schema.d.ts +6 -0
  93. package/build/esm/blocks/Info/schema.d.ts +6 -0
  94. package/build/esm/blocks/Map/schema.d.ts +9 -0
  95. package/build/esm/blocks/Media/schema.d.ts +18 -0
  96. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
  97. package/build/esm/blocks/Questions/schema.d.ts +6 -0
  98. package/build/esm/blocks/Share/Share.js +5 -1
  99. package/build/esm/blocks/Share/i18n/en.json +11 -1
  100. package/build/esm/blocks/Share/i18n/ru.json +11 -1
  101. package/build/esm/blocks/Slider/schema.d.ts +6 -0
  102. package/build/esm/blocks/Table/schema.d.ts +3 -0
  103. package/build/esm/blocks/Tabs/schema.d.ts +12 -0
  104. package/build/esm/blocks/index.d.ts +1 -0
  105. package/build/esm/blocks/index.js +1 -0
  106. package/build/esm/components/Author/Author.js +7 -1
  107. package/build/esm/components/Author/schema.d.ts +12 -2
  108. package/build/esm/components/Button/Button.d.ts +1 -0
  109. package/build/esm/components/Button/Button.js +2 -2
  110. package/build/esm/components/CardBase/CardBase.d.ts +1 -0
  111. package/build/esm/components/CardBase/CardBase.js +2 -5
  112. package/build/esm/components/Image/Image.js +1 -2
  113. package/build/esm/components/Media/Image/Image.js +1 -1
  114. package/build/esm/components/ReactPlayer/ReactPlayer.d.ts +1 -2
  115. package/build/esm/components/YandexForm/YandexForm.d.ts +2 -17
  116. package/build/esm/components/YandexForm/YandexForm.js +5 -3
  117. package/build/esm/components/YandexForm/schema.d.ts +16 -0
  118. package/build/esm/components/YandexForm/schema.js +10 -0
  119. package/build/esm/constructor-items.d.ts +1 -0
  120. package/build/esm/constructor-items.js +2 -1
  121. package/build/esm/editor/data/templates/form-block.json +20 -0
  122. package/build/esm/models/components.d.ts +1 -2
  123. package/build/esm/models/constructor-items/blocks.d.ts +33 -5
  124. package/build/esm/models/constructor-items/blocks.js +12 -0
  125. package/build/esm/models/constructor-items/common.d.ts +22 -2
  126. package/build/esm/models/constructor-items/common.js +5 -0
  127. package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -2
  128. package/build/esm/models/guards.d.ts +3 -1
  129. package/build/esm/models/guards.js +7 -1
  130. package/build/esm/schema/constants.d.ts +46 -4
  131. package/build/esm/schema/constants.js +3 -2
  132. package/build/esm/schema/validators/blocks.d.ts +1 -0
  133. package/build/esm/schema/validators/blocks.js +1 -0
  134. package/build/esm/schema/validators/common.d.ts +35 -3
  135. package/build/esm/schema/validators/common.js +15 -6
  136. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +6 -0
  137. package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
  138. package/build/esm/sub-blocks/BasicCard/schema.d.ts +6 -0
  139. package/build/esm/sub-blocks/BasicCard/schema.js +2 -0
  140. package/build/esm/sub-blocks/Content/schema.d.ts +6 -0
  141. package/build/esm/sub-blocks/HubspotForm/schema.d.ts +22 -0
  142. package/build/esm/sub-blocks/HubspotForm/schema.js +14 -0
  143. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +3 -0
  144. package/build/esm/sub-blocks/Quote/Quote.css +12 -3
  145. package/build/esm/sub-blocks/Quote/Quote.js +6 -5
  146. package/build/esm/sub-blocks/Quote/schema.d.ts +31 -4
  147. package/build/esm/sub-blocks/Quote/schema.js +9 -7
  148. package/build/esm/text-transform/transformers.js +3 -1
  149. package/package.json +2 -2
  150. package/server/models/components.d.ts +1 -2
  151. package/server/models/constructor-items/blocks.d.ts +33 -5
  152. package/server/models/constructor-items/blocks.js +13 -1
  153. package/server/models/constructor-items/common.d.ts +22 -2
  154. package/server/models/constructor-items/common.js +6 -1
  155. package/server/models/constructor-items/sub-blocks.d.ts +5 -2
  156. package/server/models/guards.d.ts +3 -1
  157. package/server/models/guards.js +9 -1
  158. package/server/text-transform/transformers.js +3 -1
  159. package/widget/index.js +1 -1
  160. package/build/cjs/components/Image/i18n/en.json +0 -3
  161. package/build/cjs/components/Image/i18n/index.d.ts +0 -2
  162. package/build/cjs/components/Image/i18n/index.js +0 -8
  163. package/build/cjs/components/Image/i18n/ru.json +0 -3
  164. package/build/esm/components/Image/i18n/en.json +0 -3
  165. package/build/esm/components/Image/i18n/index.d.ts +0 -2
  166. package/build/esm/components/Image/i18n/index.js +0 -5
  167. package/build/esm/components/Image/i18n/ru.json +0 -3
@@ -0,0 +1,22 @@
1
+ export declare const HubspotFormProps: {
2
+ type: string;
3
+ required: string[];
4
+ properties: {
5
+ region: {
6
+ type: string;
7
+ };
8
+ portalId: {
9
+ type: string;
10
+ };
11
+ formId: {
12
+ type: string;
13
+ };
14
+ formInstanceId: {
15
+ type: string;
16
+ };
17
+ type: {};
18
+ when: {
19
+ type: string;
20
+ };
21
+ };
22
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HubspotFormProps = void 0;
4
+ const common_1 = require("../../schema/validators/common");
5
+ exports.HubspotFormProps = {
6
+ type: 'object',
7
+ required: ['portalId', 'formId'],
8
+ properties: Object.assign(Object.assign({}, common_1.BaseProps), { region: {
9
+ type: 'string',
10
+ }, portalId: {
11
+ type: 'string',
12
+ }, formId: {
13
+ type: 'string',
14
+ }, formInstanceId: {
15
+ type: 'string',
16
+ } }),
17
+ };
@@ -270,6 +270,9 @@ export declare const LayoutItem: {
270
270
  url: {
271
271
  type: string;
272
272
  };
273
+ urlTitle: {
274
+ type: string;
275
+ };
273
276
  resetMargin: {
274
277
  type: string;
275
278
  };
@@ -60,14 +60,23 @@ unpredictable css rules order in build */
60
60
  font-size: var(--g-text-body-3-font-size);
61
61
  line-height: var(--g-text-body-3-line-height);
62
62
  }
63
- .pc-quote__content::before {
63
+ .pc-quote__content_quote-type_chevron::before {
64
64
  position: absolute;
65
65
  top: -1px;
66
66
  left: -10px;
67
67
  content: "«";
68
68
  }
69
- .pc-quote__text::after {
70
- content: "».";
69
+ .pc-quote__content_quote-type_chevron .pc-quote__text::after {
70
+ content: "»";
71
+ }
72
+ .pc-quote__content_quote-type_english-double::before {
73
+ position: absolute;
74
+ top: -1px;
75
+ left: -8px;
76
+ content: "“";
77
+ }
78
+ .pc-quote__content_quote-type_english-double .pc-quote__text::after {
79
+ content: "”";
71
80
  }
72
81
  .pc-quote__image {
73
82
  width: 100%;
@@ -11,7 +11,7 @@ const models_1 = require("../../models");
11
11
  const utils_2 = require("../../utils");
12
12
  const b = (0, utils_2.block)('quote');
13
13
  const Quote = (props) => {
14
- const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
14
+ const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, urlTitle, buttonText, quoteType = models_1.QuoteType.Chevron, } = props;
15
15
  const theme = (0, theme_1.useTheme)();
16
16
  const imageThemed = (0, utils_2.getThemedValue)(image, theme);
17
17
  const imageData = (0, utils_1.getMediaImage)(imageThemed);
@@ -19,12 +19,13 @@ const Quote = (props) => {
19
19
  const handleButtonClick = (0, react_1.useCallback)(() => handleAnalytics(), [handleAnalytics]);
20
20
  const renderFooter = Boolean(author || url) && (react_1.default.createElement("div", { className: b('author-wrapper') },
21
21
  author && (react_1.default.createElement(components_1.Author, { className: b('author', { theme: textTheme }), author: author, type: models_1.AuthorType.Line })),
22
- url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }), onClick: handleButtonClick }, buttonText))));
22
+ url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }), onClick: handleButtonClick, title: urlTitle }, buttonText))));
23
+ const logoProps = (0, utils_1.getMediaImage)(logo);
23
24
  return (react_1.default.createElement("div", { className: b({ theme: textTheme, border }), style: color ? { backgroundColor: color } : {} },
24
25
  react_1.default.createElement("div", { key: text, className: b('content-wrapper') },
25
26
  react_1.default.createElement("div", null,
26
- react_1.default.createElement(components_1.Image, { className: b('logo'), src: logo }),
27
- react_1.default.createElement("div", { className: b('content') },
27
+ react_1.default.createElement(components_1.Image, Object.assign({ className: b('logo') }, logoProps)),
28
+ react_1.default.createElement("div", { className: b('content', { 'quote-type': quoteType }) },
28
29
  react_1.default.createElement("span", { className: b('text') },
29
30
  react_1.default.createElement(components_1.HTML, null, text)))),
30
31
  renderFooter),
@@ -32,8 +32,18 @@ export declare const Quote: {
32
32
  })[];
33
33
  };
34
34
  logo: {
35
- type: string;
36
- pattern: string;
35
+ oneOf: ({
36
+ type: string;
37
+ properties: {
38
+ when: {
39
+ type: string;
40
+ };
41
+ };
42
+ } | {
43
+ type: string;
44
+ pattern: string;
45
+ optionName: string;
46
+ })[];
37
47
  };
38
48
  color: {
39
49
  type: string;
@@ -41,6 +51,9 @@ export declare const Quote: {
41
51
  url: {
42
52
  type: string;
43
53
  };
54
+ urlTitle: {
55
+ type: string;
56
+ };
44
57
  buttonText: {
45
58
  type: string;
46
59
  };
@@ -61,8 +74,18 @@ export declare const Quote: {
61
74
  contentType: string;
62
75
  };
63
76
  avatar: {
64
- type: string;
65
- pattern: string;
77
+ oneOf: ({
78
+ type: string;
79
+ properties: {
80
+ when: {
81
+ type: string;
82
+ };
83
+ };
84
+ } | {
85
+ type: string;
86
+ pattern: string;
87
+ optionName: string;
88
+ })[];
66
89
  };
67
90
  description: {
68
91
  type: string;
@@ -70,6 +93,10 @@ export declare const Quote: {
70
93
  };
71
94
  };
72
95
  };
96
+ quoteType: {
97
+ type: string;
98
+ enum: import("../..").QuoteType[];
99
+ };
73
100
  type: {};
74
101
  when: {
75
102
  type: string;
@@ -10,15 +10,17 @@ exports.Quote = {
10
10
  properties: Object.assign(Object.assign({}, common_1.BaseProps), { text: {
11
11
  type: 'string',
12
12
  contentType: 'text',
13
- }, image: (0, common_1.withTheme)(schema_1.ImageProps), logo: {
14
- type: 'string',
15
- pattern: schema_1.imageUrlPattern,
16
- }, color: {
13
+ }, image: (0, common_1.withTheme)(schema_1.ImageProps), logo: schema_1.ImageProps, color: {
17
14
  type: 'string',
18
15
  }, url: {
19
16
  type: 'string',
17
+ }, urlTitle: {
18
+ type: 'string',
20
19
  }, buttonText: {
21
20
  type: 'string',
22
- }, theme: common_1.ThemeProps, author: common_1.authorItem }),
21
+ }, theme: common_1.ThemeProps, author: common_1.authorItem, quoteType: {
22
+ type: 'string',
23
+ enum: common_1.quoteTypes,
24
+ } }),
23
25
  },
24
26
  };
@@ -44,7 +44,9 @@ function transformBlock(lang, blocksConfig, block, plugins) {
44
44
  });
45
45
  }
46
46
  if ('children' in block && block.children) {
47
- block.children = transformBlocks(block.children, lang, blocksConfig);
47
+ block.children = transformBlocks(block.children, lang, blocksConfig, {
48
+ plugins,
49
+ });
48
50
  }
49
51
  return block;
50
52
  }
@@ -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,5 @@
1
+ import React from 'react';
2
+ import type { FormBlockProps } from '../../models';
3
+ import './Form.css';
4
+ declare const FormBlock: React.FC<FormBlockProps>;
5
+ export default FormBlock;
@@ -0,0 +1,59 @@
1
+ import React, { useCallback, useContext, useMemo, useState } from 'react';
2
+ import { BackgroundImage, Title } from '../../components';
3
+ import { MobileContext } from '../../context/mobileContext';
4
+ import { Col, Grid, GridAlignItems, GridColumnSize, Row } from '../../grid';
5
+ import { FormBlockDataTypes, FormBlockDirection, isHubspotDataForm, isYandexDataForm, } from '../../models';
6
+ import { Content } from '../../sub-blocks';
7
+ import { block } from '../../utils';
8
+ import InnerForm from './InnerForm/InnerForm';
9
+ import './Form.css';
10
+ const b = block('form-block');
11
+ const colSizes = { [GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12 };
12
+ const FormBlock = (props) => {
13
+ var _a;
14
+ const { formData, title, textContent, direction = FormBlockDirection.Center, background } = props;
15
+ const [contentLoaded, setContentLoaded] = useState(false);
16
+ const isMobile = useContext(MobileContext);
17
+ const hasImage = background && (background.src || background.desktop);
18
+ 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
19
+ const onContentLoad = useCallback(() => {
20
+ setContentLoaded(true);
21
+ }, []);
22
+ const formType = useMemo(() => {
23
+ if (isYandexDataForm(formData)) {
24
+ return FormBlockDataTypes.YANDEX;
25
+ }
26
+ if (isHubspotDataForm(formData)) {
27
+ return FormBlockDataTypes.HUBSPOT_INLINE;
28
+ }
29
+ return undefined;
30
+ }, [formData]);
31
+ if (!formData) {
32
+ return null;
33
+ }
34
+ return (React.createElement("div", { className: b({
35
+ 'with-background': Boolean(background),
36
+ 'form-type': formType,
37
+ }) },
38
+ background && (React.createElement(BackgroundImage, Object.assign({}, background, { className: b('media'), imageClassName: b('image') }))),
39
+ React.createElement(Grid, null,
40
+ React.createElement(Row, { alignItems: direction === FormBlockDirection.Center
41
+ ? GridAlignItems.Center
42
+ : GridAlignItems.Start, className: b('row', {
43
+ direction,
44
+ 'padding-bottom': paddingBottom,
45
+ }) },
46
+ React.createElement(Col, { sizes: colSizes, className: b('content-col') }, textContent && (React.createElement("div", { className: b('content-wrapper') },
47
+ React.createElement(Content, Object.assign({ theme: "default" }, textContent, { centered: direction === FormBlockDirection.Center, colSizes: { all: 12 }, className: b('content') }))))),
48
+ React.createElement(Col, { sizes: colSizes, className: b('form-col') },
49
+ React.createElement("div", { className: b('form-wrapper') },
50
+ React.createElement("div", { className: b('full-form', {
51
+ hidden: !contentLoaded,
52
+ }) },
53
+ title && (React.createElement(Title, { title: {
54
+ text: title,
55
+ textSize: 's',
56
+ }, className: b('title', { mobile: isMobile }), colSizes: { all: 12 } })),
57
+ React.createElement(InnerForm, { className: b('form'), formData: formData, onContentLoad: onContentLoad }))))))));
58
+ };
59
+ export 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,12 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import useMount from '../../hooks/useMount';
4
+ import { HubspotForm } from '../../sub-blocks';
5
+ const HubspotInlineForm = (props) => {
6
+ const { onReady } = props, rest = __rest(props, ["onReady"]);
7
+ useMount(() => {
8
+ onReady === null || onReady === void 0 ? void 0 : onReady();
9
+ });
10
+ return React.createElement(HubspotForm, Object.assign({}, rest, { createDOMElement: true }));
11
+ };
12
+ export 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,26 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useEffect } from 'react';
3
+ import { YandexForm } from '../../../components';
4
+ import { isHubspotDataForm, isYandexDataForm } from '../../../models';
5
+ import { HubspotForm } from '../../../sub-blocks';
6
+ const InnerForm = (props) => {
7
+ const { formData, onContentLoad, className } = props;
8
+ useEffect(() => {
9
+ if (isHubspotDataForm(formData)) {
10
+ onContentLoad();
11
+ }
12
+ }, [onContentLoad, formData]);
13
+ if (isYandexDataForm(formData)) {
14
+ const _a = formData.yandex, { onLoad } = _a, rest = __rest(_a, ["onLoad"]);
15
+ return (React.createElement("div", { className: className },
16
+ React.createElement(YandexForm, Object.assign({}, rest, { onLoad: () => {
17
+ onContentLoad();
18
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad();
19
+ } }))));
20
+ }
21
+ if (isHubspotDataForm(formData)) {
22
+ return React.createElement(HubspotForm, Object.assign({}, formData.hubspot));
23
+ }
24
+ return null;
25
+ };
26
+ export default InnerForm;