@gravity-ui/blog-constructor 5.12.1-alpha.2 → 5.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/build/cjs/blocks/Form/Form.css +16 -0
- package/build/cjs/blocks/Form/Form.d.ts +3 -0
- package/build/cjs/blocks/Form/Form.js +28 -0
- package/build/cjs/blocks/Form/schema.d.ts +126 -0
- package/build/cjs/blocks/Form/schema.js +34 -0
- package/build/cjs/blocks/Header/schema.d.ts +1 -11
- package/build/cjs/blocks/Media/schema.d.ts +1 -11
- package/build/cjs/constructor/blocksMap.d.ts +1 -0
- package/build/cjs/constructor/blocksMap.js +2 -0
- package/build/cjs/hooks/useExtendedComponentMap.d.ts +1 -0
- package/build/cjs/models/blocks.d.ts +9 -2
- package/build/cjs/models/common.d.ts +2 -1
- package/build/cjs/models/common.js +1 -0
- package/build/cjs/schema/index.d.ts +2 -22
- package/build/esm/blocks/Form/Form.css +16 -0
- package/build/esm/blocks/Form/Form.d.ts +4 -0
- package/build/esm/blocks/Form/Form.js +25 -0
- package/build/esm/blocks/Form/schema.d.ts +126 -0
- package/build/esm/blocks/Form/schema.js +31 -0
- package/build/esm/blocks/Header/schema.d.ts +1 -11
- package/build/esm/blocks/Media/schema.d.ts +1 -11
- package/build/esm/constructor/blocksMap.d.ts +1 -0
- package/build/esm/constructor/blocksMap.js +2 -0
- package/build/esm/hooks/useExtendedComponentMap.d.ts +1 -0
- package/build/esm/models/blocks.d.ts +9 -2
- package/build/esm/models/common.d.ts +2 -1
- package/build/esm/models/common.js +1 -0
- package/build/esm/schema/index.d.ts +2 -22
- package/package.json +3 -2
- package/server/models/blocks.d.ts +9 -2
- package/server/models/common.d.ts +2 -1
- package/server/models/common.js +1 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
2
|
+
unpredictable css rules order in build */
|
3
|
+
.bc-form-block__container {
|
4
|
+
border-radius: var(--bc-border-radius);
|
5
|
+
position: relative;
|
6
|
+
overflow: hidden;
|
7
|
+
padding: 24px;
|
8
|
+
}
|
9
|
+
.bc-form-block__container_border_shadow {
|
10
|
+
box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
|
11
|
+
overflow-x: hidden;
|
12
|
+
border-radius: var(--bc-border-radius);
|
13
|
+
}
|
14
|
+
.bc-form-block__container_border_line {
|
15
|
+
border: 1px solid var(--g-color-line-generic);
|
16
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Form = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
6
|
+
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
7
|
+
const Wrapper_1 = require("../../components/Wrapper/Wrapper");
|
8
|
+
const paddings_1 = require("../../models/paddings");
|
9
|
+
const cn_1 = require("../../utils/cn");
|
10
|
+
const b = (0, cn_1.block)('form-block');
|
11
|
+
const Form = (_a) => {
|
12
|
+
var { paddingTop, paddingBottom } = _a, props = tslib_1.__rest(_a, ["paddingTop", "paddingBottom"]);
|
13
|
+
const { formData, border = 'shadow' } = props;
|
14
|
+
const [contentLoaded, setContentLoaded] = (0, react_1.useState)(false);
|
15
|
+
const onContentLoad = () => {
|
16
|
+
setContentLoaded(true);
|
17
|
+
};
|
18
|
+
if (!formData) {
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
return (react_1.default.createElement(Wrapper_1.Wrapper, { paddings: {
|
22
|
+
[paddings_1.PaddingsDirections.top]: paddingTop,
|
23
|
+
[paddings_1.PaddingsDirections.bottom]: paddingBottom,
|
24
|
+
}, className: b('wrapper') },
|
25
|
+
react_1.default.createElement("div", { className: b('container', { hidden: !contentLoaded, border }) },
|
26
|
+
react_1.default.createElement(page_constructor_1.InnerForm, { className: b('form'), formData: formData, onContentLoad: onContentLoad }))));
|
27
|
+
};
|
28
|
+
exports.Form = Form;
|
@@ -0,0 +1,126 @@
|
|
1
|
+
export declare const Media: {
|
2
|
+
"blog-media-block": {
|
3
|
+
type: string;
|
4
|
+
additionalProperties: boolean;
|
5
|
+
properties: {
|
6
|
+
formData: {
|
7
|
+
oneOf: ({
|
8
|
+
type: string;
|
9
|
+
optionName: string;
|
10
|
+
properties: {
|
11
|
+
yandex: {
|
12
|
+
type: string;
|
13
|
+
required: string[];
|
14
|
+
properties: {
|
15
|
+
id: {
|
16
|
+
type: string;
|
17
|
+
};
|
18
|
+
containerId: {
|
19
|
+
type: string;
|
20
|
+
};
|
21
|
+
type: {};
|
22
|
+
when: {
|
23
|
+
type: string;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
};
|
27
|
+
hubspot?: undefined;
|
28
|
+
};
|
29
|
+
} | {
|
30
|
+
type: string;
|
31
|
+
optionName: string;
|
32
|
+
properties: {
|
33
|
+
hubspot: {
|
34
|
+
type: string;
|
35
|
+
required: string[];
|
36
|
+
properties: {
|
37
|
+
region: {
|
38
|
+
type: string;
|
39
|
+
};
|
40
|
+
portalId: {
|
41
|
+
type: string;
|
42
|
+
};
|
43
|
+
formId: {
|
44
|
+
type: string;
|
45
|
+
};
|
46
|
+
formInstanceId: {
|
47
|
+
type: string;
|
48
|
+
};
|
49
|
+
type: {};
|
50
|
+
when: {
|
51
|
+
type: string;
|
52
|
+
};
|
53
|
+
};
|
54
|
+
};
|
55
|
+
yandex?: undefined;
|
56
|
+
};
|
57
|
+
})[];
|
58
|
+
};
|
59
|
+
border: {
|
60
|
+
type: string;
|
61
|
+
enum: string[];
|
62
|
+
};
|
63
|
+
paddingTop: {
|
64
|
+
type: string;
|
65
|
+
enum: string[];
|
66
|
+
};
|
67
|
+
paddingBottom: {
|
68
|
+
type: string;
|
69
|
+
enum: string[];
|
70
|
+
};
|
71
|
+
fullWidth: {
|
72
|
+
type: string;
|
73
|
+
};
|
74
|
+
column: {
|
75
|
+
type: string;
|
76
|
+
enum: string[];
|
77
|
+
};
|
78
|
+
qa: {
|
79
|
+
type: string;
|
80
|
+
};
|
81
|
+
anchor: {
|
82
|
+
type: string;
|
83
|
+
additionalProperties: boolean;
|
84
|
+
required: string[];
|
85
|
+
properties: {
|
86
|
+
text: {
|
87
|
+
type: string;
|
88
|
+
contentType: string;
|
89
|
+
};
|
90
|
+
url: {
|
91
|
+
type: string;
|
92
|
+
};
|
93
|
+
urlTitle: {
|
94
|
+
type: string;
|
95
|
+
};
|
96
|
+
};
|
97
|
+
};
|
98
|
+
visible: {
|
99
|
+
type: string;
|
100
|
+
enum: string[];
|
101
|
+
};
|
102
|
+
resetPaddings: {
|
103
|
+
type: string;
|
104
|
+
};
|
105
|
+
context: {
|
106
|
+
type: string;
|
107
|
+
};
|
108
|
+
indent: {
|
109
|
+
type: string;
|
110
|
+
additionalProperties: boolean;
|
111
|
+
properties: {
|
112
|
+
top: {
|
113
|
+
enum: string[];
|
114
|
+
};
|
115
|
+
bottom: {
|
116
|
+
enum: string[];
|
117
|
+
};
|
118
|
+
};
|
119
|
+
};
|
120
|
+
type: {};
|
121
|
+
when: {
|
122
|
+
type: string;
|
123
|
+
};
|
124
|
+
};
|
125
|
+
};
|
126
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Media = void 0;
|
4
|
+
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
5
|
+
const common_1 = require("../../models/common");
|
6
|
+
const common_2 = require("../../schema/common");
|
7
|
+
const { common: { BlockBaseProps }, components: { YandexFormProps }, subBlocks: { HubspotFormProps }, } = page_constructor_1.validators;
|
8
|
+
exports.Media = {
|
9
|
+
[common_1.BlockType.Media]: {
|
10
|
+
type: 'object',
|
11
|
+
additionalProperties: false,
|
12
|
+
properties: Object.assign(Object.assign(Object.assign({}, BlockBaseProps), common_2.BlogBlockBase), { formData: {
|
13
|
+
oneOf: [
|
14
|
+
{
|
15
|
+
type: 'object',
|
16
|
+
optionName: 'yandex',
|
17
|
+
properties: {
|
18
|
+
yandex: YandexFormProps,
|
19
|
+
},
|
20
|
+
},
|
21
|
+
{
|
22
|
+
type: 'object',
|
23
|
+
optionName: 'hubspot',
|
24
|
+
properties: {
|
25
|
+
hubspot: HubspotFormProps,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
],
|
29
|
+
}, border: {
|
30
|
+
type: 'string',
|
31
|
+
enum: ['shadow', 'line', 'none'],
|
32
|
+
} }),
|
33
|
+
},
|
34
|
+
};
|
@@ -450,20 +450,10 @@ export declare const Header: {
|
|
450
450
|
type: string;
|
451
451
|
};
|
452
452
|
height: {
|
453
|
-
oneOf: ({
|
454
|
-
type: string;
|
455
|
-
enum?: undefined;
|
456
|
-
} | {
|
457
|
-
type: string;
|
458
|
-
enum: string[];
|
459
|
-
})[];
|
460
|
-
};
|
461
|
-
width: {
|
462
453
|
type: string;
|
463
454
|
};
|
464
|
-
|
455
|
+
width: {
|
465
456
|
type: string;
|
466
|
-
enum: string[];
|
467
457
|
};
|
468
458
|
};
|
469
459
|
};
|
@@ -264,20 +264,10 @@ export declare const Media: {
|
|
264
264
|
type: string;
|
265
265
|
};
|
266
266
|
height: {
|
267
|
-
oneOf: ({
|
268
|
-
type: string;
|
269
|
-
enum?: undefined;
|
270
|
-
} | {
|
271
|
-
type: string;
|
272
|
-
enum: string[];
|
273
|
-
})[];
|
274
|
-
};
|
275
|
-
width: {
|
276
267
|
type: string;
|
277
268
|
};
|
278
|
-
|
269
|
+
width: {
|
279
270
|
type: string;
|
280
|
-
enum: string[];
|
281
271
|
};
|
282
272
|
};
|
283
273
|
};
|
@@ -10,6 +10,7 @@ declare const _default: {
|
|
10
10
|
"blog-suggest-block": ({ paddingTop, paddingBottom }: import("../models/blocks").SuggestProps) => import("react").JSX.Element | null;
|
11
11
|
"blog-meta-block": (props: import("../models/blocks").MetaProps) => import("react").JSX.Element;
|
12
12
|
"blog-feed-block": ({ image }: import("../models/blocks").FeedProps) => import("react").JSX.Element;
|
13
|
+
"blog-form-block": ({ paddingTop, paddingBottom, ...props }: import("../models/blocks").FormProps) => import("react").JSX.Element | null;
|
13
14
|
};
|
14
15
|
headers: {
|
15
16
|
"blog-header-block": (props: import("../models/blocks").HeaderProps) => import("react").JSX.Element;
|
@@ -5,6 +5,7 @@ const Banner_1 = require("../blocks/Banner/Banner");
|
|
5
5
|
const CTA_1 = require("../blocks/CTA/CTA");
|
6
6
|
const ColoredText_1 = require("../blocks/ColoredText/ColoredText");
|
7
7
|
const Feed_1 = require("../blocks/Feed/Feed");
|
8
|
+
const Form_1 = require("../blocks/Form/Form");
|
8
9
|
const Header_1 = require("../blocks/Header/Header");
|
9
10
|
const Layout_1 = require("../blocks/Layout/Layout");
|
10
11
|
const Media_1 = require("../blocks/Media/Media");
|
@@ -23,6 +24,7 @@ const blocks = {
|
|
23
24
|
[common_1.BlockType.Suggest]: Suggest_1.Suggest,
|
24
25
|
[common_1.BlockType.Meta]: Meta_1.Meta,
|
25
26
|
[common_1.BlockType.Feed]: Feed_1.Feed,
|
27
|
+
[common_1.BlockType.Form]: Form_1.Form,
|
26
28
|
};
|
27
29
|
const headers = {
|
28
30
|
[common_1.BlockType.Header]: Header_1.Header,
|
@@ -11,6 +11,7 @@ export declare const useExtendedComponentMap: (custom: CustomConfig | undefined)
|
|
11
11
|
"blog-suggest-block": ({ paddingTop, paddingBottom }: import("../models/blocks").SuggestProps) => import("react").JSX.Element | null;
|
12
12
|
"blog-meta-block": (props: import("../models/blocks").MetaProps) => import("react").JSX.Element;
|
13
13
|
"blog-feed-block": ({ image }: import("../models/blocks").FeedProps) => import("react").JSX.Element;
|
14
|
+
"blog-form-block": ({ paddingTop, paddingBottom, ...props }: import("../models/blocks").FormProps) => import("react").JSX.Element | null;
|
14
15
|
};
|
15
16
|
headers: {
|
16
17
|
"blog-header-block": (props: import("../models/blocks").HeaderProps) => import("react").JSX.Element;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ReactElement } from 'react';
|
2
|
-
import { ContentBlockProps, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
2
|
+
import { ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
3
3
|
import { BlockType, ClassNameProps, PostData, QAProps } from './common';
|
4
4
|
import { PaddingsYFMProps } from './paddings';
|
5
5
|
export type AuthorProps = ClassNameProps & {
|
@@ -27,7 +27,7 @@ export type LayoutProps = {
|
|
27
27
|
mobileOrder?: string;
|
28
28
|
children: ReactElement[];
|
29
29
|
} & PaddingsYFMProps;
|
30
|
-
export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'
|
30
|
+
export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'>> & {
|
31
31
|
text?: string;
|
32
32
|
};
|
33
33
|
export type MetaProps = QAProps & {
|
@@ -43,6 +43,10 @@ export type YFMProps = {
|
|
43
43
|
export type FeedProps = {
|
44
44
|
image: string;
|
45
45
|
};
|
46
|
+
export type FormProps = {
|
47
|
+
formData: FormBlockData;
|
48
|
+
border?: 'shadow' | 'line' | 'none';
|
49
|
+
} & PaddingsYFMProps & QAProps;
|
46
50
|
export type AuthorBlockModel = {
|
47
51
|
type: BlockType.Author;
|
48
52
|
} & AuthorProps;
|
@@ -76,6 +80,9 @@ export type YFMBlockModel = {
|
|
76
80
|
export type FeedBlockModel = {
|
77
81
|
type: BlockType.Feed;
|
78
82
|
} & FeedProps;
|
83
|
+
export type FormBlockModel = {
|
84
|
+
type: BlockType.Form;
|
85
|
+
} & FormProps;
|
79
86
|
export type BlockModel = AuthorBlockModel | BannerBlockModel | ColoredTextBlockModel | CTABlockModel | HeaderBlockModel | LayoutBlockModel | MediaBlockModel | MetaBlockModel | SuggestBlockModel | YFMBlockModel | FeedBlockModel;
|
80
87
|
export type Block = BlockModel & {
|
81
88
|
[x: string]: any;
|
@@ -96,7 +96,8 @@ export declare enum BlockType {
|
|
96
96
|
Author = "blog-author-block",
|
97
97
|
Suggest = "blog-suggest-block",
|
98
98
|
Meta = "blog-meta-block",
|
99
|
-
Feed = "blog-feed-block"
|
99
|
+
Feed = "blog-feed-block",
|
100
|
+
Form = "blog-form-block"
|
100
101
|
}
|
101
102
|
export type MetaProps = {
|
102
103
|
metaComponent: JSX.Element;
|
@@ -19,6 +19,7 @@ var BlockType;
|
|
19
19
|
BlockType["Suggest"] = "blog-suggest-block";
|
20
20
|
BlockType["Meta"] = "blog-meta-block";
|
21
21
|
BlockType["Feed"] = "blog-feed-block";
|
22
|
+
BlockType["Form"] = "blog-form-block";
|
22
23
|
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
23
24
|
var DefaultEventNames;
|
24
25
|
(function (DefaultEventNames) {
|
@@ -458,20 +458,10 @@ export declare const schemasForCustom: {
|
|
458
458
|
type: string;
|
459
459
|
};
|
460
460
|
height: {
|
461
|
-
oneOf: ({
|
462
|
-
type: string;
|
463
|
-
enum?: undefined;
|
464
|
-
} | {
|
465
|
-
type: string;
|
466
|
-
enum: string[];
|
467
|
-
})[];
|
468
|
-
};
|
469
|
-
width: {
|
470
461
|
type: string;
|
471
462
|
};
|
472
|
-
|
463
|
+
width: {
|
473
464
|
type: string;
|
474
|
-
enum: string[];
|
475
465
|
};
|
476
466
|
};
|
477
467
|
};
|
@@ -1598,20 +1588,10 @@ export declare const schemasForCustom: {
|
|
1598
1588
|
type: string;
|
1599
1589
|
};
|
1600
1590
|
height: {
|
1601
|
-
oneOf: ({
|
1602
|
-
type: string;
|
1603
|
-
enum?: undefined;
|
1604
|
-
} | {
|
1605
|
-
type: string;
|
1606
|
-
enum: string[];
|
1607
|
-
})[];
|
1608
|
-
};
|
1609
|
-
width: {
|
1610
1591
|
type: string;
|
1611
1592
|
};
|
1612
|
-
|
1593
|
+
width: {
|
1613
1594
|
type: string;
|
1614
|
-
enum: string[];
|
1615
1595
|
};
|
1616
1596
|
};
|
1617
1597
|
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
2
|
+
unpredictable css rules order in build */
|
3
|
+
.bc-form-block__container {
|
4
|
+
border-radius: var(--bc-border-radius);
|
5
|
+
position: relative;
|
6
|
+
overflow: hidden;
|
7
|
+
padding: 24px;
|
8
|
+
}
|
9
|
+
.bc-form-block__container_border_shadow {
|
10
|
+
box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
|
11
|
+
overflow-x: hidden;
|
12
|
+
border-radius: var(--bc-border-radius);
|
13
|
+
}
|
14
|
+
.bc-form-block__container_border_line {
|
15
|
+
border: 1px solid var(--g-color-line-generic);
|
16
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { __rest } from "tslib";
|
2
|
+
import React, { useState } from 'react';
|
3
|
+
import { InnerForm } from '@gravity-ui/page-constructor';
|
4
|
+
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
5
|
+
import { PaddingsDirections } from '../../models/paddings';
|
6
|
+
import { block } from '../../utils/cn';
|
7
|
+
import './Form.css';
|
8
|
+
const b = block('form-block');
|
9
|
+
export const Form = (_a) => {
|
10
|
+
var { paddingTop, paddingBottom } = _a, props = __rest(_a, ["paddingTop", "paddingBottom"]);
|
11
|
+
const { formData, border = 'shadow' } = props;
|
12
|
+
const [contentLoaded, setContentLoaded] = useState(false);
|
13
|
+
const onContentLoad = () => {
|
14
|
+
setContentLoaded(true);
|
15
|
+
};
|
16
|
+
if (!formData) {
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
return (React.createElement(Wrapper, { paddings: {
|
20
|
+
[PaddingsDirections.top]: paddingTop,
|
21
|
+
[PaddingsDirections.bottom]: paddingBottom,
|
22
|
+
}, className: b('wrapper') },
|
23
|
+
React.createElement("div", { className: b('container', { hidden: !contentLoaded, border }) },
|
24
|
+
React.createElement(InnerForm, { className: b('form'), formData: formData, onContentLoad: onContentLoad }))));
|
25
|
+
};
|
@@ -0,0 +1,126 @@
|
|
1
|
+
export declare const Media: {
|
2
|
+
"blog-media-block": {
|
3
|
+
type: string;
|
4
|
+
additionalProperties: boolean;
|
5
|
+
properties: {
|
6
|
+
formData: {
|
7
|
+
oneOf: ({
|
8
|
+
type: string;
|
9
|
+
optionName: string;
|
10
|
+
properties: {
|
11
|
+
yandex: {
|
12
|
+
type: string;
|
13
|
+
required: string[];
|
14
|
+
properties: {
|
15
|
+
id: {
|
16
|
+
type: string;
|
17
|
+
};
|
18
|
+
containerId: {
|
19
|
+
type: string;
|
20
|
+
};
|
21
|
+
type: {};
|
22
|
+
when: {
|
23
|
+
type: string;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
};
|
27
|
+
hubspot?: undefined;
|
28
|
+
};
|
29
|
+
} | {
|
30
|
+
type: string;
|
31
|
+
optionName: string;
|
32
|
+
properties: {
|
33
|
+
hubspot: {
|
34
|
+
type: string;
|
35
|
+
required: string[];
|
36
|
+
properties: {
|
37
|
+
region: {
|
38
|
+
type: string;
|
39
|
+
};
|
40
|
+
portalId: {
|
41
|
+
type: string;
|
42
|
+
};
|
43
|
+
formId: {
|
44
|
+
type: string;
|
45
|
+
};
|
46
|
+
formInstanceId: {
|
47
|
+
type: string;
|
48
|
+
};
|
49
|
+
type: {};
|
50
|
+
when: {
|
51
|
+
type: string;
|
52
|
+
};
|
53
|
+
};
|
54
|
+
};
|
55
|
+
yandex?: undefined;
|
56
|
+
};
|
57
|
+
})[];
|
58
|
+
};
|
59
|
+
border: {
|
60
|
+
type: string;
|
61
|
+
enum: string[];
|
62
|
+
};
|
63
|
+
paddingTop: {
|
64
|
+
type: string;
|
65
|
+
enum: string[];
|
66
|
+
};
|
67
|
+
paddingBottom: {
|
68
|
+
type: string;
|
69
|
+
enum: string[];
|
70
|
+
};
|
71
|
+
fullWidth: {
|
72
|
+
type: string;
|
73
|
+
};
|
74
|
+
column: {
|
75
|
+
type: string;
|
76
|
+
enum: string[];
|
77
|
+
};
|
78
|
+
qa: {
|
79
|
+
type: string;
|
80
|
+
};
|
81
|
+
anchor: {
|
82
|
+
type: string;
|
83
|
+
additionalProperties: boolean;
|
84
|
+
required: string[];
|
85
|
+
properties: {
|
86
|
+
text: {
|
87
|
+
type: string;
|
88
|
+
contentType: string;
|
89
|
+
};
|
90
|
+
url: {
|
91
|
+
type: string;
|
92
|
+
};
|
93
|
+
urlTitle: {
|
94
|
+
type: string;
|
95
|
+
};
|
96
|
+
};
|
97
|
+
};
|
98
|
+
visible: {
|
99
|
+
type: string;
|
100
|
+
enum: string[];
|
101
|
+
};
|
102
|
+
resetPaddings: {
|
103
|
+
type: string;
|
104
|
+
};
|
105
|
+
context: {
|
106
|
+
type: string;
|
107
|
+
};
|
108
|
+
indent: {
|
109
|
+
type: string;
|
110
|
+
additionalProperties: boolean;
|
111
|
+
properties: {
|
112
|
+
top: {
|
113
|
+
enum: string[];
|
114
|
+
};
|
115
|
+
bottom: {
|
116
|
+
enum: string[];
|
117
|
+
};
|
118
|
+
};
|
119
|
+
};
|
120
|
+
type: {};
|
121
|
+
when: {
|
122
|
+
type: string;
|
123
|
+
};
|
124
|
+
};
|
125
|
+
};
|
126
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { validators } from '@gravity-ui/page-constructor';
|
2
|
+
import { BlockType } from '../../models/common';
|
3
|
+
import { BlogBlockBase } from '../../schema/common';
|
4
|
+
const { common: { BlockBaseProps }, components: { YandexFormProps }, subBlocks: { HubspotFormProps }, } = validators;
|
5
|
+
export const Media = {
|
6
|
+
[BlockType.Media]: {
|
7
|
+
type: 'object',
|
8
|
+
additionalProperties: false,
|
9
|
+
properties: Object.assign(Object.assign(Object.assign({}, BlockBaseProps), BlogBlockBase), { formData: {
|
10
|
+
oneOf: [
|
11
|
+
{
|
12
|
+
type: 'object',
|
13
|
+
optionName: 'yandex',
|
14
|
+
properties: {
|
15
|
+
yandex: YandexFormProps,
|
16
|
+
},
|
17
|
+
},
|
18
|
+
{
|
19
|
+
type: 'object',
|
20
|
+
optionName: 'hubspot',
|
21
|
+
properties: {
|
22
|
+
hubspot: HubspotFormProps,
|
23
|
+
},
|
24
|
+
},
|
25
|
+
],
|
26
|
+
}, border: {
|
27
|
+
type: 'string',
|
28
|
+
enum: ['shadow', 'line', 'none'],
|
29
|
+
} }),
|
30
|
+
},
|
31
|
+
};
|
@@ -450,20 +450,10 @@ export declare const Header: {
|
|
450
450
|
type: string;
|
451
451
|
};
|
452
452
|
height: {
|
453
|
-
oneOf: ({
|
454
|
-
type: string;
|
455
|
-
enum?: undefined;
|
456
|
-
} | {
|
457
|
-
type: string;
|
458
|
-
enum: string[];
|
459
|
-
})[];
|
460
|
-
};
|
461
|
-
width: {
|
462
453
|
type: string;
|
463
454
|
};
|
464
|
-
|
455
|
+
width: {
|
465
456
|
type: string;
|
466
|
-
enum: string[];
|
467
457
|
};
|
468
458
|
};
|
469
459
|
};
|
@@ -264,20 +264,10 @@ export declare const Media: {
|
|
264
264
|
type: string;
|
265
265
|
};
|
266
266
|
height: {
|
267
|
-
oneOf: ({
|
268
|
-
type: string;
|
269
|
-
enum?: undefined;
|
270
|
-
} | {
|
271
|
-
type: string;
|
272
|
-
enum: string[];
|
273
|
-
})[];
|
274
|
-
};
|
275
|
-
width: {
|
276
267
|
type: string;
|
277
268
|
};
|
278
|
-
|
269
|
+
width: {
|
279
270
|
type: string;
|
280
|
-
enum: string[];
|
281
271
|
};
|
282
272
|
};
|
283
273
|
};
|
@@ -10,6 +10,7 @@ declare const _default: {
|
|
10
10
|
"blog-suggest-block": ({ paddingTop, paddingBottom }: import("../models/blocks").SuggestProps) => import("react").JSX.Element | null;
|
11
11
|
"blog-meta-block": (props: import("../models/blocks").MetaProps) => import("react").JSX.Element;
|
12
12
|
"blog-feed-block": ({ image }: import("../models/blocks").FeedProps) => import("react").JSX.Element;
|
13
|
+
"blog-form-block": ({ paddingTop, paddingBottom, ...props }: import("../models/blocks").FormProps) => import("react").JSX.Element | null;
|
13
14
|
};
|
14
15
|
headers: {
|
15
16
|
"blog-header-block": (props: import("../models/blocks").HeaderProps) => import("react").JSX.Element;
|
@@ -3,6 +3,7 @@ import { Banner } from '../blocks/Banner/Banner';
|
|
3
3
|
import { CTA } from '../blocks/CTA/CTA';
|
4
4
|
import { ColoredText } from '../blocks/ColoredText/ColoredText';
|
5
5
|
import { Feed } from '../blocks/Feed/Feed';
|
6
|
+
import { Form } from '../blocks/Form/Form';
|
6
7
|
import { Header } from '../blocks/Header/Header';
|
7
8
|
import { Layout } from '../blocks/Layout/Layout';
|
8
9
|
import { Media } from '../blocks/Media/Media';
|
@@ -21,6 +22,7 @@ const blocks = {
|
|
21
22
|
[BlockType.Suggest]: Suggest,
|
22
23
|
[BlockType.Meta]: Meta,
|
23
24
|
[BlockType.Feed]: Feed,
|
25
|
+
[BlockType.Form]: Form,
|
24
26
|
};
|
25
27
|
const headers = {
|
26
28
|
[BlockType.Header]: Header,
|
@@ -11,6 +11,7 @@ export declare const useExtendedComponentMap: (custom: CustomConfig | undefined)
|
|
11
11
|
"blog-suggest-block": ({ paddingTop, paddingBottom }: import("../models/blocks").SuggestProps) => import("react").JSX.Element | null;
|
12
12
|
"blog-meta-block": (props: import("../models/blocks").MetaProps) => import("react").JSX.Element;
|
13
13
|
"blog-feed-block": ({ image }: import("../models/blocks").FeedProps) => import("react").JSX.Element;
|
14
|
+
"blog-form-block": ({ paddingTop, paddingBottom, ...props }: import("../models/blocks").FormProps) => import("react").JSX.Element | null;
|
14
15
|
};
|
15
16
|
headers: {
|
16
17
|
"blog-header-block": (props: import("../models/blocks").HeaderProps) => import("react").JSX.Element;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ReactElement } from 'react';
|
2
|
-
import { ContentBlockProps, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
2
|
+
import { ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
3
3
|
import { BlockType, ClassNameProps, PostData, QAProps } from './common';
|
4
4
|
import { PaddingsYFMProps } from './paddings';
|
5
5
|
export type AuthorProps = ClassNameProps & {
|
@@ -27,7 +27,7 @@ export type LayoutProps = {
|
|
27
27
|
mobileOrder?: string;
|
28
28
|
children: ReactElement[];
|
29
29
|
} & PaddingsYFMProps;
|
30
|
-
export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'
|
30
|
+
export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'>> & {
|
31
31
|
text?: string;
|
32
32
|
};
|
33
33
|
export type MetaProps = QAProps & {
|
@@ -43,6 +43,10 @@ export type YFMProps = {
|
|
43
43
|
export type FeedProps = {
|
44
44
|
image: string;
|
45
45
|
};
|
46
|
+
export type FormProps = {
|
47
|
+
formData: FormBlockData;
|
48
|
+
border?: 'shadow' | 'line' | 'none';
|
49
|
+
} & PaddingsYFMProps & QAProps;
|
46
50
|
export type AuthorBlockModel = {
|
47
51
|
type: BlockType.Author;
|
48
52
|
} & AuthorProps;
|
@@ -76,6 +80,9 @@ export type YFMBlockModel = {
|
|
76
80
|
export type FeedBlockModel = {
|
77
81
|
type: BlockType.Feed;
|
78
82
|
} & FeedProps;
|
83
|
+
export type FormBlockModel = {
|
84
|
+
type: BlockType.Form;
|
85
|
+
} & FormProps;
|
79
86
|
export type BlockModel = AuthorBlockModel | BannerBlockModel | ColoredTextBlockModel | CTABlockModel | HeaderBlockModel | LayoutBlockModel | MediaBlockModel | MetaBlockModel | SuggestBlockModel | YFMBlockModel | FeedBlockModel;
|
80
87
|
export type Block = BlockModel & {
|
81
88
|
[x: string]: any;
|
@@ -96,7 +96,8 @@ export declare enum BlockType {
|
|
96
96
|
Author = "blog-author-block",
|
97
97
|
Suggest = "blog-suggest-block",
|
98
98
|
Meta = "blog-meta-block",
|
99
|
-
Feed = "blog-feed-block"
|
99
|
+
Feed = "blog-feed-block",
|
100
|
+
Form = "blog-form-block"
|
100
101
|
}
|
101
102
|
export type MetaProps = {
|
102
103
|
metaComponent: JSX.Element;
|
@@ -16,6 +16,7 @@ export var BlockType;
|
|
16
16
|
BlockType["Suggest"] = "blog-suggest-block";
|
17
17
|
BlockType["Meta"] = "blog-meta-block";
|
18
18
|
BlockType["Feed"] = "blog-feed-block";
|
19
|
+
BlockType["Form"] = "blog-form-block";
|
19
20
|
})(BlockType || (BlockType = {}));
|
20
21
|
export var DefaultEventNames;
|
21
22
|
(function (DefaultEventNames) {
|
@@ -458,20 +458,10 @@ export declare const schemasForCustom: {
|
|
458
458
|
type: string;
|
459
459
|
};
|
460
460
|
height: {
|
461
|
-
oneOf: ({
|
462
|
-
type: string;
|
463
|
-
enum?: undefined;
|
464
|
-
} | {
|
465
|
-
type: string;
|
466
|
-
enum: string[];
|
467
|
-
})[];
|
468
|
-
};
|
469
|
-
width: {
|
470
461
|
type: string;
|
471
462
|
};
|
472
|
-
|
463
|
+
width: {
|
473
464
|
type: string;
|
474
|
-
enum: string[];
|
475
465
|
};
|
476
466
|
};
|
477
467
|
};
|
@@ -1598,20 +1588,10 @@ export declare const schemasForCustom: {
|
|
1598
1588
|
type: string;
|
1599
1589
|
};
|
1600
1590
|
height: {
|
1601
|
-
oneOf: ({
|
1602
|
-
type: string;
|
1603
|
-
enum?: undefined;
|
1604
|
-
} | {
|
1605
|
-
type: string;
|
1606
|
-
enum: string[];
|
1607
|
-
})[];
|
1608
|
-
};
|
1609
|
-
width: {
|
1610
1591
|
type: string;
|
1611
1592
|
};
|
1612
|
-
|
1593
|
+
width: {
|
1613
1594
|
type: string;
|
1614
|
-
enum: string[];
|
1615
1595
|
};
|
1616
1596
|
};
|
1617
1597
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gravity-ui/blog-constructor",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.13.0",
|
4
4
|
"description": "Gravity UI Blog Constructor",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -62,7 +62,6 @@
|
|
62
62
|
"@bem-react/classname": "^1.6.0",
|
63
63
|
"@gravity-ui/components": "^2.8.0",
|
64
64
|
"@gravity-ui/i18n": "^1.1.0",
|
65
|
-
"@gravity-ui/page-constructor": "^4.43.2-alpha.0",
|
66
65
|
"lodash": "^4.17.21",
|
67
66
|
"react-helmet": "^6.1.0",
|
68
67
|
"ua-parser-js": "^0.7.28",
|
@@ -72,6 +71,7 @@
|
|
72
71
|
},
|
73
72
|
"peerDependencies": {
|
74
73
|
"@doc-tools/transform": "^3.3.2",
|
74
|
+
"@gravity-ui/page-constructor": "^4.45.0",
|
75
75
|
"@gravity-ui/uikit": "^5.12.0",
|
76
76
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
77
77
|
},
|
@@ -82,6 +82,7 @@
|
|
82
82
|
"@commitlint/config-conventional": "^17.4.3",
|
83
83
|
"@doc-tools/transform": "^3.11.0",
|
84
84
|
"@gravity-ui/eslint-config": "^3.1.1",
|
85
|
+
"@gravity-ui/page-constructor": "^4.46.0",
|
85
86
|
"@gravity-ui/prettier-config": "^1.1.0",
|
86
87
|
"@gravity-ui/stylelint-config": "^4.0.1",
|
87
88
|
"@gravity-ui/tsconfig": "^1.0.0",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ReactElement } from 'react';
|
2
|
-
import { ContentBlockProps, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
2
|
+
import { ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
3
3
|
import { BlockType, ClassNameProps, PostData, QAProps } from './common';
|
4
4
|
import { PaddingsYFMProps } from './paddings';
|
5
5
|
export type AuthorProps = ClassNameProps & {
|
@@ -27,7 +27,7 @@ export type LayoutProps = {
|
|
27
27
|
mobileOrder?: string;
|
28
28
|
children: ReactElement[];
|
29
29
|
} & PaddingsYFMProps;
|
30
|
-
export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'
|
30
|
+
export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'>> & {
|
31
31
|
text?: string;
|
32
32
|
};
|
33
33
|
export type MetaProps = QAProps & {
|
@@ -43,6 +43,10 @@ export type YFMProps = {
|
|
43
43
|
export type FeedProps = {
|
44
44
|
image: string;
|
45
45
|
};
|
46
|
+
export type FormProps = {
|
47
|
+
formData: FormBlockData;
|
48
|
+
border?: 'shadow' | 'line' | 'none';
|
49
|
+
} & PaddingsYFMProps & QAProps;
|
46
50
|
export type AuthorBlockModel = {
|
47
51
|
type: BlockType.Author;
|
48
52
|
} & AuthorProps;
|
@@ -76,6 +80,9 @@ export type YFMBlockModel = {
|
|
76
80
|
export type FeedBlockModel = {
|
77
81
|
type: BlockType.Feed;
|
78
82
|
} & FeedProps;
|
83
|
+
export type FormBlockModel = {
|
84
|
+
type: BlockType.Form;
|
85
|
+
} & FormProps;
|
79
86
|
export type BlockModel = AuthorBlockModel | BannerBlockModel | ColoredTextBlockModel | CTABlockModel | HeaderBlockModel | LayoutBlockModel | MediaBlockModel | MetaBlockModel | SuggestBlockModel | YFMBlockModel | FeedBlockModel;
|
80
87
|
export type Block = BlockModel & {
|
81
88
|
[x: string]: any;
|
@@ -96,7 +96,8 @@ export declare enum BlockType {
|
|
96
96
|
Author = "blog-author-block",
|
97
97
|
Suggest = "blog-suggest-block",
|
98
98
|
Meta = "blog-meta-block",
|
99
|
-
Feed = "blog-feed-block"
|
99
|
+
Feed = "blog-feed-block",
|
100
|
+
Form = "blog-form-block"
|
100
101
|
}
|
101
102
|
export type MetaProps = {
|
102
103
|
metaComponent: JSX.Element;
|
package/server/models/common.js
CHANGED
@@ -19,6 +19,7 @@ var BlockType;
|
|
19
19
|
BlockType["Suggest"] = "blog-suggest-block";
|
20
20
|
BlockType["Meta"] = "blog-meta-block";
|
21
21
|
BlockType["Feed"] = "blog-feed-block";
|
22
|
+
BlockType["Form"] = "blog-form-block";
|
22
23
|
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
23
24
|
var DefaultEventNames;
|
24
25
|
(function (DefaultEventNames) {
|