@gravity-ui/page-constructor 3.0.0-alpha.2 → 3.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +1 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +1 -1
- package/build/cjs/blocks/Icons/Icons.js +1 -1
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +1 -1
- package/build/cjs/blocks/Slider/Slider.js +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +1 -1
- package/build/cjs/components/MediaBase/MediaBase.js +1 -1
- package/build/cjs/components/Title/Title.d.ts +1 -1
- package/build/cjs/components/Title/Title.js +4 -4
- package/build/cjs/components/Title/TitleItem.d.ts +2 -2
- package/build/cjs/components/Title/TitleItem.js +2 -2
- package/build/cjs/components/index.d.ts +0 -1
- package/build/cjs/components/index.js +3 -5
- package/build/cjs/constructor-items.d.ts +0 -1
- package/build/cjs/constructor-items.js +0 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.css +0 -12
- package/build/cjs/containers/PageConstructor/PageConstructor.js +3 -8
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -2
- package/build/cjs/models/constructor-items/common.d.ts +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -14
- package/build/cjs/models/constructor-items/sub-blocks.js +0 -1
- package/build/cjs/models/constructor.d.ts +0 -1
- package/build/cjs/schema/index.d.ts +0 -6
- package/build/cjs/schema/index.js +2 -8
- package/build/cjs/schema/validators/sub-blocks.d.ts +0 -1
- package/build/cjs/schema/validators/sub-blocks.js +0 -1
- package/build/cjs/sub-blocks/Content/Content.css +2 -2
- package/build/cjs/sub-blocks/Content/Content.js +3 -3
- package/build/cjs/sub-blocks/index.d.ts +0 -1
- package/build/cjs/sub-blocks/index.js +1 -3
- package/build/cjs/text-transform/transformers.d.ts +0 -2
- package/build/cjs/text-transform/transformers.js +1 -4
- package/build/esm/blocks/CardLayout/CardLayout.js +2 -2
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +1 -1
- package/build/esm/blocks/FilterBlock/FilterBlock.js +2 -2
- package/build/esm/blocks/Icons/Icons.js +2 -2
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +1 -1
- package/build/esm/blocks/Slider/Slider.js +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +1 -1
- package/build/esm/components/MediaBase/MediaBase.js +1 -1
- package/build/esm/components/Title/Title.d.ts +1 -1
- package/build/esm/components/Title/Title.js +4 -4
- package/build/esm/components/Title/TitleItem.d.ts +2 -2
- package/build/esm/components/Title/TitleItem.js +2 -2
- package/build/esm/components/index.d.ts +0 -1
- package/build/esm/components/index.js +0 -1
- package/build/esm/constructor-items.d.ts +0 -1
- package/build/esm/constructor-items.js +1 -2
- package/build/esm/containers/PageConstructor/PageConstructor.css +0 -12
- package/build/esm/containers/PageConstructor/PageConstructor.js +3 -8
- package/build/esm/models/constructor-items/blocks.d.ts +4 -2
- package/build/esm/models/constructor-items/common.d.ts +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -14
- package/build/esm/models/constructor-items/sub-blocks.js +0 -1
- package/build/esm/models/constructor.d.ts +0 -1
- package/build/esm/schema/index.d.ts +0 -6
- package/build/esm/schema/index.js +3 -9
- package/build/esm/schema/validators/sub-blocks.d.ts +0 -1
- package/build/esm/schema/validators/sub-blocks.js +0 -1
- package/build/esm/sub-blocks/Content/Content.css +2 -2
- package/build/esm/sub-blocks/Content/Content.js +3 -3
- package/build/esm/sub-blocks/index.d.ts +0 -1
- package/build/esm/sub-blocks/index.js +0 -1
- package/build/esm/text-transform/transformers.d.ts +0 -2
- package/build/esm/text-transform/transformers.js +1 -4
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +4 -2
- package/server/models/constructor-items/common.d.ts +1 -1
- package/server/models/constructor-items/sub-blocks.d.ts +1 -14
- package/server/models/constructor-items/sub-blocks.js +0 -1
- package/server/models/constructor.d.ts +0 -1
- package/server/text-transform/transformers.d.ts +0 -2
- package/server/text-transform/transformers.js +1 -4
- package/styles/styles.css +0 -12
- package/styles/yfm.scss +0 -14
- package/build/cjs/containers/PageConstructor/components/ConstructorFootnotes/ConstructorFootnotes.css +0 -12
- package/build/cjs/containers/PageConstructor/components/ConstructorFootnotes/ConstructorFootnotes.d.ts +0 -8
- package/build/cjs/containers/PageConstructor/components/ConstructorFootnotes/ConstructorFootnotes.js +0 -19
- package/build/cjs/containers/PageConstructor/components/ConstructorFootnotes/index.d.ts +0 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorFootnotes/index.js +0 -4
- package/build/cjs/sub-blocks/NewsCard/NewsCard.css +0 -18
- package/build/cjs/sub-blocks/NewsCard/NewsCard.d.ts +0 -3
- package/build/cjs/sub-blocks/NewsCard/NewsCard.js +0 -16
- package/build/cjs/sub-blocks/NewsCard/schema.d.ts +0 -23
- package/build/cjs/sub-blocks/NewsCard/schema.js +0 -20
- package/build/esm/containers/PageConstructor/components/ConstructorFootnotes/ConstructorFootnotes.css +0 -12
- package/build/esm/containers/PageConstructor/components/ConstructorFootnotes/ConstructorFootnotes.d.ts +0 -9
- package/build/esm/containers/PageConstructor/components/ConstructorFootnotes/ConstructorFootnotes.js +0 -15
- package/build/esm/containers/PageConstructor/components/ConstructorFootnotes/index.d.ts +0 -1
- package/build/esm/containers/PageConstructor/components/ConstructorFootnotes/index.js +0 -1
- package/build/esm/sub-blocks/NewsCard/NewsCard.css +0 -18
- package/build/esm/sub-blocks/NewsCard/NewsCard.d.ts +0 -4
- package/build/esm/sub-blocks/NewsCard/NewsCard.js +0 -14
- package/build/esm/sub-blocks/NewsCard/schema.d.ts +0 -23
- package/build/esm/sub-blocks/NewsCard/schema.js +0 -17
|
@@ -22,7 +22,7 @@ export const MediaBase = (props) => {
|
|
|
22
22
|
const mediaContent = !mediaOnly && React.createElement(MediaContent, Object.assign({}, mediaContentProps));
|
|
23
23
|
const card = children.type === Card ? children === null || children === void 0 ? void 0 : children.props.children : null;
|
|
24
24
|
return (React.createElement(AnimateBlock, { className: b(), onScroll: onScroll, animate: animated },
|
|
25
|
-
mediaOnly && React.createElement(Title, { className: b('header'), title: title,
|
|
25
|
+
mediaOnly && (React.createElement(Title, { className: b('header'), title: title, subtitle: description, colSizes: { all: 12 } })),
|
|
26
26
|
React.createElement(Grid, null,
|
|
27
27
|
React.createElement(Row, { className: b('row', {
|
|
28
28
|
reverse: direction === 'media-content',
|
|
@@ -4,5 +4,5 @@ import './Title.css';
|
|
|
4
4
|
export interface TitleProps extends TitleParams {
|
|
5
5
|
colSizes?: GridColumnSizesType;
|
|
6
6
|
}
|
|
7
|
-
declare const Title: ({ title,
|
|
7
|
+
declare const Title: ({ title, subtitle, className, colSizes, }: TitleProps & ClassNameProps) => JSX.Element | null;
|
|
8
8
|
export default Title;
|
|
@@ -6,16 +6,16 @@ import YFMWrapper from '../YFMWrapper/YFMWrapper';
|
|
|
6
6
|
import TitleItem from './TitleItem';
|
|
7
7
|
import './Title.css';
|
|
8
8
|
const b = block('title');
|
|
9
|
-
const Title = ({ title,
|
|
10
|
-
if (!title && !
|
|
9
|
+
const Title = ({ title, subtitle, className, colSizes = { all: 12, sm: 8 }, }) => {
|
|
10
|
+
if (!title && !subtitle) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
const _a = !title || typeof title === 'string' ? { text: title } : title, { text } = _a, titleProps = __rest(_a, ["text"]);
|
|
14
14
|
return (React.createElement("div", { className: b(null, className) },
|
|
15
15
|
text && (React.createElement(Col, { reset: true, sizes: colSizes },
|
|
16
16
|
React.createElement(TitleItem, Object.assign({ text: text }, titleProps)))),
|
|
17
|
-
|
|
17
|
+
subtitle && (React.createElement(Col, { reset: true, sizes: colSizes },
|
|
18
18
|
React.createElement("div", { className: b('description', { titleSize: titleProps === null || titleProps === void 0 ? void 0 : titleProps.textSize }) },
|
|
19
|
-
React.createElement(YFMWrapper, { content:
|
|
19
|
+
React.createElement(YFMWrapper, { content: subtitle, modifiers: { constructor: true } }))))));
|
|
20
20
|
};
|
|
21
21
|
export default Title;
|
|
@@ -7,5 +7,5 @@ export interface TitleItemFullProps extends TitleItemProps {
|
|
|
7
7
|
dataQa?: string;
|
|
8
8
|
resetMargin?: boolean;
|
|
9
9
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
10
|
+
declare const TitleItem: (props: TitleItemFullProps) => JSX.Element;
|
|
11
|
+
export default TitleItem;
|
|
@@ -20,7 +20,7 @@ export function getArrowSize(size, isMobile) {
|
|
|
20
20
|
return 20;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const TitleItem = (props) => {
|
|
24
24
|
const isMobile = useContext(MobileContext);
|
|
25
25
|
const { textSize = 'm', text, anchor, justify, url, onClick, custom, className, dataQa, resetMargin = true, } = props;
|
|
26
26
|
const { hostname } = useContext(LocationContext);
|
|
@@ -50,4 +50,4 @@ const Title = (props) => {
|
|
|
50
50
|
'data-qa': `${dataQa}-header`,
|
|
51
51
|
}, content)));
|
|
52
52
|
};
|
|
53
|
-
export default
|
|
53
|
+
export default TitleItem;
|
|
@@ -5,7 +5,6 @@ export { default as BackgroundMedia } from './BackgroundMedia/BackgroundMedia';
|
|
|
5
5
|
export { default as BackLink } from './BackLink/BackLink';
|
|
6
6
|
export { default as BalancedMasonry } from './BalancedMasonry/BalancedMasonry';
|
|
7
7
|
export { default as BlockBase } from './BlockBase/BlockBase';
|
|
8
|
-
export { default as BlockHeader } from './Title/Title';
|
|
9
8
|
export { default as Button } from './Button/Button';
|
|
10
9
|
export { default as CardBase } from './CardBase/CardBase';
|
|
11
10
|
export { default as ErrorWrapper } from './ErrorWrapper/ErrorWrapper';
|
|
@@ -5,7 +5,6 @@ export { default as BackgroundMedia } from './BackgroundMedia/BackgroundMedia';
|
|
|
5
5
|
export { default as BackLink } from './BackLink/BackLink';
|
|
6
6
|
export { default as BalancedMasonry } from './BalancedMasonry/BalancedMasonry';
|
|
7
7
|
export { default as BlockBase } from './BlockBase/BlockBase';
|
|
8
|
-
export { default as BlockHeader } from './Title/Title';
|
|
9
8
|
export { default as Button } from './Button/Button';
|
|
10
9
|
export { default as CardBase } from './CardBase/CardBase';
|
|
11
10
|
export { default as ErrorWrapper } from './ErrorWrapper/ErrorWrapper';
|
|
@@ -23,7 +23,6 @@ export declare const subBlockMap: {
|
|
|
23
23
|
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
24
24
|
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
25
25
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
26
|
-
"news-card": (props: import("./models").NewsCardProps) => JSX.Element;
|
|
27
26
|
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
28
27
|
"background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
|
|
29
28
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './blocks';
|
|
2
2
|
import { BlockType, SubBlockType } from './models';
|
|
3
|
-
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, LayoutItem, MediaCard,
|
|
3
|
+
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, LayoutItem, MediaCard, PriceDetailed, Quote, } from './sub-blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
6
6
|
[BlockType.ExtendedFeaturesBlock]: ExtendedFeaturesBlock,
|
|
@@ -26,7 +26,6 @@ export const subBlockMap = {
|
|
|
26
26
|
[SubBlockType.PriceDetailed]: PriceDetailed,
|
|
27
27
|
[SubBlockType.MediaCard]: MediaCard,
|
|
28
28
|
[SubBlockType.BannerCard]: BannerCard,
|
|
29
|
-
[SubBlockType.NewsCard]: NewsCard,
|
|
30
29
|
[SubBlockType.LayoutItem]: LayoutItem,
|
|
31
30
|
[SubBlockType.BackgroundCard]: BackgroundCard,
|
|
32
31
|
[SubBlockType.BasicCard]: BasicCard,
|
|
@@ -83,18 +83,6 @@ unpredictable css rules order in build */
|
|
|
83
83
|
.yfm_constructor_theme_dark p {
|
|
84
84
|
color: var(--yc-color-text-light-primary);
|
|
85
85
|
}
|
|
86
|
-
.yfm_constructor_footnote_text p, .yfm_constructor_footnote_page p {
|
|
87
|
-
opacity: 0.5;
|
|
88
|
-
}
|
|
89
|
-
.yfm_constructor_footnote_text p {
|
|
90
|
-
font-size: var(--yc-text-body-2-font-size);
|
|
91
|
-
line-height: var(--yc-text-body-2-line-height);
|
|
92
|
-
}
|
|
93
|
-
.yfm_constructor_footnote_page p {
|
|
94
|
-
font-size: var(--yc-text-body-1-font-size);
|
|
95
|
-
line-height: var(--yc-text-body-1-line-height);
|
|
96
|
-
display: inline;
|
|
97
|
-
}
|
|
98
86
|
.yfm_constructor_list_style ul {
|
|
99
87
|
padding-left: 20px;
|
|
100
88
|
}
|
|
@@ -11,13 +11,12 @@ import { BlockType, BlockTypes, HeaderBlockTypes, SubBlockTypes, } from '../../m
|
|
|
11
11
|
import Layout from '../../navigation/containers/Layout/Layout';
|
|
12
12
|
import { block as cnBlock, getCustomBlockTypes, getCustomHeaderTypes, getCustomItems, getCustomSubBlockTypes, getThemedValue, } from '../../utils';
|
|
13
13
|
import { ConstructorBlocks } from './components/ConstructorBlocks';
|
|
14
|
-
import { ConstructorFootnotes } from './components/ConstructorFootnotes';
|
|
15
14
|
import { ConstructorHeader } from './components/ConstructorItem';
|
|
16
15
|
import { ConstructorRow } from './components/ConstructorRow';
|
|
17
16
|
import './PageConstructor.css';
|
|
18
17
|
const b = cnBlock('page-constructor');
|
|
19
18
|
export const Constructor = (props) => {
|
|
20
|
-
const { content: { blocks = [], background = {}
|
|
19
|
+
const { content: { blocks = [], background = {} } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
|
|
21
20
|
const { context } = useMemo(() => ({
|
|
22
21
|
context: {
|
|
23
22
|
blockTypes: [...BlockTypes, ...getCustomBlockTypes(custom)],
|
|
@@ -29,7 +28,6 @@ export const Constructor = (props) => {
|
|
|
29
28
|
},
|
|
30
29
|
}), [custom, shouldRenderBlock]);
|
|
31
30
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
32
|
-
const hasFootnotes = footnotes.length > 0;
|
|
33
31
|
const isHeaderBlock = (block) => context.headerBlockTypes.includes(block.type);
|
|
34
32
|
const header = blocks === null || blocks === void 0 ? void 0 : blocks.find(isHeaderBlock);
|
|
35
33
|
const restBlocks = blocks === null || blocks === void 0 ? void 0 : blocks.filter((block) => !isHeaderBlock(block));
|
|
@@ -41,11 +39,8 @@ export const Constructor = (props) => {
|
|
|
41
39
|
React.createElement(Layout, { navigation: navigation },
|
|
42
40
|
renderMenu && renderMenu(),
|
|
43
41
|
header && (React.createElement(ConstructorHeader, { data: header, blockKey: BlockType.HeaderBlock })),
|
|
44
|
-
React.createElement(Grid, null,
|
|
45
|
-
|
|
46
|
-
React.createElement(ConstructorBlocks, { items: restBlocks }))),
|
|
47
|
-
hasFootnotes && (React.createElement(ConstructorRow, null,
|
|
48
|
-
React.createElement(ConstructorFootnotes, { items: footnotes })))))))));
|
|
42
|
+
React.createElement(Grid, null, restBlocks && (React.createElement(ConstructorRow, null,
|
|
43
|
+
React.createElement(ConstructorBlocks, { items: restBlocks })))))))));
|
|
49
44
|
};
|
|
50
45
|
export const PageConstructor = (props) => {
|
|
51
46
|
const { content: { animated = true } = {} } = props, rest = __rest(props, ["content"]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
3
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
4
4
|
import { ThemeSupporting } from '../../utils';
|
|
5
|
-
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps
|
|
5
|
+
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps } from './common';
|
|
6
6
|
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
7
7
|
export declare enum BlockType {
|
|
8
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
@@ -207,7 +207,9 @@ export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSize
|
|
|
207
207
|
caption?: string;
|
|
208
208
|
media?: ThemedMediaProps;
|
|
209
209
|
}
|
|
210
|
-
export interface TabsBlockProps extends
|
|
210
|
+
export interface TabsBlockProps extends Animatable {
|
|
211
|
+
title?: TitleItemProps | string;
|
|
212
|
+
description?: string;
|
|
211
213
|
tabsColSizes?: GridColumnSizesType;
|
|
212
214
|
centered?: boolean;
|
|
213
215
|
direction?: MediaDirection;
|
|
@@ -7,7 +7,6 @@ import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, Divi
|
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
10
|
-
NewsCard = "news-card",
|
|
11
10
|
/**
|
|
12
11
|
* @deprecated Will be removed
|
|
13
12
|
*/
|
|
@@ -68,15 +67,6 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
68
67
|
buttonText?: string;
|
|
69
68
|
theme?: TextTheme;
|
|
70
69
|
}
|
|
71
|
-
export interface NewsCardData {
|
|
72
|
-
id: number;
|
|
73
|
-
slug: string;
|
|
74
|
-
title: string;
|
|
75
|
-
date: string;
|
|
76
|
-
url: string;
|
|
77
|
-
isoDate?: string;
|
|
78
|
-
}
|
|
79
|
-
export type NewsCardProps = Pick<NewsCardData, 'title' | 'url' | 'date' | 'isoDate'> & CardBaseProps;
|
|
80
70
|
export interface BackgroundCardProps extends CardBaseProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
81
71
|
url?: string;
|
|
82
72
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
@@ -112,9 +102,6 @@ export type DividerModel = {
|
|
|
112
102
|
export type QuoteModel = {
|
|
113
103
|
type: SubBlockType.Quote;
|
|
114
104
|
} & QuoteProps;
|
|
115
|
-
export type NewsCardModel = {
|
|
116
|
-
type: SubBlockType.NewsCard;
|
|
117
|
-
} & NewsCardProps;
|
|
118
105
|
export type LayoutItemModel = {
|
|
119
106
|
type: SubBlockType.LayoutItem;
|
|
120
107
|
} & LayoutItemProps;
|
|
@@ -136,5 +123,5 @@ export type BannerCardModel = {
|
|
|
136
123
|
export type BasicCardModel = {
|
|
137
124
|
type: SubBlockType.BasicCard;
|
|
138
125
|
} & BasicCardProps;
|
|
139
|
-
export type SubBlockModels = DividerModel | QuoteModel |
|
|
126
|
+
export type SubBlockModels = DividerModel | QuoteModel | PriceDetailedModel | MediaCardModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel | LayoutItemModel;
|
|
140
127
|
export type SubBlock = SubBlockModels;
|
|
@@ -2,7 +2,7 @@ export { validators } from './validators';
|
|
|
2
2
|
import { BannerBlock, BannerCard, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './validators/blocks';
|
|
3
3
|
import { AnimatableProps, BackgroundProps, MenuProps, withTheme } from './validators/common';
|
|
4
4
|
import { LogoProps, NavigationHeaderProps } from './validators/navigation';
|
|
5
|
-
import { BackgroundCard, BasicCard, Divider, MediaCardBlock,
|
|
5
|
+
import { BackgroundCard, BasicCard, Divider, MediaCardBlock, PriceDetailedBlock, Quote, } from './validators/sub-blocks';
|
|
6
6
|
import { filteredItem } from './validators/utils';
|
|
7
7
|
export const getBlocksCases = (blocks) => {
|
|
8
8
|
return Object.values(blocks).reduce((acc, block) => (Object.assign(Object.assign({}, acc), block)));
|
|
@@ -10,7 +10,7 @@ export const getBlocksCases = (blocks) => {
|
|
|
10
10
|
export function generateDefaultSchema(config) {
|
|
11
11
|
const { cards = {}, blocks = {}, extensions = {} } = config !== null && config !== void 0 ? config : {};
|
|
12
12
|
const blockValidators = 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({}, Divider), ExtendedFeaturesBlock), PromoFeaturesBlock), SliderBlock), QuestionsBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), MapBlock), InfoBlock), TableBlock), TabsBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), ShareBlock), FilterBlock);
|
|
13
|
-
const cardValidators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
13
|
+
const cardValidators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, MediaCardBlock), BannerCard), PriceDetailedBlock), BackgroundCard), Quote), BasicCard);
|
|
14
14
|
const constructorBlockSchemaNames = [
|
|
15
15
|
'divider',
|
|
16
16
|
'quote',
|
|
@@ -43,7 +43,6 @@ export function generateDefaultSchema(config) {
|
|
|
43
43
|
'banner-card',
|
|
44
44
|
'price-detailed',
|
|
45
45
|
'background-card',
|
|
46
|
-
'news-card',
|
|
47
46
|
'quote',
|
|
48
47
|
'basic-card',
|
|
49
48
|
'layout-item',
|
|
@@ -86,11 +85,6 @@ export function generateDefaultSchema(config) {
|
|
|
86
85
|
items: {
|
|
87
86
|
$ref: '#/definitions/children',
|
|
88
87
|
},
|
|
89
|
-
}, menu: MenuProps, background: withTheme(BackgroundProps),
|
|
90
|
-
type: 'array',
|
|
91
|
-
items: {
|
|
92
|
-
type: 'string',
|
|
93
|
-
},
|
|
94
|
-
} }), extensions),
|
|
88
|
+
}, menu: MenuProps, background: withTheme(BackgroundProps) }), extensions),
|
|
95
89
|
};
|
|
96
90
|
}
|
|
@@ -2,7 +2,6 @@ export * from '../../sub-blocks/PriceDetailed/schema';
|
|
|
2
2
|
export * from '../../sub-blocks/BackgroundCard/schema';
|
|
3
3
|
export * from '../../sub-blocks/Content/schema';
|
|
4
4
|
export * from '../../sub-blocks/MediaCard/schema';
|
|
5
|
-
export * from '../../sub-blocks/NewsCard/schema';
|
|
6
5
|
export * from '../../sub-blocks/LayoutItem/schema';
|
|
7
6
|
export * from '../../sub-blocks/Quote/schema';
|
|
8
7
|
export * from '../../sub-blocks/Divider/schema';
|
|
@@ -2,7 +2,6 @@ export * from '../../sub-blocks/PriceDetailed/schema';
|
|
|
2
2
|
export * from '../../sub-blocks/BackgroundCard/schema';
|
|
3
3
|
export * from '../../sub-blocks/Content/schema';
|
|
4
4
|
export * from '../../sub-blocks/MediaCard/schema';
|
|
5
|
-
export * from '../../sub-blocks/NewsCard/schema';
|
|
6
5
|
export * from '../../sub-blocks/LayoutItem/schema';
|
|
7
6
|
export * from '../../sub-blocks/Quote/schema';
|
|
8
7
|
export * from '../../sub-blocks/Divider/schema';
|
|
@@ -91,7 +91,7 @@ unpredictable css rules order in build */
|
|
|
91
91
|
.pc-content_size_l .pc-content__button {
|
|
92
92
|
margin-top: 12px;
|
|
93
93
|
}
|
|
94
|
-
.pc-content_theme_dark .pc-content__title
|
|
94
|
+
.pc-content_theme_dark .pc-content__title *,
|
|
95
95
|
.pc-content_theme_dark .pc-content__text .yfm,
|
|
96
96
|
.pc-content_theme_dark .pc-content__text .yfm *,
|
|
97
97
|
.pc-content_theme_dark .pc-content__link a {
|
|
@@ -123,7 +123,7 @@ unpredictable css rules order in build */
|
|
|
123
123
|
.pc-content_theme_dark .pc-content__title a:hover {
|
|
124
124
|
color: var(--yc-color-text-light-secondary);
|
|
125
125
|
}
|
|
126
|
-
.pc-content_theme_light .pc-content__title
|
|
126
|
+
.pc-content_theme_light .pc-content__title *,
|
|
127
127
|
.pc-content_theme_light .pc-content__text .yfm,
|
|
128
128
|
.pc-content_theme_light .pc-content__text .yfm *,
|
|
129
129
|
.pc-content_theme_light .pc-content__link a {
|
|
@@ -36,11 +36,11 @@ function getButtonSize(size) {
|
|
|
36
36
|
const Content = (props) => {
|
|
37
37
|
const { title, text, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, } = props;
|
|
38
38
|
const titleProps = __rest(!title || typeof title === 'string'
|
|
39
|
-
? { text: title, textSize: getTextSize(size)
|
|
40
|
-
: Object.assign(
|
|
39
|
+
? { text: title, textSize: getTextSize(size) }
|
|
40
|
+
: Object.assign({}, title), []);
|
|
41
41
|
const hasTitle = Boolean(title);
|
|
42
42
|
return (React.createElement(Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes },
|
|
43
|
-
title && React.createElement(Title, { title: titleProps }),
|
|
43
|
+
title && React.createElement(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 } }),
|
|
44
44
|
text && (React.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
|
|
45
45
|
React.createElement(YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true } }))),
|
|
46
46
|
additionalInfo && (React.createElement("div", { className: b('notice') },
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as Divider } from './Divider/Divider';
|
|
2
2
|
export { default as Quote } from './Quote/Quote';
|
|
3
|
-
export { default as NewsCard } from './NewsCard/NewsCard';
|
|
4
3
|
export { default as PriceDetailed } from './PriceDetailed/PriceDetailed';
|
|
5
4
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
6
5
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as Divider } from './Divider/Divider';
|
|
2
2
|
export { default as Quote } from './Quote/Quote';
|
|
3
|
-
export { default as NewsCard } from './NewsCard/NewsCard';
|
|
4
3
|
export { default as PriceDetailed } from './PriceDetailed/PriceDetailed';
|
|
5
4
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
6
5
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
@@ -3,7 +3,6 @@ import { Lang } from '../utils/configure';
|
|
|
3
3
|
export type ContentTransformerProps = {
|
|
4
4
|
content: {
|
|
5
5
|
blocks?: ConstructorBlock[];
|
|
6
|
-
footnotes?: string[];
|
|
7
6
|
};
|
|
8
7
|
options: {
|
|
9
8
|
lang: Lang;
|
|
@@ -12,5 +11,4 @@ export type ContentTransformerProps = {
|
|
|
12
11
|
};
|
|
13
12
|
export declare const contentTransformer: ({ content, options }: ContentTransformerProps) => {
|
|
14
13
|
blocks: ConstructorBlock[];
|
|
15
|
-
footnotes: string[];
|
|
16
14
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { config } from './config';
|
|
3
|
-
import { fullTransform } from './utils';
|
|
4
3
|
function transformBlocks(blocks, lang, customConfig = {}) {
|
|
5
4
|
const fullConfig = Object.assign(Object.assign({}, config), customConfig);
|
|
6
5
|
const clonedBlocks = _.cloneDeep(blocks);
|
|
@@ -46,11 +45,9 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
46
45
|
}
|
|
47
46
|
export const contentTransformer = ({ content, options }) => {
|
|
48
47
|
const { lang, customConfig = {} } = options;
|
|
49
|
-
const { blocks = []
|
|
48
|
+
const { blocks = [] } = content;
|
|
50
49
|
const transformedBlocks = transformBlocks(blocks, lang, customConfig);
|
|
51
|
-
const transformedFootnotes = (footnotes === null || footnotes === void 0 ? void 0 : footnotes.map((footnote) => fullTransform(footnote, { path: __dirname, lang, allowHTML: true }).html).filter(Boolean)) || [];
|
|
52
50
|
return {
|
|
53
51
|
blocks: transformedBlocks,
|
|
54
|
-
footnotes: transformedFootnotes,
|
|
55
52
|
};
|
|
56
53
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
3
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
4
4
|
import { ThemeSupporting } from '../../utils';
|
|
5
|
-
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps
|
|
5
|
+
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps } from './common';
|
|
6
6
|
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
7
7
|
export declare enum BlockType {
|
|
8
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
@@ -207,7 +207,9 @@ export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSize
|
|
|
207
207
|
caption?: string;
|
|
208
208
|
media?: ThemedMediaProps;
|
|
209
209
|
}
|
|
210
|
-
export interface TabsBlockProps extends
|
|
210
|
+
export interface TabsBlockProps extends Animatable {
|
|
211
|
+
title?: TitleItemProps | string;
|
|
212
|
+
description?: string;
|
|
211
213
|
tabsColSizes?: GridColumnSizesType;
|
|
212
214
|
centered?: boolean;
|
|
213
215
|
direction?: MediaDirection;
|
|
@@ -7,7 +7,6 @@ import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, Divi
|
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
10
|
-
NewsCard = "news-card",
|
|
11
10
|
/**
|
|
12
11
|
* @deprecated Will be removed
|
|
13
12
|
*/
|
|
@@ -68,15 +67,6 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
68
67
|
buttonText?: string;
|
|
69
68
|
theme?: TextTheme;
|
|
70
69
|
}
|
|
71
|
-
export interface NewsCardData {
|
|
72
|
-
id: number;
|
|
73
|
-
slug: string;
|
|
74
|
-
title: string;
|
|
75
|
-
date: string;
|
|
76
|
-
url: string;
|
|
77
|
-
isoDate?: string;
|
|
78
|
-
}
|
|
79
|
-
export type NewsCardProps = Pick<NewsCardData, 'title' | 'url' | 'date' | 'isoDate'> & CardBaseProps;
|
|
80
70
|
export interface BackgroundCardProps extends CardBaseProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
81
71
|
url?: string;
|
|
82
72
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
@@ -112,9 +102,6 @@ export type DividerModel = {
|
|
|
112
102
|
export type QuoteModel = {
|
|
113
103
|
type: SubBlockType.Quote;
|
|
114
104
|
} & QuoteProps;
|
|
115
|
-
export type NewsCardModel = {
|
|
116
|
-
type: SubBlockType.NewsCard;
|
|
117
|
-
} & NewsCardProps;
|
|
118
105
|
export type LayoutItemModel = {
|
|
119
106
|
type: SubBlockType.LayoutItem;
|
|
120
107
|
} & LayoutItemProps;
|
|
@@ -136,5 +123,5 @@ export type BannerCardModel = {
|
|
|
136
123
|
export type BasicCardModel = {
|
|
137
124
|
type: SubBlockType.BasicCard;
|
|
138
125
|
} & BasicCardProps;
|
|
139
|
-
export type SubBlockModels = DividerModel | QuoteModel |
|
|
126
|
+
export type SubBlockModels = DividerModel | QuoteModel | PriceDetailedModel | MediaCardModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel | LayoutItemModel;
|
|
140
127
|
export type SubBlock = SubBlockModels;
|
|
@@ -3,7 +3,6 @@ import { Lang } from '../utils/configure';
|
|
|
3
3
|
export type ContentTransformerProps = {
|
|
4
4
|
content: {
|
|
5
5
|
blocks?: ConstructorBlock[];
|
|
6
|
-
footnotes?: string[];
|
|
7
6
|
};
|
|
8
7
|
options: {
|
|
9
8
|
lang: Lang;
|
|
@@ -12,5 +11,4 @@ export type ContentTransformerProps = {
|
|
|
12
11
|
};
|
|
13
12
|
export declare const contentTransformer: ({ content, options }: ContentTransformerProps) => {
|
|
14
13
|
blocks: ConstructorBlock[];
|
|
15
|
-
footnotes: string[];
|
|
16
14
|
};
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.contentTransformer = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const config_1 = require("./config");
|
|
9
|
-
const utils_1 = require("./utils");
|
|
10
9
|
function transformBlocks(blocks, lang, customConfig = {}) {
|
|
11
10
|
const fullConfig = Object.assign(Object.assign({}, config_1.config), customConfig);
|
|
12
11
|
const clonedBlocks = lodash_1.default.cloneDeep(blocks);
|
|
@@ -52,12 +51,10 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
52
51
|
}
|
|
53
52
|
const contentTransformer = ({ content, options }) => {
|
|
54
53
|
const { lang, customConfig = {} } = options;
|
|
55
|
-
const { blocks = []
|
|
54
|
+
const { blocks = [] } = content;
|
|
56
55
|
const transformedBlocks = transformBlocks(blocks, lang, customConfig);
|
|
57
|
-
const transformedFootnotes = (footnotes === null || footnotes === void 0 ? void 0 : footnotes.map((footnote) => (0, utils_1.fullTransform)(footnote, { path: __dirname, lang, allowHTML: true }).html).filter(Boolean)) || [];
|
|
58
56
|
return {
|
|
59
57
|
blocks: transformedBlocks,
|
|
60
|
-
footnotes: transformedFootnotes,
|
|
61
58
|
};
|
|
62
59
|
};
|
|
63
60
|
exports.contentTransformer = contentTransformer;
|
package/styles/styles.css
CHANGED
|
@@ -245,18 +245,6 @@ unpredictable css rules order in build */
|
|
|
245
245
|
.yfm_constructor_theme_dark p {
|
|
246
246
|
color: var(--yc-color-text-light-primary);
|
|
247
247
|
}
|
|
248
|
-
.yfm_constructor_footnote_text p, .yfm_constructor_footnote_page p {
|
|
249
|
-
opacity: 0.5;
|
|
250
|
-
}
|
|
251
|
-
.yfm_constructor_footnote_text p {
|
|
252
|
-
font-size: var(--yc-text-body-2-font-size);
|
|
253
|
-
line-height: var(--yc-text-body-2-line-height);
|
|
254
|
-
}
|
|
255
|
-
.yfm_constructor_footnote_page p {
|
|
256
|
-
font-size: var(--yc-text-body-1-font-size);
|
|
257
|
-
line-height: var(--yc-text-body-1-line-height);
|
|
258
|
-
display: inline;
|
|
259
|
-
}
|
|
260
248
|
.yfm_constructor_list_style ul {
|
|
261
249
|
padding-left: 20px;
|
|
262
250
|
}
|
package/styles/yfm.scss
CHANGED
|
@@ -61,20 +61,6 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
&_footnote_text p,
|
|
65
|
-
&_footnote_page p {
|
|
66
|
-
opacity: 0.5;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&_footnote_text p {
|
|
70
|
-
@include text-size(body-2);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&_footnote_page p {
|
|
74
|
-
@include text-size(body-1);
|
|
75
|
-
display: inline;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
64
|
&_list_style ul {
|
|
79
65
|
padding-left: $indentS;
|
|
80
66
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* use this for style redefinitions to awoid problems with
|
|
2
|
-
unpredictable css rules order in build */
|
|
3
|
-
.pc-constructor-footnotes {
|
|
4
|
-
margin: 0;
|
|
5
|
-
padding: 32px 0 32px 16px;
|
|
6
|
-
font-size: var(--yc-text-body-1-font-size);
|
|
7
|
-
line-height: var(--yc-text-body-1-line-height);
|
|
8
|
-
color: var(--yc-color-text-hint);
|
|
9
|
-
}
|
|
10
|
-
.pc-constructor-footnotes__item + .pc-constructor-footnotes__item {
|
|
11
|
-
margin-top: 12px;
|
|
12
|
-
}
|