@gravity-ui/page-constructor 1.4.2 → 1.6.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 +12 -0
- package/build/cjs/blocks/ContentLayout/ContentLayout.css +2 -2
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.css +1 -0
- package/build/cjs/constructor-items.d.ts +0 -11
- package/build/cjs/constructor-items.js +0 -5
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +0 -2
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -5
- package/build/cjs/schema/index.js +1 -3
- package/build/cjs/schema/validators/common.d.ts +6 -0
- package/build/cjs/schema/validators/common.js +7 -1
- package/build/cjs/schema/validators/sub-blocks.d.ts +0 -4
- package/build/cjs/schema/validators/sub-blocks.js +0 -4
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +5 -6
- package/build/cjs/sub-blocks/BasicCard/schema.js +5 -6
- package/build/cjs/text-transform/blocks.js +0 -12
- package/build/esm/blocks/ContentLayout/ContentLayout.css +2 -2
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.css +1 -0
- package/build/esm/constructor-items.d.ts +0 -11
- package/build/esm/constructor-items.js +0 -5
- package/build/esm/models/constructor-items/blocks.d.ts +1 -1
- package/build/esm/models/constructor-items/common.d.ts +0 -2
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -5
- package/build/esm/schema/index.js +2 -4
- package/build/esm/schema/validators/common.d.ts +6 -0
- package/build/esm/schema/validators/common.js +6 -0
- package/build/esm/schema/validators/sub-blocks.d.ts +0 -4
- package/build/esm/schema/validators/sub-blocks.js +0 -4
- package/build/esm/sub-blocks/BackgroundCard/schema.js +1 -2
- package/build/esm/sub-blocks/BasicCard/schema.js +1 -2
- package/build/esm/text-transform/blocks.js +0 -12
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -1
- package/server/models/constructor-items/common.d.ts +0 -2
- package/server/models/constructor-items/sub-blocks.d.ts +5 -5
- package/server/text-transform/blocks.js +0 -12
- package/build/cjs/components/CardBase/schema.d.ts +0 -70
- package/build/cjs/components/CardBase/schema.js +0 -53
- package/build/esm/components/CardBase/schema.d.ts +0 -70
- package/build/esm/components/CardBase/schema.js +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.0](https://github.com/gravity-ui/page-constructor/pulls?q=is%3Apr+is%3Aclosed) (2022-11-09)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* update storybook
|
|
8
|
+
|
|
9
|
+
## [1.5.0](https://github.com/gravity-ui/page-constructor/issues/44) (2022-11-03)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* remove card validator and types
|
|
14
|
+
|
|
3
15
|
## [1.4.2](https://github.com/gravity-ui/page-constructor/pull/46) (2022-11-07)
|
|
4
16
|
|
|
5
17
|
### Bug Fixes
|
|
@@ -19,8 +19,8 @@ unpredictable css rules order in build */
|
|
|
19
19
|
line-height: var(--yc-text-body-2-line-height);
|
|
20
20
|
}
|
|
21
21
|
.pc-content-layout-block__files_size_l {
|
|
22
|
-
font-size: var(--yc-text-
|
|
23
|
-
line-height: var(--yc-text-
|
|
22
|
+
font-size: var(--yc-text-body-3-font-size);
|
|
23
|
+
line-height: var(--yc-text-body-3-line-height);
|
|
24
24
|
}
|
|
25
25
|
.pc-content-layout-block__files_centered {
|
|
26
26
|
margin-left: auto;
|
|
@@ -38,15 +38,4 @@ export declare const subBlockMap: {
|
|
|
38
38
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
39
39
|
content: (props: import("./models").ContentBlockProps & import("./models").ClassNameProps) => JSX.Element;
|
|
40
40
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Will be removed, use basic card instead
|
|
43
|
-
*/
|
|
44
|
-
card: {
|
|
45
|
-
(props: import("./components/CardBase/CardBase").CardBaseProps): JSX.Element;
|
|
46
|
-
Header: import("react").FC<import("./models").WithChildren<import("./components/CardBase/CardBase").CardHeaderBaseProps>>;
|
|
47
|
-
Content: import("react").FC<{
|
|
48
|
-
children?: import("react").ReactNode;
|
|
49
|
-
}>;
|
|
50
|
-
Footer: import("react").FC<import("./models").WithChildren<import("./components/CardBase/CardBase").CardFooterBaseProps>>;
|
|
51
|
-
};
|
|
52
41
|
};
|
|
@@ -4,7 +4,6 @@ exports.subBlockMap = exports.blockMap = void 0;
|
|
|
4
4
|
const models_1 = require("./models");
|
|
5
5
|
const sub_blocks_1 = require("./sub-blocks");
|
|
6
6
|
const blocks_1 = require("./blocks");
|
|
7
|
-
const components_1 = require("./components");
|
|
8
7
|
exports.blockMap = {
|
|
9
8
|
[models_1.BlockType.SliderBlock]: blocks_1.SliderBlock,
|
|
10
9
|
[models_1.BlockType.SimpleBlock]: blocks_1.SimpleBlock,
|
|
@@ -45,8 +44,4 @@ exports.subBlockMap = {
|
|
|
45
44
|
[models_1.SubBlockType.BasicCard]: sub_blocks_1.BasicCard,
|
|
46
45
|
[models_1.SubBlockType.Content]: sub_blocks_1.Content,
|
|
47
46
|
[models_1.SubBlockType.Quote]: sub_blocks_1.Quote,
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Will be removed, use basic card instead
|
|
50
|
-
*/
|
|
51
|
-
[models_1.SubBlockType.Card]: components_1.CardBase,
|
|
52
47
|
};
|
|
@@ -260,8 +260,6 @@ export declare type CardBorder = 'shadow' | 'line' | 'none';
|
|
|
260
260
|
export interface CardBaseProps {
|
|
261
261
|
border?: CardBorder;
|
|
262
262
|
}
|
|
263
|
-
export interface CardProps extends CardBaseProps, CardData {
|
|
264
|
-
}
|
|
265
263
|
export interface CardHeader {
|
|
266
264
|
title?: string;
|
|
267
265
|
image?: ImageProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClassNameProps } from '../../models';
|
|
2
2
|
import { ThemeSupporting } from '../../utils';
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps,
|
|
4
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
6
|
import { PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
@@ -128,9 +128,6 @@ export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockPro
|
|
|
128
128
|
export declare type DividerModel = {
|
|
129
129
|
type: SubBlockType.Divider;
|
|
130
130
|
} & DividerProps;
|
|
131
|
-
export declare type CardModel = {
|
|
132
|
-
type: SubBlockType.Card;
|
|
133
|
-
} & CardProps;
|
|
134
131
|
export declare type QuoteModel = {
|
|
135
132
|
type: SubBlockType.Quote;
|
|
136
133
|
} & QuoteProps;
|
|
@@ -161,5 +158,8 @@ export declare type HubspotFormModel = {
|
|
|
161
158
|
export declare type BannerCardModel = {
|
|
162
159
|
type: SubBlockType.BannerCard;
|
|
163
160
|
} & BannerCardProps;
|
|
164
|
-
export declare type
|
|
161
|
+
export declare type BasicCardModel = {
|
|
162
|
+
type: SubBlockType.BasicCard;
|
|
163
|
+
} & BasicCardProps;
|
|
164
|
+
export declare type SubBlockModels = DividerModel | QuoteModel | NewsCardModel | PartnerModel | PriceDetailedModel | MediaCardModel | TutorialCardModel | CardWithImageModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel;
|
|
165
165
|
export declare type SubBlock = SubBlockModels;
|
|
@@ -24,7 +24,6 @@ function generateDefaultSchema(config) {
|
|
|
24
24
|
type: 'string',
|
|
25
25
|
enum: [
|
|
26
26
|
'divider',
|
|
27
|
-
'card',
|
|
28
27
|
'quote',
|
|
29
28
|
'event',
|
|
30
29
|
'post',
|
|
@@ -63,7 +62,6 @@ function generateDefaultSchema(config) {
|
|
|
63
62
|
type: {
|
|
64
63
|
type: 'string',
|
|
65
64
|
enum: [
|
|
66
|
-
'card',
|
|
67
65
|
'partner',
|
|
68
66
|
'post',
|
|
69
67
|
'media-card',
|
|
@@ -80,7 +78,7 @@ function generateDefaultSchema(config) {
|
|
|
80
78
|
},
|
|
81
79
|
},
|
|
82
80
|
select: { $data: '0/type' },
|
|
83
|
-
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
81
|
+
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sub_blocks_1.PartnerBlock), sub_blocks_1.MediaCardBlock), blocks_1.BannerCard), sub_blocks_1.PriceDetailedBlock), sub_blocks_1.TutorialCard), sub_blocks_1.BackgroundCard), sub_blocks_1.NewsCard), sub_blocks_1.CardWithImage), sub_blocks_1.Quote), (0, exports.getBlocksCases)(cards)),
|
|
84
82
|
}),
|
|
85
83
|
},
|
|
86
84
|
type: 'object',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.JustifyProps = exports.ThemeProps = exports.VideoProps = exports.PlayIconProps = exports.LoopProps = exports.ChildrenCardsProps = exports.ChildrenProps = exports.AnimatableProps = exports.sliderSizesObject = exports.containerSizesObject = exports.BaseProps = exports.contentThemes = exports.sizeNumber = exports.dividerEnum = exports.fileLinkTypes = exports.videoControlsTypes = exports.playIconThemes = exports.playIconTypes = exports.videoTypes = exports.contentTextWidth = exports.contentSizes = exports.sliderSizesArray = exports.containerSizesArray = exports.textSize = exports.mediaDirection = void 0;
|
|
3
|
+
exports.CardBase = exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.JustifyProps = exports.ThemeProps = exports.VideoProps = exports.PlayIconProps = exports.LoopProps = exports.ChildrenCardsProps = exports.ChildrenProps = exports.AnimatableProps = exports.sliderSizesObject = exports.containerSizesObject = exports.BaseProps = exports.contentThemes = exports.sizeNumber = exports.dividerEnum = exports.fileLinkTypes = exports.videoControlsTypes = exports.playIconThemes = exports.playIconTypes = exports.videoTypes = exports.contentTextWidth = exports.contentSizes = exports.sliderSizesArray = exports.containerSizesArray = exports.textSize = exports.mediaDirection = void 0;
|
|
4
4
|
const pixel_1 = require("./pixel");
|
|
5
5
|
const models_1 = require("../../models");
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
@@ -431,3 +431,9 @@ exports.MediaProps = {
|
|
|
431
431
|
},
|
|
432
432
|
dataLens: exports.DataLensProps,
|
|
433
433
|
};
|
|
434
|
+
exports.CardBase = {
|
|
435
|
+
border: {
|
|
436
|
+
type: 'string',
|
|
437
|
+
enum: ['border', 'shadow', 'none'],
|
|
438
|
+
},
|
|
439
|
+
};
|
|
@@ -9,7 +9,3 @@ export * from '../../sub-blocks/CardWithImage/schema';
|
|
|
9
9
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
10
|
export * from '../../sub-blocks/Divider/schema';
|
|
11
11
|
export * from '../../sub-blocks/BasicCard/schema';
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Will be removed
|
|
14
|
-
*/
|
|
15
|
-
export * from '../../components/CardBase/schema';
|
|
@@ -12,7 +12,3 @@ const tslib_1 = require("tslib");
|
|
|
12
12
|
(0, tslib_1.__exportStar)(require("../../sub-blocks/Quote/schema"), exports);
|
|
13
13
|
(0, tslib_1.__exportStar)(require("../../sub-blocks/Divider/schema"), exports);
|
|
14
14
|
(0, tslib_1.__exportStar)(require("../../sub-blocks/BasicCard/schema"), exports);
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Will be removed
|
|
17
|
-
*/
|
|
18
|
-
(0, tslib_1.__exportStar)(require("../../components/CardBase/schema"), exports);
|
|
@@ -3,18 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BackgroundCard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("../../schema/validators/common");
|
|
6
|
-
const schema_1 = require("
|
|
7
|
-
const schema_2 = require("
|
|
8
|
-
const schema_3 = require("../../components/Image/schema");
|
|
6
|
+
const schema_1 = require("../Content/schema");
|
|
7
|
+
const schema_2 = require("../../components/Image/schema");
|
|
9
8
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
10
|
-
const BackgroundCardContentProps = lodash_1.default.omit(
|
|
9
|
+
const BackgroundCardContentProps = lodash_1.default.omit(schema_1.ContentBase, ['size']);
|
|
11
10
|
exports.BackgroundCard = {
|
|
12
11
|
'background-card': {
|
|
13
12
|
additionalProperties: false,
|
|
14
13
|
required: ['title', 'text'],
|
|
15
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps),
|
|
14
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), BackgroundCardContentProps), { url: {
|
|
16
15
|
type: 'string',
|
|
17
|
-
}, background: (0, common_1.withTheme)(
|
|
16
|
+
}, background: (0, common_1.withTheme)(schema_2.ImageObjectProps), backgroundColor: {
|
|
18
17
|
type: 'string',
|
|
19
18
|
}, paddingBottom: {
|
|
20
19
|
type: 'string',
|
|
@@ -4,16 +4,15 @@ exports.BasicCard = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
6
6
|
const common_1 = require("../../schema/validators/common");
|
|
7
|
-
const schema_1 = require("
|
|
8
|
-
const schema_2 = require("
|
|
9
|
-
const
|
|
10
|
-
const BasicCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size', 'theme']);
|
|
7
|
+
const schema_1 = require("../Content/schema");
|
|
8
|
+
const schema_2 = require("../../components/Image/schema");
|
|
9
|
+
const BasicCardContentProps = lodash_1.default.omit(schema_1.ContentBase, ['size', 'theme']);
|
|
11
10
|
exports.BasicCard = {
|
|
12
11
|
'basic-card': {
|
|
13
12
|
additionalProperties: false,
|
|
14
13
|
required: ['url'],
|
|
15
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps),
|
|
14
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), BasicCardContentProps), { url: {
|
|
16
15
|
type: 'string',
|
|
17
|
-
}, icon:
|
|
16
|
+
}, icon: schema_2.ImageProps }),
|
|
18
17
|
},
|
|
19
18
|
};
|
|
@@ -47,14 +47,6 @@ function parseSlider(transformer, block) {
|
|
|
47
47
|
block.description = transformer(description);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
function parseCard(transformer, card) {
|
|
51
|
-
const { header, text } = card;
|
|
52
|
-
card.text = text && transformer(text);
|
|
53
|
-
if (header && header.title) {
|
|
54
|
-
card.header = card.header || {};
|
|
55
|
-
card.header.title = transformer(header.title);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
50
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
59
51
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
60
52
|
function parsePriceDetailedBlock(transformer, block) {
|
|
@@ -150,10 +142,6 @@ const config = {
|
|
|
150
142
|
fields: ['text'],
|
|
151
143
|
transformer: typografTransformer,
|
|
152
144
|
},
|
|
153
|
-
[models_1.SubBlockType.Card]: {
|
|
154
|
-
transformer: yfmTransformer,
|
|
155
|
-
parser: parseCard,
|
|
156
|
-
},
|
|
157
145
|
[models_1.BlockType.ExtendedFeaturesBlock]: [
|
|
158
146
|
{
|
|
159
147
|
fields: ['title'],
|
|
@@ -19,8 +19,8 @@ unpredictable css rules order in build */
|
|
|
19
19
|
line-height: var(--yc-text-body-2-line-height);
|
|
20
20
|
}
|
|
21
21
|
.pc-content-layout-block__files_size_l {
|
|
22
|
-
font-size: var(--yc-text-
|
|
23
|
-
line-height: var(--yc-text-
|
|
22
|
+
font-size: var(--yc-text-body-3-font-size);
|
|
23
|
+
line-height: var(--yc-text-body-3-line-height);
|
|
24
24
|
}
|
|
25
25
|
.pc-content-layout-block__files_centered {
|
|
26
26
|
margin-left: auto;
|
|
@@ -38,15 +38,4 @@ export declare const subBlockMap: {
|
|
|
38
38
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
39
39
|
content: (props: import("./models").ContentBlockProps & import("./models").ClassNameProps) => JSX.Element;
|
|
40
40
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Will be removed, use basic card instead
|
|
43
|
-
*/
|
|
44
|
-
card: {
|
|
45
|
-
(props: import("./components/CardBase/CardBase").CardBaseProps): JSX.Element;
|
|
46
|
-
Header: import("react").FC<import("./models").WithChildren<import("./components/CardBase/CardBase").CardHeaderBaseProps>>;
|
|
47
|
-
Content: import("react").FC<{
|
|
48
|
-
children?: import("react").ReactNode;
|
|
49
|
-
}>;
|
|
50
|
-
Footer: import("react").FC<import("./models").WithChildren<import("./components/CardBase/CardBase").CardFooterBaseProps>>;
|
|
51
|
-
};
|
|
52
41
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BlockType, SubBlockType } from './models';
|
|
2
2
|
import { Partner, PriceDetailed, MediaCard, NewsCard, TutorialCard, CardWithImage, 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, } from './blocks';
|
|
4
|
-
import { CardBase } from './components';
|
|
5
4
|
export const blockMap = {
|
|
6
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
7
6
|
[BlockType.SimpleBlock]: SimpleBlock,
|
|
@@ -42,8 +41,4 @@ export const subBlockMap = {
|
|
|
42
41
|
[SubBlockType.BasicCard]: BasicCard,
|
|
43
42
|
[SubBlockType.Content]: Content,
|
|
44
43
|
[SubBlockType.Quote]: Quote,
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Will be removed, use basic card instead
|
|
47
|
-
*/
|
|
48
|
-
[SubBlockType.Card]: CardBase,
|
|
49
44
|
};
|
|
@@ -260,8 +260,6 @@ export declare type CardBorder = 'shadow' | 'line' | 'none';
|
|
|
260
260
|
export interface CardBaseProps {
|
|
261
261
|
border?: CardBorder;
|
|
262
262
|
}
|
|
263
|
-
export interface CardProps extends CardBaseProps, CardData {
|
|
264
|
-
}
|
|
265
263
|
export interface CardHeader {
|
|
266
264
|
title?: string;
|
|
267
265
|
image?: ImageProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClassNameProps } from '../../models';
|
|
2
2
|
import { ThemeSupporting } from '../../utils';
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps,
|
|
4
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
6
|
import { PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
@@ -128,9 +128,6 @@ export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockPro
|
|
|
128
128
|
export declare type DividerModel = {
|
|
129
129
|
type: SubBlockType.Divider;
|
|
130
130
|
} & DividerProps;
|
|
131
|
-
export declare type CardModel = {
|
|
132
|
-
type: SubBlockType.Card;
|
|
133
|
-
} & CardProps;
|
|
134
131
|
export declare type QuoteModel = {
|
|
135
132
|
type: SubBlockType.Quote;
|
|
136
133
|
} & QuoteProps;
|
|
@@ -161,5 +158,8 @@ export declare type HubspotFormModel = {
|
|
|
161
158
|
export declare type BannerCardModel = {
|
|
162
159
|
type: SubBlockType.BannerCard;
|
|
163
160
|
} & BannerCardProps;
|
|
164
|
-
export declare type
|
|
161
|
+
export declare type BasicCardModel = {
|
|
162
|
+
type: SubBlockType.BasicCard;
|
|
163
|
+
} & BasicCardProps;
|
|
164
|
+
export declare type SubBlockModels = DividerModel | QuoteModel | NewsCardModel | PartnerModel | PriceDetailedModel | MediaCardModel | TutorialCardModel | CardWithImageModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel;
|
|
165
165
|
export declare type SubBlock = SubBlockModels;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { validators } from './validators';
|
|
2
2
|
import { TabsBlock, BannerCard, SliderBlock, ExtendedFeaturesBlock, HeaderBlock, BannerBlock, CompaniesBlock, MediaBlock, InfoBlock, QuestionsBlock, SecurityBlock, TableBlock, SimpleBlock, LinkTableBlock, PromoFeaturesBlock, PreviewBlock, ContentLayoutBlock, HeaderSliderBlock, IconsBlock, CardLayoutBlock, } from './validators/blocks';
|
|
3
|
-
import {
|
|
3
|
+
import { PartnerBlock, MediaCardBlock, TutorialCard, BackgroundCard, NewsCard, CardWithImage, PriceDetailedBlock, Quote, Divider, } from './validators/sub-blocks';
|
|
4
4
|
import { AnimatableProps, BackgroundProps, MenuProps, withTheme } from './validators/common';
|
|
5
5
|
import { filteredItem } from './validators/utils';
|
|
6
6
|
export const getBlocksCases = (blocks) => {
|
|
@@ -19,7 +19,6 @@ export function generateDefaultSchema(config) {
|
|
|
19
19
|
type: 'string',
|
|
20
20
|
enum: [
|
|
21
21
|
'divider',
|
|
22
|
-
'card',
|
|
23
22
|
'quote',
|
|
24
23
|
'event',
|
|
25
24
|
'post',
|
|
@@ -58,7 +57,6 @@ export function generateDefaultSchema(config) {
|
|
|
58
57
|
type: {
|
|
59
58
|
type: 'string',
|
|
60
59
|
enum: [
|
|
61
|
-
'card',
|
|
62
60
|
'partner',
|
|
63
61
|
'post',
|
|
64
62
|
'media-card',
|
|
@@ -75,7 +73,7 @@ export function generateDefaultSchema(config) {
|
|
|
75
73
|
},
|
|
76
74
|
},
|
|
77
75
|
select: { $data: '0/type' },
|
|
78
|
-
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
76
|
+
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, PartnerBlock), MediaCardBlock), BannerCard), PriceDetailedBlock), TutorialCard), BackgroundCard), NewsCard), CardWithImage), Quote), getBlocksCases(cards)),
|
|
79
77
|
}),
|
|
80
78
|
},
|
|
81
79
|
type: 'object',
|
|
@@ -9,7 +9,3 @@ export * from '../../sub-blocks/CardWithImage/schema';
|
|
|
9
9
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
10
|
export * from '../../sub-blocks/Divider/schema';
|
|
11
11
|
export * from '../../sub-blocks/BasicCard/schema';
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Will be removed
|
|
14
|
-
*/
|
|
15
|
-
export * from '../../components/CardBase/schema';
|
|
@@ -9,7 +9,3 @@ export * from '../../sub-blocks/CardWithImage/schema';
|
|
|
9
9
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
10
|
export * from '../../sub-blocks/Divider/schema';
|
|
11
11
|
export * from '../../sub-blocks/BasicCard/schema';
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Will be removed
|
|
14
|
-
*/
|
|
15
|
-
export * from '../../components/CardBase/schema';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseProps, withTheme } from '../../schema/validators/common';
|
|
2
|
-
import { CardBase } from '../../components/CardBase/schema';
|
|
1
|
+
import { BaseProps, CardBase, withTheme } from '../../schema/validators/common';
|
|
3
2
|
import { ContentBase } from '../Content/schema';
|
|
4
3
|
import { ImageObjectProps } from '../../components/Image/schema';
|
|
5
4
|
import _ from 'lodash';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { BaseProps } from '../../schema/validators/common';
|
|
3
|
-
import { CardBase } from '../../components/CardBase/schema';
|
|
2
|
+
import { BaseProps, CardBase } from '../../schema/validators/common';
|
|
4
3
|
import { ContentBase } from '../Content/schema';
|
|
5
4
|
import { ImageProps } from '../../components/Image/schema';
|
|
6
5
|
const BasicCardContentProps = _.omit(ContentBase, ['size', 'theme']);
|
|
@@ -43,14 +43,6 @@ function parseSlider(transformer, block) {
|
|
|
43
43
|
block.description = transformer(description);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function parseCard(transformer, card) {
|
|
47
|
-
const { header, text } = card;
|
|
48
|
-
card.text = text && transformer(text);
|
|
49
|
-
if (header && header.title) {
|
|
50
|
-
card.header = card.header || {};
|
|
51
|
-
card.header.title = transformer(header.title);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
46
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
55
47
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
56
48
|
function parsePriceDetailedBlock(transformer, block) {
|
|
@@ -144,10 +136,6 @@ const config = {
|
|
|
144
136
|
fields: ['text'],
|
|
145
137
|
transformer: typografTransformer,
|
|
146
138
|
},
|
|
147
|
-
[SubBlockType.Card]: {
|
|
148
|
-
transformer: yfmTransformer,
|
|
149
|
-
parser: parseCard,
|
|
150
|
-
},
|
|
151
139
|
[BlockType.ExtendedFeaturesBlock]: [
|
|
152
140
|
{
|
|
153
141
|
fields: ['title'],
|
package/package.json
CHANGED
|
@@ -260,8 +260,6 @@ export declare type CardBorder = 'shadow' | 'line' | 'none';
|
|
|
260
260
|
export interface CardBaseProps {
|
|
261
261
|
border?: CardBorder;
|
|
262
262
|
}
|
|
263
|
-
export interface CardProps extends CardBaseProps, CardData {
|
|
264
|
-
}
|
|
265
263
|
export interface CardHeader {
|
|
266
264
|
title?: string;
|
|
267
265
|
image?: ImageProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClassNameProps } from '../../models';
|
|
2
2
|
import { ThemeSupporting } from '../../utils';
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps,
|
|
4
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
6
|
import { PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
@@ -128,9 +128,6 @@ export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockPro
|
|
|
128
128
|
export declare type DividerModel = {
|
|
129
129
|
type: SubBlockType.Divider;
|
|
130
130
|
} & DividerProps;
|
|
131
|
-
export declare type CardModel = {
|
|
132
|
-
type: SubBlockType.Card;
|
|
133
|
-
} & CardProps;
|
|
134
131
|
export declare type QuoteModel = {
|
|
135
132
|
type: SubBlockType.Quote;
|
|
136
133
|
} & QuoteProps;
|
|
@@ -161,5 +158,8 @@ export declare type HubspotFormModel = {
|
|
|
161
158
|
export declare type BannerCardModel = {
|
|
162
159
|
type: SubBlockType.BannerCard;
|
|
163
160
|
} & BannerCardProps;
|
|
164
|
-
export declare type
|
|
161
|
+
export declare type BasicCardModel = {
|
|
162
|
+
type: SubBlockType.BasicCard;
|
|
163
|
+
} & BasicCardProps;
|
|
164
|
+
export declare type SubBlockModels = DividerModel | QuoteModel | NewsCardModel | PartnerModel | PriceDetailedModel | MediaCardModel | TutorialCardModel | CardWithImageModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel;
|
|
165
165
|
export declare type SubBlock = SubBlockModels;
|
|
@@ -60,14 +60,6 @@ function parseSlider(transformer, block) {
|
|
|
60
60
|
block.description = transformer(description);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function parseCard(transformer, card) {
|
|
64
|
-
const { header, text } = card;
|
|
65
|
-
card.text = text && transformer(text);
|
|
66
|
-
if (header && header.title) {
|
|
67
|
-
card.header = card.header || {};
|
|
68
|
-
card.header.title = transformer(header.title);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
63
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
72
64
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
73
65
|
function parsePriceDetailedBlock(transformer, block) {
|
|
@@ -163,10 +155,6 @@ const config = {
|
|
|
163
155
|
fields: ['text'],
|
|
164
156
|
transformer: typografTransformer,
|
|
165
157
|
},
|
|
166
|
-
[models_1.SubBlockType.Card]: {
|
|
167
|
-
transformer: yfmTransformer,
|
|
168
|
-
parser: parseCard,
|
|
169
|
-
},
|
|
170
158
|
[models_1.BlockType.ExtendedFeaturesBlock]: [
|
|
171
159
|
{
|
|
172
160
|
fields: ['title'],
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export declare const CardBase: {
|
|
2
|
-
border: {
|
|
3
|
-
type: string;
|
|
4
|
-
enum: string[];
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
export declare const CardBlock: {
|
|
8
|
-
card: {
|
|
9
|
-
additionalProperties: boolean;
|
|
10
|
-
required: never[];
|
|
11
|
-
properties: {
|
|
12
|
-
header: {
|
|
13
|
-
additionalProperties: boolean;
|
|
14
|
-
required: never[];
|
|
15
|
-
properties: {
|
|
16
|
-
text: {
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
image: {
|
|
20
|
-
type: string;
|
|
21
|
-
};
|
|
22
|
-
title: {
|
|
23
|
-
type: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
service: {
|
|
28
|
-
additionalProperties: boolean;
|
|
29
|
-
required: string[];
|
|
30
|
-
properties: {
|
|
31
|
-
slug: {
|
|
32
|
-
type: string;
|
|
33
|
-
};
|
|
34
|
-
name: {
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
text: {
|
|
40
|
-
type: string;
|
|
41
|
-
};
|
|
42
|
-
title: {
|
|
43
|
-
type: string;
|
|
44
|
-
};
|
|
45
|
-
footer: {
|
|
46
|
-
type: string;
|
|
47
|
-
};
|
|
48
|
-
url: {
|
|
49
|
-
type: string;
|
|
50
|
-
};
|
|
51
|
-
links: {
|
|
52
|
-
type: string;
|
|
53
|
-
items: {
|
|
54
|
-
type: string;
|
|
55
|
-
properties: {
|
|
56
|
-
when: {
|
|
57
|
-
type: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
border: {
|
|
63
|
-
type: string;
|
|
64
|
-
enum: string[];
|
|
65
|
-
};
|
|
66
|
-
type: {};
|
|
67
|
-
when: {};
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CardBlock = exports.CardBase = void 0;
|
|
4
|
-
const utils_1 = require("../../schema/validators/utils");
|
|
5
|
-
const common_1 = require("../../schema/validators/common");
|
|
6
|
-
exports.CardBase = {
|
|
7
|
-
border: {
|
|
8
|
-
type: 'string',
|
|
9
|
-
enum: ['border', 'shadow', 'none'],
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const CardHeader = {
|
|
13
|
-
additionalProperties: false,
|
|
14
|
-
required: [],
|
|
15
|
-
properties: {
|
|
16
|
-
text: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
},
|
|
19
|
-
image: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
},
|
|
22
|
-
title: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
const CardService = {
|
|
28
|
-
additionalProperties: false,
|
|
29
|
-
required: ['slug', 'name'],
|
|
30
|
-
properties: {
|
|
31
|
-
slug: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
},
|
|
34
|
-
name: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
exports.CardBlock = {
|
|
40
|
-
card: {
|
|
41
|
-
additionalProperties: false,
|
|
42
|
-
required: [],
|
|
43
|
-
properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), exports.CardBase), { header: CardHeader, service: CardService, text: {
|
|
44
|
-
type: 'string',
|
|
45
|
-
}, title: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
}, footer: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
}, url: {
|
|
50
|
-
type: 'string',
|
|
51
|
-
}, links: (0, utils_1.filteredArray)(common_1.LinkProps) }),
|
|
52
|
-
},
|
|
53
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export declare const CardBase: {
|
|
2
|
-
border: {
|
|
3
|
-
type: string;
|
|
4
|
-
enum: string[];
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
export declare const CardBlock: {
|
|
8
|
-
card: {
|
|
9
|
-
additionalProperties: boolean;
|
|
10
|
-
required: never[];
|
|
11
|
-
properties: {
|
|
12
|
-
header: {
|
|
13
|
-
additionalProperties: boolean;
|
|
14
|
-
required: never[];
|
|
15
|
-
properties: {
|
|
16
|
-
text: {
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
image: {
|
|
20
|
-
type: string;
|
|
21
|
-
};
|
|
22
|
-
title: {
|
|
23
|
-
type: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
service: {
|
|
28
|
-
additionalProperties: boolean;
|
|
29
|
-
required: string[];
|
|
30
|
-
properties: {
|
|
31
|
-
slug: {
|
|
32
|
-
type: string;
|
|
33
|
-
};
|
|
34
|
-
name: {
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
text: {
|
|
40
|
-
type: string;
|
|
41
|
-
};
|
|
42
|
-
title: {
|
|
43
|
-
type: string;
|
|
44
|
-
};
|
|
45
|
-
footer: {
|
|
46
|
-
type: string;
|
|
47
|
-
};
|
|
48
|
-
url: {
|
|
49
|
-
type: string;
|
|
50
|
-
};
|
|
51
|
-
links: {
|
|
52
|
-
type: string;
|
|
53
|
-
items: {
|
|
54
|
-
type: string;
|
|
55
|
-
properties: {
|
|
56
|
-
when: {
|
|
57
|
-
type: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
border: {
|
|
63
|
-
type: string;
|
|
64
|
-
enum: string[];
|
|
65
|
-
};
|
|
66
|
-
type: {};
|
|
67
|
-
when: {};
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { filteredArray } from '../../schema/validators/utils';
|
|
2
|
-
import { BaseProps, LinkProps } from '../../schema/validators/common';
|
|
3
|
-
export const CardBase = {
|
|
4
|
-
border: {
|
|
5
|
-
type: 'string',
|
|
6
|
-
enum: ['border', 'shadow', 'none'],
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
const CardHeader = {
|
|
10
|
-
additionalProperties: false,
|
|
11
|
-
required: [],
|
|
12
|
-
properties: {
|
|
13
|
-
text: {
|
|
14
|
-
type: 'string',
|
|
15
|
-
},
|
|
16
|
-
image: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
},
|
|
19
|
-
title: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
const CardService = {
|
|
25
|
-
additionalProperties: false,
|
|
26
|
-
required: ['slug', 'name'],
|
|
27
|
-
properties: {
|
|
28
|
-
slug: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
},
|
|
31
|
-
name: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
export const CardBlock = {
|
|
37
|
-
card: {
|
|
38
|
-
additionalProperties: false,
|
|
39
|
-
required: [],
|
|
40
|
-
properties: Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), { header: CardHeader, service: CardService, text: {
|
|
41
|
-
type: 'string',
|
|
42
|
-
}, title: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
}, footer: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
}, url: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
}, links: filteredArray(LinkProps) }),
|
|
49
|
-
},
|
|
50
|
-
};
|