@gravity-ui/page-constructor 1.14.1 → 1.14.3
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 +14 -0
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +8 -6
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +9 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.js +40 -0
- package/build/cjs/components/Media/Media.js +3 -2
- package/build/cjs/components/MetaInfo/MetaInfo.css +13 -0
- package/build/cjs/components/MetaInfo/MetaInfo.d.ts +6 -0
- package/build/cjs/components/MetaInfo/MetaInfo.js +8 -0
- package/build/cjs/components/MetaInfo/schema.d.ts +8 -0
- package/build/cjs/components/MetaInfo/schema.js +10 -0
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +6 -10
- package/build/cjs/components/index.d.ts +2 -0
- package/build/cjs/components/index.js +5 -1
- package/build/cjs/constructor-items.d.ts +4 -0
- package/build/cjs/constructor-items.js +4 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/cjs/models/constructor-items/common.d.ts +1 -17
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +14 -0
- package/build/cjs/models/constructor-items/sub-blocks.js +4 -0
- package/build/cjs/schema/index.js +1 -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/HubspotForm/HubspotForm.css +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +3 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +21 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +18 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +15 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.js +12 -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 +17 -0
- package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -7
- package/build/esm/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +10 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.js +38 -0
- package/build/esm/components/Media/Media.js +3 -2
- package/build/esm/components/MetaInfo/MetaInfo.css +13 -0
- package/build/esm/components/MetaInfo/MetaInfo.d.ts +7 -0
- package/build/esm/components/MetaInfo/MetaInfo.js +6 -0
- package/build/esm/components/MetaInfo/schema.d.ts +8 -0
- package/build/esm/components/MetaInfo/schema.js +8 -0
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +6 -10
- package/build/esm/components/index.d.ts +2 -0
- package/build/esm/components/index.js +2 -0
- package/build/esm/constructor-items.d.ts +4 -0
- package/build/esm/constructor-items.js +5 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/esm/models/constructor-items/common.d.ts +1 -17
- package/build/esm/models/constructor-items/sub-blocks.d.ts +14 -0
- package/build/esm/models/constructor-items/sub-blocks.js +4 -0
- package/build/esm/schema/index.js +1 -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/HubspotForm/HubspotForm.css +2 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +20 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +14 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +15 -0
- package/build/esm/sub-blocks/LayoutItem/utils.js +6 -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 +17 -0
- package/package.json +4 -2
- package/server/models/constructor-items/common.d.ts +1 -17
- package/server/models/constructor-items/sub-blocks.d.ts +14 -0
- package/server/models/constructor-items/sub-blocks.js +4 -0
- package/server/text-transform/blocks.js +17 -0
- package/styles/root.scss +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockType, SubBlockType } from './models';
|
|
2
|
-
import { Partner, PriceDetailed, MediaCard, NewsCard, TutorialCard, CardWithImage, BackgroundCard, Content, Quote, Divider, BannerCard, BasicCard, } from './sub-blocks';
|
|
2
|
+
import { Partner, PriceDetailed, MediaCard, NewsCard, TutorialCard, CardWithImage, LayoutItem, BackgroundCard, Content, Quote, Divider, BannerCard, BasicCard, } from './sub-blocks';
|
|
3
3
|
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, } from './blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
@@ -37,6 +37,10 @@ export const subBlockMap = {
|
|
|
37
37
|
[SubBlockType.MediaCard]: MediaCard,
|
|
38
38
|
[SubBlockType.BannerCard]: BannerCard,
|
|
39
39
|
[SubBlockType.NewsCard]: NewsCard,
|
|
40
|
+
[SubBlockType.LayoutItem]: LayoutItem,
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use LayoutItem
|
|
43
|
+
*/
|
|
40
44
|
[SubBlockType.CardWithImage]: CardWithImage,
|
|
41
45
|
[SubBlockType.BackgroundCard]: BackgroundCard,
|
|
42
46
|
[SubBlockType.BasicCard]: BasicCard,
|
|
@@ -18,6 +18,7 @@ unpredictable css rules order in build */
|
|
|
18
18
|
--pc-monochrome-button-background-color-hover: #393939;
|
|
19
19
|
--pc-monochrome-button-color: var(--yc-color-text-light-primary);
|
|
20
20
|
--pc-text-header-color: var(--yc-color-text-primary);
|
|
21
|
+
--pc-media-card-meta-info-color: var(--yc-color-text-secondary);
|
|
21
22
|
}
|
|
22
23
|
.yc-root.yc-root_theme_dark {
|
|
23
24
|
--pc-color-sfx-shadow: var(--yc-color-sfx-shadow);
|
|
@@ -172,6 +172,7 @@ export interface MediaComponentVideoProps {
|
|
|
172
172
|
export interface MediaComponentYoutubeProps {
|
|
173
173
|
youtube: string;
|
|
174
174
|
previewImg?: string;
|
|
175
|
+
fullScreen?: boolean;
|
|
175
176
|
}
|
|
176
177
|
export interface MediaComponentImageProps {
|
|
177
178
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -243,27 +244,10 @@ export interface TitleBaseProps {
|
|
|
243
244
|
custom?: string | ReactNode;
|
|
244
245
|
onClick?: () => void;
|
|
245
246
|
}
|
|
246
|
-
export interface CardData {
|
|
247
|
-
header?: CardHeader;
|
|
248
|
-
text?: string;
|
|
249
|
-
title?: string;
|
|
250
|
-
link?: LinkProps;
|
|
251
|
-
footer?: string;
|
|
252
|
-
url?: string;
|
|
253
|
-
service?: {
|
|
254
|
-
slug: string;
|
|
255
|
-
name: string;
|
|
256
|
-
};
|
|
257
|
-
links?: LinkProps[];
|
|
258
|
-
}
|
|
259
247
|
export type CardBorder = 'shadow' | 'line' | 'none';
|
|
260
248
|
export interface CardBaseProps {
|
|
261
249
|
border?: CardBorder;
|
|
262
250
|
}
|
|
263
|
-
export interface CardHeader {
|
|
264
|
-
title?: string;
|
|
265
|
-
image?: ImageProps;
|
|
266
|
-
}
|
|
267
251
|
export interface PriceDescriptionProps {
|
|
268
252
|
title: string;
|
|
269
253
|
detailedTitle?: string;
|
|
@@ -19,7 +19,11 @@ export declare enum SubBlockType {
|
|
|
19
19
|
* @deprecated Will be moved to params use BasicCard instead
|
|
20
20
|
*/
|
|
21
21
|
TutorialCard = "tutoral-card",
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use LayoutItem
|
|
24
|
+
*/
|
|
22
25
|
CardWithImage = "card-with-image",
|
|
26
|
+
LayoutItem = "layout-item",
|
|
23
27
|
BackgroundCard = "background-card",
|
|
24
28
|
BasicCard = "basic-card",
|
|
25
29
|
Content = "content",
|
|
@@ -125,6 +129,13 @@ export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockPro
|
|
|
125
129
|
fullScreen?: boolean;
|
|
126
130
|
links?: CardWithImageLinkProps[];
|
|
127
131
|
}
|
|
132
|
+
export interface LayoutItemProps extends ClassNameProps {
|
|
133
|
+
content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
|
|
134
|
+
media: MediaProps;
|
|
135
|
+
metaInfo?: string[];
|
|
136
|
+
border?: boolean;
|
|
137
|
+
fullScreen?: boolean;
|
|
138
|
+
}
|
|
128
139
|
export type DividerModel = {
|
|
129
140
|
type: SubBlockType.Divider;
|
|
130
141
|
} & DividerProps;
|
|
@@ -137,6 +148,9 @@ export type NewsCardModel = {
|
|
|
137
148
|
export type CardWithImageModel = {
|
|
138
149
|
type: SubBlockType.CardWithImage;
|
|
139
150
|
} & CardWithImageProps;
|
|
151
|
+
export type LayoutItemModel = {
|
|
152
|
+
type: SubBlockType.CardWithImage;
|
|
153
|
+
} & LayoutItemProps;
|
|
140
154
|
export type TutorialCardModel = {
|
|
141
155
|
type: SubBlockType.TutorialCard;
|
|
142
156
|
} & TutorialCardProps;
|
|
@@ -14,7 +14,11 @@ export var SubBlockType;
|
|
|
14
14
|
* @deprecated Will be moved to params use BasicCard instead
|
|
15
15
|
*/
|
|
16
16
|
SubBlockType["TutorialCard"] = "tutoral-card";
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use LayoutItem
|
|
19
|
+
*/
|
|
17
20
|
SubBlockType["CardWithImage"] = "card-with-image";
|
|
21
|
+
SubBlockType["LayoutItem"] = "layout-item";
|
|
18
22
|
SubBlockType["BackgroundCard"] = "background-card";
|
|
19
23
|
SubBlockType["BasicCard"] = "basic-card";
|
|
20
24
|
SubBlockType["Content"] = "content";
|
|
@@ -50,6 +50,7 @@ export function generateDefaultSchema(config) {
|
|
|
50
50
|
'card-with-image',
|
|
51
51
|
'quote',
|
|
52
52
|
'basic-card',
|
|
53
|
+
'layout-item',
|
|
53
54
|
];
|
|
54
55
|
const configBlockSchemaNames = Object.keys(blocks).filter((item) => !constructorBlockSchemaNames.includes(item));
|
|
55
56
|
const configCardSchemaNames = Object.keys(cards).filter((item) => !constructorCardSchemaNames.includes(item));
|
|
@@ -6,6 +6,7 @@ export * from '../../sub-blocks/NewsCard/schema';
|
|
|
6
6
|
export * from '../../sub-blocks/Partner/schema';
|
|
7
7
|
export * from '../../sub-blocks/TutorialCard/schema';
|
|
8
8
|
export * from '../../sub-blocks/CardWithImage/schema';
|
|
9
|
+
export * from '../../sub-blocks/LayoutItem/schema';
|
|
9
10
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
11
|
export * from '../../sub-blocks/Divider/schema';
|
|
11
12
|
export * from '../../sub-blocks/BasicCard/schema';
|
|
@@ -6,6 +6,7 @@ export * from '../../sub-blocks/NewsCard/schema';
|
|
|
6
6
|
export * from '../../sub-blocks/Partner/schema';
|
|
7
7
|
export * from '../../sub-blocks/TutorialCard/schema';
|
|
8
8
|
export * from '../../sub-blocks/CardWithImage/schema';
|
|
9
|
+
export * from '../../sub-blocks/LayoutItem/schema';
|
|
9
10
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
11
|
export * from '../../sub-blocks/Divider/schema';
|
|
11
12
|
export * from '../../sub-blocks/BasicCard/schema';
|
|
@@ -46,7 +46,7 @@ unpredictable css rules order in build */
|
|
|
46
46
|
color: var(--yc-color-text-primary);
|
|
47
47
|
background-color: transparent;
|
|
48
48
|
border: 1px solid var(--yc-color-line-generic);
|
|
49
|
-
border-radius:
|
|
49
|
+
border-radius: var(--yc-border-radius-l);
|
|
50
50
|
}
|
|
51
51
|
.pc-hubspot-form .hs-form-field .input input[type=text]:hover,
|
|
52
52
|
.pc-hubspot-form .hs-form-field .input input[type=number]:hover,
|
|
@@ -276,7 +276,7 @@ unpredictable css rules order in build */
|
|
|
276
276
|
box-sizing: border-box;
|
|
277
277
|
height: 44px;
|
|
278
278
|
padding: 0 20px;
|
|
279
|
-
border-radius:
|
|
279
|
+
border-radius: var(--yc-border-radius-xl);
|
|
280
280
|
background-color: var(--yc-color-base-special);
|
|
281
281
|
color: var(--yc-my-color-brand-text-contrast);
|
|
282
282
|
line-height: 44px;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-layout-item__media {
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: block;
|
|
6
|
+
border-radius: var(--pc-border-radius);
|
|
7
|
+
}
|
|
8
|
+
.pc-layout-item__media_border {
|
|
9
|
+
border: 1px solid var(--yc-color-line-generic);
|
|
10
|
+
}
|
|
11
|
+
.pc-layout-item__meta-info {
|
|
12
|
+
margin: 16px 0 -8px 0;
|
|
13
|
+
}
|
|
14
|
+
.pc-layout-item__content {
|
|
15
|
+
margin: 16px 16px 0 0;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
import { FullScreenMedia, Media, MetaInfo } from '../../components';
|
|
5
|
+
import { getLayoutItemLinks, hasFullScreen, showFullScreenIcon } from './utils';
|
|
6
|
+
import { Content } from '..';
|
|
7
|
+
import './LayoutItem.css';
|
|
8
|
+
const b = block('layout-item');
|
|
9
|
+
const LayoutItem = (_a) => {
|
|
10
|
+
var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullScreen, className } = _a;
|
|
11
|
+
return (React.createElement("div", { className: b(null, className) },
|
|
12
|
+
fullScreen && hasFullScreen(media) ? (React.createElement(FullScreenMedia, { showFullScreenIcon: showFullScreenIcon(media) }, (_a = {}) => {
|
|
13
|
+
var { className: mediaClassName } = _a, fullScreenMediaProps = __rest(_a, ["className"]);
|
|
14
|
+
return (React.createElement(Media, Object.assign({}, media, fullScreenMediaProps, { className: b('media', { border }, mediaClassName) })));
|
|
15
|
+
})) : (React.createElement(Media, Object.assign({}, media, { className: b('media', { border }) }))),
|
|
16
|
+
metaInfo && React.createElement(MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
17
|
+
React.createElement("div", { className: b('content') },
|
|
18
|
+
React.createElement(Content, Object.assign({}, content, { links: getLayoutItemLinks(links), size: "s", colSizes: { all: 12, md: 12 } })))));
|
|
19
|
+
};
|
|
20
|
+
export default LayoutItem;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export declare const LayoutItem: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
media: {
|
|
7
|
+
color: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
image: {
|
|
11
|
+
anyOf: ({
|
|
12
|
+
oneOf: ({
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
when: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
type: string;
|
|
21
|
+
pattern: string;
|
|
22
|
+
})[];
|
|
23
|
+
} | {
|
|
24
|
+
type: string;
|
|
25
|
+
items: {
|
|
26
|
+
oneOf: ({
|
|
27
|
+
type: string;
|
|
28
|
+
properties: {
|
|
29
|
+
when: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
pattern: string;
|
|
36
|
+
})[];
|
|
37
|
+
};
|
|
38
|
+
})[];
|
|
39
|
+
};
|
|
40
|
+
video: {
|
|
41
|
+
type: string;
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
required: string[];
|
|
44
|
+
properties: {
|
|
45
|
+
src: {
|
|
46
|
+
type: string;
|
|
47
|
+
items: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
loop: {
|
|
52
|
+
anyOf: ({
|
|
53
|
+
type: string;
|
|
54
|
+
additionalProperties: boolean;
|
|
55
|
+
required: string[];
|
|
56
|
+
properties: {
|
|
57
|
+
start: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
end: {
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
type: string;
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
type: {
|
|
69
|
+
type: string;
|
|
70
|
+
enum: string[];
|
|
71
|
+
};
|
|
72
|
+
muted: {
|
|
73
|
+
type: string;
|
|
74
|
+
};
|
|
75
|
+
playing: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
elapsedTime: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
playIcon: {
|
|
82
|
+
type: string;
|
|
83
|
+
additionalProperties: boolean;
|
|
84
|
+
properties: {
|
|
85
|
+
type: {
|
|
86
|
+
type: string;
|
|
87
|
+
enum: string[];
|
|
88
|
+
};
|
|
89
|
+
theme: {
|
|
90
|
+
type: string;
|
|
91
|
+
enum: string[];
|
|
92
|
+
};
|
|
93
|
+
text: {
|
|
94
|
+
type: string;
|
|
95
|
+
contentType: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
controls: {
|
|
100
|
+
type: string;
|
|
101
|
+
enum: string[];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
youtube: {
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
parallax: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
height: {
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
114
|
+
previewImg: {
|
|
115
|
+
type: string;
|
|
116
|
+
};
|
|
117
|
+
dataLens: {
|
|
118
|
+
oneOf: ({
|
|
119
|
+
type: string;
|
|
120
|
+
additionalProperties: boolean;
|
|
121
|
+
required: string[];
|
|
122
|
+
properties: {
|
|
123
|
+
id: {
|
|
124
|
+
type: string;
|
|
125
|
+
};
|
|
126
|
+
theme: {
|
|
127
|
+
type: string;
|
|
128
|
+
enum: string[];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
type: string;
|
|
133
|
+
})[];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
content: Partial<{
|
|
137
|
+
title: {
|
|
138
|
+
oneOf: ({
|
|
139
|
+
type: string;
|
|
140
|
+
additionalProperties: boolean;
|
|
141
|
+
required: string[];
|
|
142
|
+
properties: {
|
|
143
|
+
text: {
|
|
144
|
+
type: string;
|
|
145
|
+
contentType: string;
|
|
146
|
+
};
|
|
147
|
+
textSize: {
|
|
148
|
+
type: string;
|
|
149
|
+
enum: string[];
|
|
150
|
+
};
|
|
151
|
+
url: {
|
|
152
|
+
type: string;
|
|
153
|
+
};
|
|
154
|
+
resetMargin: {
|
|
155
|
+
type: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
} | {
|
|
159
|
+
type: string;
|
|
160
|
+
contentType: string;
|
|
161
|
+
})[];
|
|
162
|
+
};
|
|
163
|
+
text: {
|
|
164
|
+
type: string;
|
|
165
|
+
contentType: string;
|
|
166
|
+
};
|
|
167
|
+
additionalInfo: {
|
|
168
|
+
type: string;
|
|
169
|
+
contentType: string;
|
|
170
|
+
};
|
|
171
|
+
size: {
|
|
172
|
+
type: string;
|
|
173
|
+
enum: string[];
|
|
174
|
+
};
|
|
175
|
+
links: {
|
|
176
|
+
type: string;
|
|
177
|
+
items: {
|
|
178
|
+
type: string;
|
|
179
|
+
properties: {
|
|
180
|
+
when: {
|
|
181
|
+
type: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
buttons: {
|
|
187
|
+
type: string;
|
|
188
|
+
items: {
|
|
189
|
+
type: string;
|
|
190
|
+
properties: {
|
|
191
|
+
when: {
|
|
192
|
+
type: string;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
theme: {
|
|
198
|
+
type: string;
|
|
199
|
+
enum: string[];
|
|
200
|
+
};
|
|
201
|
+
}>;
|
|
202
|
+
metaInfo: {
|
|
203
|
+
type: string;
|
|
204
|
+
items: {
|
|
205
|
+
type: string;
|
|
206
|
+
contentType: string;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
border: {
|
|
210
|
+
type: string;
|
|
211
|
+
};
|
|
212
|
+
fullScreen: {
|
|
213
|
+
type: string;
|
|
214
|
+
};
|
|
215
|
+
type: {};
|
|
216
|
+
when: {};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { omit } from 'lodash';
|
|
2
|
+
import { BaseProps, MediaProps } from '../../schema/validators/common';
|
|
3
|
+
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
4
|
+
import metaInfo from '../../components/MetaInfo/schema';
|
|
5
|
+
export const LayoutItem = {
|
|
6
|
+
type: 'object',
|
|
7
|
+
additionalProperties: false,
|
|
8
|
+
required: ['content', 'media'],
|
|
9
|
+
properties: Object.assign(Object.assign({}, BaseProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
}, fullScreen: {
|
|
12
|
+
type: 'boolean',
|
|
13
|
+
} }),
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LayoutItemProps, LinkTheme, MediaProps } from '../../models';
|
|
2
|
+
export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['links']) => {
|
|
3
|
+
url: string;
|
|
4
|
+
text?: string | undefined;
|
|
5
|
+
textSize?: import("../../models").TextSize | undefined;
|
|
6
|
+
theme: LinkTheme;
|
|
7
|
+
colorTheme?: import("../../models").TextTheme | undefined;
|
|
8
|
+
arrow?: boolean | undefined;
|
|
9
|
+
target?: string | undefined;
|
|
10
|
+
metrikaGoals?: import("../../models").MetrikaGoal | undefined;
|
|
11
|
+
pixelEvents?: import("../../models").ButtonPixel | undefined;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
}[] | undefined;
|
|
14
|
+
export declare const hasFullScreen: ({ dataLens, image }: MediaProps) => boolean;
|
|
15
|
+
export declare const showFullScreenIcon: ({ youtube }: MediaProps) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getLayoutItemLinks = (links) => links === null || links === void 0 ? void 0 : links.map((link) => (Object.assign({ theme: 'normal' }, link)));
|
|
2
|
+
export const hasFullScreen = ({ dataLens, image }) => {
|
|
3
|
+
// datalens and slider media card don't support fullScreen mode
|
|
4
|
+
return !(dataLens || Array.isArray(image));
|
|
5
|
+
};
|
|
6
|
+
export const showFullScreenIcon = ({ youtube }) => !youtube;
|
|
@@ -7,6 +7,7 @@ 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
9
|
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
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';
|
|
12
13
|
export { default as Content } from './Content/Content';
|
|
@@ -7,6 +7,7 @@ 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
9
|
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
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';
|
|
12
13
|
export { default as Content } from './Content/Content';
|
|
@@ -138,6 +138,23 @@ const config = {
|
|
|
138
138
|
transformer: typografTransformer,
|
|
139
139
|
},
|
|
140
140
|
],
|
|
141
|
+
[SubBlockType.LayoutItem]: [
|
|
142
|
+
{
|
|
143
|
+
fields: ['content'],
|
|
144
|
+
parser: parseContentLayout,
|
|
145
|
+
transformer: yfmTransformer,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
fields: ['content'],
|
|
149
|
+
parser: parseContentLayoutTitle,
|
|
150
|
+
transformer: typografTransformer,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
fields: ['metaInfo'],
|
|
154
|
+
parser: createItemsParser([]),
|
|
155
|
+
transformer: typografTransformer,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
141
158
|
[SubBlockType.Quote]: {
|
|
142
159
|
fields: ['text'],
|
|
143
160
|
transformer: typografTransformer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"react-waypoint": "^10.1.0",
|
|
57
57
|
"sanitize-html": "^2.6.1",
|
|
58
58
|
"snakecase-keys": "^5.1.0",
|
|
59
|
-
"typograf": "^6.14.0"
|
|
59
|
+
"typograf": "^6.14.0",
|
|
60
|
+
"uuid": "^9.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"react": "^16.0.0 || ^17.0.0",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"@types/react-slick": "^0.23.7",
|
|
88
89
|
"@types/react-transition-group": "^4.4.4",
|
|
89
90
|
"@types/sanitize-html": "^2.6.0",
|
|
91
|
+
"@types/uuid": "^9.0.0",
|
|
90
92
|
"eslint": "^7.32.0",
|
|
91
93
|
"eslint-plugin-local": "./eslint-plugin-local",
|
|
92
94
|
"eslint-plugin-testing-library": "^5.9.1",
|
|
@@ -172,6 +172,7 @@ export interface MediaComponentVideoProps {
|
|
|
172
172
|
export interface MediaComponentYoutubeProps {
|
|
173
173
|
youtube: string;
|
|
174
174
|
previewImg?: string;
|
|
175
|
+
fullScreen?: boolean;
|
|
175
176
|
}
|
|
176
177
|
export interface MediaComponentImageProps {
|
|
177
178
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -243,27 +244,10 @@ export interface TitleBaseProps {
|
|
|
243
244
|
custom?: string | ReactNode;
|
|
244
245
|
onClick?: () => void;
|
|
245
246
|
}
|
|
246
|
-
export interface CardData {
|
|
247
|
-
header?: CardHeader;
|
|
248
|
-
text?: string;
|
|
249
|
-
title?: string;
|
|
250
|
-
link?: LinkProps;
|
|
251
|
-
footer?: string;
|
|
252
|
-
url?: string;
|
|
253
|
-
service?: {
|
|
254
|
-
slug: string;
|
|
255
|
-
name: string;
|
|
256
|
-
};
|
|
257
|
-
links?: LinkProps[];
|
|
258
|
-
}
|
|
259
247
|
export type CardBorder = 'shadow' | 'line' | 'none';
|
|
260
248
|
export interface CardBaseProps {
|
|
261
249
|
border?: CardBorder;
|
|
262
250
|
}
|
|
263
|
-
export interface CardHeader {
|
|
264
|
-
title?: string;
|
|
265
|
-
image?: ImageProps;
|
|
266
|
-
}
|
|
267
251
|
export interface PriceDescriptionProps {
|
|
268
252
|
title: string;
|
|
269
253
|
detailedTitle?: string;
|
|
@@ -19,7 +19,11 @@ export declare enum SubBlockType {
|
|
|
19
19
|
* @deprecated Will be moved to params use BasicCard instead
|
|
20
20
|
*/
|
|
21
21
|
TutorialCard = "tutoral-card",
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use LayoutItem
|
|
24
|
+
*/
|
|
22
25
|
CardWithImage = "card-with-image",
|
|
26
|
+
LayoutItem = "layout-item",
|
|
23
27
|
BackgroundCard = "background-card",
|
|
24
28
|
BasicCard = "basic-card",
|
|
25
29
|
Content = "content",
|
|
@@ -125,6 +129,13 @@ export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockPro
|
|
|
125
129
|
fullScreen?: boolean;
|
|
126
130
|
links?: CardWithImageLinkProps[];
|
|
127
131
|
}
|
|
132
|
+
export interface LayoutItemProps extends ClassNameProps {
|
|
133
|
+
content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
|
|
134
|
+
media: MediaProps;
|
|
135
|
+
metaInfo?: string[];
|
|
136
|
+
border?: boolean;
|
|
137
|
+
fullScreen?: boolean;
|
|
138
|
+
}
|
|
128
139
|
export type DividerModel = {
|
|
129
140
|
type: SubBlockType.Divider;
|
|
130
141
|
} & DividerProps;
|
|
@@ -137,6 +148,9 @@ export type NewsCardModel = {
|
|
|
137
148
|
export type CardWithImageModel = {
|
|
138
149
|
type: SubBlockType.CardWithImage;
|
|
139
150
|
} & CardWithImageProps;
|
|
151
|
+
export type LayoutItemModel = {
|
|
152
|
+
type: SubBlockType.CardWithImage;
|
|
153
|
+
} & LayoutItemProps;
|
|
140
154
|
export type TutorialCardModel = {
|
|
141
155
|
type: SubBlockType.TutorialCard;
|
|
142
156
|
} & TutorialCardProps;
|
|
@@ -17,7 +17,11 @@ var SubBlockType;
|
|
|
17
17
|
* @deprecated Will be moved to params use BasicCard instead
|
|
18
18
|
*/
|
|
19
19
|
SubBlockType["TutorialCard"] = "tutoral-card";
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use LayoutItem
|
|
22
|
+
*/
|
|
20
23
|
SubBlockType["CardWithImage"] = "card-with-image";
|
|
24
|
+
SubBlockType["LayoutItem"] = "layout-item";
|
|
21
25
|
SubBlockType["BackgroundCard"] = "background-card";
|
|
22
26
|
SubBlockType["BasicCard"] = "basic-card";
|
|
23
27
|
SubBlockType["Content"] = "content";
|
|
@@ -157,6 +157,23 @@ const config = {
|
|
|
157
157
|
transformer: typografTransformer,
|
|
158
158
|
},
|
|
159
159
|
],
|
|
160
|
+
[models_1.SubBlockType.LayoutItem]: [
|
|
161
|
+
{
|
|
162
|
+
fields: ['content'],
|
|
163
|
+
parser: parseContentLayout,
|
|
164
|
+
transformer: yfmTransformer,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
fields: ['content'],
|
|
168
|
+
parser: parseContentLayoutTitle,
|
|
169
|
+
transformer: typografTransformer,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
fields: ['metaInfo'],
|
|
173
|
+
parser: (0, exports.createItemsParser)([]),
|
|
174
|
+
transformer: typografTransformer,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
160
177
|
[models_1.SubBlockType.Quote]: {
|
|
161
178
|
fields: ['text'],
|
|
162
179
|
transformer: typografTransformer,
|
package/styles/root.scss
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
--pc-monochrome-button-background-color-hover: #393939;
|
|
18
18
|
--pc-monochrome-button-color: var(--yc-color-text-light-primary);
|
|
19
19
|
--pc-text-header-color: var(--yc-color-text-primary);
|
|
20
|
+
--pc-media-card-meta-info-color: var(--yc-color-text-secondary);
|
|
20
21
|
|
|
21
22
|
&.yc-root_theme_dark {
|
|
22
23
|
--pc-color-sfx-shadow: var(--yc-color-sfx-shadow);
|