@gravity-ui/page-constructor 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/build/cjs/blocks/Companies/Companies.js +2 -6
- package/build/cjs/blocks/ContentLayout/schema.js +2 -1
- package/build/cjs/blocks/Header/Header.css +11 -10
- package/build/cjs/blocks/Header/Header.js +15 -15
- package/build/cjs/blocks/Header/schema.d.ts +332 -230
- package/build/cjs/blocks/Header/schema.js +6 -20
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/cjs/blocks/Tabs/Tabs.js +3 -2
- package/build/cjs/blocks/Tabs/schema.js +2 -1
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/cjs/components/Image/Image.d.ts +2 -4
- package/build/cjs/components/Image/Image.js +16 -6
- package/build/cjs/components/Image/schema.d.ts +56 -0
- package/build/cjs/components/Image/schema.js +54 -0
- package/build/cjs/components/Media/Image/Image.js +3 -3
- package/build/cjs/components/Media/Image/utils.d.ts +2 -2
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
- package/build/cjs/models/constructor-items/common.d.ts +11 -7
- package/build/cjs/models/guards.d.ts +2 -3
- package/build/cjs/models/guards.js +1 -5
- package/build/cjs/schema/validators/common.d.ts +0 -31
- package/build/cjs/schema/validators/common.js +5 -32
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -1
- package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
- package/build/cjs/sub-blocks/Partner/schema.js +2 -1
- package/build/cjs/sub-blocks/Quote/Quote.js +3 -2
- package/build/cjs/sub-blocks/Quote/schema.js +4 -3
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -1
- package/build/esm/blocks/Companies/Companies.js +2 -6
- package/build/esm/blocks/ContentLayout/schema.js +2 -1
- package/build/esm/blocks/Header/Header.css +11 -10
- package/build/esm/blocks/Header/Header.js +16 -16
- package/build/esm/blocks/Header/schema.d.ts +332 -230
- package/build/esm/blocks/Header/schema.js +5 -19
- package/build/esm/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/esm/blocks/Tabs/Tabs.js +3 -2
- package/build/esm/blocks/Tabs/schema.js +2 -1
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/esm/components/Image/Image.d.ts +2 -4
- package/build/esm/components/Image/Image.js +17 -7
- package/build/esm/components/Image/schema.d.ts +56 -0
- package/build/esm/components/Image/schema.js +51 -0
- package/build/esm/components/Media/Image/Image.js +3 -3
- package/build/esm/components/Media/Image/utils.d.ts +2 -2
- package/build/esm/models/constructor-items/blocks.d.ts +4 -8
- package/build/esm/models/constructor-items/common.d.ts +11 -7
- package/build/esm/models/guards.d.ts +2 -3
- package/build/esm/models/guards.js +0 -3
- package/build/esm/schema/validators/common.d.ts +0 -31
- package/build/esm/schema/validators/common.js +1 -28
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/esm/sub-blocks/BasicCard/schema.js +2 -1
- package/build/esm/sub-blocks/Partner/Partner.js +1 -1
- package/build/esm/sub-blocks/Partner/schema.js +2 -1
- package/build/esm/sub-blocks/Quote/Quote.js +3 -2
- package/build/esm/sub-blocks/Quote/schema.js +2 -1
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/esm/sub-blocks/TutorialCard/schema.js +2 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +4 -8
- package/server/models/constructor-items/common.d.ts +11 -7
- package/server/models/guards.d.ts +2 -3
- package/server/models/guards.js +1 -5
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VideoProps, withTheme, BlockBaseProps, ButtonBlock, MediaProps, } from '../../schema/validators/common';
|
|
2
2
|
import { filteredArray } from '../../schema/validators/utils';
|
|
3
|
-
|
|
3
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
4
|
+
export const HeaderBackgroundProps = {
|
|
4
5
|
type: 'object',
|
|
5
6
|
additionalProperties: false,
|
|
6
7
|
required: [],
|
|
7
|
-
properties: Object.assign(Object.assign({}, MediaProps), { fullWidth: { type: 'boolean' } }),
|
|
8
|
+
properties: Object.assign(Object.assign({}, MediaProps), { fullWidth: { type: 'boolean' }, fullWidthMedia: { type: 'boolean' } }),
|
|
8
9
|
};
|
|
9
10
|
export const HeaderProperties = {
|
|
10
11
|
title: {
|
|
@@ -47,22 +48,7 @@ export const HeaderProperties = {
|
|
|
47
48
|
type: 'string',
|
|
48
49
|
enum: ['s', 'm', 'l', 'xl'],
|
|
49
50
|
},
|
|
50
|
-
background: withTheme(
|
|
51
|
-
oneOf: [
|
|
52
|
-
HeaderMedia,
|
|
53
|
-
{
|
|
54
|
-
type: 'object',
|
|
55
|
-
additionalProperties: false,
|
|
56
|
-
properties: {
|
|
57
|
-
color: { type: 'string' },
|
|
58
|
-
url: { type: 'string' },
|
|
59
|
-
disableCompress: { type: 'boolean' },
|
|
60
|
-
fullWidth: { type: 'boolean' },
|
|
61
|
-
fullWidthMedia: { type: 'boolean' },
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
}),
|
|
51
|
+
background: withTheme(HeaderBackgroundProps),
|
|
66
52
|
theme: {
|
|
67
53
|
type: 'string',
|
|
68
54
|
enum: ['default', 'dark'],
|
|
@@ -151,19 +151,35 @@ export declare const HeaderSliderBlock: {
|
|
|
151
151
|
};
|
|
152
152
|
background: {
|
|
153
153
|
oneOf: ({
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
type: string;
|
|
155
|
+
additionalProperties: boolean;
|
|
156
|
+
required: never[];
|
|
157
|
+
properties: {
|
|
158
|
+
fullWidth: {
|
|
159
|
+
type: string;
|
|
160
|
+
};
|
|
161
|
+
fullWidthMedia: {
|
|
162
|
+
type: string;
|
|
163
|
+
};
|
|
164
|
+
color: {
|
|
165
|
+
type: string;
|
|
166
|
+
};
|
|
167
|
+
image: {
|
|
168
|
+
anyOf: ({
|
|
169
|
+
oneOf: ({
|
|
170
|
+
type: string;
|
|
171
|
+
properties: {
|
|
172
|
+
when: {
|
|
173
|
+
type: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
} | {
|
|
177
|
+
type: string;
|
|
178
|
+
pattern: string;
|
|
179
|
+
})[];
|
|
180
|
+
} | {
|
|
163
181
|
type: string;
|
|
164
|
-
|
|
165
|
-
image: {
|
|
166
|
-
anyOf: ({
|
|
182
|
+
items: {
|
|
167
183
|
oneOf: ({
|
|
168
184
|
type: string;
|
|
169
185
|
properties: {
|
|
@@ -175,139 +191,104 @@ export declare const HeaderSliderBlock: {
|
|
|
175
191
|
type: string;
|
|
176
192
|
pattern: string;
|
|
177
193
|
})[];
|
|
178
|
-
}
|
|
194
|
+
};
|
|
195
|
+
})[];
|
|
196
|
+
};
|
|
197
|
+
video: {
|
|
198
|
+
type: string;
|
|
199
|
+
additionalProperties: boolean;
|
|
200
|
+
required: string[];
|
|
201
|
+
properties: {
|
|
202
|
+
src: {
|
|
179
203
|
type: string;
|
|
180
204
|
items: {
|
|
181
|
-
oneOf: ({
|
|
182
|
-
type: string;
|
|
183
|
-
properties: {
|
|
184
|
-
when: {
|
|
185
|
-
type: string;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
} | {
|
|
189
|
-
type: string;
|
|
190
|
-
pattern: string;
|
|
191
|
-
})[];
|
|
192
|
-
};
|
|
193
|
-
})[];
|
|
194
|
-
};
|
|
195
|
-
video: {
|
|
196
|
-
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
205
|
type: string;
|
|
235
206
|
};
|
|
236
|
-
|
|
207
|
+
};
|
|
208
|
+
loop: {
|
|
209
|
+
anyOf: ({
|
|
237
210
|
type: string;
|
|
238
211
|
additionalProperties: boolean;
|
|
212
|
+
required: string[];
|
|
239
213
|
properties: {
|
|
240
|
-
|
|
214
|
+
start: {
|
|
241
215
|
type: string;
|
|
242
|
-
enum: string[];
|
|
243
216
|
};
|
|
244
|
-
|
|
245
|
-
type: string;
|
|
246
|
-
enum: string[];
|
|
247
|
-
};
|
|
248
|
-
text: {
|
|
217
|
+
end: {
|
|
249
218
|
type: string;
|
|
250
219
|
};
|
|
251
220
|
};
|
|
252
|
-
}
|
|
253
|
-
controls: {
|
|
221
|
+
} | {
|
|
254
222
|
type: string;
|
|
255
|
-
|
|
256
|
-
};
|
|
223
|
+
})[];
|
|
257
224
|
};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
oneOf: ({
|
|
225
|
+
type: {
|
|
226
|
+
type: string;
|
|
227
|
+
enum: string[];
|
|
228
|
+
};
|
|
229
|
+
muted: {
|
|
230
|
+
type: string;
|
|
231
|
+
};
|
|
232
|
+
playing: {
|
|
233
|
+
type: string;
|
|
234
|
+
};
|
|
235
|
+
elapsedTime: {
|
|
236
|
+
type: string;
|
|
237
|
+
};
|
|
238
|
+
playIcon: {
|
|
273
239
|
type: string;
|
|
274
240
|
additionalProperties: boolean;
|
|
275
|
-
required: string[];
|
|
276
241
|
properties: {
|
|
277
|
-
|
|
242
|
+
type: {
|
|
278
243
|
type: string;
|
|
244
|
+
enum: string[];
|
|
279
245
|
};
|
|
280
246
|
theme: {
|
|
281
247
|
type: string;
|
|
282
248
|
enum: string[];
|
|
283
249
|
};
|
|
250
|
+
text: {
|
|
251
|
+
type: string;
|
|
252
|
+
};
|
|
284
253
|
};
|
|
285
|
-
}
|
|
254
|
+
};
|
|
255
|
+
controls: {
|
|
286
256
|
type: string;
|
|
287
|
-
|
|
257
|
+
enum: string[];
|
|
258
|
+
};
|
|
288
259
|
};
|
|
289
260
|
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
261
|
+
youtube: {
|
|
262
|
+
type: string;
|
|
263
|
+
};
|
|
264
|
+
parallax: {
|
|
265
|
+
type: string;
|
|
266
|
+
};
|
|
267
|
+
height: {
|
|
268
|
+
type: string;
|
|
269
|
+
};
|
|
270
|
+
previewImg: {
|
|
271
|
+
type: string;
|
|
272
|
+
};
|
|
273
|
+
dataLens: {
|
|
274
|
+
oneOf: ({
|
|
304
275
|
type: string;
|
|
305
|
-
|
|
306
|
-
|
|
276
|
+
additionalProperties: boolean;
|
|
277
|
+
required: string[];
|
|
278
|
+
properties: {
|
|
279
|
+
id: {
|
|
280
|
+
type: string;
|
|
281
|
+
};
|
|
282
|
+
theme: {
|
|
283
|
+
type: string;
|
|
284
|
+
enum: string[];
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
} | {
|
|
307
288
|
type: string;
|
|
308
|
-
};
|
|
289
|
+
})[];
|
|
309
290
|
};
|
|
310
|
-
}
|
|
291
|
+
};
|
|
311
292
|
} | {
|
|
312
293
|
type: string;
|
|
313
294
|
additionalProperties: boolean;
|
|
@@ -9,6 +9,7 @@ import FullScreenImage from '../../components/FullscreenImage/FullscreenImage';
|
|
|
9
9
|
import Media from '../../components/Media/Media';
|
|
10
10
|
import Links from '../../components/Link/Links';
|
|
11
11
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
12
|
+
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
12
13
|
import './Tabs.css';
|
|
13
14
|
const b = block('TabsBlock');
|
|
14
15
|
export const TabsBlock = ({ items, title, description, animated }) => {
|
|
@@ -20,7 +21,7 @@ export const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
20
21
|
let imageProps;
|
|
21
22
|
if (activeTabData) {
|
|
22
23
|
const themedImage = getThemedValue(activeTabData.image, theme);
|
|
23
|
-
imageProps =
|
|
24
|
+
imageProps = themedImage && getMediaImage(themedImage);
|
|
24
25
|
}
|
|
25
26
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
26
27
|
return (React.createElement(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
@@ -33,7 +34,7 @@ export const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
33
34
|
} },
|
|
34
35
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play }))),
|
|
35
36
|
imageProps && (React.createElement(Fragment, null,
|
|
36
|
-
React.createElement(FullScreenImage, { imageClassName: b('image')
|
|
37
|
+
React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
37
38
|
activeTabData && (React.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
|
|
38
39
|
React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
|
|
39
40
|
React.createElement("div", { className: b('content-wrapper', {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { filteredArray } from '../../schema/validators/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkProps, withTheme, BlockBaseProps, TitleProps, MediaProps, } from '../../schema/validators/common';
|
|
3
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
3
4
|
export const tabsItem = {
|
|
4
5
|
type: 'object',
|
|
5
6
|
additionalProperties: false,
|
|
@@ -4,9 +4,9 @@ import Image from '../Image/Image';
|
|
|
4
4
|
import './BackgroundImage.css';
|
|
5
5
|
const b = block('storage-background-image');
|
|
6
6
|
const BackgroundImage = (props) => {
|
|
7
|
-
const { children, src,
|
|
7
|
+
const { children, src, desktop, className, imageClassName, style, hide } = props;
|
|
8
8
|
return (React.createElement("div", { className: b(null, className), style: style },
|
|
9
|
-
src && !hide &&
|
|
9
|
+
(src || desktop) && !hide && React.createElement(Image, Object.assign({}, props, { className: b('img', imageClassName) })),
|
|
10
10
|
children && React.createElement("div", { className: b('container') }, children)));
|
|
11
11
|
};
|
|
12
12
|
export default BackgroundImage;
|
|
@@ -10,6 +10,7 @@ unpredictable css rules order in build */
|
|
|
10
10
|
margin: 0 auto;
|
|
11
11
|
max-width: 1440px;
|
|
12
12
|
text-align: center;
|
|
13
|
+
height: 100%;
|
|
13
14
|
}
|
|
14
15
|
.pc-BackgroundMedia__image {
|
|
15
16
|
height: 100%;
|
|
@@ -17,6 +18,7 @@ unpredictable css rules order in build */
|
|
|
17
18
|
}
|
|
18
19
|
.pc-BackgroundMedia__video {
|
|
19
20
|
position: relative;
|
|
21
|
+
height: 100%;
|
|
20
22
|
}
|
|
21
23
|
.pc-BackgroundMedia__video video {
|
|
22
24
|
position: absolute;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
alt?: string;
|
|
5
|
-
disableCompress?: boolean;
|
|
2
|
+
import { ImageDeviceProps, ImageObjectProps } from '../../models';
|
|
3
|
+
export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps> {
|
|
6
4
|
style?: CSSProperties;
|
|
7
5
|
className?: string;
|
|
8
6
|
onClick?: MouseEventHandler;
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import React, { useContext, useState } from 'react';
|
|
1
|
+
import React, { useContext, useState, Fragment } from 'react';
|
|
2
2
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
3
|
+
import { BREAKPOINTS } from '../../constants';
|
|
4
|
+
const checkWebP = (src) => {
|
|
5
|
+
return src.endsWith('.webp') ? src : src + '.webp';
|
|
6
|
+
};
|
|
3
7
|
const Image = (props) => {
|
|
4
8
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
5
|
-
const { src, alt, disableCompress, style, className, onClick } = props;
|
|
9
|
+
const { src, alt, disableCompress, tablet, desktop, mobile, style, className, onClick } = props;
|
|
6
10
|
const [imgLoadingError, setImgLoadingError] = useState(false);
|
|
7
|
-
|
|
11
|
+
const imageSrc = src || desktop;
|
|
12
|
+
if (!imageSrc) {
|
|
8
13
|
return null;
|
|
9
14
|
}
|
|
10
15
|
// TODO: Temporary solution for .svg images
|
|
11
16
|
const disableWebp = projectSettings.disableCompress ||
|
|
12
17
|
disableCompress ||
|
|
13
|
-
|
|
18
|
+
imageSrc.endsWith('.svg') ||
|
|
14
19
|
imgLoadingError;
|
|
15
|
-
const webp = src.endsWith('.webp') ? src : src + '.webp';
|
|
16
20
|
return (React.createElement("picture", null,
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
mobile && (React.createElement(Fragment, null,
|
|
22
|
+
!disableWebp && (React.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${BREAKPOINTS.sm}px)` })),
|
|
23
|
+
React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)` }))),
|
|
24
|
+
tablet && (React.createElement(Fragment, null,
|
|
25
|
+
!disableWebp && (React.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${BREAKPOINTS.md}px)` })),
|
|
26
|
+
React.createElement("source", { srcSet: tablet, media: `(max-width: ${BREAKPOINTS.md}px)` }))),
|
|
27
|
+
desktop && !disableWebp && React.createElement("source", { srcSet: checkWebP(imageSrc), type: "image/webp" }),
|
|
28
|
+
React.createElement("img", { className: className, src: imageSrc, alt: alt, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
19
29
|
};
|
|
20
30
|
export default Image;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const urlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
|
|
2
|
+
export declare const ImageDeviceProps: {
|
|
3
|
+
type: string;
|
|
4
|
+
additionalProperties: boolean;
|
|
5
|
+
required: string[];
|
|
6
|
+
properties: {
|
|
7
|
+
desktop: {
|
|
8
|
+
type: string;
|
|
9
|
+
pattern: string;
|
|
10
|
+
};
|
|
11
|
+
tablet: {
|
|
12
|
+
type: string;
|
|
13
|
+
pattern: string;
|
|
14
|
+
};
|
|
15
|
+
mobile: {
|
|
16
|
+
type: string;
|
|
17
|
+
pattern: string;
|
|
18
|
+
};
|
|
19
|
+
alt: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
disableCompress: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const ImageObjectProps: {
|
|
28
|
+
type: string;
|
|
29
|
+
additionalProperties: boolean;
|
|
30
|
+
required: string[];
|
|
31
|
+
properties: {
|
|
32
|
+
src: {
|
|
33
|
+
type: string;
|
|
34
|
+
pattern: string;
|
|
35
|
+
};
|
|
36
|
+
alt: {
|
|
37
|
+
type: string;
|
|
38
|
+
};
|
|
39
|
+
disableCompress: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const ImageProps: {
|
|
45
|
+
oneOf: ({
|
|
46
|
+
type: string;
|
|
47
|
+
properties: {
|
|
48
|
+
when: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
type: string;
|
|
54
|
+
pattern: string;
|
|
55
|
+
})[];
|
|
56
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { filteredItem } from '../../schema/validators/utils';
|
|
2
|
+
export const urlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
|
|
3
|
+
export const ImageDeviceProps = {
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
required: ['desktop', 'mobile'],
|
|
7
|
+
properties: {
|
|
8
|
+
desktop: { type: 'string', pattern: urlPattern },
|
|
9
|
+
tablet: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
pattern: urlPattern,
|
|
12
|
+
},
|
|
13
|
+
mobile: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
pattern: urlPattern,
|
|
16
|
+
},
|
|
17
|
+
alt: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
disableCompress: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const ImageObjectProps = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
additionalProperties: false,
|
|
28
|
+
required: ['src'],
|
|
29
|
+
properties: {
|
|
30
|
+
src: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
pattern: urlPattern,
|
|
33
|
+
},
|
|
34
|
+
alt: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
},
|
|
37
|
+
disableCompress: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const ImageProps = {
|
|
43
|
+
oneOf: [
|
|
44
|
+
{
|
|
45
|
+
type: 'string',
|
|
46
|
+
pattern: urlPattern,
|
|
47
|
+
},
|
|
48
|
+
filteredItem(Object.assign({}, ImageObjectProps)),
|
|
49
|
+
filteredItem(Object.assign({}, ImageDeviceProps)),
|
|
50
|
+
],
|
|
51
|
+
};
|
|
@@ -34,16 +34,16 @@ const Image = (props) => {
|
|
|
34
34
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
35
35
|
const imageSlider = (imageArray) => (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => {
|
|
36
36
|
const itemData = getMediaImage(item);
|
|
37
|
-
return (React.createElement(FullScreenImage, { key: itemData.
|
|
37
|
+
return (React.createElement(FullScreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
38
38
|
})));
|
|
39
39
|
const imageBackground = (oneImage) => {
|
|
40
40
|
const imageData = getMediaImage(oneImage);
|
|
41
41
|
return (React.createElement(animated.div, { style: { transform: parallaxInterpolate } },
|
|
42
|
-
React.createElement(BackgroundImage, { className: imageClass,
|
|
42
|
+
React.createElement(BackgroundImage, Object.assign({}, imageData, { className: imageClass, style: { height } }))));
|
|
43
43
|
};
|
|
44
44
|
const imageOnly = (oneImage) => {
|
|
45
45
|
const imageData = getMediaImage(oneImage);
|
|
46
|
-
return
|
|
46
|
+
return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
47
47
|
};
|
|
48
48
|
if (Array.isArray(image)) {
|
|
49
49
|
return imageSlider(image);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getMediaImage(image: ImageProps): ImageObjectProps;
|
|
1
|
+
import { ImageProps } from '../../../models';
|
|
2
|
+
export declare function getMediaImage(image: ImageProps): import("../../../models").ImageObjectProps | import("../../../models").ImageDeviceProps;
|
|
@@ -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 } 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,8 +78,9 @@ export interface HeaderSliderBlockProps extends Omit<SliderProps, 'title' | 'des
|
|
|
78
78
|
items: HeaderBlockProps[];
|
|
79
79
|
}
|
|
80
80
|
interface HeaderBackgroundProps {
|
|
81
|
-
|
|
81
|
+
/** @deprecated replaced by Media Props image */
|
|
82
82
|
url?: string;
|
|
83
|
+
/** @deprecated replaced by Media Props image */
|
|
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;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Block, ConstructorItem
|
|
2
|
-
import {
|
|
1
|
+
import { Block, ConstructorItem } from './';
|
|
2
|
+
import { 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,6 +5,3 @@ 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
|
-
}
|