@gravity-ui/page-constructor 1.2.3-alpha.3 → 1.2.4

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 (72) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/cjs/blocks/Companies/Companies.js +6 -2
  3. package/build/cjs/blocks/ContentLayout/schema.js +1 -2
  4. package/build/cjs/blocks/Header/Header.css +9 -2
  5. package/build/cjs/blocks/Header/Header.js +9 -6
  6. package/build/cjs/blocks/Header/schema.d.ts +244 -196
  7. package/build/cjs/blocks/Header/schema.js +23 -3
  8. package/build/cjs/blocks/HeaderSlider/schema.d.ts +122 -98
  9. package/build/cjs/blocks/Tabs/Tabs.js +2 -3
  10. package/build/cjs/blocks/Tabs/schema.js +1 -2
  11. package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
  12. package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +2 -2
  13. package/build/cjs/components/Image/Image.d.ts +5 -3
  14. package/build/cjs/components/Image/Image.js +5 -9
  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 +9 -5
  18. package/build/cjs/models/constructor-items/common.d.ts +7 -11
  19. package/build/cjs/models/guards.d.ts +3 -2
  20. package/build/cjs/models/guards.js +5 -1
  21. package/build/cjs/schema/validators/common.d.ts +31 -0
  22. package/build/cjs/schema/validators/common.js +32 -5
  23. package/build/cjs/sub-blocks/BackgroundCard/schema.js +1 -2
  24. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
  25. package/build/cjs/sub-blocks/BasicCard/schema.js +1 -2
  26. package/build/cjs/sub-blocks/Content/Content.css +2 -1
  27. package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
  28. package/build/cjs/sub-blocks/Partner/schema.js +1 -2
  29. package/build/cjs/sub-blocks/Quote/Quote.js +2 -3
  30. package/build/cjs/sub-blocks/Quote/schema.js +3 -4
  31. package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
  32. package/build/cjs/sub-blocks/TutorialCard/schema.js +1 -2
  33. package/build/esm/blocks/Companies/Companies.js +6 -2
  34. package/build/esm/blocks/ContentLayout/schema.js +1 -2
  35. package/build/esm/blocks/Header/Header.css +9 -2
  36. package/build/esm/blocks/Header/Header.js +10 -7
  37. package/build/esm/blocks/Header/schema.d.ts +244 -196
  38. package/build/esm/blocks/Header/schema.js +23 -3
  39. package/build/esm/blocks/HeaderSlider/schema.d.ts +122 -98
  40. package/build/esm/blocks/Tabs/Tabs.js +2 -3
  41. package/build/esm/blocks/Tabs/schema.js +1 -2
  42. package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
  43. package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +2 -2
  44. package/build/esm/components/Image/Image.d.ts +5 -3
  45. package/build/esm/components/Image/Image.js +5 -9
  46. package/build/esm/components/Media/Image/Image.js +3 -3
  47. package/build/esm/components/Media/Image/utils.d.ts +2 -2
  48. package/build/esm/models/constructor-items/blocks.d.ts +9 -5
  49. package/build/esm/models/constructor-items/common.d.ts +7 -11
  50. package/build/esm/models/guards.d.ts +3 -2
  51. package/build/esm/models/guards.js +3 -0
  52. package/build/esm/schema/validators/common.d.ts +31 -0
  53. package/build/esm/schema/validators/common.js +28 -1
  54. package/build/esm/sub-blocks/BackgroundCard/schema.js +1 -2
  55. package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
  56. package/build/esm/sub-blocks/BasicCard/schema.js +1 -2
  57. package/build/esm/sub-blocks/Content/Content.css +2 -1
  58. package/build/esm/sub-blocks/Partner/Partner.js +1 -1
  59. package/build/esm/sub-blocks/Partner/schema.js +1 -2
  60. package/build/esm/sub-blocks/Quote/Quote.js +2 -3
  61. package/build/esm/sub-blocks/Quote/schema.js +1 -2
  62. package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
  63. package/build/esm/sub-blocks/TutorialCard/schema.js +1 -2
  64. package/package.json +1 -4
  65. package/server/models/constructor-items/blocks.d.ts +9 -5
  66. package/server/models/constructor-items/common.d.ts +7 -11
  67. package/server/models/guards.d.ts +3 -2
  68. package/server/models/guards.js +5 -1
  69. package/build/cjs/components/Image/schema.d.ts +0 -56
  70. package/build/cjs/components/Image/schema.js +0 -54
  71. package/build/esm/components/Image/schema.d.ts +0 -56
  72. package/build/esm/components/Image/schema.js +0 -51
@@ -151,139 +151,163 @@ export declare const HeaderSliderBlock: {
151
151
  };
152
152
  background: {
153
153
  oneOf: ({
154
- fullWidth: {
155
- type: string;
156
- };
157
- fullWidthMedia: {
158
- type: string;
159
- };
160
- color: {
154
+ oneOf: ({
161
155
  type: string;
162
- };
163
- image: {
164
- anyOf: ({
165
- oneOf: ({
156
+ additionalProperties: boolean;
157
+ required: never[];
158
+ properties: {
159
+ fullWidth: {
166
160
  type: string;
167
- properties: {
168
- when: {
169
- type: string;
170
- };
171
- };
172
- } | {
161
+ };
162
+ color: {
173
163
  type: string;
174
- pattern: string;
175
- })[];
176
- } | {
177
- type: string;
178
- items: {
179
- oneOf: ({
180
- type: string;
181
- properties: {
182
- when: {
183
- type: string;
164
+ };
165
+ image: {
166
+ anyOf: ({
167
+ oneOf: ({
168
+ type: string;
169
+ properties: {
170
+ when: {
171
+ type: string;
172
+ };
184
173
  };
185
- };
174
+ } | {
175
+ type: string;
176
+ pattern: string;
177
+ })[];
186
178
  } | {
187
179
  type: string;
188
- pattern: string;
180
+ items: {
181
+ oneOf: ({
182
+ type: string;
183
+ properties: {
184
+ when: {
185
+ type: string;
186
+ };
187
+ };
188
+ } | {
189
+ type: string;
190
+ pattern: string;
191
+ })[];
192
+ };
189
193
  })[];
190
194
  };
191
- })[];
192
- };
193
- video: {
194
- type: string;
195
- additionalProperties: boolean;
196
- required: string[];
197
- properties: {
198
- src: {
195
+ video: {
199
196
  type: string;
200
- items: {
201
- type: string;
197
+ additionalProperties: boolean;
198
+ required: string[];
199
+ properties: {
200
+ src: {
201
+ type: string;
202
+ items: {
203
+ type: string;
204
+ };
205
+ };
206
+ loop: {
207
+ anyOf: ({
208
+ type: string;
209
+ additionalProperties: boolean;
210
+ required: string[];
211
+ properties: {
212
+ start: {
213
+ type: string;
214
+ };
215
+ end: {
216
+ type: string;
217
+ };
218
+ };
219
+ } | {
220
+ type: string;
221
+ })[];
222
+ };
223
+ type: {
224
+ type: string;
225
+ enum: string[];
226
+ };
227
+ muted: {
228
+ type: string;
229
+ };
230
+ playing: {
231
+ type: string;
232
+ };
233
+ elapsedTime: {
234
+ type: string;
235
+ };
236
+ playIcon: {
237
+ type: string;
238
+ additionalProperties: boolean;
239
+ properties: {
240
+ type: {
241
+ type: string;
242
+ enum: string[];
243
+ };
244
+ theme: {
245
+ type: string;
246
+ enum: string[];
247
+ };
248
+ text: {
249
+ type: string;
250
+ };
251
+ };
252
+ };
253
+ controls: {
254
+ type: string;
255
+ enum: string[];
256
+ };
202
257
  };
203
258
  };
204
- loop: {
205
- anyOf: ({
259
+ youtube: {
260
+ type: string;
261
+ };
262
+ parallax: {
263
+ type: string;
264
+ };
265
+ height: {
266
+ type: string;
267
+ };
268
+ previewImg: {
269
+ type: string;
270
+ };
271
+ dataLens: {
272
+ oneOf: ({
206
273
  type: string;
207
274
  additionalProperties: boolean;
208
275
  required: string[];
209
276
  properties: {
210
- start: {
277
+ id: {
211
278
  type: string;
212
279
  };
213
- end: {
280
+ theme: {
214
281
  type: string;
282
+ enum: string[];
215
283
  };
216
284
  };
217
285
  } | {
218
286
  type: string;
219
287
  })[];
220
288
  };
221
- type: {
222
- type: string;
223
- enum: string[];
224
- };
225
- muted: {
289
+ };
290
+ } | {
291
+ type: string;
292
+ additionalProperties: boolean;
293
+ properties: {
294
+ color: {
226
295
  type: string;
227
296
  };
228
- playing: {
297
+ url: {
229
298
  type: string;
230
299
  };
231
- elapsedTime: {
300
+ disableCompress: {
232
301
  type: string;
233
302
  };
234
- playIcon: {
303
+ fullWidth: {
235
304
  type: string;
236
- additionalProperties: boolean;
237
- properties: {
238
- type: {
239
- type: string;
240
- enum: string[];
241
- };
242
- theme: {
243
- type: string;
244
- enum: string[];
245
- };
246
- text: {
247
- type: string;
248
- };
249
- };
250
305
  };
251
- controls: {
306
+ fullWidthMedia: {
252
307
  type: string;
253
- enum: string[];
254
308
  };
255
309
  };
256
- };
257
- youtube: {
258
- type: string;
259
- };
260
- parallax: {
261
- type: string;
262
- };
263
- height: {
264
- type: string;
265
- };
266
- previewImg: {
267
- type: string;
268
- };
269
- dataLens: {
270
- oneOf: ({
271
- type: string;
272
- additionalProperties: boolean;
273
- required: string[];
274
- properties: {
275
- id: {
276
- type: string;
277
- };
278
- theme: {
279
- type: string;
280
- enum: string[];
281
- };
282
- };
283
- } | {
284
- type: string;
285
- })[];
286
- };
310
+ })[];
287
311
  } | {
288
312
  type: string;
289
313
  additionalProperties: boolean;
@@ -9,7 +9,6 @@ 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';
13
12
  import './Tabs.css';
14
13
  const b = block('TabsBlock');
15
14
  export const TabsBlock = ({ items, title, description, animated }) => {
@@ -21,7 +20,7 @@ export const TabsBlock = ({ items, title, description, animated }) => {
21
20
  let imageProps;
22
21
  if (activeTabData) {
23
22
  const themedImage = getThemedValue(activeTabData.image, theme);
24
- imageProps = themedImage && getMediaImage(themedImage);
23
+ imageProps = typeof themedImage === 'string' ? { src: themedImage } : themedImage;
25
24
  }
26
25
  const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
27
26
  return (React.createElement(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated },
@@ -34,7 +33,7 @@ export const TabsBlock = ({ items, title, description, animated }) => {
34
33
  } },
35
34
  (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 }))),
36
35
  imageProps && (React.createElement(Fragment, null,
37
- React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })),
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 }),
38
37
  activeTabData && (React.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
39
38
  React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
40
39
  React.createElement("div", { className: b('content-wrapper', {
@@ -1,6 +1,5 @@
1
1
  import { filteredArray } from '../../schema/validators/utils';
2
- import { LinkProps, withTheme, BlockBaseProps, TitleProps, MediaProps, } from '../../schema/validators/common';
3
- import { ImageProps } from '../../components/Image/schema';
2
+ import { ImageProps, LinkProps, withTheme, BlockBaseProps, TitleProps, MediaProps, } from '../../schema/validators/common';
4
3
  export const tabsItem = {
5
4
  type: 'object',
6
5
  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, desktop, className, imageClassName, style, hide } = props;
7
+ const { children, src, alt, disableCompress, className, imageClassName, style, hide } = props;
8
8
  return (React.createElement("div", { className: b(null, className), style: style },
9
- (src || desktop) && !hide && React.createElement(Image, Object.assign({}, props, { className: b('img', imageClassName) })),
9
+ src && !hide && (React.createElement(Image, { className: b('img', imageClassName), src: src, alt: alt, disableCompress: disableCompress })),
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 { ImageOwnProps } from '../Image/Image';
2
+ import { ImageProps } from '../Image/Image';
3
3
  import './FullScreenImage.css';
4
- export interface FullScreenImageProps extends ImageOwnProps {
4
+ export interface FullScreenImageProps extends ImageProps {
5
5
  imageClassName?: string;
6
6
  modalImageClass?: string;
7
7
  imageStyle?: CSSProperties;
@@ -1,9 +1,11 @@
1
1
  import { CSSProperties, MouseEventHandler } from 'react';
2
- import { ImageDeviceProps, ImageObjectProps } from '../../models';
3
- export interface ImageOwnProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps> {
2
+ export interface ImageProps {
3
+ src: string;
4
+ alt?: string;
5
+ disableCompress?: boolean;
4
6
  style?: CSSProperties;
5
7
  className?: string;
6
8
  onClick?: MouseEventHandler;
7
9
  }
8
- declare const Image: (props: ImageOwnProps) => JSX.Element | null;
10
+ declare const Image: (props: ImageProps) => JSX.Element | null;
9
11
  export default Image;
@@ -1,24 +1,20 @@
1
1
  import React, { useContext, useState } from 'react';
2
2
  import { ProjectSettingsContext } from '../../context/projectSettingsContext';
3
- import { BREAKPOINTS } from '../../constants';
4
3
  const Image = (props) => {
5
4
  const projectSettings = useContext(ProjectSettingsContext);
6
- const { src, alt, disableCompress, tablet, desktop, mobile, style, className, onClick } = props;
5
+ const { src, alt, disableCompress, style, className, onClick } = props;
7
6
  const [imgLoadingError, setImgLoadingError] = useState(false);
8
- const imageSrc = src || desktop;
9
- if (!imageSrc) {
7
+ if (!src) {
10
8
  return null;
11
9
  }
12
10
  // TODO: Temporary solution for .svg images
13
11
  const disableWebp = projectSettings.disableCompress ||
14
12
  disableCompress ||
15
- imageSrc.endsWith('.svg') ||
13
+ src.endsWith('.svg') ||
16
14
  imgLoadingError;
17
- const webp = imageSrc.endsWith('.webp') ? src : src + '.webp';
15
+ const webp = src.endsWith('.webp') ? src : src + '.webp';
18
16
  return (React.createElement("picture", null,
19
17
  disableWebp ? null : React.createElement("source", { srcSet: webp, type: "image/webp" }),
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) })));
18
+ React.createElement("img", { className: className, src: src, alt: alt, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
23
19
  };
24
20
  export default Image;
@@ -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, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
37
+ return (React.createElement(FullScreenImage, { key: itemData.src, src: itemData.src, alt: itemData.alt, 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, Object.assign({}, imageData, { className: imageClass, style: { height } }))));
42
+ React.createElement(BackgroundImage, { className: imageClass, src: imageData.src, style: { height }, disableCompress: imageData.disableCompress })));
43
43
  };
44
44
  const imageOnly = (oneImage) => {
45
45
  const imageData = getMediaImage(oneImage);
46
- return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
46
+ return (React.createElement(ImageView, { className: imageClass, src: imageData.src, alt: imageData.alt, style: { height }, disableCompress: imageData.disableCompress }));
47
47
  };
48
48
  if (Array.isArray(image)) {
49
49
  return imageSlider(image);
@@ -1,2 +1,2 @@
1
- import { ImageProps } from '../../../models';
2
- export declare function getMediaImage(image: ImageProps): import("../../../models").ImageObjectProps | import("../../../models").ImageDeviceProps;
1
+ import { ImageObjectProps, ImageProps } from '../../../models';
2
+ export declare function getMediaImage(image: ImageProps): ImageObjectProps;
@@ -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, ImageDeviceProps, ImageProps } 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 } from './common';
3
3
  import { ThemeSupporting } from '../../utils';
4
4
  import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
5
5
  import { BannerCardProps, SubBlock } from './sub-blocks';
@@ -78,9 +78,8 @@ export interface HeaderSliderBlockProps extends Omit<SliderProps, 'title' | 'des
78
78
  items: HeaderBlockProps[];
79
79
  }
80
80
  interface HeaderBackgroundProps {
81
- /** @deprecated replaced by Media Props image */
82
- url?: ImageProps;
83
- /** @deprecated replaced by Media Props image */
81
+ color?: string;
82
+ url?: string;
84
83
  disableCompress?: boolean;
85
84
  }
86
85
  export interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {
@@ -152,7 +151,12 @@ export interface BannerBlockProps extends BannerCardProps, Animatable {
152
151
  }
153
152
  export interface CompaniesBlockProps extends Animatable {
154
153
  title: string;
155
- images: ThemeSupporting<ImageDeviceProps>;
154
+ images: ThemeSupporting<{
155
+ desktop: string;
156
+ tablet: string;
157
+ mobile: string;
158
+ alt?: string;
159
+ }>;
156
160
  }
157
161
  export interface MediaContentProps {
158
162
  title: string;
@@ -81,21 +81,17 @@ interface LoopProps {
81
81
  start: number;
82
82
  end?: number;
83
83
  }
84
- export interface ImageInfoProps {
84
+ export interface ImageObjectProps {
85
+ src: string;
85
86
  alt?: string;
86
87
  disableCompress?: boolean;
87
88
  }
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;
89
+ export declare type ImageProps = string | ImageObjectProps;
97
90
  export declare type ThemedImage = ThemeSupporting<ImageProps>;
98
- export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, Partial<ImageDeviceProps>, Partial<ImageObjectProps> {
91
+ export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement> {
92
+ src?: string;
93
+ alt?: string;
94
+ disableCompress?: boolean;
99
95
  style?: CSSProperties;
100
96
  imageClassName?: string;
101
97
  hide?: boolean;
@@ -1,4 +1,5 @@
1
- import { Block, ConstructorItem } from './';
2
- import { MetrikaGoal, NewMetrikaGoal } from './index';
1
+ import { Block, ConstructorItem, HeaderBlockBackground } from './';
2
+ import { MediaProps, MetrikaGoal, NewMetrikaGoal } from './index';
3
3
  export declare function isBlock(block: ConstructorItem): block is Block;
4
4
  export declare function isNewMetrikaFormat(metrika: MetrikaGoal): metrika is NewMetrikaGoal[];
5
+ export declare function headerHasMediaBackground(background: HeaderBlockBackground): background is MediaProps;
@@ -5,3 +5,6 @@ export function isBlock(block) {
5
5
  export function isNewMetrikaFormat(metrika) {
6
6
  return Boolean(Array.isArray(metrika) && metrika.length && typeof metrika[0] === 'object');
7
7
  }
8
+ export function headerHasMediaBackground(background) {
9
+ return 'image' in background || 'video' in background || 'youtube' in background;
10
+ }
@@ -19,6 +19,7 @@ export declare const sizeNumber: {
19
19
  minimum: number;
20
20
  };
21
21
  export declare const contentThemes: string[];
22
+ export declare const urlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
22
23
  export declare const BaseProps: {
23
24
  type: {};
24
25
  when: {};
@@ -158,6 +159,36 @@ export declare const JustifyProps: {
158
159
  type: string;
159
160
  enum: string[];
160
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
+ };
161
192
  export declare const DataLensObjectProps: {
162
193
  type: string;
163
194
  additionalProperties: boolean;
@@ -1,6 +1,6 @@
1
+ import { filteredItem } from './utils';
1
2
  import { pixelEvents } from './pixel';
2
3
  import { Theme } from '../../models';
3
- import { ImageProps, urlPattern } 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'];
@@ -15,6 +15,7 @@ export const fileLinkTypes = ['vertical', 'horizontal'];
15
15
  export const dividerEnum = { enum: [0, 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl'] };
16
16
  export const sizeNumber = { type: 'number', maximum: 12, minimum: 1 };
17
17
  export const contentThemes = ['default', 'dark', 'light'];
18
+ export const urlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
18
19
  export const BaseProps = {
19
20
  type: {},
20
21
  when: {},
@@ -126,6 +127,32 @@ export const JustifyProps = {
126
127
  type: 'string',
127
128
  enum: ['start', 'center', 'end'],
128
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
+ };
129
156
  export const DataLensObjectProps = {
130
157
  type: 'object',
131
158
  additionalProperties: false,
@@ -1,7 +1,6 @@
1
- import { BaseProps, withTheme } from '../../schema/validators/common';
1
+ import { BaseProps, ImageObjectProps, 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';
5
4
  import _ from 'lodash';
6
5
  const BackgroundCardContentProps = _.omit(ContentBase, ['size']);
7
6
  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, Object.assign({}, iconProps, { className: b('icon') })),
14
+ iconProps && (React.createElement(Image, { src: iconProps.src, alt: iconProps.alt, className: b('icon'), disableCompress: iconProps.disableCompress })),
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,8 +1,7 @@
1
1
  import _ from 'lodash';
2
- import { BaseProps } from '../../schema/validators/common';
2
+ import { BaseProps, ImageProps } 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';
6
5
  const BasicCardContentProps = _.omit(ContentBase, ['size', 'theme']);
7
6
  export const BasicCard = {
8
7
  'basic-card': {
@@ -22,10 +22,11 @@ unpredictable css rules order in build */
22
22
  color: var(--yc-color-text-primary);
23
23
  }
24
24
 
25
- .pc-content__button {
25
+ .pc-content__button.pc-content__button {
26
26
  margin-top: 0;
27
27
  margin-right: 12px;
28
28
  }
29
+
29
30
  .pc-content__links {
30
31
  display: flex;
31
32
  flex-direction: column;
@@ -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, Object.assign({ className: b('logo') }, logoData)),
10
+ React.createElement(Image, { className: b('logo'), src: logoData.src, alt: logoData.alt }),
11
11
  React.createElement(HTML, null, text))));
12
12
  };
13
13
  export default Partner;
@@ -1,5 +1,4 @@
1
- import { BaseProps } from '../../schema/validators/common';
2
- import { ImageProps } from '../../components/Image/schema';
1
+ import { BaseProps, ImageProps } from '../../schema/validators/common';
3
2
  export const PartnerBlock = {
4
3
  partner: {
5
4
  additionalProperties: false,