@gravity-ui/page-constructor 1.2.3 → 1.2.5-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 (78) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/cjs/blocks/Companies/Companies.js +2 -6
  3. package/build/cjs/blocks/ContentLayout/schema.js +2 -1
  4. package/build/cjs/blocks/Header/Header.css +13 -11
  5. package/build/cjs/blocks/Header/Header.js +15 -15
  6. package/build/cjs/blocks/Header/schema.d.ts +332 -230
  7. package/build/cjs/blocks/Header/schema.js +6 -20
  8. package/build/cjs/blocks/HeaderSlider/schema.d.ts +96 -115
  9. package/build/cjs/blocks/Tabs/Tabs.js +3 -2
  10. package/build/cjs/blocks/Tabs/schema.js +2 -1
  11. package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
  12. package/build/cjs/components/BackgroundMedia/BackgroundMedia.css +2 -0
  13. package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +2 -2
  14. package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +2 -2
  15. package/build/cjs/components/Image/Image.d.ts +3 -5
  16. package/build/cjs/components/Image/Image.js +16 -6
  17. package/build/cjs/components/Image/schema.d.ts +56 -0
  18. package/build/cjs/components/Image/schema.js +54 -0
  19. package/build/cjs/components/Link/Link.js +1 -1
  20. package/build/cjs/components/Media/Image/Image.js +3 -3
  21. package/build/cjs/components/Media/Image/utils.d.ts +2 -2
  22. package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
  23. package/build/cjs/models/constructor-items/common.d.ts +11 -7
  24. package/build/cjs/models/guards.d.ts +2 -3
  25. package/build/cjs/models/guards.js +1 -5
  26. package/build/cjs/schema/validators/common.d.ts +0 -31
  27. package/build/cjs/schema/validators/common.js +5 -32
  28. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -1
  29. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
  30. package/build/cjs/sub-blocks/BasicCard/schema.js +2 -1
  31. package/build/cjs/sub-blocks/Content/Content.css +2 -1
  32. package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
  33. package/build/cjs/sub-blocks/Partner/schema.js +2 -1
  34. package/build/cjs/sub-blocks/Quote/Quote.js +3 -2
  35. package/build/cjs/sub-blocks/Quote/schema.js +4 -3
  36. package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
  37. package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -1
  38. package/build/esm/blocks/Companies/Companies.js +2 -6
  39. package/build/esm/blocks/ContentLayout/schema.js +2 -1
  40. package/build/esm/blocks/Header/Header.css +13 -11
  41. package/build/esm/blocks/Header/Header.js +16 -16
  42. package/build/esm/blocks/Header/schema.d.ts +332 -230
  43. package/build/esm/blocks/Header/schema.js +5 -19
  44. package/build/esm/blocks/HeaderSlider/schema.d.ts +96 -115
  45. package/build/esm/blocks/Tabs/Tabs.js +3 -2
  46. package/build/esm/blocks/Tabs/schema.js +2 -1
  47. package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
  48. package/build/esm/components/BackgroundMedia/BackgroundMedia.css +2 -0
  49. package/build/esm/components/BackgroundMedia/BackgroundMedia.js +2 -2
  50. package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +2 -2
  51. package/build/esm/components/Image/Image.d.ts +3 -5
  52. package/build/esm/components/Image/Image.js +17 -7
  53. package/build/esm/components/Image/schema.d.ts +56 -0
  54. package/build/esm/components/Image/schema.js +51 -0
  55. package/build/esm/components/Link/Link.js +1 -1
  56. package/build/esm/components/Media/Image/Image.js +3 -3
  57. package/build/esm/components/Media/Image/utils.d.ts +2 -2
  58. package/build/esm/models/constructor-items/blocks.d.ts +4 -8
  59. package/build/esm/models/constructor-items/common.d.ts +11 -7
  60. package/build/esm/models/guards.d.ts +2 -3
  61. package/build/esm/models/guards.js +0 -3
  62. package/build/esm/schema/validators/common.d.ts +0 -31
  63. package/build/esm/schema/validators/common.js +1 -28
  64. package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
  65. package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
  66. package/build/esm/sub-blocks/BasicCard/schema.js +2 -1
  67. package/build/esm/sub-blocks/Content/Content.css +2 -1
  68. package/build/esm/sub-blocks/Partner/Partner.js +1 -1
  69. package/build/esm/sub-blocks/Partner/schema.js +2 -1
  70. package/build/esm/sub-blocks/Quote/Quote.js +3 -2
  71. package/build/esm/sub-blocks/Quote/schema.js +2 -1
  72. package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
  73. package/build/esm/sub-blocks/TutorialCard/schema.js +2 -1
  74. package/package.json +4 -1
  75. package/server/models/constructor-items/blocks.d.ts +4 -8
  76. package/server/models/constructor-items/common.d.ts +11 -7
  77. package/server/models/guards.d.ts +2 -3
  78. package/server/models/guards.js +1 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.5](https://github.com/gravity-ui/page-constructor/compare/v1.2.4...v1.2.5) (2022-10-19)
4
+
5
+ ### Bug Fixes
6
+
7
+ * content block link arrow l size changed to 20 ([8b05033](https://github.com/gravity-ui/page-constructor/commit/8b050332273453aedc2937303d9dec76b878482c))
8
+
9
+
10
+ ## [1.2.4](https://github.com/gravity-ui/page-constructor/compare/v1.2.3...v1.2.4) (2022-10-19)
11
+
12
+ ### Bug Fixes
13
+
14
+ * buttons specificities fixes ([96a4cf6](https://github.com/gravity-ui/page-constructor/commit/96a4cf6aee58d19b42e9e649ee3969c86d94be2a))
15
+
3
16
  ## [1.2.3](https://github.com/gravity-ui/page-constructor/compare/v1.2.2...v1.2.3) (2022-10-14)
4
17
 
5
18
 
@@ -5,21 +5,17 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const utils_1 = require("../../utils");
7
7
  const AnimateBlock_1 = (0, tslib_1.__importDefault)(require("../../components/AnimateBlock/AnimateBlock"));
8
- const constants_1 = require("../../constants");
9
8
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
9
+ const components_1 = require("../../components");
10
10
  const b = (0, utils_1.block)('companies-block');
11
11
  const CompaniesBlock = ({ title, images, animated }) => {
12
12
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
13
13
  const themedImages = (0, utils_1.getThemedValue)(images, theme) || {};
14
- const { desktop, mobile, tablet, alt } = themedImages;
15
14
  return (react_1.default.createElement(AnimateBlock_1.default, { className: b(), offset: 150, animate: animated },
16
15
  react_1.default.createElement("div", { className: b('content') },
17
16
  react_1.default.createElement("h2", { className: b('title') }, title),
18
17
  react_1.default.createElement("div", { className: b('images') },
19
- react_1.default.createElement("picture", null,
20
- react_1.default.createElement("source", { srcSet: desktop, media: `(min-width: ${constants_1.BREAKPOINTS.md}px)` }),
21
- react_1.default.createElement("source", { srcSet: tablet, media: `(min-width: ${constants_1.BREAKPOINTS.sm}px)` }),
22
- react_1.default.createElement("img", { className: b('image'), srcSet: mobile, alt: alt }))))));
18
+ react_1.default.createElement(components_1.Image, Object.assign({}, themedImages))))));
23
19
  };
24
20
  exports.CompaniesBlock = CompaniesBlock;
25
21
  exports.default = exports.CompaniesBlock;
@@ -4,6 +4,7 @@ exports.ContentLayoutBlock = void 0;
4
4
  const schema_1 = require("../../sub-blocks/Content/schema");
5
5
  const utils_1 = require("../../schema/validators/utils");
6
6
  const common_1 = require("../../schema/validators/common");
7
+ const schema_2 = require("../../components/Image/schema");
7
8
  exports.ContentLayoutBlock = {
8
9
  'content-layout-block': {
9
10
  additionalProperties: false,
@@ -12,7 +13,7 @@ exports.ContentLayoutBlock = {
12
13
  type: 'string',
13
14
  enum: common_1.contentSizes,
14
15
  },
15
- background: common_1.ImageObjectProps,
16
+ background: schema_2.ImageObjectProps,
16
17
  centered: {
17
18
  type: 'boolean',
18
19
  },
@@ -9,6 +9,7 @@ unpredictable css rules order in build */
9
9
  margin: 16px 0;
10
10
  }
11
11
  .pc-header-block_full-width {
12
+ --pc-border-radius: 0;
12
13
  padding: 16px 0;
13
14
  margin: 0 0 16px;
14
15
  }
@@ -86,10 +87,11 @@ unpredictable css rules order in build */
86
87
  .pc-header-block__buttons {
87
88
  margin-top: 16px;
88
89
  }
89
- .pc-header-block__button {
90
+ .pc-header-block__button.pc-header-block__button {
90
91
  margin-top: 16px;
91
92
  margin-right: 16px;
92
93
  }
94
+
93
95
  .pc-header-block__media {
94
96
  position: absolute;
95
97
  display: none;
@@ -123,6 +125,16 @@ unpredictable css rules order in build */
123
125
  top: 16px;
124
126
  z-index: 11;
125
127
  }
128
+ .pc-header-block__background-media {
129
+ height: 100%;
130
+ }
131
+ .pc-header-block__background-media > div {
132
+ height: 100%;
133
+ width: 100%;
134
+ }
135
+ .pc-header-block__background-media > div:not(.pc-header-block__video) {
136
+ position: absolute;
137
+ }
126
138
  .pc-header-block__background, .pc-header-block__background.pc-header-block__background_media {
127
139
  position: absolute;
128
140
  top: 0;
@@ -141,19 +153,12 @@ unpredictable css rules order in build */
141
153
  .pc-header-block__background.pc-header-block__background_full-width-media > div, .pc-header-block__background.pc-header-block__background_media.pc-header-block__background_full-width-media > div {
142
154
  max-width: none;
143
155
  }
144
- .pc-header-block__background.pc-header-block__background_full-width-media .pc-header-block__background-media, .pc-header-block__background.pc-header-block__background_media.pc-header-block__background_full-width-media .pc-header-block__background-media {
145
- height: 100%;
146
- }
147
156
  .pc-header-block__background.pc-header-block__background_full-width-media video, .pc-header-block__background.pc-header-block__background_media.pc-header-block__background_full-width-media video {
148
157
  height: 100%;
149
158
  width: 100%;
150
159
  object-fit: cover;
151
160
  }
152
- .pc-header-block__background_full-width-media {
153
- --pc-border-radius: 0;
154
- }
155
161
  .pc-header-block__background_full-width {
156
- --pc-border-radius: 0;
157
162
  left: 0;
158
163
  transform: none;
159
164
  max-width: none;
@@ -189,9 +194,6 @@ unpredictable css rules order in build */
189
194
  .pc-header-block_has-media .pc-header-block__content {
190
195
  padding-top: 48px;
191
196
  }
192
- .pc-header-block_has-background .pc-header-block__background-img {
193
- display: none;
194
- }
195
197
  .pc-header-block .pc-header-block__content_vertical-offset_s, .pc-header-block .pc-header-block__content_vertical-offset_m, .pc-header-block .pc-header-block__content_vertical-offset_l, .pc-header-block .pc-header-block__content_vertical-offset_xl {
196
198
  padding: calc(96px - 16px) 0;
197
199
  }
@@ -4,40 +4,40 @@ exports.HeaderBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const utils_1 = require("../../utils");
7
- const guards_1 = require("../../models/guards");
8
7
  const components_1 = require("../../components");
9
8
  const grid_1 = require("../../grid");
10
9
  const utils_2 = require("./utils");
10
+ const mobileContext_1 = require("../../context/mobileContext");
11
11
  const YFMWrapper_1 = (0, tslib_1.__importDefault)(require("../../components/YFMWrapper/YFMWrapper"));
12
12
  const HeaderBreadcrumbs_1 = (0, tslib_1.__importDefault)(require("../../components/HeaderBreadcrumbs/HeaderBreadcrumbs"));
13
13
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
14
+ const utils_3 = require("../../components/Media/Image/utils");
14
15
  const b = (0, utils_1.block)('header-block');
15
- const Background = ({ background }) => {
16
- const { url, color, disableCompress, fullWidth, fullWidthMedia } = background;
17
- return (0, guards_1.headerHasMediaBackground)(background) ? (react_1.default.createElement(components_1.BackgroundMedia, Object.assign({}, background, { mediaClassName: b('background-media'), className: b('background', { media: true, 'full-width-media': fullWidthMedia }) }))) : (react_1.default.createElement(components_1.BackgroundImage, { src: url, className: b('background', { 'full-width-media': fullWidthMedia }), imageClassName: b('background-img'), style: { backgroundColor: fullWidth ? 'none' : color }, disableCompress: disableCompress }));
16
+ const Background = ({ background, isMobile }) => {
17
+ const { url, image, fullWidthMedia, video, color } = background;
18
+ const imageObject = url ? (0, utils_3.getMediaImage)(url) : image;
19
+ const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);
20
+ return (react_1.default.createElement("div", { className: b('background', { media: true, 'full-width-media': fullWidthMedia }), style: { backgroundColor: color } }, renderMedia && (react_1.default.createElement(components_1.Media, Object.assign({}, background, { className: b('background-media'), imageClassName: b('image'), videoClassName: b('video'), isBackground: true, parallax: false, video: isMobile ? undefined : video, image: imageObject })))));
18
21
  };
19
22
  const FullWidthBackground = ({ background }) => (react_1.default.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
20
23
  const HeaderBlock = (props) => {
21
24
  const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, children, } = props;
25
+ const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
22
26
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
23
- const hasMedia = Boolean(image || video);
27
+ const hasRightSideImage = Boolean(image || video);
24
28
  const curImageSize = imageSize || (0, utils_2.getImageSize)(width);
25
- const titleSizes = hasMedia ? (0, utils_2.titleWithImageSizes)(curImageSize) : (0, utils_2.getTitleSizes)(width);
29
+ const titleSizes = hasRightSideImage ? (0, utils_2.titleWithImageSizes)(curImageSize) : (0, utils_2.getTitleSizes)(width);
26
30
  let curVerticalOffset = verticalOffset;
27
- if (hasMedia && !verticalOffset) {
31
+ if (hasRightSideImage && !verticalOffset) {
28
32
  curVerticalOffset = 'm';
29
33
  }
30
34
  const backgroundThemed = background && (0, utils_1.getThemedValue)(background, theme);
31
35
  const imageThemed = image && (0, utils_1.getThemedValue)(image, theme);
32
36
  const videoThemed = video && (0, utils_1.getThemedValue)(video, theme);
33
- const fullWidth = Boolean(backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.fullWidth);
34
- return (react_1.default.createElement("header", { className: b({
35
- ['has-media']: hasMedia,
36
- ['has-background']: Boolean(background),
37
- ['full-width']: fullWidth,
38
- }, className) },
37
+ const fullWidth = (backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.fullWidth) || (backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.fullWidthMedia);
38
+ return (react_1.default.createElement("header", { className: b({ ['has-media']: hasRightSideImage, ['full-width']: fullWidth }, className) },
39
39
  backgroundThemed && fullWidth && react_1.default.createElement(FullWidthBackground, { background: backgroundThemed }),
40
- backgroundThemed && react_1.default.createElement(Background, { background: backgroundThemed }),
40
+ backgroundThemed && react_1.default.createElement(Background, { background: backgroundThemed, isMobile: isMobile }),
41
41
  react_1.default.createElement(grid_1.Grid, { containerClass: b('container-fluid') },
42
42
  breadcrumbs && (react_1.default.createElement(grid_1.Row, { className: b('breadcrumbs') },
43
43
  react_1.default.createElement(grid_1.Col, null,
@@ -62,7 +62,7 @@ const HeaderBlock = (props) => {
62
62
  buttons.map((button, index) => (react_1.default.createElement(components_1.RouterLink, { href: button.url, key: index },
63
63
  react_1.default.createElement(components_1.Button, Object.assign({ key: index, className: b('button'), size: "xl" }, button))))))),
64
64
  children))),
65
- hasMedia && (react_1.default.createElement(components_1.Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed })))))));
65
+ hasRightSideImage && (react_1.default.createElement(components_1.Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed })))))));
66
66
  };
67
67
  exports.HeaderBlock = HeaderBlock;
68
68
  exports.default = exports.HeaderBlock;