@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.3](https://github.com/gravity-ui/page-constructor/compare/v1.2.2...v1.2.3) (2022-10-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* content links margin ([6977b96](https://github.com/gravity-ui/page-constructor/commit/6977b9601e3936ba5293eadeeaeccd640814125f))
|
|
9
|
+
|
|
10
|
+
## [1.2.2](https://github.com/gravity-ui/page-constructor/compare/v1.2.1...v1.2.2) (2022-10-14)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* change p margin for size s ([#29](https://github.com/gravity-ui/page-constructor/issues/29)) ([dcb1c2a](https://github.com/gravity-ui/page-constructor/commit/dcb1c2acba20659a8f536f4bd7401dc54b4d7b71))
|
|
16
|
+
|
|
3
17
|
## [1.2.1](https://github.com/gravity-ui/page-constructor/compare/v1.2.0...v1.2.1) (2022-10-14)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -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))))));
|
|
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
|
},
|
|
@@ -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
|
}
|
|
@@ -11,10 +11,15 @@ const utils_2 = require("./utils");
|
|
|
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
16
|
const Background = ({ background }) => {
|
|
16
|
-
const { url, color, disableCompress, fullWidth, fullWidthMedia } = background;
|
|
17
|
-
|
|
17
|
+
const { url, color, disableCompress, fullWidth, fullWidthMedia, image } = background;
|
|
18
|
+
const imageObject = (url && (0, utils_3.getMediaImage)(url)) || image;
|
|
19
|
+
if (imageObject && disableCompress) {
|
|
20
|
+
imageObject.disableCompress = disableCompress;
|
|
21
|
+
}
|
|
22
|
+
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, Object.assign({}, imageObject, { className: b('background', { 'full-width-media': fullWidthMedia }), imageClassName: b('background-img'), style: { backgroundColor: fullWidth ? 'none' : color } })));
|
|
18
23
|
};
|
|
19
24
|
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
25
|
const HeaderBlock = (props) => {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HeaderBlock = exports.HeaderProperties = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
5
|
const utils_1 = require("../../schema/validators/utils");
|
|
6
|
+
const schema_1 = require("../../components/Image/schema");
|
|
6
7
|
const HeaderMedia = {
|
|
7
8
|
type: 'object',
|
|
8
9
|
additionalProperties: false,
|
|
@@ -28,7 +29,7 @@ exports.HeaderProperties = {
|
|
|
28
29
|
type: 'string',
|
|
29
30
|
enum: ['default', 'large'],
|
|
30
31
|
},
|
|
31
|
-
image: (0, common_1.withTheme)(
|
|
32
|
+
image: (0, common_1.withTheme)(schema_1.ImageProps),
|
|
32
33
|
video: (0, common_1.withTheme)(common_1.VideoProps),
|
|
33
34
|
backLink: {
|
|
34
35
|
type: 'object',
|
|
@@ -13,6 +13,7 @@ const FullscreenImage_1 = (0, tslib_1.__importDefault)(require("../../components
|
|
|
13
13
|
const Media_1 = (0, tslib_1.__importDefault)(require("../../components/Media/Media"));
|
|
14
14
|
const Links_1 = (0, tslib_1.__importDefault)(require("../../components/Link/Links"));
|
|
15
15
|
const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
16
|
+
const utils_2 = require("../../components/Media/Image/utils");
|
|
16
17
|
const b = (0, utils_1.block)('TabsBlock');
|
|
17
18
|
const TabsBlock = ({ items, title, description, animated }) => {
|
|
18
19
|
const [activeTab, setActiveTab] = (0, react_1.useState)(items[0].tabName);
|
|
@@ -23,7 +24,7 @@ const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
23
24
|
let imageProps;
|
|
24
25
|
if (activeTabData) {
|
|
25
26
|
const themedImage = (0, utils_1.getThemedValue)(activeTabData.image, theme);
|
|
26
|
-
imageProps =
|
|
27
|
+
imageProps = themedImage && (0, utils_2.getMediaImage)(themedImage);
|
|
27
28
|
}
|
|
28
29
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
29
30
|
return (react_1.default.createElement(AnimateBlock_1.default, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
@@ -36,7 +37,7 @@ const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
36
37
|
} },
|
|
37
38
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (react_1.default.createElement(Media_1.default, Object.assign({}, (0, utils_1.getThemedValue)(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play }))),
|
|
38
39
|
imageProps && (react_1.default.createElement(react_1.Fragment, null,
|
|
39
|
-
react_1.default.createElement(FullscreenImage_1.default, { imageClassName: b('image')
|
|
40
|
+
react_1.default.createElement(FullscreenImage_1.default, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
40
41
|
activeTabData && (react_1.default.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
|
|
41
42
|
react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
|
|
42
43
|
react_1.default.createElement("div", { className: b('content-wrapper', {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TabsBlock = exports.tabsItem = void 0;
|
|
4
4
|
const utils_1 = require("../../schema/validators/utils");
|
|
5
5
|
const common_1 = require("../../schema/validators/common");
|
|
6
|
+
const schema_1 = require("../../components/Image/schema");
|
|
6
7
|
exports.tabsItem = {
|
|
7
8
|
type: 'object',
|
|
8
9
|
additionalProperties: false,
|
|
@@ -27,7 +28,7 @@ exports.tabsItem = {
|
|
|
27
28
|
//TODO deprecated
|
|
28
29
|
link: common_1.LinkProps,
|
|
29
30
|
links: (0, utils_1.filteredArray)(common_1.LinkProps),
|
|
30
|
-
image: (0, common_1.withTheme)(
|
|
31
|
+
image: (0, common_1.withTheme)(schema_1.ImageProps),
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
exports.TabsBlock = {
|
|
@@ -6,9 +6,9 @@ const utils_1 = require("../../utils");
|
|
|
6
6
|
const Image_1 = (0, tslib_1.__importDefault)(require("../Image/Image"));
|
|
7
7
|
const b = (0, utils_1.block)('storage-background-image');
|
|
8
8
|
const BackgroundImage = (props) => {
|
|
9
|
-
const { children, src,
|
|
9
|
+
const { children, src, desktop, className, imageClassName, style, hide } = props;
|
|
10
10
|
return (react_1.default.createElement("div", { className: b(null, className), style: style },
|
|
11
|
-
src && !hide &&
|
|
11
|
+
(src || desktop) && !hide && react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('img', imageClassName) })),
|
|
12
12
|
children && react_1.default.createElement("div", { className: b('container') }, children)));
|
|
13
13
|
};
|
|
14
14
|
exports.default = BackgroundImage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface FullScreenImageProps extends
|
|
2
|
+
import { ImageOwnProps } from '../Image/Image';
|
|
3
|
+
export interface FullScreenImageProps extends ImageOwnProps {
|
|
4
4
|
imageClassName?: string;
|
|
5
5
|
modalImageClass?: string;
|
|
6
6
|
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;
|
|
@@ -3,21 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
5
5
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
const Image = (props) => {
|
|
7
8
|
const projectSettings = (0, react_1.useContext)(projectSettingsContext_1.ProjectSettingsContext);
|
|
8
|
-
const { src, alt, disableCompress, style, className, onClick } = props;
|
|
9
|
+
const { src, alt, disableCompress, tablet, desktop, mobile, style, className, onClick } = props;
|
|
9
10
|
const [imgLoadingError, setImgLoadingError] = (0, react_1.useState)(false);
|
|
10
|
-
|
|
11
|
+
const imageSrc = src || desktop;
|
|
12
|
+
if (!imageSrc) {
|
|
11
13
|
return null;
|
|
12
14
|
}
|
|
13
15
|
// TODO: Temporary solution for .svg images
|
|
14
16
|
const disableWebp = projectSettings.disableCompress ||
|
|
15
17
|
disableCompress ||
|
|
16
|
-
|
|
18
|
+
imageSrc.endsWith('.svg') ||
|
|
17
19
|
imgLoadingError;
|
|
18
|
-
const webp =
|
|
20
|
+
const webp = imageSrc.endsWith('.webp') ? src : src + '.webp';
|
|
19
21
|
return (react_1.default.createElement("picture", null,
|
|
20
22
|
disableWebp ? null : react_1.default.createElement("source", { srcSet: webp, type: "image/webp" }),
|
|
21
|
-
react_1.default.createElement("
|
|
23
|
+
mobile && react_1.default.createElement("source", { srcSet: mobile, media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)` }),
|
|
24
|
+
tablet && react_1.default.createElement("source", { srcSet: tablet, media: `(max-width: ${constants_1.BREAKPOINTS.md}px)` }),
|
|
25
|
+
react_1.default.createElement("img", { className: className, src: imageSrc, alt: alt, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
22
26
|
};
|
|
23
27
|
exports.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,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageProps = exports.ImageObjectProps = exports.ImageDeviceProps = void 0;
|
|
4
|
+
const utils_1 = require("../../schema/validators/utils");
|
|
5
|
+
const common_1 = require("../../schema/validators/common");
|
|
6
|
+
exports.ImageDeviceProps = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: ['desktop', 'mobile'],
|
|
10
|
+
properties: {
|
|
11
|
+
desktop: { type: 'string' },
|
|
12
|
+
tablet: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
mobile: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
alt: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
disableCompress: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
exports.ImageObjectProps = {
|
|
27
|
+
type: 'object',
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
required: ['src'],
|
|
30
|
+
properties: {
|
|
31
|
+
src: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
pattern: common_1.urlPattern,
|
|
34
|
+
},
|
|
35
|
+
alt: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
},
|
|
38
|
+
disableCompress: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.ImageProps = {
|
|
44
|
+
oneOf: [
|
|
45
|
+
{
|
|
46
|
+
type: 'string',
|
|
47
|
+
pattern: common_1.urlPattern,
|
|
48
|
+
},
|
|
49
|
+
(0, utils_1.filteredItem)(Object.assign({}, exports.ImageObjectProps)),
|
|
50
|
+
(0, utils_1.filteredItem)(Object.assign({}, exports.ImageDeviceProps)),
|
|
51
|
+
],
|
|
52
|
+
};
|
|
@@ -36,16 +36,16 @@ const Image = (props) => {
|
|
|
36
36
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
37
37
|
const imageSlider = (imageArray) => (react_1.default.createElement(Slider_1.default, { slidesToShow: 1, type: models_1.SliderType.MediaCard }, imageArray.map((item) => {
|
|
38
38
|
const itemData = (0, utils_1.getMediaImage)(item);
|
|
39
|
-
return (react_1.default.createElement(FullscreenImage_1.default, { key: itemData.
|
|
39
|
+
return (react_1.default.createElement(FullscreenImage_1.default, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
40
40
|
})));
|
|
41
41
|
const imageBackground = (oneImage) => {
|
|
42
42
|
const imageData = (0, utils_1.getMediaImage)(oneImage);
|
|
43
43
|
return (react_1.default.createElement(react_spring_1.animated.div, { style: { transform: parallaxInterpolate } },
|
|
44
|
-
react_1.default.createElement(BackgroundImage_1.default, { className: imageClass,
|
|
44
|
+
react_1.default.createElement(BackgroundImage_1.default, Object.assign({}, imageData, { className: imageClass, style: { height } }))));
|
|
45
45
|
};
|
|
46
46
|
const imageOnly = (oneImage) => {
|
|
47
47
|
const imageData = (0, utils_1.getMediaImage)(oneImage);
|
|
48
|
-
return
|
|
48
|
+
return react_1.default.createElement(Image_1.default, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
49
49
|
};
|
|
50
50
|
if (Array.isArray(image)) {
|
|
51
51
|
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;
|
|
@@ -159,36 +159,6 @@ export declare const JustifyProps: {
|
|
|
159
159
|
type: string;
|
|
160
160
|
enum: string[];
|
|
161
161
|
};
|
|
162
|
-
export declare const ImageObjectProps: {
|
|
163
|
-
type: string;
|
|
164
|
-
additionalProperties: boolean;
|
|
165
|
-
required: string[];
|
|
166
|
-
properties: {
|
|
167
|
-
src: {
|
|
168
|
-
type: string;
|
|
169
|
-
pattern: string;
|
|
170
|
-
};
|
|
171
|
-
alt: {
|
|
172
|
-
type: string;
|
|
173
|
-
};
|
|
174
|
-
disableCompress: {
|
|
175
|
-
type: string;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
export declare const ImageProps: {
|
|
180
|
-
oneOf: ({
|
|
181
|
-
type: string;
|
|
182
|
-
properties: {
|
|
183
|
-
when: {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
} | {
|
|
188
|
-
type: string;
|
|
189
|
-
pattern: string;
|
|
190
|
-
})[];
|
|
191
|
-
};
|
|
192
162
|
export declare const DataLensObjectProps: {
|
|
193
163
|
type: string;
|
|
194
164
|
additionalProperties: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.
|
|
4
|
-
const utils_1 = require("./utils");
|
|
3
|
+
exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.JustifyProps = exports.ThemeProps = exports.VideoProps = exports.PlayIconProps = exports.LoopProps = exports.ChildrenCardsProps = exports.ChildrenProps = exports.AnimatableProps = exports.sliderSizesObject = exports.containerSizesObject = exports.BaseProps = exports.urlPattern = exports.contentThemes = exports.sizeNumber = exports.dividerEnum = exports.fileLinkTypes = exports.videoControlsTypes = exports.playIconThemes = exports.playIconTypes = exports.videoTypes = exports.contentTextWidth = exports.contentSizes = exports.sliderSizesArray = exports.containerSizesArray = exports.textSize = exports.mediaDirection = void 0;
|
|
5
4
|
const pixel_1 = require("./pixel");
|
|
6
5
|
const models_1 = require("../../models");
|
|
6
|
+
const schema_1 = require("../../components/Image/schema");
|
|
7
7
|
exports.mediaDirection = ['media-content', 'content-media'];
|
|
8
8
|
exports.textSize = ['s', 'm', 'l'];
|
|
9
9
|
exports.containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
|
|
@@ -130,32 +130,6 @@ exports.JustifyProps = {
|
|
|
130
130
|
type: 'string',
|
|
131
131
|
enum: ['start', 'center', 'end'],
|
|
132
132
|
};
|
|
133
|
-
exports.ImageObjectProps = {
|
|
134
|
-
type: 'object',
|
|
135
|
-
additionalProperties: false,
|
|
136
|
-
required: ['src'],
|
|
137
|
-
properties: {
|
|
138
|
-
src: {
|
|
139
|
-
type: 'string',
|
|
140
|
-
pattern: exports.urlPattern,
|
|
141
|
-
},
|
|
142
|
-
alt: {
|
|
143
|
-
type: 'string',
|
|
144
|
-
},
|
|
145
|
-
disableCompress: {
|
|
146
|
-
type: 'boolean',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
exports.ImageProps = {
|
|
151
|
-
oneOf: [
|
|
152
|
-
{
|
|
153
|
-
type: 'string',
|
|
154
|
-
pattern: exports.urlPattern,
|
|
155
|
-
},
|
|
156
|
-
(0, utils_1.filteredItem)(Object.assign({}, exports.ImageObjectProps)),
|
|
157
|
-
],
|
|
158
|
-
};
|
|
159
133
|
exports.DataLensObjectProps = {
|
|
160
134
|
type: 'object',
|
|
161
135
|
additionalProperties: false,
|
|
@@ -172,7 +146,7 @@ exports.DataLensProps = {
|
|
|
172
146
|
};
|
|
173
147
|
exports.BackgroundProps = {
|
|
174
148
|
additionalProperties: false,
|
|
175
|
-
properties: Object.assign(Object.assign({}, exports.AnimatableProps), { image:
|
|
149
|
+
properties: Object.assign(Object.assign({}, exports.AnimatableProps), { image: schema_1.ImageProps, color: {
|
|
176
150
|
type: 'string',
|
|
177
151
|
}, video: exports.VideoProps, height: {
|
|
178
152
|
type: 'number',
|
|
@@ -441,7 +415,7 @@ exports.MediaProps = {
|
|
|
441
415
|
type: 'string',
|
|
442
416
|
},
|
|
443
417
|
image: {
|
|
444
|
-
anyOf: [
|
|
418
|
+
anyOf: [schema_1.ImageProps, { type: 'array', items: schema_1.ImageProps }],
|
|
445
419
|
},
|
|
446
420
|
video: exports.VideoProps,
|
|
447
421
|
youtube: {
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("../../schema/validators/common");
|
|
6
6
|
const schema_1 = require("../../components/CardBase/schema");
|
|
7
7
|
const schema_2 = require("../Content/schema");
|
|
8
|
+
const schema_3 = require("../../components/Image/schema");
|
|
8
9
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
9
10
|
const BackgroundCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size']);
|
|
10
11
|
exports.BackgroundCard = {
|
|
@@ -13,7 +14,7 @@ exports.BackgroundCard = {
|
|
|
13
14
|
required: ['title', 'text'],
|
|
14
15
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), schema_1.CardBase), BackgroundCardContentProps), { url: {
|
|
15
16
|
type: 'string',
|
|
16
|
-
}, background: (0, common_1.withTheme)(
|
|
17
|
+
}, background: (0, common_1.withTheme)(schema_3.ImageObjectProps), backgroundColor: {
|
|
17
18
|
type: 'string',
|
|
18
19
|
}, paddingBottom: {
|
|
19
20
|
type: 'string',
|
|
@@ -13,7 +13,7 @@ const BasicCard = (props) => {
|
|
|
13
13
|
const iconProps = icon && (0, utils_2.getMediaImage)(icon);
|
|
14
14
|
return (react_1.default.createElement(CardBase_1.default, { className: b(), url: url, border: border },
|
|
15
15
|
react_1.default.createElement(CardBase_1.default.Content, null,
|
|
16
|
-
iconProps &&
|
|
16
|
+
iconProps && react_1.default.createElement(Image_1.default, Object.assign({}, iconProps, { className: b('icon') })),
|
|
17
17
|
react_1.default.createElement(__1.Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s" }))));
|
|
18
18
|
};
|
|
19
19
|
exports.default = BasicCard;
|
|
@@ -6,6 +6,7 @@ const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
|
6
6
|
const common_1 = require("../../schema/validators/common");
|
|
7
7
|
const schema_1 = require("../../components/CardBase/schema");
|
|
8
8
|
const schema_2 = require("../Content/schema");
|
|
9
|
+
const schema_3 = require("../../components/Image/schema");
|
|
9
10
|
const BasicCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size', 'theme']);
|
|
10
11
|
exports.BasicCard = {
|
|
11
12
|
'basic-card': {
|
|
@@ -13,6 +14,6 @@ exports.BasicCard = {
|
|
|
13
14
|
required: ['url'],
|
|
14
15
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), schema_1.CardBase), BasicCardContentProps), { url: {
|
|
15
16
|
type: 'string',
|
|
16
|
-
}, icon:
|
|
17
|
+
}, icon: schema_3.ImageProps }),
|
|
17
18
|
},
|
|
18
19
|
};
|