@gravity-ui/page-constructor 1.2.5 → 1.3.0-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.
- package/CHANGELOG.md +7 -0
- package/build/cjs/blocks/Companies/Companies.js +2 -6
- package/build/cjs/blocks/ContentLayout/schema.js +2 -1
- package/build/cjs/blocks/Header/Header.css +11 -10
- package/build/cjs/blocks/Header/Header.js +15 -15
- package/build/cjs/blocks/Header/schema.d.ts +332 -230
- package/build/cjs/blocks/Header/schema.js +6 -20
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/cjs/blocks/Tabs/Tabs.js +3 -2
- package/build/cjs/blocks/Tabs/schema.js +2 -1
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +1 -1
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +4 -3
- package/build/cjs/components/Image/Image.d.ts +2 -4
- package/build/cjs/components/Image/Image.js +16 -6
- package/build/cjs/components/Image/schema.d.ts +56 -0
- package/build/cjs/components/Image/schema.js +54 -0
- package/build/cjs/components/Media/Image/Image.js +3 -3
- package/build/cjs/components/Media/Image/utils.d.ts +2 -2
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
- package/build/cjs/models/constructor-items/common.d.ts +12 -8
- package/build/cjs/models/guards.d.ts +2 -3
- package/build/cjs/models/guards.js +1 -5
- package/build/cjs/schema/validators/common.d.ts +0 -31
- package/build/cjs/schema/validators/common.js +5 -32
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -1
- package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
- package/build/cjs/sub-blocks/Partner/schema.js +2 -1
- package/build/cjs/sub-blocks/Quote/Quote.js +3 -2
- package/build/cjs/sub-blocks/Quote/schema.js +4 -3
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -1
- package/build/esm/blocks/Companies/Companies.js +2 -6
- package/build/esm/blocks/ContentLayout/schema.js +2 -1
- package/build/esm/blocks/Header/Header.css +11 -10
- package/build/esm/blocks/Header/Header.js +16 -16
- package/build/esm/blocks/Header/schema.d.ts +332 -230
- package/build/esm/blocks/Header/schema.js +5 -19
- package/build/esm/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/esm/blocks/Tabs/Tabs.js +3 -2
- package/build/esm/blocks/Tabs/schema.js +2 -1
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +1 -1
- package/build/esm/components/FullscreenImage/FullscreenImage.js +4 -3
- package/build/esm/components/Image/Image.d.ts +2 -4
- package/build/esm/components/Image/Image.js +17 -7
- package/build/esm/components/Image/schema.d.ts +56 -0
- package/build/esm/components/Image/schema.js +51 -0
- package/build/esm/components/Media/Image/Image.js +3 -3
- package/build/esm/components/Media/Image/utils.d.ts +2 -2
- package/build/esm/models/constructor-items/blocks.d.ts +4 -8
- package/build/esm/models/constructor-items/common.d.ts +12 -8
- package/build/esm/models/guards.d.ts +2 -3
- package/build/esm/models/guards.js +0 -3
- package/build/esm/schema/validators/common.d.ts +0 -31
- package/build/esm/schema/validators/common.js +1 -28
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/esm/sub-blocks/BasicCard/schema.js +2 -1
- package/build/esm/sub-blocks/Partner/Partner.js +1 -1
- package/build/esm/sub-blocks/Partner/schema.js +2 -1
- package/build/esm/sub-blocks/Quote/Quote.js +3 -2
- package/build/esm/sub-blocks/Quote/schema.js +2 -1
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/esm/sub-blocks/TutorialCard/schema.js +2 -1
- package/package.json +4 -1
- package/server/models/constructor-items/blocks.d.ts +4 -8
- package/server/models/constructor-items/common.d.ts +12 -8
- package/server/models/guards.d.ts +2 -3
- package/server/models/guards.js +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.0](https://github.com/gravity-ui/page-constructor/pull/35) (2022-10-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add devices support to component Image and block Header
|
|
9
|
+
|
|
3
10
|
## [1.2.5](https://github.com/gravity-ui/page-constructor/compare/v1.2.4...v1.2.5) (2022-10-19)
|
|
4
11
|
|
|
5
12
|
### Bug Fixes
|
|
@@ -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(
|
|
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, { className: b('image') }))))));
|
|
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:
|
|
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
|
}
|
|
@@ -124,6 +125,16 @@ unpredictable css rules order in build */
|
|
|
124
125
|
top: 16px;
|
|
125
126
|
z-index: 11;
|
|
126
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
|
+
}
|
|
127
138
|
.pc-header-block__background, .pc-header-block__background.pc-header-block__background_media {
|
|
128
139
|
position: absolute;
|
|
129
140
|
top: 0;
|
|
@@ -142,19 +153,12 @@ unpredictable css rules order in build */
|
|
|
142
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 {
|
|
143
154
|
max-width: none;
|
|
144
155
|
}
|
|
145
|
-
.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 {
|
|
146
|
-
height: 100%;
|
|
147
|
-
}
|
|
148
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 {
|
|
149
157
|
height: 100%;
|
|
150
158
|
width: 100%;
|
|
151
159
|
object-fit: cover;
|
|
152
160
|
}
|
|
153
|
-
.pc-header-block__background_full-width-media {
|
|
154
|
-
--pc-border-radius: 0;
|
|
155
|
-
}
|
|
156
161
|
.pc-header-block__background_full-width {
|
|
157
|
-
--pc-border-radius: 0;
|
|
158
162
|
left: 0;
|
|
159
163
|
transform: none;
|
|
160
164
|
max-width: none;
|
|
@@ -190,9 +194,6 @@ unpredictable css rules order in build */
|
|
|
190
194
|
.pc-header-block_has-media .pc-header-block__content {
|
|
191
195
|
padding-top: 48px;
|
|
192
196
|
}
|
|
193
|
-
.pc-header-block_has-background .pc-header-block__background-img {
|
|
194
|
-
display: none;
|
|
195
|
-
}
|
|
196
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 {
|
|
197
198
|
padding: calc(96px - 16px) 0;
|
|
198
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,
|
|
17
|
-
|
|
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
|
|
27
|
+
const hasRightSideImage = Boolean(image || video);
|
|
24
28
|
const curImageSize = imageSize || (0, utils_2.getImageSize)(width);
|
|
25
|
-
const titleSizes =
|
|
29
|
+
const titleSizes = hasRightSideImage ? (0, utils_2.titleWithImageSizes)(curImageSize) : (0, utils_2.getTitleSizes)(width);
|
|
26
30
|
let curVerticalOffset = verticalOffset;
|
|
27
|
-
if (
|
|
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 =
|
|
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
|
-
|
|
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;
|