@gravity-ui/page-constructor 4.51.1 → 4.52.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/build/cjs/components/ReactPlayer/ReactPlayer.js +9 -1
- package/build/cjs/components/ReactPlayer/utils/youtube.d.ts +2 -0
- package/build/cjs/components/ReactPlayer/utils/youtube.js +7 -0
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/models/constructor-items/common.d.ts +1 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +18 -3
- package/build/cjs/models/constructor-items/sub-blocks.js +7 -1
- package/build/cjs/schema/constants.d.ts +76 -0
- package/build/cjs/schema/constants.js +2 -1
- package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
- package/build/cjs/schema/validators/sub-blocks.js +1 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +59 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.d.ts +3 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js +21 -0
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +78 -0
- package/build/cjs/sub-blocks/ImageCard/schema.js +24 -0
- package/build/cjs/sub-blocks/index.d.ts +1 -0
- package/build/cjs/sub-blocks/index.js +3 -1
- package/build/esm/components/ReactPlayer/ReactPlayer.js +9 -1
- package/build/esm/components/ReactPlayer/utils/youtube.d.ts +2 -0
- package/build/esm/components/ReactPlayer/utils/youtube.js +3 -0
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/models/constructor-items/common.d.ts +1 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +18 -3
- package/build/esm/models/constructor-items/sub-blocks.js +6 -0
- package/build/esm/schema/constants.d.ts +76 -0
- package/build/esm/schema/constants.js +3 -2
- package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
- package/build/esm/schema/validators/sub-blocks.js +1 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +59 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.d.ts +4 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.js +19 -0
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +78 -0
- package/build/esm/sub-blocks/ImageCard/schema.js +20 -0
- package/build/esm/sub-blocks/index.d.ts +1 -0
- package/build/esm/sub-blocks/index.js +1 -0
- package/package.json +2 -1
- package/server/models/constructor-items/common.d.ts +1 -0
- package/server/models/constructor-items/sub-blocks.d.ts +18 -3
- package/server/models/constructor-items/sub-blocks.js +7 -1
- package/widget/index.js +1 -1
|
@@ -16,6 +16,7 @@ const utils_1 = require("../../utils");
|
|
|
16
16
|
const CustomBarControls_1 = tslib_1.__importDefault(require("./CustomBarControls"));
|
|
17
17
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
18
18
|
const utils_2 = require("./utils");
|
|
19
|
+
const youtube_1 = require("./utils/youtube");
|
|
19
20
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
20
21
|
const FPS = 60;
|
|
21
22
|
// eslint-disable-next-line react/display-name
|
|
@@ -52,8 +53,15 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
52
53
|
if (!playerRef) {
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
56
|
+
let play, pause, addEventListener;
|
|
55
57
|
const videoInstance = playerRef.getInternalPlayer();
|
|
56
|
-
|
|
58
|
+
if ((0, youtube_1.isYoutubePlayerInstance)(videoInstance)) {
|
|
59
|
+
({ pauseVideo: pause, playVideo: play, addEventListener } = videoInstance);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// it is assumed that `videoInstance` is HTMLVideoElement by default
|
|
63
|
+
({ play, pause, addEventListener } = videoInstance);
|
|
64
|
+
}
|
|
57
65
|
// eslint-disable-next-line consistent-return
|
|
58
66
|
return {
|
|
59
67
|
play: play.bind(videoInstance),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isYoutubePlayerInstance = void 0;
|
|
4
|
+
const isYoutubePlayerInstance = (playerInstance) => {
|
|
5
|
+
return Boolean(playerInstance['pauseVideo'] && playerInstance['playVideo']);
|
|
6
|
+
};
|
|
7
|
+
exports.isYoutubePlayerInstance = isYoutubePlayerInstance;
|
|
@@ -30,6 +30,7 @@ export declare const subBlockMap: {
|
|
|
30
30
|
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
31
31
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
32
32
|
"price-card": (props: import("./models").PriceCardProps) => JSX.Element;
|
|
33
|
+
"image-card": (props: import("./models").ImageCardProps) => JSX.Element;
|
|
33
34
|
};
|
|
34
35
|
export declare const navItemMap: {
|
|
35
36
|
button: import("react").FC<Pick<import("./navigation/models").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
@@ -39,6 +39,7 @@ exports.subBlockMap = {
|
|
|
39
39
|
[models_1.SubBlockType.Content]: sub_blocks_1.Content,
|
|
40
40
|
[models_1.SubBlockType.Quote]: sub_blocks_1.Quote,
|
|
41
41
|
[models_1.SubBlockType.PriceCard]: sub_blocks_1.PriceCard,
|
|
42
|
+
[models_1.SubBlockType.ImageCard]: sub_blocks_1.ImageCard,
|
|
42
43
|
};
|
|
43
44
|
exports.navItemMap = {
|
|
44
45
|
[models_1.NavigationItemType.Button]: NavigationItem_1.NavigationButton,
|
|
@@ -62,6 +62,7 @@ export type ContentSize = 's' | 'l';
|
|
|
62
62
|
export type ContentTextSize = 's' | 'm' | 'l';
|
|
63
63
|
export type ContentTheme = 'default' | 'dark' | 'light';
|
|
64
64
|
export type FileLinkType = 'vertical' | 'horizontal';
|
|
65
|
+
export type ImageCardMargins = 's' | 'm';
|
|
65
66
|
export interface Themable {
|
|
66
67
|
theme?: TextTheme;
|
|
67
68
|
}
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AnalyticsEventsBase, PixelEvent } from '../common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, MediaView, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
6
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageCardMargins, ImageObjectProps, ImageProps, LinkProps, MediaProps, MediaView, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -22,7 +22,8 @@ export declare enum SubBlockType {
|
|
|
22
22
|
* @deprecated Will be removed, use BasicCard instead
|
|
23
23
|
*/
|
|
24
24
|
Card = "card",
|
|
25
|
-
PriceCard = "price-card"
|
|
25
|
+
PriceCard = "price-card",
|
|
26
|
+
ImageCard = "image-card"
|
|
26
27
|
}
|
|
27
28
|
export declare enum IconPosition {
|
|
28
29
|
Top = "top",
|
|
@@ -35,6 +36,10 @@ export interface PositionedIcon {
|
|
|
35
36
|
export interface IconWrapperProps {
|
|
36
37
|
icon?: PositionedIcon;
|
|
37
38
|
}
|
|
39
|
+
export declare enum ImageCardDirection {
|
|
40
|
+
Direct = "direct",
|
|
41
|
+
Reverse = "reverse"
|
|
42
|
+
}
|
|
38
43
|
export declare const SubBlockTypes: SubBlockType[];
|
|
39
44
|
export interface DividerProps {
|
|
40
45
|
size?: DividerSize;
|
|
@@ -137,6 +142,13 @@ export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase {
|
|
|
137
142
|
fullscreen?: boolean;
|
|
138
143
|
icon?: PositionedIcon;
|
|
139
144
|
}
|
|
145
|
+
export interface ImageCardProps extends CardBaseProps, Pick<ContentBlockProps, 'title' | 'text'> {
|
|
146
|
+
image: ImageProps;
|
|
147
|
+
enableImageBorderRadius?: boolean;
|
|
148
|
+
margins?: ImageCardMargins;
|
|
149
|
+
direction?: ImageCardDirection;
|
|
150
|
+
backgroundColor?: string;
|
|
151
|
+
}
|
|
140
152
|
export type DividerModel = {
|
|
141
153
|
type: SubBlockType.Divider;
|
|
142
154
|
} & DividerProps;
|
|
@@ -167,5 +179,8 @@ export type BasicCardModel = {
|
|
|
167
179
|
export type PriceCardModel = {
|
|
168
180
|
type: SubBlockType.PriceCard;
|
|
169
181
|
} & PriceCardProps;
|
|
170
|
-
export type
|
|
182
|
+
export type ImageCardModel = {
|
|
183
|
+
type: SubBlockType.ImageCard;
|
|
184
|
+
} & ImageCardProps;
|
|
185
|
+
export type SubBlockModels = DividerModel | QuoteModel | PriceDetailedModel | MediaCardModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel | PriceCardModel | LayoutItemModel | ImageCardModel;
|
|
171
186
|
export type SubBlock = SubBlockModels;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubBlockTypes = exports.IconPosition = exports.SubBlockType = void 0;
|
|
3
|
+
exports.SubBlockTypes = exports.ImageCardDirection = exports.IconPosition = exports.SubBlockType = void 0;
|
|
4
4
|
var SubBlockType;
|
|
5
5
|
(function (SubBlockType) {
|
|
6
6
|
SubBlockType["Divider"] = "divider";
|
|
@@ -21,10 +21,16 @@ var SubBlockType;
|
|
|
21
21
|
*/
|
|
22
22
|
SubBlockType["Card"] = "card";
|
|
23
23
|
SubBlockType["PriceCard"] = "price-card";
|
|
24
|
+
SubBlockType["ImageCard"] = "image-card";
|
|
24
25
|
})(SubBlockType = exports.SubBlockType || (exports.SubBlockType = {}));
|
|
25
26
|
var IconPosition;
|
|
26
27
|
(function (IconPosition) {
|
|
27
28
|
IconPosition["Top"] = "top";
|
|
28
29
|
IconPosition["Left"] = "left";
|
|
29
30
|
})(IconPosition = exports.IconPosition || (exports.IconPosition = {}));
|
|
31
|
+
var ImageCardDirection;
|
|
32
|
+
(function (ImageCardDirection) {
|
|
33
|
+
ImageCardDirection["Direct"] = "direct";
|
|
34
|
+
ImageCardDirection["Reverse"] = "reverse";
|
|
35
|
+
})(ImageCardDirection = exports.ImageCardDirection || (exports.ImageCardDirection = {}));
|
|
30
36
|
exports.SubBlockTypes = Object.values(SubBlockType);
|
|
@@ -1,6 +1,82 @@
|
|
|
1
1
|
import { BlockType } from '../models';
|
|
2
2
|
export declare const blockSchemas: Record<BlockType, object>;
|
|
3
3
|
export declare const cardSchemas: {
|
|
4
|
+
'image-card': {
|
|
5
|
+
additionalProperties: boolean;
|
|
6
|
+
required: string[];
|
|
7
|
+
properties: {
|
|
8
|
+
image: {
|
|
9
|
+
oneOf: ({
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
when: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
type: string;
|
|
18
|
+
pattern: string;
|
|
19
|
+
optionName: string;
|
|
20
|
+
})[];
|
|
21
|
+
};
|
|
22
|
+
direction: {
|
|
23
|
+
type: string;
|
|
24
|
+
enum: string[];
|
|
25
|
+
};
|
|
26
|
+
margins: {
|
|
27
|
+
type: string;
|
|
28
|
+
enum: string[];
|
|
29
|
+
};
|
|
30
|
+
backgroundColor: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
title: {
|
|
34
|
+
oneOf: ({
|
|
35
|
+
type: string;
|
|
36
|
+
contentType: string;
|
|
37
|
+
optionName: string;
|
|
38
|
+
} | {
|
|
39
|
+
optionName: string;
|
|
40
|
+
type: string;
|
|
41
|
+
additionalProperties: boolean;
|
|
42
|
+
required: string[];
|
|
43
|
+
properties: {
|
|
44
|
+
text: {
|
|
45
|
+
type: string;
|
|
46
|
+
contentType: string;
|
|
47
|
+
};
|
|
48
|
+
textSize: {
|
|
49
|
+
type: string;
|
|
50
|
+
enum: string[];
|
|
51
|
+
};
|
|
52
|
+
url: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
urlTitle: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
resetMargin: {
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
contentType?: undefined;
|
|
63
|
+
})[];
|
|
64
|
+
};
|
|
65
|
+
text: {
|
|
66
|
+
type: string;
|
|
67
|
+
contentType: string;
|
|
68
|
+
inputType: string;
|
|
69
|
+
};
|
|
70
|
+
border: {
|
|
71
|
+
type: string;
|
|
72
|
+
enum: string[];
|
|
73
|
+
};
|
|
74
|
+
type: {};
|
|
75
|
+
when: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
4
80
|
'price-card': {
|
|
5
81
|
additionalProperties: boolean;
|
|
6
82
|
required: string[];
|
|
@@ -4,7 +4,7 @@ exports.constructorCardSchemaNames = exports.constructorBlockSchemaNames = expor
|
|
|
4
4
|
const blocks_1 = require("./validators/blocks");
|
|
5
5
|
const sub_blocks_1 = require("./validators/sub-blocks");
|
|
6
6
|
exports.blockSchemas = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sub_blocks_1.Divider), blocks_1.ExtendedFeaturesBlock), blocks_1.PromoFeaturesBlock), blocks_1.SliderBlock), blocks_1.QuestionsBlock), blocks_1.HeaderBlock), blocks_1.BannerBlock), blocks_1.CompaniesBlock), blocks_1.MediaBlock), blocks_1.MapBlock), blocks_1.InfoBlock), blocks_1.TableBlock), blocks_1.TabsBlock), blocks_1.HeaderSliderBlock), blocks_1.IconsBlock), blocks_1.CardLayoutBlock), blocks_1.ContentLayoutBlock), blocks_1.ShareBlock), blocks_1.FilterBlock), blocks_1.FormBlock);
|
|
7
|
-
exports.cardSchemas = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sub_blocks_1.MediaCardBlock), blocks_1.BannerCard), sub_blocks_1.PriceDetailedBlock), sub_blocks_1.BackgroundCard), sub_blocks_1.Quote), sub_blocks_1.BasicCard), sub_blocks_1.PriceCardBlock);
|
|
7
|
+
exports.cardSchemas = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sub_blocks_1.MediaCardBlock), blocks_1.BannerCard), sub_blocks_1.PriceDetailedBlock), sub_blocks_1.BackgroundCard), sub_blocks_1.Quote), sub_blocks_1.BasicCard), sub_blocks_1.PriceCardBlock), sub_blocks_1.ImageCard);
|
|
8
8
|
exports.constructorBlockSchemaNames = [
|
|
9
9
|
'divider',
|
|
10
10
|
'quote',
|
|
@@ -41,4 +41,5 @@ exports.constructorCardSchemaNames = [
|
|
|
41
41
|
'basic-card',
|
|
42
42
|
'layout-item',
|
|
43
43
|
'price-card',
|
|
44
|
+
'image-card',
|
|
44
45
|
];
|
|
@@ -11,3 +11,4 @@ tslib_1.__exportStar(require("../../sub-blocks/Divider/schema"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("../../sub-blocks/BasicCard/schema"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("../../sub-blocks/PriceCard/schema"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("../../sub-blocks/HubspotForm/schema"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("../../sub-blocks/ImageCard/schema"), exports);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.pc-image-card_border_shadow {
|
|
2
|
+
box-shadow: 0px 4px 24px var(--pc-color-sfx-shadow), 0px 2px 8px var(--pc-color-sfx-shadow);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* use this for style redefinitions to awoid problems with
|
|
6
|
+
unpredictable css rules order in build */
|
|
7
|
+
.pc-image-card {
|
|
8
|
+
min-height: 248px;
|
|
9
|
+
height: 100%;
|
|
10
|
+
overflow-x: hidden;
|
|
11
|
+
border-radius: var(--pc-border-radius);
|
|
12
|
+
background-color: var(--g-color-base-float);
|
|
13
|
+
transition: box-shadow 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
|
|
14
|
+
min-height: 1px;
|
|
15
|
+
}
|
|
16
|
+
.pc-image-card_border_line {
|
|
17
|
+
border: 1px solid var(--g-color-line-generic);
|
|
18
|
+
}
|
|
19
|
+
.pc-image-card .pc-image-card__content {
|
|
20
|
+
padding: 32px;
|
|
21
|
+
}
|
|
22
|
+
.pc-image-card .pc-image-card__image_inner {
|
|
23
|
+
width: 100%;
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
.pc-image-card .pc-image-card__image_inner_radius {
|
|
27
|
+
border-radius: var(--pc-border-radius);
|
|
28
|
+
}
|
|
29
|
+
.pc-image-card .pc-image-card__image_margins_s {
|
|
30
|
+
padding: 4px;
|
|
31
|
+
}
|
|
32
|
+
.pc-image-card .pc-image-card__image_margins_s .pc-image-card__image_inner {
|
|
33
|
+
border-radius: calc(var(--pc-border-radius) - var(--pc-image-padding));
|
|
34
|
+
}
|
|
35
|
+
.pc-image-card .pc-image-card__image_margins_m {
|
|
36
|
+
padding: 32px;
|
|
37
|
+
}
|
|
38
|
+
.pc-image-card .pc-image-card__image_margins_m .pc-image-card__image_inner {
|
|
39
|
+
border-radius: initial;
|
|
40
|
+
}
|
|
41
|
+
.pc-image-card_with-content {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
}
|
|
45
|
+
.pc-image-card_with-content.pc-image-card_direction_direct .pc-image-card__image {
|
|
46
|
+
padding-bottom: 0;
|
|
47
|
+
}
|
|
48
|
+
.pc-image-card_with-content.pc-image-card_direction_direct .pc-image-card__content {
|
|
49
|
+
padding-top: 24px;
|
|
50
|
+
}
|
|
51
|
+
.pc-image-card_with-content.pc-image-card_direction_reverse {
|
|
52
|
+
flex-direction: column-reverse;
|
|
53
|
+
}
|
|
54
|
+
.pc-image-card_with-content.pc-image-card_direction_reverse .pc-image-card__image {
|
|
55
|
+
padding-top: 0;
|
|
56
|
+
}
|
|
57
|
+
.pc-image-card_with-content.pc-image-card_direction_reverse .pc-image-card__content {
|
|
58
|
+
padding-bottom: 24px;
|
|
59
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const components_1 = require("../../components");
|
|
6
|
+
const utils_1 = require("../../components/Media/Image/utils");
|
|
7
|
+
const models_1 = require("../../models");
|
|
8
|
+
const utils_2 = require("../../utils");
|
|
9
|
+
const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
|
|
10
|
+
const b = (0, utils_2.block)('image-card');
|
|
11
|
+
const ImageCard = (props) => {
|
|
12
|
+
const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = models_1.ImageCardDirection.Direct, margins, backgroundColor, } = props;
|
|
13
|
+
const hasContent = Boolean(text || title);
|
|
14
|
+
const imageProps = (0, utils_1.getMediaImage)(image);
|
|
15
|
+
return (react_1.default.createElement("div", { className: b({ border, 'with-content': hasContent, direction }), style: { backgroundColor } },
|
|
16
|
+
react_1.default.createElement("div", { className: b('image', { margins }) },
|
|
17
|
+
react_1.default.createElement(components_1.Image, Object.assign({ className: b('image_inner', { radius: enableImageBorderRadius }) }, imageProps))),
|
|
18
|
+
hasContent && (react_1.default.createElement("div", { className: b('content') },
|
|
19
|
+
react_1.default.createElement(Content_1.default, { title: title, text: text, colSizes: { all: 12, md: 12 }, size: "s" })))));
|
|
20
|
+
};
|
|
21
|
+
exports.default = ImageCard;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export declare const ImageCard: {
|
|
2
|
+
'image-card': {
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
image: {
|
|
7
|
+
oneOf: ({
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
when: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: string;
|
|
16
|
+
pattern: string;
|
|
17
|
+
optionName: string;
|
|
18
|
+
})[];
|
|
19
|
+
};
|
|
20
|
+
direction: {
|
|
21
|
+
type: string;
|
|
22
|
+
enum: string[];
|
|
23
|
+
};
|
|
24
|
+
margins: {
|
|
25
|
+
type: string;
|
|
26
|
+
enum: string[];
|
|
27
|
+
};
|
|
28
|
+
backgroundColor: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
title: {
|
|
32
|
+
oneOf: ({
|
|
33
|
+
type: string;
|
|
34
|
+
contentType: string;
|
|
35
|
+
optionName: string;
|
|
36
|
+
} | {
|
|
37
|
+
optionName: string;
|
|
38
|
+
type: string;
|
|
39
|
+
additionalProperties: boolean;
|
|
40
|
+
required: string[];
|
|
41
|
+
properties: {
|
|
42
|
+
text: {
|
|
43
|
+
type: string;
|
|
44
|
+
contentType: string;
|
|
45
|
+
};
|
|
46
|
+
textSize: {
|
|
47
|
+
type: string;
|
|
48
|
+
enum: string[];
|
|
49
|
+
};
|
|
50
|
+
url: {
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
urlTitle: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
resetMargin: {
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
contentType?: undefined;
|
|
61
|
+
})[];
|
|
62
|
+
};
|
|
63
|
+
text: {
|
|
64
|
+
type: string;
|
|
65
|
+
contentType: string;
|
|
66
|
+
inputType: string;
|
|
67
|
+
};
|
|
68
|
+
border: {
|
|
69
|
+
type: string;
|
|
70
|
+
enum: string[];
|
|
71
|
+
};
|
|
72
|
+
type: {};
|
|
73
|
+
when: {
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageCard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pick_1 = tslib_1.__importDefault(require("lodash/pick"));
|
|
6
|
+
const common_1 = require("../../schema/validators/common");
|
|
7
|
+
const components_1 = require("../../schema/validators/components");
|
|
8
|
+
const schema_1 = require("../Content/schema");
|
|
9
|
+
const ImageCardBlockContentProps = (0, pick_1.default)(schema_1.ContentBase, ['title', 'text']);
|
|
10
|
+
exports.ImageCard = {
|
|
11
|
+
'image-card': {
|
|
12
|
+
additionalProperties: false,
|
|
13
|
+
required: ['image'],
|
|
14
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), ImageCardBlockContentProps), { image: components_1.ImageProps, direction: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
enum: ['direct', 'reverse'],
|
|
17
|
+
}, margins: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: ['s', 'm'],
|
|
20
|
+
}, backgroundColor: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
} }),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -9,3 +9,4 @@ export { default as BasicCard } from './BasicCard/BasicCard';
|
|
|
9
9
|
export { default as Content } from './Content/Content';
|
|
10
10
|
export { default as HubspotForm } from './HubspotForm';
|
|
11
11
|
export { default as PriceCard } from './PriceCard/PriceCard';
|
|
12
|
+
export { default as ImageCard } from './ImageCard/ImageCard';
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PriceCard = exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.BannerCard = exports.MediaCard = exports.PriceDetailed = exports.Quote = exports.Divider = void 0;
|
|
6
|
+
exports.ImageCard = exports.PriceCard = exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.BannerCard = exports.MediaCard = exports.PriceDetailed = exports.Quote = exports.Divider = void 0;
|
|
7
7
|
var Divider_1 = require("./Divider/Divider");
|
|
8
8
|
Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return __importDefault(Divider_1).default; } });
|
|
9
9
|
var Quote_1 = require("./Quote/Quote");
|
|
@@ -26,3 +26,5 @@ var HubspotForm_1 = require("./HubspotForm");
|
|
|
26
26
|
Object.defineProperty(exports, "HubspotForm", { enumerable: true, get: function () { return __importDefault(HubspotForm_1).default; } });
|
|
27
27
|
var PriceCard_1 = require("./PriceCard/PriceCard");
|
|
28
28
|
Object.defineProperty(exports, "PriceCard", { enumerable: true, get: function () { return __importDefault(PriceCard_1).default; } });
|
|
29
|
+
var ImageCard_1 = require("./ImageCard/ImageCard");
|
|
30
|
+
Object.defineProperty(exports, "ImageCard", { enumerable: true, get: function () { return __importDefault(ImageCard_1).default; } });
|
|
@@ -12,6 +12,7 @@ import { block } from '../../utils';
|
|
|
12
12
|
import CustomBarControls from './CustomBarControls';
|
|
13
13
|
import i18n from './i18n';
|
|
14
14
|
import { checkYoutubeVideos } from './utils';
|
|
15
|
+
import { isYoutubePlayerInstance } from './utils/youtube';
|
|
15
16
|
import './ReactPlayer.css';
|
|
16
17
|
const b = block('ReactPlayer');
|
|
17
18
|
const FPS = 60;
|
|
@@ -49,8 +50,15 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
49
50
|
if (!playerRef) {
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
53
|
+
let play, pause, addEventListener;
|
|
52
54
|
const videoInstance = playerRef.getInternalPlayer();
|
|
53
|
-
|
|
55
|
+
if (isYoutubePlayerInstance(videoInstance)) {
|
|
56
|
+
({ pauseVideo: pause, playVideo: play, addEventListener } = videoInstance);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// it is assumed that `videoInstance` is HTMLVideoElement by default
|
|
60
|
+
({ play, pause, addEventListener } = videoInstance);
|
|
61
|
+
}
|
|
54
62
|
// eslint-disable-next-line consistent-return
|
|
55
63
|
return {
|
|
56
64
|
play: play.bind(videoInstance),
|
|
@@ -30,6 +30,7 @@ export declare const subBlockMap: {
|
|
|
30
30
|
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
31
31
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
32
32
|
"price-card": (props: import("./models").PriceCardProps) => JSX.Element;
|
|
33
|
+
"image-card": (props: import("./models").ImageCardProps) => JSX.Element;
|
|
33
34
|
};
|
|
34
35
|
export declare const navItemMap: {
|
|
35
36
|
button: import("react").FC<Pick<import("./navigation/models").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
@@ -2,7 +2,7 @@ import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, Exten
|
|
|
2
2
|
import { BlockType, NavigationItemType, SubBlockType } from './models';
|
|
3
3
|
import { GithubButton, NavigationButton, NavigationDropdown, NavigationLink, } from './navigation/components/NavigationItem';
|
|
4
4
|
import SocialIcon from './navigation/components/SocialIcon/SocialIcon';
|
|
5
|
-
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, LayoutItem, MediaCard, PriceCard, PriceDetailed, Quote, } from './sub-blocks';
|
|
5
|
+
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, ImageCard, LayoutItem, MediaCard, PriceCard, PriceDetailed, Quote, } from './sub-blocks';
|
|
6
6
|
export const blockMap = {
|
|
7
7
|
[BlockType.SliderBlock]: SliderBlock,
|
|
8
8
|
[BlockType.ExtendedFeaturesBlock]: ExtendedFeaturesBlock,
|
|
@@ -35,6 +35,7 @@ export const subBlockMap = {
|
|
|
35
35
|
[SubBlockType.Content]: Content,
|
|
36
36
|
[SubBlockType.Quote]: Quote,
|
|
37
37
|
[SubBlockType.PriceCard]: PriceCard,
|
|
38
|
+
[SubBlockType.ImageCard]: ImageCard,
|
|
38
39
|
};
|
|
39
40
|
export const navItemMap = {
|
|
40
41
|
[NavigationItemType.Button]: NavigationButton,
|
|
@@ -62,6 +62,7 @@ export type ContentSize = 's' | 'l';
|
|
|
62
62
|
export type ContentTextSize = 's' | 'm' | 'l';
|
|
63
63
|
export type ContentTheme = 'default' | 'dark' | 'light';
|
|
64
64
|
export type FileLinkType = 'vertical' | 'horizontal';
|
|
65
|
+
export type ImageCardMargins = 's' | 'm';
|
|
65
66
|
export interface Themable {
|
|
66
67
|
theme?: TextTheme;
|
|
67
68
|
}
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AnalyticsEventsBase, PixelEvent } from '../common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, MediaView, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
6
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageCardMargins, ImageObjectProps, ImageProps, LinkProps, MediaProps, MediaView, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -22,7 +22,8 @@ export declare enum SubBlockType {
|
|
|
22
22
|
* @deprecated Will be removed, use BasicCard instead
|
|
23
23
|
*/
|
|
24
24
|
Card = "card",
|
|
25
|
-
PriceCard = "price-card"
|
|
25
|
+
PriceCard = "price-card",
|
|
26
|
+
ImageCard = "image-card"
|
|
26
27
|
}
|
|
27
28
|
export declare enum IconPosition {
|
|
28
29
|
Top = "top",
|
|
@@ -35,6 +36,10 @@ export interface PositionedIcon {
|
|
|
35
36
|
export interface IconWrapperProps {
|
|
36
37
|
icon?: PositionedIcon;
|
|
37
38
|
}
|
|
39
|
+
export declare enum ImageCardDirection {
|
|
40
|
+
Direct = "direct",
|
|
41
|
+
Reverse = "reverse"
|
|
42
|
+
}
|
|
38
43
|
export declare const SubBlockTypes: SubBlockType[];
|
|
39
44
|
export interface DividerProps {
|
|
40
45
|
size?: DividerSize;
|
|
@@ -137,6 +142,13 @@ export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase {
|
|
|
137
142
|
fullscreen?: boolean;
|
|
138
143
|
icon?: PositionedIcon;
|
|
139
144
|
}
|
|
145
|
+
export interface ImageCardProps extends CardBaseProps, Pick<ContentBlockProps, 'title' | 'text'> {
|
|
146
|
+
image: ImageProps;
|
|
147
|
+
enableImageBorderRadius?: boolean;
|
|
148
|
+
margins?: ImageCardMargins;
|
|
149
|
+
direction?: ImageCardDirection;
|
|
150
|
+
backgroundColor?: string;
|
|
151
|
+
}
|
|
140
152
|
export type DividerModel = {
|
|
141
153
|
type: SubBlockType.Divider;
|
|
142
154
|
} & DividerProps;
|
|
@@ -167,5 +179,8 @@ export type BasicCardModel = {
|
|
|
167
179
|
export type PriceCardModel = {
|
|
168
180
|
type: SubBlockType.PriceCard;
|
|
169
181
|
} & PriceCardProps;
|
|
170
|
-
export type
|
|
182
|
+
export type ImageCardModel = {
|
|
183
|
+
type: SubBlockType.ImageCard;
|
|
184
|
+
} & ImageCardProps;
|
|
185
|
+
export type SubBlockModels = DividerModel | QuoteModel | PriceDetailedModel | MediaCardModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel | PriceCardModel | LayoutItemModel | ImageCardModel;
|
|
171
186
|
export type SubBlock = SubBlockModels;
|
|
@@ -18,10 +18,16 @@ export var SubBlockType;
|
|
|
18
18
|
*/
|
|
19
19
|
SubBlockType["Card"] = "card";
|
|
20
20
|
SubBlockType["PriceCard"] = "price-card";
|
|
21
|
+
SubBlockType["ImageCard"] = "image-card";
|
|
21
22
|
})(SubBlockType || (SubBlockType = {}));
|
|
22
23
|
export var IconPosition;
|
|
23
24
|
(function (IconPosition) {
|
|
24
25
|
IconPosition["Top"] = "top";
|
|
25
26
|
IconPosition["Left"] = "left";
|
|
26
27
|
})(IconPosition || (IconPosition = {}));
|
|
28
|
+
export var ImageCardDirection;
|
|
29
|
+
(function (ImageCardDirection) {
|
|
30
|
+
ImageCardDirection["Direct"] = "direct";
|
|
31
|
+
ImageCardDirection["Reverse"] = "reverse";
|
|
32
|
+
})(ImageCardDirection || (ImageCardDirection = {}));
|
|
27
33
|
export const SubBlockTypes = Object.values(SubBlockType);
|