@gravity-ui/page-constructor 1.2.2 → 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.
Files changed (62) hide show
  1. package/CHANGELOG.md +7 -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 +0 -3
  5. package/build/cjs/blocks/Header/Header.js +7 -2
  6. package/build/cjs/blocks/Header/schema.js +2 -1
  7. package/build/cjs/blocks/Tabs/Tabs.js +3 -2
  8. package/build/cjs/blocks/Tabs/schema.js +2 -1
  9. package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
  10. package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +2 -2
  11. package/build/cjs/components/Image/Image.d.ts +3 -5
  12. package/build/cjs/components/Image/Image.js +9 -5
  13. package/build/cjs/components/Image/schema.d.ts +52 -0
  14. package/build/cjs/components/Image/schema.js +52 -0
  15. package/build/cjs/components/Media/Image/Image.js +3 -3
  16. package/build/cjs/components/Media/Image/utils.d.ts +2 -2
  17. package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
  18. package/build/cjs/models/constructor-items/common.d.ts +11 -7
  19. package/build/cjs/schema/validators/common.d.ts +0 -30
  20. package/build/cjs/schema/validators/common.js +4 -30
  21. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -1
  22. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
  23. package/build/cjs/sub-blocks/BasicCard/schema.js +2 -1
  24. package/build/cjs/sub-blocks/Content/Content.css +8 -0
  25. package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
  26. package/build/cjs/sub-blocks/Partner/schema.js +2 -1
  27. package/build/cjs/sub-blocks/Quote/Quote.js +3 -2
  28. package/build/cjs/sub-blocks/Quote/schema.js +2 -1
  29. package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
  30. package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -1
  31. package/build/esm/blocks/Companies/Companies.js +2 -6
  32. package/build/esm/blocks/ContentLayout/schema.js +2 -1
  33. package/build/esm/blocks/Header/Header.css +0 -3
  34. package/build/esm/blocks/Header/Header.js +7 -2
  35. package/build/esm/blocks/Header/schema.js +2 -1
  36. package/build/esm/blocks/Tabs/Tabs.js +3 -2
  37. package/build/esm/blocks/Tabs/schema.js +2 -1
  38. package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
  39. package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +2 -2
  40. package/build/esm/components/Image/Image.d.ts +3 -5
  41. package/build/esm/components/Image/Image.js +9 -5
  42. package/build/esm/components/Image/schema.d.ts +52 -0
  43. package/build/esm/components/Image/schema.js +49 -0
  44. package/build/esm/components/Media/Image/Image.js +3 -3
  45. package/build/esm/components/Media/Image/utils.d.ts +2 -2
  46. package/build/esm/models/constructor-items/blocks.d.ts +4 -8
  47. package/build/esm/models/constructor-items/common.d.ts +11 -7
  48. package/build/esm/schema/validators/common.d.ts +0 -30
  49. package/build/esm/schema/validators/common.js +1 -27
  50. package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
  51. package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
  52. package/build/esm/sub-blocks/BasicCard/schema.js +2 -1
  53. package/build/esm/sub-blocks/Content/Content.css +8 -0
  54. package/build/esm/sub-blocks/Partner/Partner.js +1 -1
  55. package/build/esm/sub-blocks/Partner/schema.js +2 -1
  56. package/build/esm/sub-blocks/Quote/Quote.js +3 -2
  57. package/build/esm/sub-blocks/Quote/schema.js +2 -1
  58. package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
  59. package/build/esm/sub-blocks/TutorialCard/schema.js +2 -1
  60. package/package.json +4 -1
  61. package/server/models/constructor-items/blocks.d.ts +4 -8
  62. package/server/models/constructor-items/common.d.ts +11 -7
@@ -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)(common_1.ImageProps), logo: {
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 { src, alt = title, disableCompress } = (0, utils_2.getMediaImage)(icon !== null && icon !== void 0 ? icon : {});
12
- return react_1.default.createElement(components_1.Image, { src: src, alt: alt, className: b('icon'), disableCompress: disableCompress });
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: common_1.ImageProps }),
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("picture", null,
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, ImageObjectProps, BlockBaseProps, } from '../../schema/validators/common';
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
- 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, { src: url, className: b('background', { 'full-width-media': fullWidthMedia }), imageClassName: b('background-img'), style: { backgroundColor: fullWidth ? 'none' : color }, disableCompress: disableCompress }));
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 { ImageProps, VideoProps, withTheme, BlockBaseProps, ButtonBlock, MediaProps, } from '../../schema/validators/common';
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 = typeof themedImage === 'string' ? { src: themedImage } : themedImage;
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'), src: (imageProps && imageProps.src) || 'default_image', alt: imageProps && imageProps.alt, disableCompress: imageProps === null || imageProps === void 0 ? void 0 : imageProps.disableCompress }),
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 { ImageProps, LinkProps, withTheme, BlockBaseProps, TitleProps, MediaProps, } from '../../schema/validators/common';
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, alt, disableCompress, className, imageClassName, style, hide } = props;
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 && (React.createElement(Image, { className: b('img', imageClassName), src: src, alt: alt, disableCompress: disableCompress })),
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 { ImageProps } from '../Image/Image';
2
+ import { ImageOwnProps } from '../Image/Image';
3
3
  import './FullScreenImage.css';
4
- export interface FullScreenImageProps extends ImageProps {
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
- export interface ImageProps {
3
- src: string;
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: ImageProps) => JSX.Element | null;
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
- if (!src) {
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
- src.endsWith('.svg') ||
15
+ imageSrc.endsWith('.svg') ||
14
16
  imgLoadingError;
15
- const webp = src.endsWith('.webp') ? src : src + '.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("img", { className: className, src: src, alt: alt, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
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.src, src: itemData.src, alt: itemData.alt, imageClassName: imageClass, imageStyle: { height } }));
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, src: imageData.src, style: { height }, disableCompress: imageData.disableCompress })));
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 (React.createElement(ImageView, { className: imageClass, src: imageData.src, alt: imageData.alt, style: { height }, disableCompress: imageData.disableCompress }));
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 { ImageObjectProps, ImageProps } from '../../../models';
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;
@@ -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?: string;
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 ImageObjectProps {
85
- src: string;
84
+ export interface ImageInfoProps {
86
85
  alt?: string;
87
86
  disableCompress?: boolean;
88
87
  }
89
- export declare type ImageProps = string | ImageObjectProps;
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,6 +1,6 @@
1
- import { filteredItem } from './utils';
2
1
  import { pixelEvents } from './pixel';
3
2
  import { Theme } from '../../models';
3
+ import { ImageProps } from '../../components/Image/schema';
4
4
  export const mediaDirection = ['media-content', 'content-media'];
5
5
  export const textSize = ['s', 'm', 'l'];
6
6
  export const containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
@@ -127,32 +127,6 @@ export const JustifyProps = {
127
127
  type: 'string',
128
128
  enum: ['start', 'center', 'end'],
129
129
  };
130
- export const ImageObjectProps = {
131
- type: 'object',
132
- additionalProperties: false,
133
- required: ['src'],
134
- properties: {
135
- src: {
136
- type: 'string',
137
- pattern: urlPattern,
138
- },
139
- alt: {
140
- type: 'string',
141
- },
142
- disableCompress: {
143
- type: 'boolean',
144
- },
145
- },
146
- };
147
- export const ImageProps = {
148
- oneOf: [
149
- {
150
- type: 'string',
151
- pattern: urlPattern,
152
- },
153
- filteredItem(Object.assign({}, ImageObjectProps)),
154
- ],
155
- };
156
130
  export const DataLensObjectProps = {
157
131
  type: 'object',
158
132
  additionalProperties: false,
@@ -1,6 +1,7 @@
1
- import { BaseProps, ImageObjectProps, withTheme } from '../../schema/validators/common';
1
+ import { BaseProps, withTheme } from '../../schema/validators/common';
2
2
  import { CardBase } from '../../components/CardBase/schema';
3
3
  import { ContentBase } from '../Content/schema';
4
+ import { ImageObjectProps } from '../../components/Image/schema';
4
5
  import _ from 'lodash';
5
6
  const BackgroundCardContentProps = _.omit(ContentBase, ['size']);
6
7
  export const BackgroundCard = {
@@ -11,7 +11,7 @@ const BasicCard = (props) => {
11
11
  const iconProps = icon && getMediaImage(icon);
12
12
  return (React.createElement(CardBase, { className: b(), url: url, border: border },
13
13
  React.createElement(CardBase.Content, null,
14
- iconProps && (React.createElement(Image, { src: iconProps.src, alt: iconProps.alt, className: b('icon'), disableCompress: iconProps.disableCompress })),
14
+ iconProps && React.createElement(Image, Object.assign({}, iconProps, { className: b('icon') })),
15
15
  React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s" }))));
16
16
  };
17
17
  export default BasicCard;
@@ -1,7 +1,8 @@
1
1
  import _ from 'lodash';
2
- import { BaseProps, ImageProps } from '../../schema/validators/common';
2
+ import { BaseProps } from '../../schema/validators/common';
3
3
  import { CardBase } from '../../components/CardBase/schema';
4
4
  import { ContentBase } from '../Content/schema';
5
+ import { ImageProps } from '../../components/Image/schema';
5
6
  const BasicCardContentProps = _.omit(ContentBase, ['size', 'theme']);
6
7
  export const BasicCard = {
7
8
  'basic-card': {
@@ -26,6 +26,11 @@ unpredictable css rules order in build */
26
26
  margin-top: 0;
27
27
  margin-right: 12px;
28
28
  }
29
+ .pc-content__links {
30
+ display: flex;
31
+ flex-direction: column;
32
+ align-items: baseline;
33
+ }
29
34
  .pc-content__link {
30
35
  display: block;
31
36
  margin-right: 32px;
@@ -35,6 +40,9 @@ unpredictable css rules order in build */
35
40
  text-align: center;
36
41
  }
37
42
 
43
+ .pc-content_centered .pc-content__links {
44
+ align-items: center;
45
+ }
38
46
  .pc-content_centered .pc-content__link a {
39
47
  justify-content: center;
40
48
  }
@@ -7,7 +7,7 @@ const Partner = ({ text, logo, url, border }) => {
7
7
  const logoData = typeof logo === 'string' ? { src: logo } : logo;
8
8
  return (React.createElement(CardBase, { url: url, target: "_blank", className: b(), border: border },
9
9
  React.createElement(CardBase.Content, null,
10
- React.createElement(Image, { className: b('logo'), src: logoData.src, alt: logoData.alt }),
10
+ React.createElement(Image, Object.assign({ className: b('logo') }, logoData)),
11
11
  React.createElement(HTML, null, text))));
12
12
  };
13
13
  export default Partner;
@@ -1,4 +1,5 @@
1
- import { BaseProps, ImageProps } from '../../schema/validators/common';
1
+ import { BaseProps } from '../../schema/validators/common';
2
+ import { ImageProps } from '../../components/Image/schema';
2
3
  export const PartnerBlock = {
3
4
  partner: {
4
5
  additionalProperties: false,
@@ -4,13 +4,14 @@ import { block, getThemedValue } from '../../utils';
4
4
  import { AuthorType } from '../../models';
5
5
  import { Author, Image, HTML } from '../../components';
6
6
  import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
7
+ import { getMediaImage } from '../../components/Media/Image/utils';
7
8
  import './Quote.css';
8
9
  const b = block('quote');
9
10
  const Quote = (props) => {
10
11
  const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
11
12
  const { themeValue: theme } = useContext(ThemeValueContext);
12
13
  const imageThemed = getThemedValue(image, theme);
13
- const imageData = typeof imageThemed === 'string' ? { src: imageThemed } : imageThemed;
14
+ const imageData = getMediaImage(imageThemed);
14
15
  const renderFooter = Boolean(author || url) && (React.createElement("div", { className: b('author-wrapper') },
15
16
  author && (React.createElement(Author, { className: b('author', { theme: textTheme }), author: author, type: AuthorType.Line })),
16
17
  url && buttonText && (React.createElement(Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }) }, buttonText))));
@@ -23,6 +24,6 @@ const Quote = (props) => {
23
24
  React.createElement(HTML, null, text)))),
24
25
  renderFooter),
25
26
  React.createElement("div", { className: b('image-wrapper') },
26
- React.createElement(Image, { src: imageData.src, alt: imageData.alt, className: b('image') }))));
27
+ React.createElement(Image, Object.assign({}, imageData, { className: b('image') })))));
27
28
  };
28
29
  export default Quote;
@@ -1,4 +1,5 @@
1
- import { authorItem, BaseProps, ImageProps, ThemeProps, withTheme, urlPattern, } from '../../schema/validators/common';
1
+ import { authorItem, BaseProps, ThemeProps, withTheme, urlPattern, } from '../../schema/validators/common';
2
+ import { ImageProps } from '../../components/Image/schema';
2
3
  export const Quote = {
3
4
  quote: {
4
5
  additionalProperties: false,
@@ -6,8 +6,8 @@ import { getMediaImage } from '../../components/Media/Image/utils';
6
6
  import './TutorialCard.css';
7
7
  const b = block('tutorial-card');
8
8
  function iconElement(icon, title) {
9
- const { src, alt = title, disableCompress } = getMediaImage(icon !== null && icon !== void 0 ? icon : {});
10
- return React.createElement(Image, { src: src, alt: alt, className: b('icon'), disableCompress: disableCompress });
9
+ const image = getMediaImage(icon !== null && icon !== void 0 ? icon : {});
10
+ return React.createElement(Image, Object.assign({}, image, { alt: title, className: b('icon') }));
11
11
  }
12
12
  const TutorialCard = (props) => {
13
13
  const { url, title, text, border, icon } = props;
@@ -1,4 +1,5 @@
1
- import { BaseProps, ImageProps } from '../../schema/validators/common';
1
+ import { BaseProps } from '../../schema/validators/common';
2
+ import { ImageProps } from '../../components/Image/schema';
2
3
  export const TutorialCard = {
3
4
  'tutorial-card': {
4
5
  additionalProperties: false,