@gravity-ui/page-constructor 2.2.1-alpha.0 → 2.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/README.md +1 -1
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.css +50 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +13 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +49 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.css +106 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.d.ts +11 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.js +17 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.css +54 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +9 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +13 -0
- package/build/cjs/blocks/Preview/Preview.css +50 -0
- package/build/cjs/blocks/Preview/Preview.d.ts +3 -0
- package/build/cjs/blocks/Preview/Preview.js +130 -0
- package/build/cjs/blocks/Preview/schema.d.ts +40 -0
- package/build/cjs/blocks/Preview/schema.js +53 -0
- package/build/cjs/blocks/Simple/Simple.css +22 -0
- package/build/cjs/blocks/Simple/Simple.d.ts +3 -0
- package/build/cjs/blocks/Simple/Simple.js +22 -0
- package/build/cjs/blocks/Simple/schema.d.ts +68 -0
- package/build/cjs/blocks/Simple/schema.js +14 -0
- package/build/cjs/blocks/index.d.ts +2 -0
- package/build/cjs/blocks/index.js +5 -1
- package/build/cjs/blocks/validators.d.ts +2 -0
- package/build/cjs/blocks/validators.js +2 -0
- package/build/cjs/components/HTML/HTML.d.ts +1 -1
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/constructor-items.d.ts +6 -0
- package/build/cjs/constructor-items.js +6 -0
- package/build/cjs/context/breakpointContext/breakpointContext.d.ts +2 -0
- package/build/cjs/context/breakpointContext/breakpointContext.js +7 -0
- package/build/cjs/context/breakpointContext/index.d.ts +1 -0
- package/build/cjs/context/breakpointContext/index.js +4 -0
- package/build/cjs/hooks/index.d.ts +1 -0
- package/build/cjs/hooks/index.js +3 -1
- package/build/cjs/hooks/useIntersection.d.ts +1 -0
- package/build/cjs/hooks/useIntersection.js +21 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +23 -2
- package/build/cjs/models/constructor-items/blocks.js +2 -0
- package/build/cjs/models/constructor-items/common.d.ts +14 -0
- package/build/cjs/models/constructor-items/common.js +6 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +25 -9
- package/build/cjs/models/constructor-items/sub-blocks.js +7 -6
- package/build/cjs/schema/index.js +4 -2
- package/build/cjs/schema/validators/blocks.d.ts +2 -0
- package/build/cjs/schema/validators/blocks.js +2 -0
- 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/CardWithImage/CardWithImage.css +19 -0
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +3 -0
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +16 -0
- package/build/cjs/sub-blocks/CardWithImage/schema.d.ts +154 -0
- package/build/cjs/sub-blocks/CardWithImage/schema.js +46 -0
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +1 -0
- package/build/cjs/sub-blocks/index.d.ts +1 -0
- package/build/cjs/sub-blocks/index.js +3 -1
- package/build/cjs/text-transform/blocks.js +32 -0
- package/build/cjs/utils/imageCompress.d.ts +6 -0
- package/build/cjs/utils/imageCompress.js +11 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/cjs/utils/scroll.d.ts +15 -0
- package/build/cjs/utils/scroll.js +34 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.css +50 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +14 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +47 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.css +106 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.d.ts +12 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.js +15 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.css +54 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +10 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +11 -0
- package/build/esm/blocks/Preview/Preview.css +50 -0
- package/build/esm/blocks/Preview/Preview.d.ts +4 -0
- package/build/esm/blocks/Preview/Preview.js +126 -0
- package/build/esm/blocks/Preview/schema.d.ts +40 -0
- package/build/esm/blocks/Preview/schema.js +50 -0
- package/build/esm/blocks/Simple/Simple.css +22 -0
- package/build/esm/blocks/Simple/Simple.d.ts +4 -0
- package/build/esm/blocks/Simple/Simple.js +18 -0
- package/build/esm/blocks/Simple/schema.d.ts +68 -0
- package/build/esm/blocks/Simple/schema.js +11 -0
- package/build/esm/blocks/index.d.ts +2 -0
- package/build/esm/blocks/index.js +2 -0
- package/build/esm/blocks/validators.d.ts +2 -0
- package/build/esm/blocks/validators.js +2 -0
- package/build/esm/components/HTML/HTML.d.ts +1 -1
- package/build/esm/components/Image/Image.js +2 -2
- package/build/esm/constructor-items.d.ts +6 -0
- package/build/esm/constructor-items.js +8 -2
- package/build/esm/context/breakpointContext/breakpointContext.d.ts +2 -0
- package/build/esm/context/breakpointContext/breakpointContext.js +3 -0
- package/build/esm/context/breakpointContext/index.d.ts +1 -0
- package/build/esm/context/breakpointContext/index.js +1 -0
- package/build/esm/hooks/index.d.ts +1 -0
- package/build/esm/hooks/index.js +1 -0
- package/build/esm/hooks/useIntersection.d.ts +1 -0
- package/build/esm/hooks/useIntersection.js +17 -0
- package/build/esm/models/constructor-items/blocks.d.ts +23 -2
- package/build/esm/models/constructor-items/blocks.js +2 -0
- package/build/esm/models/constructor-items/common.d.ts +14 -0
- package/build/esm/models/constructor-items/common.js +5 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +25 -9
- package/build/esm/models/constructor-items/sub-blocks.js +7 -6
- package/build/esm/schema/index.js +6 -4
- package/build/esm/schema/validators/blocks.d.ts +2 -0
- package/build/esm/schema/validators/blocks.js +2 -0
- 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/CardWithImage/CardWithImage.css +19 -0
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +4 -0
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +14 -0
- package/build/esm/sub-blocks/CardWithImage/schema.d.ts +154 -0
- package/build/esm/sub-blocks/CardWithImage/schema.js +43 -0
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +1 -0
- package/build/esm/sub-blocks/index.d.ts +1 -0
- package/build/esm/sub-blocks/index.js +1 -0
- package/build/esm/text-transform/blocks.js +32 -0
- package/build/esm/utils/imageCompress.d.ts +6 -0
- package/build/esm/utils/imageCompress.js +7 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/build/esm/utils/scroll.d.ts +15 -0
- package/build/esm/utils/scroll.js +30 -0
- package/package.json +1 -4
- package/server/models/constructor-items/blocks.d.ts +23 -2
- package/server/models/constructor-items/blocks.js +2 -0
- package/server/models/constructor-items/common.d.ts +14 -0
- package/server/models/constructor-items/common.js +6 -1
- package/server/models/constructor-items/sub-blocks.d.ts +25 -9
- package/server/models/constructor-items/sub-blocks.js +7 -6
- package/server/text-transform/blocks.js +32 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
- package/server/utils/scroll.d.ts +15 -0
- package/server/utils/scroll.js +34 -0
|
@@ -5,6 +5,7 @@ tslib_1.__exportStar(require("../../blocks/Banner/schema"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("../../blocks/Companies/schema"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("../../blocks/ExtendedFeatures/schema"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("../../blocks/PromoFeaturesBlock/schema"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("../../blocks/Simple/schema"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("../../blocks/Header/schema"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("../../blocks/Info/schema"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("../../blocks/Media/schema"), exports);
|
|
@@ -15,6 +16,7 @@ tslib_1.__exportStar(require("../../blocks/Slider/schema"), exports);
|
|
|
15
16
|
tslib_1.__exportStar(require("../../blocks/Table/schema"), exports);
|
|
16
17
|
tslib_1.__exportStar(require("../../blocks/LinkTable/schema"), exports);
|
|
17
18
|
tslib_1.__exportStar(require("../../blocks/Tabs/schema"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("../../blocks/Preview/schema"), exports);
|
|
18
20
|
tslib_1.__exportStar(require("../../blocks/HeaderSlider/schema"), exports);
|
|
19
21
|
tslib_1.__exportStar(require("../../blocks/Icons/schema"), exports);
|
|
20
22
|
tslib_1.__exportStar(require("../../blocks/CardLayout/schema"), exports);
|
|
@@ -5,6 +5,7 @@ export * from '../../sub-blocks/MediaCard/schema';
|
|
|
5
5
|
export * from '../../sub-blocks/NewsCard/schema';
|
|
6
6
|
export * from '../../sub-blocks/Partner/schema';
|
|
7
7
|
export * from '../../sub-blocks/TutorialCard/schema';
|
|
8
|
+
export * from '../../sub-blocks/CardWithImage/schema';
|
|
8
9
|
export * from '../../sub-blocks/LayoutItem/schema';
|
|
9
10
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
11
|
export * from '../../sub-blocks/Divider/schema';
|
|
@@ -8,6 +8,7 @@ tslib_1.__exportStar(require("../../sub-blocks/MediaCard/schema"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("../../sub-blocks/NewsCard/schema"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("../../sub-blocks/Partner/schema"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("../../sub-blocks/TutorialCard/schema"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("../../sub-blocks/CardWithImage/schema"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("../../sub-blocks/LayoutItem/schema"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("../../sub-blocks/Quote/schema"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("../../sub-blocks/Divider/schema"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-card-with-image__content {
|
|
4
|
+
padding-right: 16px;
|
|
5
|
+
}
|
|
6
|
+
.pc-card-with-image__image {
|
|
7
|
+
width: 100%;
|
|
8
|
+
display: block;
|
|
9
|
+
margin-bottom: 16px;
|
|
10
|
+
border-radius: var(--pc-border-radius);
|
|
11
|
+
}
|
|
12
|
+
.pc-card-with-image__image_border {
|
|
13
|
+
border: 1px solid var(--yc-color-line-generic);
|
|
14
|
+
}
|
|
15
|
+
.pc-card-with-image__image-item {
|
|
16
|
+
width: 100%;
|
|
17
|
+
display: block;
|
|
18
|
+
border-radius: var(--pc-border-radius);
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 utils_1 = require("../../utils");
|
|
6
|
+
const components_1 = require("../../components");
|
|
7
|
+
const __1 = require("../");
|
|
8
|
+
const b = (0, utils_1.block)('card-with-image');
|
|
9
|
+
const CardWithImage = ({ title, description, image, disableCompress, links, border, fullScreen, className, additionalInfo, buttons, }) => {
|
|
10
|
+
const unifiedLinks = links === null || links === void 0 ? void 0 : links.map((link) => (Object.assign(Object.assign({ theme: 'normal' }, link), { text: link.title, url: link.link })));
|
|
11
|
+
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
12
|
+
react_1.default.createElement("div", { className: b('image', { border }) }, fullScreen ? (react_1.default.createElement(components_1.FullscreenImage, { src: image, imageClassName: b('image-item'), disableCompress: disableCompress })) : (react_1.default.createElement(components_1.Image, { className: b('image-item'), src: image, alt: 'card-image', disableCompress: disableCompress }))),
|
|
13
|
+
react_1.default.createElement("div", { className: b('content') },
|
|
14
|
+
react_1.default.createElement(__1.Content, { title: title, text: description, links: unifiedLinks, additionalInfo: additionalInfo, buttons: buttons, size: "s", colSizes: { all: 12, md: 12 } }))));
|
|
15
|
+
};
|
|
16
|
+
exports.default = CardWithImage;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export declare const CardWithImageItem: {
|
|
2
|
+
additionalProperties: boolean;
|
|
3
|
+
required: string[];
|
|
4
|
+
properties: {
|
|
5
|
+
image: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
description: {
|
|
9
|
+
type: string;
|
|
10
|
+
contentType: string;
|
|
11
|
+
};
|
|
12
|
+
disableCompress: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
border: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
fullScreen: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
links: {
|
|
22
|
+
type: string;
|
|
23
|
+
items: {
|
|
24
|
+
type: string;
|
|
25
|
+
properties: {
|
|
26
|
+
when: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
title: {
|
|
33
|
+
oneOf: ({
|
|
34
|
+
type: string;
|
|
35
|
+
additionalProperties: boolean;
|
|
36
|
+
required: string[];
|
|
37
|
+
properties: {
|
|
38
|
+
text: {
|
|
39
|
+
type: string;
|
|
40
|
+
contentType: string;
|
|
41
|
+
};
|
|
42
|
+
textSize: {
|
|
43
|
+
type: string;
|
|
44
|
+
enum: string[];
|
|
45
|
+
};
|
|
46
|
+
url: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
resetMargin: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: string;
|
|
55
|
+
contentType: string;
|
|
56
|
+
})[];
|
|
57
|
+
};
|
|
58
|
+
additionalInfo: {
|
|
59
|
+
type: string;
|
|
60
|
+
contentType: string;
|
|
61
|
+
};
|
|
62
|
+
buttons: {
|
|
63
|
+
type: string;
|
|
64
|
+
items: {
|
|
65
|
+
type: string;
|
|
66
|
+
properties: {
|
|
67
|
+
when: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
type: {};
|
|
74
|
+
when: {};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export declare const CardWithImage: {
|
|
78
|
+
'card-with-image': {
|
|
79
|
+
additionalProperties: boolean;
|
|
80
|
+
required: string[];
|
|
81
|
+
properties: {
|
|
82
|
+
image: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
description: {
|
|
86
|
+
type: string;
|
|
87
|
+
contentType: string;
|
|
88
|
+
};
|
|
89
|
+
disableCompress: {
|
|
90
|
+
type: string;
|
|
91
|
+
};
|
|
92
|
+
border: {
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
95
|
+
fullScreen: {
|
|
96
|
+
type: string;
|
|
97
|
+
};
|
|
98
|
+
links: {
|
|
99
|
+
type: string;
|
|
100
|
+
items: {
|
|
101
|
+
type: string;
|
|
102
|
+
properties: {
|
|
103
|
+
when: {
|
|
104
|
+
type: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
title: {
|
|
110
|
+
oneOf: ({
|
|
111
|
+
type: string;
|
|
112
|
+
additionalProperties: boolean;
|
|
113
|
+
required: string[];
|
|
114
|
+
properties: {
|
|
115
|
+
text: {
|
|
116
|
+
type: string;
|
|
117
|
+
contentType: string;
|
|
118
|
+
};
|
|
119
|
+
textSize: {
|
|
120
|
+
type: string;
|
|
121
|
+
enum: string[];
|
|
122
|
+
};
|
|
123
|
+
url: {
|
|
124
|
+
type: string;
|
|
125
|
+
};
|
|
126
|
+
resetMargin: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
type: string;
|
|
132
|
+
contentType: string;
|
|
133
|
+
})[];
|
|
134
|
+
};
|
|
135
|
+
additionalInfo: {
|
|
136
|
+
type: string;
|
|
137
|
+
contentType: string;
|
|
138
|
+
};
|
|
139
|
+
buttons: {
|
|
140
|
+
type: string;
|
|
141
|
+
items: {
|
|
142
|
+
type: string;
|
|
143
|
+
properties: {
|
|
144
|
+
when: {
|
|
145
|
+
type: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
type: {};
|
|
151
|
+
when: {};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardWithImage = exports.CardWithImageItem = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const common_1 = require("../../schema/validators/common");
|
|
6
|
+
const utils_1 = require("../../schema/validators/utils");
|
|
7
|
+
const schema_1 = require("../../sub-blocks/Content/schema");
|
|
8
|
+
const CardWithImageContentProps = (0, lodash_1.omit)(schema_1.ContentBase, ['links', 'size', 'text', 'theme']);
|
|
9
|
+
const CardWithImageLinks = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
additionalProperties: false,
|
|
12
|
+
required: ['title', 'link'],
|
|
13
|
+
properties: Object.assign(Object.assign({}, common_1.BaseProps), { title: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
contentType: 'text',
|
|
16
|
+
}, link: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
}, arrow: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
}, theme: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
enum: ['back', 'file-link', 'normal'],
|
|
23
|
+
}, textSize: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: common_1.textSize,
|
|
26
|
+
} }),
|
|
27
|
+
};
|
|
28
|
+
exports.CardWithImageItem = {
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
required: ['image'],
|
|
31
|
+
properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), CardWithImageContentProps), { image: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
}, description: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
contentType: 'yfm',
|
|
36
|
+
}, disableCompress: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
}, border: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
}, fullScreen: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
}, links: (0, utils_1.filteredArray)(CardWithImageLinks) }),
|
|
43
|
+
};
|
|
44
|
+
exports.CardWithImage = {
|
|
45
|
+
'card-with-image': exports.CardWithImageItem,
|
|
46
|
+
};
|
|
@@ -6,6 +6,7 @@ export { default as PriceDetailed } from './PriceDetailed/PriceDetailed';
|
|
|
6
6
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
7
7
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
8
8
|
export { default as TutorialCard } from './TutorialCard/TutorialCard';
|
|
9
|
+
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
9
10
|
export { default as LayoutItem } from './LayoutItem/LayoutItem';
|
|
10
11
|
export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
|
|
11
12
|
export { default as BasicCard } from './BasicCard/BasicCard';
|
|
@@ -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.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.TutorialCard = exports.BannerCard = exports.MediaCard = exports.PriceDetailed = exports.Partner = exports.NewsCard = exports.Quote = exports.Divider = void 0;
|
|
6
|
+
exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.CardWithImage = exports.TutorialCard = exports.BannerCard = exports.MediaCard = exports.PriceDetailed = exports.Partner = exports.NewsCard = 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");
|
|
@@ -20,6 +20,8 @@ var BannerCard_1 = require("./BannerCard/BannerCard");
|
|
|
20
20
|
Object.defineProperty(exports, "BannerCard", { enumerable: true, get: function () { return __importDefault(BannerCard_1).default; } });
|
|
21
21
|
var TutorialCard_1 = require("./TutorialCard/TutorialCard");
|
|
22
22
|
Object.defineProperty(exports, "TutorialCard", { enumerable: true, get: function () { return __importDefault(TutorialCard_1).default; } });
|
|
23
|
+
var CardWithImage_1 = require("./CardWithImage/CardWithImage");
|
|
24
|
+
Object.defineProperty(exports, "CardWithImage", { enumerable: true, get: function () { return __importDefault(CardWithImage_1).default; } });
|
|
23
25
|
var LayoutItem_1 = require("./LayoutItem/LayoutItem");
|
|
24
26
|
Object.defineProperty(exports, "LayoutItem", { enumerable: true, get: function () { return __importDefault(LayoutItem_1).default; } });
|
|
25
27
|
var BackgroundCard_1 = require("./BackgroundCard/BackgroundCard");
|
|
@@ -134,6 +134,16 @@ const config = {
|
|
|
134
134
|
transformer: typografTransformer,
|
|
135
135
|
},
|
|
136
136
|
],
|
|
137
|
+
[models_1.SubBlockType.CardWithImage]: [
|
|
138
|
+
{
|
|
139
|
+
fields: ['description', 'additionalInfo'],
|
|
140
|
+
transformer: yfmTransformer,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
fields: ['title'],
|
|
144
|
+
transformer: typografTransformer,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
137
147
|
[models_1.SubBlockType.LayoutItem]: [
|
|
138
148
|
{
|
|
139
149
|
fields: ['content'],
|
|
@@ -258,6 +268,17 @@ const config = {
|
|
|
258
268
|
parser: (0, exports.createItemsParser)(['description']),
|
|
259
269
|
},
|
|
260
270
|
],
|
|
271
|
+
[models_1.BlockType.SimpleBlock]: [
|
|
272
|
+
{
|
|
273
|
+
fields: ['title'],
|
|
274
|
+
transformer: typografTransformer,
|
|
275
|
+
parser: parseTitle,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
fields: ['description'],
|
|
279
|
+
transformer: yfmTransformer,
|
|
280
|
+
},
|
|
281
|
+
],
|
|
261
282
|
[models_1.SubBlockType.PriceDetailed]: [
|
|
262
283
|
{
|
|
263
284
|
transformer: yfmTransformer,
|
|
@@ -293,6 +314,17 @@ const config = {
|
|
|
293
314
|
parser: parseTitle,
|
|
294
315
|
},
|
|
295
316
|
],
|
|
317
|
+
[models_1.BlockType.PreviewBlock]: [
|
|
318
|
+
{
|
|
319
|
+
fields: ['description'],
|
|
320
|
+
transformer: yfmTransformer,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
fields: ['title'],
|
|
324
|
+
transformer: typografTransformer,
|
|
325
|
+
parser: parseTitle,
|
|
326
|
+
},
|
|
327
|
+
],
|
|
296
328
|
[models_1.BlockType.InfoBlock]: [
|
|
297
329
|
{
|
|
298
330
|
fields: ['rightContent', 'leftContent'],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCompressible = exports.AvailableForCompressExtension = void 0;
|
|
4
|
+
var AvailableForCompressExtension;
|
|
5
|
+
(function (AvailableForCompressExtension) {
|
|
6
|
+
AvailableForCompressExtension["PNG"] = "png";
|
|
7
|
+
AvailableForCompressExtension["JPG"] = "jpg";
|
|
8
|
+
AvailableForCompressExtension["JPEG"] = "jpeg";
|
|
9
|
+
})(AvailableForCompressExtension = exports.AvailableForCompressExtension || (exports.AvailableForCompressExtension = {}));
|
|
10
|
+
const isCompressible = (fileName) => Object.keys(AvailableForCompressExtension).some((ext) => fileName.endsWith(`.${ext}`));
|
|
11
|
+
exports.isCompressible = isCompressible;
|
package/build/cjs/utils/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
tslib_1.__exportStar(require("./common"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./analytics"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./blocks"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./scroll"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./url"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./cn"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./url"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum ScrollDirection {
|
|
2
|
+
HORIZONTAL = "scrollLeft",
|
|
3
|
+
VERTICAL = "scrollTop"
|
|
4
|
+
}
|
|
5
|
+
export interface ScrollReverseParams {
|
|
6
|
+
distance?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ScrollOptions {
|
|
9
|
+
distance: number;
|
|
10
|
+
timeSeconds: number;
|
|
11
|
+
speed: number;
|
|
12
|
+
direction?: ScrollDirection;
|
|
13
|
+
reverseParams?: ScrollReverseParams;
|
|
14
|
+
}
|
|
15
|
+
export declare function doSmoothScroll(element: HTMLDivElement, startPosition: number, scrollOptions: ScrollOptions): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doSmoothScroll = exports.ScrollDirection = void 0;
|
|
4
|
+
var ScrollDirection;
|
|
5
|
+
(function (ScrollDirection) {
|
|
6
|
+
ScrollDirection["HORIZONTAL"] = "scrollLeft";
|
|
7
|
+
ScrollDirection["VERTICAL"] = "scrollTop";
|
|
8
|
+
})(ScrollDirection = exports.ScrollDirection || (exports.ScrollDirection = {}));
|
|
9
|
+
function doSmoothScroll(element, startPosition, scrollOptions) {
|
|
10
|
+
const { distance, timeSeconds, speed, direction = ScrollDirection.HORIZONTAL, reverseParams, } = scrollOptions;
|
|
11
|
+
let scrollShift = 0;
|
|
12
|
+
let currentTimeChanges = 0;
|
|
13
|
+
const changeScrollFunction = getChangeScrollFunction(direction, Boolean(reverseParams));
|
|
14
|
+
const scrollDistance = (reverseParams === null || reverseParams === void 0 ? void 0 : reverseParams.distance) || distance;
|
|
15
|
+
const timeChanges = getTimeChanges(scrollDistance, timeSeconds, speed);
|
|
16
|
+
while (scrollShift < scrollDistance) {
|
|
17
|
+
window.setTimeout(changeScrollFunction, currentTimeChanges, element, scrollShift, startPosition);
|
|
18
|
+
currentTimeChanges += timeChanges;
|
|
19
|
+
scrollShift++;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.doSmoothScroll = doSmoothScroll;
|
|
23
|
+
function getChangeScrollFunction(direction, isReverse) {
|
|
24
|
+
return (element, scrollPosition, startPosition) => {
|
|
25
|
+
element[direction] = isReverse
|
|
26
|
+
? startPosition - scrollPosition
|
|
27
|
+
: startPosition + scrollPosition;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function getTimeChanges(distance, timeSeconds, acceleration) {
|
|
31
|
+
const physicalSpeed = distance / timeSeconds;
|
|
32
|
+
const programSpeedMilliseconds = (1 / physicalSpeed) * 1000;
|
|
33
|
+
return programSpeedMilliseconds / acceleration;
|
|
34
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-preview-media-content-block__header {
|
|
4
|
+
margin-bottom: 24px;
|
|
5
|
+
}
|
|
6
|
+
.pc-preview-media-content-block__menu {
|
|
7
|
+
padding: 0;
|
|
8
|
+
}
|
|
9
|
+
.pc-preview-media-content-block__title {
|
|
10
|
+
font-size: var(--yc-text-display-1-font-size);
|
|
11
|
+
line-height: var(--yc-text-display-1-line-height);
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
.pc-preview-media-content-block__description {
|
|
16
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
17
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
18
|
+
margin-top: 12px;
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
.pc-preview-media-content-block__content, .pc-preview-media-content-block__media {
|
|
22
|
+
padding: 0;
|
|
23
|
+
}
|
|
24
|
+
@media (max-width: 769px) {
|
|
25
|
+
.pc-preview-media-content-block__menu.col {
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
margin-bottom: 16px;
|
|
28
|
+
padding: 0;
|
|
29
|
+
}
|
|
30
|
+
.pc-preview-media-content-block__content-wrapper {
|
|
31
|
+
width: fit-content;
|
|
32
|
+
display: flex;
|
|
33
|
+
}
|
|
34
|
+
.pc-preview-media-content-block__content-wrapper div.preview-content-block__content-wrapper:first-child div.preview-content-block__content_active {
|
|
35
|
+
margin-left: 0;
|
|
36
|
+
}
|
|
37
|
+
.pc-preview-media-content-block__content-wrapper div.preview-content-block__content-wrapper:last-child div.preview-content-block__content_active {
|
|
38
|
+
margin-right: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
@media (min-width: 577px) and (max-width: 769px) {
|
|
42
|
+
.pc-preview-media-content-block__header, .pc-preview-media-content-block__content-wrapper {
|
|
43
|
+
padding: 0 32px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
@media (max-width: 577px) {
|
|
47
|
+
.pc-preview-media-content-block__header, .pc-preview-media-content-block__content-wrapper {
|
|
48
|
+
padding: 0 20px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PreviewItemProps, PreviewRatioMediaContent, Refable } from '../../../models';
|
|
3
|
+
import './MediaContent.css';
|
|
4
|
+
interface MediaContentProps extends Refable<HTMLDivElement> {
|
|
5
|
+
items: PreviewItemProps[];
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
ratioMediaContent?: PreviewRatioMediaContent;
|
|
9
|
+
switching: boolean;
|
|
10
|
+
isActiveBlock: (id: number, isMediaBlock?: boolean) => boolean;
|
|
11
|
+
showMediaContent: (id: number) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const MediaContent: React.ForwardRefExoticComponent<Pick<MediaContentProps, "title" | "items" | "description" | "ratioMediaContent" | "switching" | "isActiveBlock" | "showMediaContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default MediaContent;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { forwardRef, Fragment, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { block, getThemedValue } from '../../../utils';
|
|
3
|
+
import { Col, GridColumnSize } from '../../../grid';
|
|
4
|
+
import { YFMWrapper, HTML } from '../../../components/';
|
|
5
|
+
import PreviewContent from './PreviewContent';
|
|
6
|
+
import PreviewMedia from './PreviewMedia';
|
|
7
|
+
import { ThemeValueContext } from '../../../context/theme/ThemeValueContext';
|
|
8
|
+
import './MediaContent.css';
|
|
9
|
+
const b = block('preview-media-content-block');
|
|
10
|
+
const MediaContent = forwardRef((props, ref) => {
|
|
11
|
+
const { items, title, description = '', switching, ratioMediaContent = '1-1', isActiveBlock, showMediaContent, } = props;
|
|
12
|
+
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
13
|
+
const [mediaSizes, setMediaSizes] = useState({ [GridColumnSize.All]: 12 });
|
|
14
|
+
const [contentSizes, setContentSizes] = useState({ [GridColumnSize.All]: 12 });
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const [mediaSize, contentSize] = ratioMediaContent.split('-');
|
|
17
|
+
const blockSize = 12 / (Number(mediaSize) + Number(contentSize));
|
|
18
|
+
const updatedMediaSizes = Object.assign(Object.assign({}, mediaSizes), { [GridColumnSize.Md]: blockSize * Number(mediaSize) });
|
|
19
|
+
setMediaSizes(updatedMediaSizes);
|
|
20
|
+
const updatedContentSizes = Object.assign(Object.assign({}, contentSizes), { [GridColumnSize.Md]: blockSize * Number(contentSize) });
|
|
21
|
+
setContentSizes(updatedContentSizes);
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
}, [ratioMediaContent]);
|
|
24
|
+
const contentComponents = [];
|
|
25
|
+
const mediaComponents = [];
|
|
26
|
+
items.forEach((item, id) => {
|
|
27
|
+
const { content, media } = item;
|
|
28
|
+
const isActive = isActiveBlock(id);
|
|
29
|
+
const contentMods = { active: isActive };
|
|
30
|
+
const mediaMods = { active: isActiveBlock(id, true) };
|
|
31
|
+
const onClick = () => showMediaContent(id);
|
|
32
|
+
contentComponents.push(React.createElement(PreviewContent, Object.assign({ key: id, id: id }, content, { switching: switching, onClick: onClick, mods: contentMods })));
|
|
33
|
+
mediaComponents.push(React.createElement(PreviewMedia, { key: id, id: id, media: media && getThemedValue(media, theme), play: isActive, mods: mediaMods }));
|
|
34
|
+
});
|
|
35
|
+
return (React.createElement(Fragment, null,
|
|
36
|
+
React.createElement(Col, { sizes: contentSizes, className: b('content') },
|
|
37
|
+
React.createElement("div", { className: b('header') },
|
|
38
|
+
React.createElement("h2", { className: b('title') },
|
|
39
|
+
React.createElement(HTML, null, title)),
|
|
40
|
+
description && (React.createElement("div", { className: b('description') },
|
|
41
|
+
React.createElement(YFMWrapper, { content: description, modifiers: { constructor: true } })))),
|
|
42
|
+
React.createElement(Col, { ref: ref, className: b('menu') },
|
|
43
|
+
React.createElement("div", { className: b('content-wrapper') }, contentComponents))),
|
|
44
|
+
React.createElement(Col, { sizes: mediaSizes, className: b('media') }, mediaComponents)));
|
|
45
|
+
});
|
|
46
|
+
MediaContent.displayName = 'MediaContent';
|
|
47
|
+
export default MediaContent;
|