@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.
- package/CHANGELOG.md +6 -0
- package/build/cjs/blocks/Companies/Companies.js +6 -2
- package/build/cjs/blocks/ContentLayout/schema.js +1 -2
- package/build/cjs/blocks/Header/Header.css +9 -2
- package/build/cjs/blocks/Header/Header.js +9 -6
- package/build/cjs/blocks/Header/schema.d.ts +244 -196
- package/build/cjs/blocks/Header/schema.js +23 -3
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +122 -98
- package/build/cjs/blocks/Tabs/Tabs.js +2 -3
- package/build/cjs/blocks/Tabs/schema.js +1 -2
- 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 +5 -3
- package/build/cjs/components/Image/Image.js +5 -9
- 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 +9 -5
- package/build/cjs/models/constructor-items/common.d.ts +7 -11
- package/build/cjs/models/guards.d.ts +3 -2
- package/build/cjs/models/guards.js +5 -1
- package/build/cjs/schema/validators/common.d.ts +31 -0
- package/build/cjs/schema/validators/common.js +32 -5
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +1 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/cjs/sub-blocks/BasicCard/schema.js +1 -2
- package/build/cjs/sub-blocks/Content/Content.css +2 -1
- package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
- package/build/cjs/sub-blocks/Partner/schema.js +1 -2
- package/build/cjs/sub-blocks/Quote/Quote.js +2 -3
- package/build/cjs/sub-blocks/Quote/schema.js +3 -4
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/cjs/sub-blocks/TutorialCard/schema.js +1 -2
- package/build/esm/blocks/Companies/Companies.js +6 -2
- package/build/esm/blocks/ContentLayout/schema.js +1 -2
- package/build/esm/blocks/Header/Header.css +9 -2
- package/build/esm/blocks/Header/Header.js +10 -7
- package/build/esm/blocks/Header/schema.d.ts +244 -196
- package/build/esm/blocks/Header/schema.js +23 -3
- package/build/esm/blocks/HeaderSlider/schema.d.ts +122 -98
- package/build/esm/blocks/Tabs/Tabs.js +2 -3
- package/build/esm/blocks/Tabs/schema.js +1 -2
- 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 +5 -3
- package/build/esm/components/Image/Image.js +5 -9
- 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 +9 -5
- package/build/esm/models/constructor-items/common.d.ts +7 -11
- package/build/esm/models/guards.d.ts +3 -2
- package/build/esm/models/guards.js +3 -0
- package/build/esm/schema/validators/common.d.ts +31 -0
- package/build/esm/schema/validators/common.js +28 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.js +1 -2
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/esm/sub-blocks/BasicCard/schema.js +1 -2
- package/build/esm/sub-blocks/Content/Content.css +2 -1
- package/build/esm/sub-blocks/Partner/Partner.js +1 -1
- package/build/esm/sub-blocks/Partner/schema.js +1 -2
- package/build/esm/sub-blocks/Quote/Quote.js +2 -3
- package/build/esm/sub-blocks/Quote/schema.js +1 -2
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/esm/sub-blocks/TutorialCard/schema.js +1 -2
- package/package.json +1 -4
- package/server/models/constructor-items/blocks.d.ts +9 -5
- package/server/models/constructor-items/common.d.ts +7 -11
- package/server/models/guards.d.ts +3 -2
- package/server/models/guards.js +5 -1
- package/build/cjs/components/Image/schema.d.ts +0 -56
- package/build/cjs/components/Image/schema.js +0 -54
- package/build/esm/components/Image/schema.d.ts +0 -56
- package/build/esm/components/Image/schema.js +0 -51
|
@@ -3,7 +3,12 @@ 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
|
|
6
|
+
const HeaderMedia = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: [],
|
|
10
|
+
properties: Object.assign(Object.assign({}, common_1.MediaProps), { fullWidth: { type: 'boolean' } }),
|
|
11
|
+
};
|
|
7
12
|
exports.HeaderProperties = {
|
|
8
13
|
title: {
|
|
9
14
|
type: 'string',
|
|
@@ -23,7 +28,7 @@ exports.HeaderProperties = {
|
|
|
23
28
|
type: 'string',
|
|
24
29
|
enum: ['default', 'large'],
|
|
25
30
|
},
|
|
26
|
-
image: (0, common_1.withTheme)(
|
|
31
|
+
image: (0, common_1.withTheme)(common_1.ImageProps),
|
|
27
32
|
video: (0, common_1.withTheme)(common_1.VideoProps),
|
|
28
33
|
backLink: {
|
|
29
34
|
type: 'object',
|
|
@@ -45,7 +50,22 @@ exports.HeaderProperties = {
|
|
|
45
50
|
type: 'string',
|
|
46
51
|
enum: ['s', 'm', 'l', 'xl'],
|
|
47
52
|
},
|
|
48
|
-
background: (0, common_1.withTheme)(
|
|
53
|
+
background: (0, common_1.withTheme)({
|
|
54
|
+
oneOf: [
|
|
55
|
+
HeaderMedia,
|
|
56
|
+
{
|
|
57
|
+
type: 'object',
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
properties: {
|
|
60
|
+
color: { type: 'string' },
|
|
61
|
+
url: { type: 'string' },
|
|
62
|
+
disableCompress: { type: 'boolean' },
|
|
63
|
+
fullWidth: { type: 'boolean' },
|
|
64
|
+
fullWidthMedia: { type: 'boolean' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
}),
|
|
49
69
|
theme: {
|
|
50
70
|
type: 'string',
|
|
51
71
|
enum: ['default', 'dark'],
|
|
@@ -151,139 +151,163 @@ export declare const HeaderSliderBlock: {
|
|
|
151
151
|
};
|
|
152
152
|
background: {
|
|
153
153
|
oneOf: ({
|
|
154
|
-
|
|
155
|
-
type: string;
|
|
156
|
-
};
|
|
157
|
-
fullWidthMedia: {
|
|
158
|
-
type: string;
|
|
159
|
-
};
|
|
160
|
-
color: {
|
|
154
|
+
oneOf: ({
|
|
161
155
|
type: string;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
additionalProperties: boolean;
|
|
157
|
+
required: never[];
|
|
158
|
+
properties: {
|
|
159
|
+
fullWidth: {
|
|
166
160
|
type: string;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
type: string;
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
} | {
|
|
161
|
+
};
|
|
162
|
+
color: {
|
|
173
163
|
type: string;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
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
|
-
|
|
201
|
-
|
|
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
|
-
|
|
205
|
-
|
|
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
|
-
|
|
277
|
+
id: {
|
|
211
278
|
type: string;
|
|
212
279
|
};
|
|
213
|
-
|
|
280
|
+
theme: {
|
|
214
281
|
type: string;
|
|
282
|
+
enum: string[];
|
|
215
283
|
};
|
|
216
284
|
};
|
|
217
285
|
} | {
|
|
218
286
|
type: string;
|
|
219
287
|
})[];
|
|
220
288
|
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
289
|
+
};
|
|
290
|
+
} | {
|
|
291
|
+
type: string;
|
|
292
|
+
additionalProperties: boolean;
|
|
293
|
+
properties: {
|
|
294
|
+
color: {
|
|
226
295
|
type: string;
|
|
227
296
|
};
|
|
228
|
-
|
|
297
|
+
url: {
|
|
229
298
|
type: string;
|
|
230
299
|
};
|
|
231
|
-
|
|
300
|
+
disableCompress: {
|
|
232
301
|
type: string;
|
|
233
302
|
};
|
|
234
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -13,7 +13,6 @@ 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");
|
|
17
16
|
const b = (0, utils_1.block)('TabsBlock');
|
|
18
17
|
const TabsBlock = ({ items, title, description, animated }) => {
|
|
19
18
|
const [activeTab, setActiveTab] = (0, react_1.useState)(items[0].tabName);
|
|
@@ -24,7 +23,7 @@ const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
24
23
|
let imageProps;
|
|
25
24
|
if (activeTabData) {
|
|
26
25
|
const themedImage = (0, utils_1.getThemedValue)(activeTabData.image, theme);
|
|
27
|
-
imageProps = themedImage
|
|
26
|
+
imageProps = typeof themedImage === 'string' ? { src: themedImage } : themedImage;
|
|
28
27
|
}
|
|
29
28
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
30
29
|
return (react_1.default.createElement(AnimateBlock_1.default, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
@@ -37,7 +36,7 @@ const TabsBlock = ({ items, title, description, animated }) => {
|
|
|
37
36
|
} },
|
|
38
37
|
(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 }))),
|
|
39
38
|
imageProps && (react_1.default.createElement(react_1.Fragment, null,
|
|
40
|
-
react_1.default.createElement(FullscreenImage_1.default,
|
|
39
|
+
react_1.default.createElement(FullscreenImage_1.default, { imageClassName: b('image'), src: (imageProps && imageProps.src) || 'default_image', alt: imageProps && imageProps.alt, disableCompress: imageProps === null || imageProps === void 0 ? void 0 : imageProps.disableCompress }),
|
|
41
40
|
activeTabData && (react_1.default.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
|
|
42
41
|
react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
|
|
43
42
|
react_1.default.createElement("div", { className: b('content-wrapper', {
|
|
@@ -3,7 +3,6 @@ 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");
|
|
7
6
|
exports.tabsItem = {
|
|
8
7
|
type: 'object',
|
|
9
8
|
additionalProperties: false,
|
|
@@ -28,7 +27,7 @@ exports.tabsItem = {
|
|
|
28
27
|
//TODO deprecated
|
|
29
28
|
link: common_1.LinkProps,
|
|
30
29
|
links: (0, utils_1.filteredArray)(common_1.LinkProps),
|
|
31
|
-
image: (0, common_1.withTheme)(
|
|
30
|
+
image: (0, common_1.withTheme)(common_1.ImageProps),
|
|
32
31
|
},
|
|
33
32
|
};
|
|
34
33
|
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, alt, disableCompress, className, imageClassName, style, hide } = props;
|
|
10
10
|
return (react_1.default.createElement("div", { className: b(null, className), style: style },
|
|
11
|
-
|
|
11
|
+
src && !hide && (react_1.default.createElement(Image_1.default, { className: b('img', imageClassName), src: src, alt: alt, disableCompress: disableCompress })),
|
|
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 { ImageProps } from '../Image/Image';
|
|
3
|
+
export interface FullScreenImageProps extends ImageProps {
|
|
4
4
|
imageClassName?: string;
|
|
5
5
|
modalImageClass?: string;
|
|
6
6
|
imageStyle?: CSSProperties;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
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:
|
|
10
|
+
declare const Image: (props: ImageProps) => JSX.Element | null;
|
|
9
11
|
export default Image;
|
|
@@ -3,25 +3,21 @@ 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");
|
|
7
6
|
const Image = (props) => {
|
|
8
7
|
const projectSettings = (0, react_1.useContext)(projectSettingsContext_1.ProjectSettingsContext);
|
|
9
|
-
const { src, alt, disableCompress,
|
|
8
|
+
const { src, alt, disableCompress, style, className, onClick } = props;
|
|
10
9
|
const [imgLoadingError, setImgLoadingError] = (0, react_1.useState)(false);
|
|
11
|
-
|
|
12
|
-
if (!imageSrc) {
|
|
10
|
+
if (!src) {
|
|
13
11
|
return null;
|
|
14
12
|
}
|
|
15
13
|
// TODO: Temporary solution for .svg images
|
|
16
14
|
const disableWebp = projectSettings.disableCompress ||
|
|
17
15
|
disableCompress ||
|
|
18
|
-
|
|
16
|
+
src.endsWith('.svg') ||
|
|
19
17
|
imgLoadingError;
|
|
20
|
-
const webp =
|
|
18
|
+
const webp = src.endsWith('.webp') ? src : src + '.webp';
|
|
21
19
|
return (react_1.default.createElement("picture", null,
|
|
22
20
|
disableWebp ? null : react_1.default.createElement("source", { srcSet: webp, type: "image/webp" }),
|
|
23
|
-
|
|
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) })));
|
|
21
|
+
react_1.default.createElement("img", { className: className, src: src, alt: alt, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
26
22
|
};
|
|
27
23
|
exports.default = Image;
|
|
@@ -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,
|
|
39
|
+
return (react_1.default.createElement(FullscreenImage_1.default, { key: itemData.src, src: itemData.src, alt: itemData.alt, 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,
|
|
44
|
+
react_1.default.createElement(BackgroundImage_1.default, { className: imageClass, src: imageData.src, style: { height }, disableCompress: imageData.disableCompress })));
|
|
45
45
|
};
|
|
46
46
|
const imageOnly = (oneImage) => {
|
|
47
47
|
const imageData = (0, utils_1.getMediaImage)(oneImage);
|
|
48
|
-
return react_1.default.createElement(Image_1.default,
|
|
48
|
+
return (react_1.default.createElement(Image_1.default, { className: imageClass, src: imageData.src, alt: imageData.alt, style: { height }, disableCompress: imageData.disableCompress }));
|
|
49
49
|
};
|
|
50
50
|
if (Array.isArray(image)) {
|
|
51
51
|
return imageSlider(image);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ImageProps } from '../../../models';
|
|
2
|
-
export declare function getMediaImage(image: ImageProps):
|
|
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
|
|
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
|
-
|
|
82
|
-
url?:
|
|
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<
|
|
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
|
|
84
|
+
export interface ImageObjectProps {
|
|
85
|
+
src: string;
|
|
85
86
|
alt?: string;
|
|
86
87
|
disableCompress?: boolean;
|
|
87
88
|
}
|
|
88
|
-
export
|
|
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
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNewMetrikaFormat = exports.isBlock = void 0;
|
|
3
|
+
exports.headerHasMediaBackground = exports.isNewMetrikaFormat = exports.isBlock = void 0;
|
|
4
4
|
const _1 = require("./");
|
|
5
5
|
function isBlock(block) {
|
|
6
6
|
return block.type in _1.BlockTypes;
|
|
@@ -10,3 +10,7 @@ function isNewMetrikaFormat(metrika) {
|
|
|
10
10
|
return Boolean(Array.isArray(metrika) && metrika.length && typeof metrika[0] === 'object');
|
|
11
11
|
}
|
|
12
12
|
exports.isNewMetrikaFormat = isNewMetrikaFormat;
|
|
13
|
+
function headerHasMediaBackground(background) {
|
|
14
|
+
return 'image' in background || 'video' in background || 'youtube' in background;
|
|
15
|
+
}
|
|
16
|
+
exports.headerHasMediaBackground = headerHasMediaBackground;
|
|
@@ -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;
|