@gravity-ui/page-constructor 1.2.1 → 1.2.3-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 +14 -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 +0 -3
- package/build/cjs/blocks/Header/Header.js +7 -2
- package/build/cjs/blocks/Header/schema.js +2 -1
- 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/FullscreenImage/FullscreenImage.d.ts +2 -2
- package/build/cjs/components/Image/Image.d.ts +3 -5
- package/build/cjs/components/Image/Image.js +9 -5
- package/build/cjs/components/Image/schema.d.ts +52 -0
- package/build/cjs/components/Image/schema.js +52 -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/containers/PageConstructor/PageConstructor.css +17 -5
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
- package/build/cjs/models/constructor-items/common.d.ts +11 -7
- package/build/cjs/schema/validators/common.d.ts +0 -30
- package/build/cjs/schema/validators/common.js +4 -30
- 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/Content/Content.css +16 -8
- package/build/cjs/sub-blocks/Content/Content.js +6 -2
- 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 +2 -1
- 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 +0 -3
- package/build/esm/blocks/Header/Header.js +7 -2
- package/build/esm/blocks/Header/schema.js +2 -1
- 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/FullscreenImage/FullscreenImage.d.ts +2 -2
- package/build/esm/components/Image/Image.d.ts +3 -5
- package/build/esm/components/Image/Image.js +9 -5
- package/build/esm/components/Image/schema.d.ts +52 -0
- package/build/esm/components/Image/schema.js +49 -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/containers/PageConstructor/PageConstructor.css +17 -5
- package/build/esm/models/constructor-items/blocks.d.ts +4 -8
- package/build/esm/models/constructor-items/common.d.ts +11 -7
- package/build/esm/schema/validators/common.d.ts +0 -30
- package/build/esm/schema/validators/common.js +1 -27
- 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/Content/Content.css +16 -8
- package/build/esm/sub-blocks/Content/Content.js +6 -2
- 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 +11 -7
- package/styles/styles.css +17 -5
- package/styles/yfm.scss +18 -5
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.pc-content_size_l .pc-content__text .yfm,
|
|
2
|
-
.pc-content_size_l .pc-content__notice .yfm
|
|
3
|
-
.pc-content_size_l .pc-content__notice .yfm > * {
|
|
2
|
+
.pc-content_size_l .pc-content__notice .yfm {
|
|
4
3
|
margin: 0;
|
|
5
4
|
}
|
|
6
5
|
|
|
@@ -22,15 +21,16 @@ unpredictable css rules order in build */
|
|
|
22
21
|
.pc-content__notice.pc-content__notice .yfm a:hover {
|
|
23
22
|
color: var(--yc-color-text-primary);
|
|
24
23
|
}
|
|
25
|
-
.pc-content__notice.pc-content__notice ol,
|
|
26
|
-
.pc-content__notice.pc-content__notice ul {
|
|
27
|
-
padding-left: 25px;
|
|
28
|
-
}
|
|
29
24
|
|
|
30
25
|
.pc-content__button {
|
|
31
26
|
margin-top: 0;
|
|
32
27
|
margin-right: 12px;
|
|
33
28
|
}
|
|
29
|
+
.pc-content__links {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
align-items: baseline;
|
|
33
|
+
}
|
|
34
34
|
.pc-content__link {
|
|
35
35
|
display: block;
|
|
36
36
|
margin-right: 32px;
|
|
@@ -40,9 +40,18 @@ unpredictable css rules order in build */
|
|
|
40
40
|
text-align: center;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
.pc-content_centered .pc-content__links {
|
|
44
|
+
align-items: center;
|
|
45
|
+
}
|
|
43
46
|
.pc-content_centered .pc-content__link a {
|
|
44
47
|
justify-content: center;
|
|
45
48
|
}
|
|
49
|
+
.pc-content_centered .pc-content__notice .yfm ul,
|
|
50
|
+
.pc-content_centered .pc-content__notice .yfm ol,
|
|
51
|
+
.pc-content_centered .pc-content__text .yfm ul,
|
|
52
|
+
.pc-content_centered .pc-content__text .yfm ol {
|
|
53
|
+
text-align: left;
|
|
54
|
+
}
|
|
46
55
|
.pc-content_size_s .pc-content__text,
|
|
47
56
|
.pc-content_size_s .pc-content__notice {
|
|
48
57
|
margin-top: 8px;
|
|
@@ -64,8 +73,7 @@ unpredictable css rules order in build */
|
|
|
64
73
|
margin-top: 0;
|
|
65
74
|
}
|
|
66
75
|
.pc-content_size_l .pc-content__text .yfm,
|
|
67
|
-
.pc-content_size_l .pc-content__notice .yfm
|
|
68
|
-
.pc-content_size_l .pc-content__notice .yfm > * {
|
|
76
|
+
.pc-content_size_l .pc-content__notice .yfm {
|
|
69
77
|
font-size: var(--yc-text-body-3-font-size);
|
|
70
78
|
line-height: var(--yc-text-body-3-line-height);
|
|
71
79
|
}
|
|
@@ -43,9 +43,13 @@ const Content = (props) => {
|
|
|
43
43
|
return (react_1.default.createElement(grid_1.Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes },
|
|
44
44
|
title && react_1.default.createElement(components_1.Title, Object.assign({ className: b('title') }, titleProps, { resetMargin: true })),
|
|
45
45
|
text && (react_1.default.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
|
|
46
|
-
react_1.default.createElement(components_1.YFMWrapper, { content: text, modifiers: { constructor: true } }))),
|
|
46
|
+
react_1.default.createElement(components_1.YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true } }))),
|
|
47
47
|
additionalInfo && (react_1.default.createElement("div", { className: b('notice') },
|
|
48
|
-
react_1.default.createElement(components_1.YFMWrapper, { content: additionalInfo, modifiers: {
|
|
48
|
+
react_1.default.createElement(components_1.YFMWrapper, { content: additionalInfo, modifiers: {
|
|
49
|
+
constructor: true,
|
|
50
|
+
'constructor-notice': true,
|
|
51
|
+
[`constructor-size-${size}`]: true,
|
|
52
|
+
} }))),
|
|
49
53
|
links && (react_1.default.createElement("div", { className: b('links') }, links.map((link) => (react_1.default.createElement(Link_1.default, Object.assign({ className: b('link') }, link, { textSize: getLinkSize(size), key: link.url })))))),
|
|
50
54
|
buttons && (react_1.default.createElement("div", { className: b('buttons') }, buttons.map((item) => (react_1.default.createElement(components_1.Button, Object.assign({ className: b('button') }, item, { key: item.url, size: getButtonSize(size) }))))))));
|
|
51
55
|
};
|
|
@@ -9,7 +9,7 @@ const Partner = ({ text, logo, url, border }) => {
|
|
|
9
9
|
const logoData = typeof logo === 'string' ? { src: logo } : logo;
|
|
10
10
|
return (react_1.default.createElement(components_1.CardBase, { url: url, target: "_blank", className: b(), border: border },
|
|
11
11
|
react_1.default.createElement(components_1.CardBase.Content, null,
|
|
12
|
-
react_1.default.createElement(components_1.Image, { className: b('logo')
|
|
12
|
+
react_1.default.createElement(components_1.Image, Object.assign({ className: b('logo') }, logoData)),
|
|
13
13
|
react_1.default.createElement(components_1.HTML, null, text))));
|
|
14
14
|
};
|
|
15
15
|
exports.default = Partner;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PartnerBlock = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../../components/Image/schema");
|
|
5
6
|
exports.PartnerBlock = {
|
|
6
7
|
partner: {
|
|
7
8
|
additionalProperties: false,
|
|
8
9
|
required: ['text', 'logo', 'url'],
|
|
9
10
|
properties: Object.assign(Object.assign({}, common_1.BaseProps), { text: {
|
|
10
11
|
type: 'string',
|
|
11
|
-
}, logo:
|
|
12
|
+
}, logo: schema_1.ImageProps, url: {
|
|
12
13
|
type: 'string',
|
|
13
14
|
} }),
|
|
14
15
|
},
|
|
@@ -7,12 +7,13 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const models_1 = require("../../models");
|
|
8
8
|
const components_1 = require("../../components");
|
|
9
9
|
const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
10
|
+
const utils_2 = require("../../components/Media/Image/utils");
|
|
10
11
|
const b = (0, utils_1.block)('quote');
|
|
11
12
|
const Quote = (props) => {
|
|
12
13
|
const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
|
|
13
14
|
const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
|
|
14
15
|
const imageThemed = (0, utils_1.getThemedValue)(image, theme);
|
|
15
|
-
const imageData =
|
|
16
|
+
const imageData = (0, utils_2.getMediaImage)(imageThemed);
|
|
16
17
|
const renderFooter = Boolean(author || url) && (react_1.default.createElement("div", { className: b('author-wrapper') },
|
|
17
18
|
author && (react_1.default.createElement(components_1.Author, { className: b('author', { theme: textTheme }), author: author, type: models_1.AuthorType.Line })),
|
|
18
19
|
url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }) }, buttonText))));
|
|
@@ -25,6 +26,6 @@ const Quote = (props) => {
|
|
|
25
26
|
react_1.default.createElement(components_1.HTML, null, text)))),
|
|
26
27
|
renderFooter),
|
|
27
28
|
react_1.default.createElement("div", { className: b('image-wrapper') },
|
|
28
|
-
react_1.default.createElement(components_1.Image, {
|
|
29
|
+
react_1.default.createElement(components_1.Image, Object.assign({}, imageData, { className: b('image') })))));
|
|
29
30
|
};
|
|
30
31
|
exports.default = Quote;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Quote = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../../components/Image/schema");
|
|
5
6
|
exports.Quote = {
|
|
6
7
|
quote: {
|
|
7
8
|
additionalProperties: false,
|
|
8
9
|
required: ['text', 'image', 'logo'],
|
|
9
10
|
properties: Object.assign(Object.assign({}, common_1.BaseProps), { text: {
|
|
10
11
|
type: 'string',
|
|
11
|
-
}, image: (0, common_1.withTheme)(
|
|
12
|
+
}, image: (0, common_1.withTheme)(schema_1.ImageProps), logo: {
|
|
12
13
|
type: 'string',
|
|
13
14
|
pattern: common_1.urlPattern,
|
|
14
15
|
}, color: {
|
|
@@ -8,8 +8,8 @@ const components_1 = require("../../components/");
|
|
|
8
8
|
const utils_2 = require("../../components/Media/Image/utils");
|
|
9
9
|
const b = (0, utils_1.block)('tutorial-card');
|
|
10
10
|
function iconElement(icon, title) {
|
|
11
|
-
const
|
|
12
|
-
return react_1.default.createElement(components_1.Image, {
|
|
11
|
+
const image = (0, utils_2.getMediaImage)(icon !== null && icon !== void 0 ? icon : {});
|
|
12
|
+
return react_1.default.createElement(components_1.Image, Object.assign({}, image, { alt: title, className: b('icon') }));
|
|
13
13
|
}
|
|
14
14
|
const TutorialCard = (props) => {
|
|
15
15
|
const { url, title, text, border, icon } = props;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TutorialCard = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../../components/Image/schema");
|
|
5
6
|
exports.TutorialCard = {
|
|
6
7
|
'tutorial-card': {
|
|
7
8
|
additionalProperties: false,
|
|
@@ -12,6 +13,6 @@ exports.TutorialCard = {
|
|
|
12
13
|
type: 'string',
|
|
13
14
|
}, text: {
|
|
14
15
|
type: 'string',
|
|
15
|
-
}, icon:
|
|
16
|
+
}, icon: schema_1.ImageProps }),
|
|
16
17
|
},
|
|
17
18
|
};
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
3
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
4
|
-
import { BREAKPOINTS } from '../../constants';
|
|
5
4
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
5
|
+
import { Image } from '../../components';
|
|
6
6
|
import './Companies.css';
|
|
7
7
|
const b = block('companies-block');
|
|
8
8
|
export const CompaniesBlock = ({ title, images, animated }) => {
|
|
9
9
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
10
10
|
const themedImages = getThemedValue(images, theme) || {};
|
|
11
|
-
const { desktop, mobile, tablet, alt } = themedImages;
|
|
12
11
|
return (React.createElement(AnimateBlock, { className: b(), offset: 150, animate: animated },
|
|
13
12
|
React.createElement("div", { className: b('content') },
|
|
14
13
|
React.createElement("h2", { className: b('title') }, title),
|
|
15
14
|
React.createElement("div", { className: b('images') },
|
|
16
|
-
React.createElement(
|
|
17
|
-
React.createElement("source", { srcSet: desktop, media: `(min-width: ${BREAKPOINTS.md}px)` }),
|
|
18
|
-
React.createElement("source", { srcSet: tablet, media: `(min-width: ${BREAKPOINTS.sm}px)` }),
|
|
19
|
-
React.createElement("img", { className: b('image'), srcSet: mobile, alt: alt }))))));
|
|
15
|
+
React.createElement(Image, Object.assign({}, themedImages))))));
|
|
20
16
|
};
|
|
21
17
|
export default CompaniesBlock;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ContentBlock } from '../../sub-blocks/Content/schema';
|
|
2
2
|
import { filteredArray } from '../../schema/validators/utils';
|
|
3
|
-
import { contentSizes, contentTextWidth, contentThemes, FileLinkProps,
|
|
3
|
+
import { contentSizes, contentTextWidth, contentThemes, FileLinkProps, BlockBaseProps, } from '../../schema/validators/common';
|
|
4
|
+
import { ImageObjectProps } from '../../components/Image/schema';
|
|
4
5
|
export const ContentLayoutBlock = {
|
|
5
6
|
'content-layout-block': {
|
|
6
7
|
additionalProperties: false,
|
|
@@ -189,9 +189,6 @@ unpredictable css rules order in build */
|
|
|
189
189
|
.pc-header-block_has-media .pc-header-block__content {
|
|
190
190
|
padding-top: 48px;
|
|
191
191
|
}
|
|
192
|
-
.pc-header-block_has-background .pc-header-block__background-img {
|
|
193
|
-
display: none;
|
|
194
|
-
}
|
|
195
192
|
.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
193
|
padding: calc(96px - 16px) 0;
|
|
197
194
|
}
|
|
@@ -7,11 +7,16 @@ import { getImageSize, getTitleSizes, titleWithImageSizes } from './utils';
|
|
|
7
7
|
import YFMWrapper from '../../components/YFMWrapper/YFMWrapper';
|
|
8
8
|
import HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';
|
|
9
9
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
10
|
+
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
10
11
|
import './Header.css';
|
|
11
12
|
const b = block('header-block');
|
|
12
13
|
const Background = ({ background }) => {
|
|
13
|
-
const { url, color, disableCompress, fullWidth, fullWidthMedia } = background;
|
|
14
|
-
|
|
14
|
+
const { url, color, disableCompress, fullWidth, fullWidthMedia, image } = background;
|
|
15
|
+
const imageObject = (url && getMediaImage(url)) || image;
|
|
16
|
+
if (imageObject && disableCompress) {
|
|
17
|
+
imageObject.disableCompress = disableCompress;
|
|
18
|
+
}
|
|
19
|
+
return headerHasMediaBackground(background) ? (React.createElement(BackgroundMedia, Object.assign({}, background, { mediaClassName: b('background-media'), className: b('background', { media: true, 'full-width-media': fullWidthMedia }) }))) : (React.createElement(BackgroundImage, Object.assign({}, imageObject, { className: b('background', { 'full-width-media': fullWidthMedia }), imageClassName: b('background-img'), style: { backgroundColor: fullWidth ? 'none' : color } })));
|
|
15
20
|
};
|
|
16
21
|
const FullWidthBackground = ({ background }) => (React.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
|
|
17
22
|
export const HeaderBlock = (props) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VideoProps, withTheme, BlockBaseProps, ButtonBlock, MediaProps, } from '../../schema/validators/common';
|
|
2
2
|
import { filteredArray } from '../../schema/validators/utils';
|
|
3
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
3
4
|
const HeaderMedia = {
|
|
4
5
|
type: 'object',
|
|
5
6
|
additionalProperties: false,
|
|
@@ -9,6 +9,7 @@ import FullScreenImage from '../../components/FullscreenImage/FullscreenImage';
|
|
|
9
9
|
import Media from '../../components/Media/Media';
|
|
10
10
|
import Links from '../../components/Link/Links';
|
|
11
11
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
12
|
+
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
12
13
|
import './Tabs.css';
|
|
13
14
|
const b = block('TabsBlock');
|
|
14
15
|
export const TabsBlock = ({ items, title, description, animated }) => {
|
|
@@ -20,7 +21,7 @@ export const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
20
21
|
let imageProps;
|
|
21
22
|
if (activeTabData) {
|
|
22
23
|
const themedImage = getThemedValue(activeTabData.image, theme);
|
|
23
|
-
imageProps =
|
|
24
|
+
imageProps = themedImage && getMediaImage(themedImage);
|
|
24
25
|
}
|
|
25
26
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
26
27
|
return (React.createElement(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
@@ -33,7 +34,7 @@ export const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
33
34
|
} },
|
|
34
35
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play }))),
|
|
35
36
|
imageProps && (React.createElement(Fragment, null,
|
|
36
|
-
React.createElement(FullScreenImage, { imageClassName: b('image')
|
|
37
|
+
React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
37
38
|
activeTabData && (React.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
|
|
38
39
|
React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
|
|
39
40
|
React.createElement("div", { className: b('content-wrapper', {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { filteredArray } from '../../schema/validators/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkProps, withTheme, BlockBaseProps, TitleProps, MediaProps, } from '../../schema/validators/common';
|
|
3
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
3
4
|
export const tabsItem = {
|
|
4
5
|
type: 'object',
|
|
5
6
|
additionalProperties: false,
|
|
@@ -4,9 +4,9 @@ import Image from '../Image/Image';
|
|
|
4
4
|
import './BackgroundImage.css';
|
|
5
5
|
const b = block('storage-background-image');
|
|
6
6
|
const BackgroundImage = (props) => {
|
|
7
|
-
const { children, src,
|
|
7
|
+
const { children, src, desktop, className, imageClassName, style, hide } = props;
|
|
8
8
|
return (React.createElement("div", { className: b(null, className), style: style },
|
|
9
|
-
src && !hide &&
|
|
9
|
+
(src || desktop) && !hide && React.createElement(Image, Object.assign({}, props, { className: b('img', imageClassName) })),
|
|
10
10
|
children && React.createElement("div", { className: b('container') }, children)));
|
|
11
11
|
};
|
|
12
12
|
export default BackgroundImage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ImageOwnProps } from '../Image/Image';
|
|
3
3
|
import './FullScreenImage.css';
|
|
4
|
-
export interface FullScreenImageProps extends
|
|
4
|
+
export interface FullScreenImageProps extends ImageOwnProps {
|
|
5
5
|
imageClassName?: string;
|
|
6
6
|
modalImageClass?: string;
|
|
7
7
|
imageStyle?: CSSProperties;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
alt?: string;
|
|
5
|
-
disableCompress?: boolean;
|
|
2
|
+
import { ImageDeviceProps, ImageObjectProps } from '../../models';
|
|
3
|
+
export interface ImageOwnProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps> {
|
|
6
4
|
style?: CSSProperties;
|
|
7
5
|
className?: string;
|
|
8
6
|
onClick?: MouseEventHandler;
|
|
9
7
|
}
|
|
10
|
-
declare const Image: (props:
|
|
8
|
+
declare const Image: (props: ImageOwnProps) => JSX.Element | null;
|
|
11
9
|
export default Image;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import React, { useContext, useState } from 'react';
|
|
2
2
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
3
|
+
import { BREAKPOINTS } from '../../constants';
|
|
3
4
|
const Image = (props) => {
|
|
4
5
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
5
|
-
const { src, alt, disableCompress, style, className, onClick } = props;
|
|
6
|
+
const { src, alt, disableCompress, tablet, desktop, mobile, style, className, onClick } = props;
|
|
6
7
|
const [imgLoadingError, setImgLoadingError] = useState(false);
|
|
7
|
-
|
|
8
|
+
const imageSrc = src || desktop;
|
|
9
|
+
if (!imageSrc) {
|
|
8
10
|
return null;
|
|
9
11
|
}
|
|
10
12
|
// TODO: Temporary solution for .svg images
|
|
11
13
|
const disableWebp = projectSettings.disableCompress ||
|
|
12
14
|
disableCompress ||
|
|
13
|
-
|
|
15
|
+
imageSrc.endsWith('.svg') ||
|
|
14
16
|
imgLoadingError;
|
|
15
|
-
const webp =
|
|
17
|
+
const webp = imageSrc.endsWith('.webp') ? src : src + '.webp';
|
|
16
18
|
return (React.createElement("picture", null,
|
|
17
19
|
disableWebp ? null : React.createElement("source", { srcSet: webp, type: "image/webp" }),
|
|
18
|
-
React.createElement("
|
|
20
|
+
mobile && React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)` }),
|
|
21
|
+
tablet && React.createElement("source", { srcSet: tablet, media: `(max-width: ${BREAKPOINTS.md}px)` }),
|
|
22
|
+
React.createElement("img", { className: className, src: imageSrc, alt: alt, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
19
23
|
};
|
|
20
24
|
export default Image;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const ImageDeviceProps: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
desktop: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
tablet: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
mobile: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
alt: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
disableCompress: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare const ImageObjectProps: {
|
|
24
|
+
type: string;
|
|
25
|
+
additionalProperties: boolean;
|
|
26
|
+
required: string[];
|
|
27
|
+
properties: {
|
|
28
|
+
src: {
|
|
29
|
+
type: string;
|
|
30
|
+
pattern: string;
|
|
31
|
+
};
|
|
32
|
+
alt: {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
disableCompress: {
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare const ImageProps: {
|
|
41
|
+
oneOf: ({
|
|
42
|
+
type: string;
|
|
43
|
+
properties: {
|
|
44
|
+
when: {
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
pattern: string;
|
|
51
|
+
})[];
|
|
52
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { filteredItem } from '../../schema/validators/utils';
|
|
2
|
+
import { urlPattern } from '../../schema/validators/common';
|
|
3
|
+
export const ImageDeviceProps = {
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
required: ['desktop', 'mobile'],
|
|
7
|
+
properties: {
|
|
8
|
+
desktop: { type: 'string' },
|
|
9
|
+
tablet: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
mobile: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
alt: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
disableCompress: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const ImageObjectProps = {
|
|
24
|
+
type: 'object',
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
required: ['src'],
|
|
27
|
+
properties: {
|
|
28
|
+
src: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
pattern: urlPattern,
|
|
31
|
+
},
|
|
32
|
+
alt: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
},
|
|
35
|
+
disableCompress: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const ImageProps = {
|
|
41
|
+
oneOf: [
|
|
42
|
+
{
|
|
43
|
+
type: 'string',
|
|
44
|
+
pattern: urlPattern,
|
|
45
|
+
},
|
|
46
|
+
filteredItem(Object.assign({}, ImageObjectProps)),
|
|
47
|
+
filteredItem(Object.assign({}, ImageDeviceProps)),
|
|
48
|
+
],
|
|
49
|
+
};
|
|
@@ -34,16 +34,16 @@ const Image = (props) => {
|
|
|
34
34
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
35
35
|
const imageSlider = (imageArray) => (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => {
|
|
36
36
|
const itemData = getMediaImage(item);
|
|
37
|
-
return (React.createElement(FullScreenImage, { key: itemData.
|
|
37
|
+
return (React.createElement(FullScreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
38
38
|
})));
|
|
39
39
|
const imageBackground = (oneImage) => {
|
|
40
40
|
const imageData = getMediaImage(oneImage);
|
|
41
41
|
return (React.createElement(animated.div, { style: { transform: parallaxInterpolate } },
|
|
42
|
-
React.createElement(BackgroundImage, { className: imageClass,
|
|
42
|
+
React.createElement(BackgroundImage, Object.assign({}, imageData, { className: imageClass, style: { height } }))));
|
|
43
43
|
};
|
|
44
44
|
const imageOnly = (oneImage) => {
|
|
45
45
|
const imageData = getMediaImage(oneImage);
|
|
46
|
-
return
|
|
46
|
+
return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
47
47
|
};
|
|
48
48
|
if (Array.isArray(image)) {
|
|
49
49
|
return imageSlider(image);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getMediaImage(image: ImageProps): ImageObjectProps;
|
|
1
|
+
import { ImageProps } from '../../../models';
|
|
2
|
+
export declare function getMediaImage(image: ImageProps): import("../../../models").ImageObjectProps | import("../../../models").ImageDeviceProps;
|
|
@@ -51,13 +51,21 @@ unpredictable css rules order in build */
|
|
|
51
51
|
.yfm_constructor.yfm_constructor_notice p {
|
|
52
52
|
color: var(--yc-color-text-secondary);
|
|
53
53
|
}
|
|
54
|
-
.yfm_constructor.yfm_constructor
|
|
55
|
-
.yfm_constructor.yfm_constructor
|
|
54
|
+
.yfm_constructor.yfm_constructor ul,
|
|
55
|
+
.yfm_constructor.yfm_constructor ol,
|
|
56
|
+
.yfm_constructor.yfm_constructor li,
|
|
57
|
+
.yfm_constructor.yfm_constructor p {
|
|
56
58
|
margin: 0 0 12px;
|
|
57
59
|
}
|
|
58
60
|
.yfm_constructor.yfm_constructor p strong {
|
|
59
61
|
font-weight: 500;
|
|
60
62
|
}
|
|
63
|
+
.yfm_constructor.yfm_constructor_size_s ul,
|
|
64
|
+
.yfm_constructor.yfm_constructor_size_s ol,
|
|
65
|
+
.yfm_constructor.yfm_constructor_size_s li,
|
|
66
|
+
.yfm_constructor.yfm_constructor_size_s p {
|
|
67
|
+
margin-bottom: 8px;
|
|
68
|
+
}
|
|
61
69
|
|
|
62
70
|
.yfm_constructor_theme_dark p {
|
|
63
71
|
color: var(--yc-color-text-light-primary);
|
|
@@ -109,13 +117,17 @@ unpredictable css rules order in build */
|
|
|
109
117
|
background-color: var(--yc-color-base-generic);
|
|
110
118
|
}
|
|
111
119
|
|
|
120
|
+
.yfm_constructor_table {
|
|
121
|
+
/* stylelint-enable declaration-no-important */
|
|
122
|
+
}
|
|
112
123
|
.yfm_constructor_table table {
|
|
113
124
|
border: 0;
|
|
114
125
|
table-layout: fixed;
|
|
115
126
|
}
|
|
116
127
|
.yfm_constructor_table thead,
|
|
117
128
|
.yfm_constructor_table tr {
|
|
118
|
-
|
|
129
|
+
/* stylelint-disable declaration-no-important */
|
|
130
|
+
background-color: transparent !important;
|
|
119
131
|
}
|
|
120
132
|
.yfm_constructor_table tbody tr {
|
|
121
133
|
border-top: 1px solid var(--yc-color-line-generic);
|
|
@@ -125,7 +137,7 @@ unpredictable css rules order in build */
|
|
|
125
137
|
min-width: 120px;
|
|
126
138
|
width: 120px;
|
|
127
139
|
box-sizing: content-box;
|
|
128
|
-
white-space: inherit !important;
|
|
140
|
+
white-space: inherit !important;
|
|
129
141
|
}
|
|
130
142
|
.yfm_constructor_table td:first-child,
|
|
131
143
|
.yfm_constructor_table th:first-child {
|
|
@@ -133,7 +145,7 @@ unpredictable css rules order in build */
|
|
|
133
145
|
width: 172px;
|
|
134
146
|
}
|
|
135
147
|
.yfm_constructor_table th {
|
|
136
|
-
text-align: left !important;
|
|
148
|
+
text-align: left !important;
|
|
137
149
|
}
|
|
138
150
|
|
|
139
151
|
.pc-page-constructor {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps } from './common';
|
|
2
|
+
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps, ImageProps } from './common';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
5
5
|
import { BannerCardProps, SubBlock } from './sub-blocks';
|
|
@@ -79,7 +79,8 @@ export interface HeaderSliderBlockProps extends Omit<SliderProps, 'title' | 'des
|
|
|
79
79
|
}
|
|
80
80
|
interface HeaderBackgroundProps {
|
|
81
81
|
color?: string;
|
|
82
|
-
url?:
|
|
82
|
+
url?: ImageProps;
|
|
83
|
+
/** @deprecated put it in url props instead */
|
|
83
84
|
disableCompress?: boolean;
|
|
84
85
|
}
|
|
85
86
|
export interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {
|
|
@@ -151,12 +152,7 @@ export interface BannerBlockProps extends BannerCardProps, Animatable {
|
|
|
151
152
|
}
|
|
152
153
|
export interface CompaniesBlockProps extends Animatable {
|
|
153
154
|
title: string;
|
|
154
|
-
images: ThemeSupporting<
|
|
155
|
-
desktop: string;
|
|
156
|
-
tablet: string;
|
|
157
|
-
mobile: string;
|
|
158
|
-
alt?: string;
|
|
159
|
-
}>;
|
|
155
|
+
images: ThemeSupporting<ImageDeviceProps>;
|
|
160
156
|
}
|
|
161
157
|
export interface MediaContentProps {
|
|
162
158
|
title: string;
|
|
@@ -81,17 +81,21 @@ interface LoopProps {
|
|
|
81
81
|
start: number;
|
|
82
82
|
end?: number;
|
|
83
83
|
}
|
|
84
|
-
export interface
|
|
85
|
-
src: string;
|
|
84
|
+
export interface ImageInfoProps {
|
|
86
85
|
alt?: string;
|
|
87
86
|
disableCompress?: boolean;
|
|
88
87
|
}
|
|
89
|
-
export
|
|
88
|
+
export interface ImageObjectProps extends ImageInfoProps {
|
|
89
|
+
src: string;
|
|
90
|
+
}
|
|
91
|
+
export interface ImageDeviceProps extends ImageInfoProps {
|
|
92
|
+
desktop: string;
|
|
93
|
+
mobile: string;
|
|
94
|
+
tablet?: string;
|
|
95
|
+
}
|
|
96
|
+
export declare type ImageProps = string | ImageObjectProps | ImageDeviceProps;
|
|
90
97
|
export declare type ThemedImage = ThemeSupporting<ImageProps>;
|
|
91
|
-
export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement> {
|
|
92
|
-
src?: string;
|
|
93
|
-
alt?: string;
|
|
94
|
-
disableCompress?: boolean;
|
|
98
|
+
export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, Partial<ImageDeviceProps>, Partial<ImageObjectProps> {
|
|
95
99
|
style?: CSSProperties;
|
|
96
100
|
imageClassName?: string;
|
|
97
101
|
hide?: boolean;
|