@gravity-ui/page-constructor 6.0.0-alpha.1 → 6.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/Slider/Slider.d.ts +3 -2
- package/build/cjs/blocks/index.d.ts +1 -0
- package/build/cjs/components/ContentList/ContentList.css +26 -9
- package/build/cjs/components/ContentList/ContentList.js +1 -1
- package/build/cjs/components/FullscreenMedia/FullscreenMedia.css +6 -2
- package/build/cjs/sub-blocks/PriceCard/PriceCard.js +1 -1
- package/build/cjs/text-transform/common.d.ts +3 -4
- package/build/cjs/text-transform/common.js +3 -30
- package/build/cjs/text-transform/config.d.ts +2 -5
- package/build/cjs/text-transform/config.js +11 -51
- package/build/cjs/text-transform/transformers.js +2 -2
- package/build/esm/blocks/Slider/Slider.d.ts +3 -2
- package/build/esm/blocks/Slider/Slider.js +4 -4
- package/build/esm/blocks/index.d.ts +1 -0
- package/build/esm/components/ContentList/ContentList.css +26 -9
- package/build/esm/components/ContentList/ContentList.js +1 -1
- package/build/esm/components/FullscreenMedia/FullscreenMedia.css +6 -2
- package/build/esm/sub-blocks/PriceCard/PriceCard.js +1 -1
- package/build/esm/text-transform/common.d.ts +3 -4
- package/build/esm/text-transform/common.js +3 -30
- package/build/esm/text-transform/config.d.ts +2 -5
- package/build/esm/text-transform/config.js +11 -51
- package/build/esm/text-transform/transformers.js +2 -2
- package/package.json +1 -1
- package/server/text-transform/common.d.ts +3 -4
- package/server/text-transform/common.js +3 -30
- package/server/text-transform/config.d.ts +2 -5
- package/server/text-transform/config.js +11 -51
- package/server/text-transform/transformers.js +2 -2
- package/widget/index.js +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Swiper } from 'swiper/react';
|
|
2
|
+
import { Swiper as SwiperReact } from 'swiper/react';
|
|
3
3
|
import { ClassNameProps, Refable, SliderProps as SliderParams } from '../../models';
|
|
4
4
|
import 'swiper/swiper-bundle.css';
|
|
5
|
-
export
|
|
5
|
+
export type { Swiper, SwiperOptions } from 'swiper';
|
|
6
|
+
export interface SliderProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperReact, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
6
7
|
type?: string;
|
|
7
8
|
anchorId?: string;
|
|
8
9
|
dotsClassName?: string;
|
|
@@ -5,6 +5,7 @@ export { default as MediaBlock } from './Media/Media';
|
|
|
5
5
|
export { default as MapBlock } from './Map/Map';
|
|
6
6
|
export { default as SliderOldBlock } from './SliderOld/SliderOld';
|
|
7
7
|
export { default as SliderBlock } from './Slider/Slider';
|
|
8
|
+
export type { Swiper, SwiperOptions } from './Slider/Slider';
|
|
8
9
|
export { default as ExtendedFeaturesBlock } from './ExtendedFeatures/ExtendedFeatures';
|
|
9
10
|
export { default as PromoFeaturesBlock } from './PromoFeaturesBlock/PromoFeaturesBlock';
|
|
10
11
|
export { default as QuestionsBlock } from './Questions/Questions';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
+
.pc-content-list_size_l {
|
|
4
|
+
max-width: 480px;
|
|
5
|
+
}
|
|
3
6
|
.pc-content-list_size_l .pc-content-list__title {
|
|
4
7
|
font-size: var(--g-text-header-1-font-size);
|
|
5
8
|
line-height: var(--g-text-header-1-line-height);
|
|
@@ -21,10 +24,21 @@ unpredictable css rules order in build */
|
|
|
21
24
|
.pc-content-list_size_l .pc-content-list__item_without-title .pc-content-list__icon {
|
|
22
25
|
width: 20px;
|
|
23
26
|
height: 20px;
|
|
24
|
-
margin-top:
|
|
25
|
-
margin-bottom:
|
|
27
|
+
margin-top: 2px;
|
|
28
|
+
margin-bottom: 2px;
|
|
26
29
|
margin-right: 8px;
|
|
27
30
|
}
|
|
31
|
+
.pc-content-list_size_l .pc-content-list__text {
|
|
32
|
+
font-size: var(--g-text-subheader-2-font-size);
|
|
33
|
+
line-height: var(--g-text-subheader-2-line-height);
|
|
34
|
+
}
|
|
35
|
+
.pc-content-list_size_l .pc-content-list__text_without-title {
|
|
36
|
+
font-size: var(--g-text-subheader-3-font-size);
|
|
37
|
+
line-height: var(--g-text-subheader-3-line-height);
|
|
38
|
+
}
|
|
39
|
+
.pc-content-list_size_s {
|
|
40
|
+
max-width: 440px;
|
|
41
|
+
}
|
|
28
42
|
.pc-content-list_size_s .pc-content-list__title {
|
|
29
43
|
font-size: var(--g-text-subheader-3-font-size);
|
|
30
44
|
line-height: var(--g-text-subheader-3-line-height);
|
|
@@ -46,8 +60,16 @@ unpredictable css rules order in build */
|
|
|
46
60
|
.pc-content-list_size_s .pc-content-list__item_without-title .pc-content-list__icon {
|
|
47
61
|
width: 18px;
|
|
48
62
|
height: 18px;
|
|
49
|
-
margin-top:
|
|
50
|
-
margin-bottom:
|
|
63
|
+
margin-top: 1px;
|
|
64
|
+
margin-bottom: 1px;
|
|
65
|
+
}
|
|
66
|
+
.pc-content-list_size_s .pc-content-list__text {
|
|
67
|
+
font-size: var(--g-text-body-1-font-size);
|
|
68
|
+
line-height: var(--g-text-body-1-line-height);
|
|
69
|
+
}
|
|
70
|
+
.pc-content-list_size_s .pc-content-list__text_without-title {
|
|
71
|
+
font-size: var(--g-text-subheader-2-font-size);
|
|
72
|
+
line-height: var(--g-text-subheader-2-line-height);
|
|
51
73
|
}
|
|
52
74
|
.pc-content-list_theme_light .pc-content-list__item *,
|
|
53
75
|
.pc-content-list_theme_light .pc-content-list__item .yfm,
|
|
@@ -73,11 +95,6 @@ unpredictable css rules order in build */
|
|
|
73
95
|
.pc-content-list_theme_dark .pc-content-list__item .yfm a:hover {
|
|
74
96
|
color: var(--g-color-text-light-secondary);
|
|
75
97
|
}
|
|
76
|
-
.pc-content-list_size_s.pc-content-list_size_s .pc-content-list__text {
|
|
77
|
-
font-size: var(--g-text-body-1-font-size);
|
|
78
|
-
line-height: var(--g-text-body-1-line-height);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
98
|
.pc-content-list__icon {
|
|
82
99
|
display: block;
|
|
83
100
|
}
|
|
@@ -26,7 +26,7 @@ const ContentList = ({ list, size = 'l', qa, theme }) => {
|
|
|
26
26
|
react_1.default.createElement("div", null,
|
|
27
27
|
title &&
|
|
28
28
|
react_1.default.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, react_1.default.createElement(YFMWrapper_1.default, { content: title, modifiers: { constructor: true } })),
|
|
29
|
-
text && (react_1.default.createElement(YFMWrapper_1.default, { contentClassName: b('text'), content: text, modifiers: { constructor: true }, qa: qaAttributes.text })))));
|
|
29
|
+
text && (react_1.default.createElement(YFMWrapper_1.default, { contentClassName: b('text', { 'without-title': !title }), content: text, modifiers: { constructor: true }, qa: qaAttributes.text })))));
|
|
30
30
|
})));
|
|
31
31
|
};
|
|
32
32
|
exports.default = ContentList;
|
|
@@ -26,8 +26,12 @@ unpredictable css rules order in build */
|
|
|
26
26
|
border-radius: var(--pc-border-radius);
|
|
27
27
|
}
|
|
28
28
|
.pc-full-screen-media__modal-media_type_youtube {
|
|
29
|
-
width: min(65vw, 1232px);
|
|
30
|
-
|
|
29
|
+
max-width: min(65vw, 1232px);
|
|
30
|
+
width: 100%;
|
|
31
|
+
aspect-ratio: 16/9;
|
|
32
|
+
height: calc(
|
|
33
|
+
min(65vw, 1232px) * 9 / 16
|
|
34
|
+
) !important; /* stylelint-disable-line declaration-no-important */
|
|
31
35
|
}
|
|
32
36
|
.pc-full-screen-media__modal .g-modal__content, .pc-full-screen-media__modal-image {
|
|
33
37
|
border-radius: var(--pc-border-radius);
|
|
@@ -26,7 +26,7 @@ const PriceCard = (props) => {
|
|
|
26
26
|
react_1.default.createElement(components_1.ContentList, { list: list.map((item) => ({
|
|
27
27
|
icon: Check_1.default,
|
|
28
28
|
text: item,
|
|
29
|
-
})), size: "
|
|
29
|
+
})), size: "s" }))) : null),
|
|
30
30
|
react_1.default.createElement(components_1.Buttons, { className: b('buttons'), buttons: buttons, size: "s" }),
|
|
31
31
|
react_1.default.createElement(components_1.Links, { className: b('links'), links: links, size: "s" })))));
|
|
32
32
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { MarkdownItPluginCb } from '@diplodoc/transform/lib/plugins/typings';
|
|
2
2
|
import { Lang } from './types';
|
|
3
3
|
export type ComplexItem = {
|
|
4
|
-
[key: string]: string
|
|
4
|
+
[key: string]: string;
|
|
5
5
|
};
|
|
6
6
|
export type Item = string | null | ComplexItem;
|
|
7
7
|
export type Transformer = (text: string) => string;
|
|
8
8
|
export type TransformerRaw = (lang: Lang, content: string, options: {
|
|
9
9
|
plugins: MarkdownItPluginCb[];
|
|
10
|
-
renderInline?: boolean;
|
|
11
10
|
}) => string;
|
|
12
11
|
export type Parser<T = any> = (transformer: Transformer, block: T) => T;
|
|
13
12
|
export declare const createItemsParser: (fields: string[]) => (transformer: Transformer, items: Item[]) => (string | {
|
|
14
|
-
[x: string]: string
|
|
13
|
+
[x: string]: string;
|
|
15
14
|
} | null)[];
|
|
16
15
|
export declare function yfmTransformer(lang: Lang, content: string, options?: {
|
|
17
16
|
plugins?: MarkdownItPluginCb[];
|
|
18
|
-
}
|
|
17
|
+
}): string;
|
|
19
18
|
export declare function typografTransformer(lang: Lang, content: string): string;
|
|
@@ -13,47 +13,20 @@ const createItemsParser = (fields) => (transformer, items) => items.map((item) =
|
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
15
|
return Object.assign(Object.assign({}, item), fields.reduce((acc, fieldName) => {
|
|
16
|
-
if (fieldName
|
|
17
|
-
const [firstProperty, secondProperty] = fieldName.split('.');
|
|
18
|
-
const root = item[firstProperty];
|
|
19
|
-
if (!root || typeof root !== 'object') {
|
|
20
|
-
return acc;
|
|
21
|
-
}
|
|
22
|
-
if (Array.isArray(root)) {
|
|
23
|
-
if (!acc[firstProperty]) {
|
|
24
|
-
// eslint-disable-next-line no-param-reassign
|
|
25
|
-
acc[firstProperty] = [];
|
|
26
|
-
}
|
|
27
|
-
// eslint-disable-next-line no-param-reassign
|
|
28
|
-
acc[firstProperty] = root.map((subItem) => (Object.assign(Object.assign({}, subItem), { [secondProperty]: typeof subItem[secondProperty] === 'string'
|
|
29
|
-
? transformer(subItem[secondProperty])
|
|
30
|
-
: subItem[secondProperty] })));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// eslint-disable-next-line no-param-reassign
|
|
34
|
-
acc[firstProperty] = Object.assign(Object.assign({}, root), { [secondProperty]: typeof root[secondProperty] === 'string'
|
|
35
|
-
? transformer(root[secondProperty])
|
|
36
|
-
: root[secondProperty] });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else if (item[fieldName]) {
|
|
16
|
+
if (item[fieldName]) {
|
|
40
17
|
// eslint-disable-next-line no-param-reassign
|
|
41
|
-
acc[fieldName] =
|
|
42
|
-
typeof item[fieldName] === 'string'
|
|
43
|
-
? transformer(item[fieldName])
|
|
44
|
-
: item[fieldName];
|
|
18
|
+
acc[fieldName] = transformer(item[fieldName]);
|
|
45
19
|
}
|
|
46
20
|
return acc;
|
|
47
21
|
}, {}));
|
|
48
22
|
}
|
|
49
23
|
});
|
|
50
24
|
exports.createItemsParser = createItemsParser;
|
|
51
|
-
function yfmTransformer(lang, content, options = {}
|
|
25
|
+
function yfmTransformer(lang, content, options = {}) {
|
|
52
26
|
const { plugins = [] } = options;
|
|
53
27
|
const { html } = (0, utils_1.fullTransform)(content, {
|
|
54
28
|
lang,
|
|
55
29
|
plugins: [...plugins_1.default, ...plugins],
|
|
56
|
-
renderInline,
|
|
57
30
|
});
|
|
58
31
|
return html;
|
|
59
32
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TitleItemProps } from '../models';
|
|
2
|
-
import { Parser, Transformer, TransformerRaw, yfmTransformer } from './common';
|
|
2
|
+
import { Parser, Transformer, TransformerRaw, typografTransformer, yfmTransformer } from './common';
|
|
3
3
|
export declare const blockHeaderTransformer: ({
|
|
4
4
|
fields: string[];
|
|
5
|
-
transformer: typeof
|
|
5
|
+
transformer: typeof typografTransformer;
|
|
6
6
|
parser: (transformer: Transformer, title: TitleItemProps | string) => string | {
|
|
7
7
|
text: string;
|
|
8
8
|
navTitle?: string | undefined;
|
|
@@ -14,18 +14,15 @@ export declare const blockHeaderTransformer: ({
|
|
|
14
14
|
custom?: import("react").ReactNode;
|
|
15
15
|
onClick?: (() => void) | undefined;
|
|
16
16
|
};
|
|
17
|
-
renderInline: boolean;
|
|
18
17
|
} | {
|
|
19
18
|
fields: string[];
|
|
20
19
|
transformer: typeof yfmTransformer;
|
|
21
20
|
parser?: undefined;
|
|
22
|
-
renderInline?: undefined;
|
|
23
21
|
})[];
|
|
24
22
|
interface BlockConfig {
|
|
25
23
|
transformer: TransformerRaw;
|
|
26
24
|
fields?: string[];
|
|
27
25
|
parser?: Parser;
|
|
28
|
-
renderInline?: boolean;
|
|
29
26
|
}
|
|
30
27
|
export type BlocksConfig = Record<string, BlockConfig | BlockConfig[]>;
|
|
31
28
|
export declare const config: BlocksConfig;
|
|
@@ -6,26 +6,10 @@ exports.config = exports.blockHeaderTransformer = void 0;
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const models_1 = require("../models");
|
|
8
8
|
const common_1 = require("./common");
|
|
9
|
-
function
|
|
9
|
+
function parseTableBlock(transformer, content) {
|
|
10
10
|
const legend = content === null || content === void 0 ? void 0 : content.legend;
|
|
11
11
|
return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
|
|
12
12
|
}
|
|
13
|
-
function parseTableBlockContent(transformer, content) {
|
|
14
|
-
const legend = content === null || content === void 0 ? void 0 : content.legend;
|
|
15
|
-
const tableContent = content === null || content === void 0 ? void 0 : content.content;
|
|
16
|
-
return Object.assign(Object.assign({}, (content || {})), { content: tableContent &&
|
|
17
|
-
tableContent.map((row, i) => row.map((cell, j) => {
|
|
18
|
-
if (legend) {
|
|
19
|
-
if (i === 0 || j === 0) {
|
|
20
|
-
return transformer(cell);
|
|
21
|
-
}
|
|
22
|
-
return cell;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return transformer(cell);
|
|
26
|
-
}
|
|
27
|
-
})) });
|
|
28
|
-
}
|
|
29
13
|
function parseFeatures(transformer, items) {
|
|
30
14
|
return items.map((_a) => {
|
|
31
15
|
var { title, text } = _a, rest = tslib_1.__rest(_a, ["title", "text"]);
|
|
@@ -100,9 +84,8 @@ function parseContentLayoutTitle(transformer, content) {
|
|
|
100
84
|
exports.blockHeaderTransformer = [
|
|
101
85
|
{
|
|
102
86
|
fields: ['title'],
|
|
103
|
-
transformer: common_1.
|
|
87
|
+
transformer: common_1.typografTransformer,
|
|
104
88
|
parser: parseTitle,
|
|
105
|
-
renderInline: true,
|
|
106
89
|
},
|
|
107
90
|
{
|
|
108
91
|
fields: ['description'],
|
|
@@ -159,30 +142,26 @@ exports.config = {
|
|
|
159
142
|
],
|
|
160
143
|
[models_1.SubBlockType.Quote]: [
|
|
161
144
|
{
|
|
162
|
-
fields: ['text'
|
|
145
|
+
fields: ['text'],
|
|
146
|
+
transformer: common_1.typografTransformer,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
fields: ['yfmText'],
|
|
163
150
|
transformer: common_1.yfmTransformer,
|
|
164
|
-
renderInline: true,
|
|
165
151
|
},
|
|
166
152
|
],
|
|
167
153
|
[models_1.BlockType.ExtendedFeaturesBlock]: [
|
|
168
154
|
...exports.blockHeaderTransformer,
|
|
169
155
|
{
|
|
170
156
|
fields: ['items'],
|
|
171
|
-
transformer: common_1.
|
|
157
|
+
transformer: common_1.typografTransformer,
|
|
172
158
|
parser: (0, common_1.createItemsParser)(['title']),
|
|
173
|
-
renderInline: true,
|
|
174
159
|
},
|
|
175
160
|
{
|
|
176
161
|
fields: ['items'],
|
|
177
162
|
transformer: common_1.yfmTransformer,
|
|
178
163
|
parser: (0, common_1.createItemsParser)(['text', 'additionalInfo']),
|
|
179
164
|
},
|
|
180
|
-
{
|
|
181
|
-
fields: ['items'],
|
|
182
|
-
transformer: common_1.yfmTransformer,
|
|
183
|
-
parser: (0, common_1.createItemsParser)(['list.text']),
|
|
184
|
-
renderInline: true,
|
|
185
|
-
},
|
|
186
165
|
],
|
|
187
166
|
[models_1.BlockType.PromoFeaturesBlock]: [
|
|
188
167
|
...exports.blockHeaderTransformer,
|
|
@@ -212,8 +191,7 @@ exports.config = {
|
|
|
212
191
|
[models_1.BlockType.BannerBlock]: [
|
|
213
192
|
{
|
|
214
193
|
fields: ['title'],
|
|
215
|
-
transformer: common_1.
|
|
216
|
-
renderInline: true,
|
|
194
|
+
transformer: common_1.typografTransformer,
|
|
217
195
|
},
|
|
218
196
|
{
|
|
219
197
|
fields: ['subtitle'],
|
|
@@ -266,13 +244,7 @@ exports.config = {
|
|
|
266
244
|
{
|
|
267
245
|
fields: ['table'],
|
|
268
246
|
transformer: common_1.yfmTransformer,
|
|
269
|
-
parser:
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
fields: ['table'],
|
|
273
|
-
transformer: common_1.yfmTransformer,
|
|
274
|
-
parser: parseTableBlockContent,
|
|
275
|
-
renderInline: true,
|
|
247
|
+
parser: parseTableBlock,
|
|
276
248
|
},
|
|
277
249
|
],
|
|
278
250
|
[models_1.BlockType.HeaderSliderBlock]: [
|
|
@@ -298,11 +270,6 @@ exports.config = {
|
|
|
298
270
|
fields: ['description'],
|
|
299
271
|
transformer: common_1.yfmTransformer,
|
|
300
272
|
},
|
|
301
|
-
{
|
|
302
|
-
fields: ['overtitle', 'title'],
|
|
303
|
-
transformer: common_1.yfmTransformer,
|
|
304
|
-
renderInline: true,
|
|
305
|
-
},
|
|
306
273
|
],
|
|
307
274
|
[models_1.BlockType.ContentLayoutBlock]: [
|
|
308
275
|
{
|
|
@@ -356,20 +323,13 @@ exports.config = {
|
|
|
356
323
|
[models_1.SubBlockType.PriceCard]: [
|
|
357
324
|
{
|
|
358
325
|
fields: ['title'],
|
|
359
|
-
transformer: common_1.
|
|
360
|
-
renderInline: true,
|
|
326
|
+
transformer: common_1.typografTransformer,
|
|
361
327
|
},
|
|
362
328
|
{
|
|
363
329
|
fields: ['list'],
|
|
364
330
|
transformer: common_1.yfmTransformer,
|
|
365
331
|
parser: (0, common_1.createItemsParser)(['text']),
|
|
366
332
|
},
|
|
367
|
-
{
|
|
368
|
-
fields: ['list'],
|
|
369
|
-
transformer: common_1.yfmTransformer,
|
|
370
|
-
parser: (0, common_1.createItemsParser)(['title']),
|
|
371
|
-
renderInline: true,
|
|
372
|
-
},
|
|
373
333
|
],
|
|
374
334
|
[models_1.BlockType.FormBlock]: [
|
|
375
335
|
{
|
|
@@ -22,10 +22,10 @@ function transformBlock(lang, blocksConfig, block, plugins) {
|
|
|
22
22
|
if (blockConfig) {
|
|
23
23
|
const configs = Array.isArray(blockConfig) ? blockConfig : [blockConfig];
|
|
24
24
|
configs.forEach((transformConfig) => {
|
|
25
|
-
const { fields, transformer: transformerRaw, parser
|
|
25
|
+
const { fields, transformer: transformerRaw, parser } = transformConfig;
|
|
26
26
|
const transformer = (content) =>
|
|
27
27
|
// eslint-disable-next-line no-useless-call
|
|
28
|
-
transformerRaw.call(null, lang, content, { plugins
|
|
28
|
+
transformerRaw.call(null, lang, content, { plugins });
|
|
29
29
|
if (fields) {
|
|
30
30
|
fields.forEach((field) => {
|
|
31
31
|
if (block[field]) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Swiper } from 'swiper/react';
|
|
2
|
+
import { Swiper as SwiperReact } from 'swiper/react';
|
|
3
3
|
import { ClassNameProps, Refable, SliderProps as SliderParams } from '../../models';
|
|
4
4
|
import './Slider.css';
|
|
5
5
|
import 'swiper/swiper-bundle.css';
|
|
6
|
-
export
|
|
6
|
+
export type { Swiper, SwiperOptions } from 'swiper';
|
|
7
|
+
export interface SliderProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperReact, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
7
8
|
type?: string;
|
|
8
9
|
anchorId?: string;
|
|
9
10
|
dotsClassName?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
2
|
+
import Swiper, { A11y, Autoplay, Pagination } from 'swiper';
|
|
3
|
+
import { Swiper as SwiperReact, SwiperSlide } from 'swiper/react';
|
|
4
4
|
import Anchor from '../../components/Anchor/Anchor';
|
|
5
5
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
6
6
|
import Title from '../../components/Title/Title';
|
|
@@ -13,7 +13,7 @@ import { useSliderPagination } from './useSliderPagination';
|
|
|
13
13
|
import './Slider.css';
|
|
14
14
|
import 'swiper/swiper-bundle.css';
|
|
15
15
|
const b = block('SliderBlock');
|
|
16
|
-
|
|
16
|
+
Swiper.use([Autoplay, A11y, Pagination]);
|
|
17
17
|
export const SliderBlock = ({ animated, title, description, type, anchorId, arrows = true, adaptive, autoplay: autoplayMs, dots = true, initialSlide = 0, className, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }) => {
|
|
18
18
|
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper, onImagesReady, onPrev, onNext, setIsLocked, } = useSlider({
|
|
19
19
|
slidesToShow,
|
|
@@ -40,7 +40,7 @@ export const SliderBlock = ({ animated, title, description, type, anchorId, arro
|
|
|
40
40
|
anchorId && React.createElement(Anchor, { id: anchorId }),
|
|
41
41
|
React.createElement(Title, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }),
|
|
42
42
|
React.createElement(AnimateBlock, { className: b('animate-slides'), animate: animated },
|
|
43
|
-
React.createElement(
|
|
43
|
+
React.createElement(SwiperReact, Object.assign({ className: b('slider', className), onSwiper: onSwiper, speed: 1000, autoplay: autoplay, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, breakpoints: breakpoints, onSlideChange: onSlideChange, onSlideChangeTransitionStart: onSlideChangeTransitionStart, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onActiveIndexChange: onActiveIndexChange, onBreakpoint: onBreakpoint, onLock: () => setIsLocked(true), onUnlock: () => setIsLocked(false), onImagesReady: onImagesReady, watchSlidesVisibility: true, watchOverflow: true, a11y: {
|
|
44
44
|
slideLabelMessage: '',
|
|
45
45
|
paginationBulletMessage: i18n('dot-label', { index: '{{index}}' }),
|
|
46
46
|
} }, paginationProps), React.Children.map(children, (elem, index) => (React.createElement(SwiperSlide, { className: b('slide'), key: index }, ({ isVisible }) => (React.createElement("div", { className: b('slide-item'), "aria-hidden": !isA11yControlHidden && !isVisible }, elem)))))),
|
|
@@ -5,6 +5,7 @@ export { default as MediaBlock } from './Media/Media';
|
|
|
5
5
|
export { default as MapBlock } from './Map/Map';
|
|
6
6
|
export { default as SliderOldBlock } from './SliderOld/SliderOld';
|
|
7
7
|
export { default as SliderBlock } from './Slider/Slider';
|
|
8
|
+
export type { Swiper, SwiperOptions } from './Slider/Slider';
|
|
8
9
|
export { default as ExtendedFeaturesBlock } from './ExtendedFeatures/ExtendedFeatures';
|
|
9
10
|
export { default as PromoFeaturesBlock } from './PromoFeaturesBlock/PromoFeaturesBlock';
|
|
10
11
|
export { default as QuestionsBlock } from './Questions/Questions';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
+
.pc-content-list_size_l {
|
|
4
|
+
max-width: 480px;
|
|
5
|
+
}
|
|
3
6
|
.pc-content-list_size_l .pc-content-list__title {
|
|
4
7
|
font-size: var(--g-text-header-1-font-size);
|
|
5
8
|
line-height: var(--g-text-header-1-line-height);
|
|
@@ -21,10 +24,21 @@ unpredictable css rules order in build */
|
|
|
21
24
|
.pc-content-list_size_l .pc-content-list__item_without-title .pc-content-list__icon {
|
|
22
25
|
width: 20px;
|
|
23
26
|
height: 20px;
|
|
24
|
-
margin-top:
|
|
25
|
-
margin-bottom:
|
|
27
|
+
margin-top: 2px;
|
|
28
|
+
margin-bottom: 2px;
|
|
26
29
|
margin-right: 8px;
|
|
27
30
|
}
|
|
31
|
+
.pc-content-list_size_l .pc-content-list__text {
|
|
32
|
+
font-size: var(--g-text-subheader-2-font-size);
|
|
33
|
+
line-height: var(--g-text-subheader-2-line-height);
|
|
34
|
+
}
|
|
35
|
+
.pc-content-list_size_l .pc-content-list__text_without-title {
|
|
36
|
+
font-size: var(--g-text-subheader-3-font-size);
|
|
37
|
+
line-height: var(--g-text-subheader-3-line-height);
|
|
38
|
+
}
|
|
39
|
+
.pc-content-list_size_s {
|
|
40
|
+
max-width: 440px;
|
|
41
|
+
}
|
|
28
42
|
.pc-content-list_size_s .pc-content-list__title {
|
|
29
43
|
font-size: var(--g-text-subheader-3-font-size);
|
|
30
44
|
line-height: var(--g-text-subheader-3-line-height);
|
|
@@ -46,8 +60,16 @@ unpredictable css rules order in build */
|
|
|
46
60
|
.pc-content-list_size_s .pc-content-list__item_without-title .pc-content-list__icon {
|
|
47
61
|
width: 18px;
|
|
48
62
|
height: 18px;
|
|
49
|
-
margin-top:
|
|
50
|
-
margin-bottom:
|
|
63
|
+
margin-top: 1px;
|
|
64
|
+
margin-bottom: 1px;
|
|
65
|
+
}
|
|
66
|
+
.pc-content-list_size_s .pc-content-list__text {
|
|
67
|
+
font-size: var(--g-text-body-1-font-size);
|
|
68
|
+
line-height: var(--g-text-body-1-line-height);
|
|
69
|
+
}
|
|
70
|
+
.pc-content-list_size_s .pc-content-list__text_without-title {
|
|
71
|
+
font-size: var(--g-text-subheader-2-font-size);
|
|
72
|
+
line-height: var(--g-text-subheader-2-line-height);
|
|
51
73
|
}
|
|
52
74
|
.pc-content-list_theme_light .pc-content-list__item *,
|
|
53
75
|
.pc-content-list_theme_light .pc-content-list__item .yfm,
|
|
@@ -73,11 +95,6 @@ unpredictable css rules order in build */
|
|
|
73
95
|
.pc-content-list_theme_dark .pc-content-list__item .yfm a:hover {
|
|
74
96
|
color: var(--g-color-text-light-secondary);
|
|
75
97
|
}
|
|
76
|
-
.pc-content-list_size_s.pc-content-list_size_s .pc-content-list__text {
|
|
77
|
-
font-size: var(--g-text-body-1-font-size);
|
|
78
|
-
line-height: var(--g-text-body-1-line-height);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
98
|
.pc-content-list__icon {
|
|
82
99
|
display: block;
|
|
83
100
|
}
|
|
@@ -24,7 +24,7 @@ const ContentList = ({ list, size = 'l', qa, theme }) => {
|
|
|
24
24
|
React.createElement("div", null,
|
|
25
25
|
title &&
|
|
26
26
|
React.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, React.createElement(YFMWrapper, { content: title, modifiers: { constructor: true } })),
|
|
27
|
-
text && (React.createElement(YFMWrapper, { contentClassName: b('text'), content: text, modifiers: { constructor: true }, qa: qaAttributes.text })))));
|
|
27
|
+
text && (React.createElement(YFMWrapper, { contentClassName: b('text', { 'without-title': !title }), content: text, modifiers: { constructor: true }, qa: qaAttributes.text })))));
|
|
28
28
|
})));
|
|
29
29
|
};
|
|
30
30
|
export default ContentList;
|
|
@@ -26,8 +26,12 @@ unpredictable css rules order in build */
|
|
|
26
26
|
border-radius: var(--pc-border-radius);
|
|
27
27
|
}
|
|
28
28
|
.pc-full-screen-media__modal-media_type_youtube {
|
|
29
|
-
width: min(65vw, 1232px);
|
|
30
|
-
|
|
29
|
+
max-width: min(65vw, 1232px);
|
|
30
|
+
width: 100%;
|
|
31
|
+
aspect-ratio: 16/9;
|
|
32
|
+
height: calc(
|
|
33
|
+
min(65vw, 1232px) * 9 / 16
|
|
34
|
+
) !important; /* stylelint-disable-line declaration-no-important */
|
|
31
35
|
}
|
|
32
36
|
.pc-full-screen-media__modal .g-modal__content, .pc-full-screen-media__modal-image {
|
|
33
37
|
border-radius: var(--pc-border-radius);
|
|
@@ -24,7 +24,7 @@ const PriceCard = (props) => {
|
|
|
24
24
|
React.createElement(ContentList, { list: list.map((item) => ({
|
|
25
25
|
icon: Check,
|
|
26
26
|
text: item,
|
|
27
|
-
})), size: "
|
|
27
|
+
})), size: "s" }))) : null),
|
|
28
28
|
React.createElement(Buttons, { className: b('buttons'), buttons: buttons, size: "s" }),
|
|
29
29
|
React.createElement(Links, { className: b('links'), links: links, size: "s" })))));
|
|
30
30
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { MarkdownItPluginCb } from '@diplodoc/transform/lib/plugins/typings';
|
|
2
2
|
import { Lang } from './types';
|
|
3
3
|
export type ComplexItem = {
|
|
4
|
-
[key: string]: string
|
|
4
|
+
[key: string]: string;
|
|
5
5
|
};
|
|
6
6
|
export type Item = string | null | ComplexItem;
|
|
7
7
|
export type Transformer = (text: string) => string;
|
|
8
8
|
export type TransformerRaw = (lang: Lang, content: string, options: {
|
|
9
9
|
plugins: MarkdownItPluginCb[];
|
|
10
|
-
renderInline?: boolean;
|
|
11
10
|
}) => string;
|
|
12
11
|
export type Parser<T = any> = (transformer: Transformer, block: T) => T;
|
|
13
12
|
export declare const createItemsParser: (fields: string[]) => (transformer: Transformer, items: Item[]) => (string | {
|
|
14
|
-
[x: string]: string
|
|
13
|
+
[x: string]: string;
|
|
15
14
|
} | null)[];
|
|
16
15
|
export declare function yfmTransformer(lang: Lang, content: string, options?: {
|
|
17
16
|
plugins?: MarkdownItPluginCb[];
|
|
18
|
-
}
|
|
17
|
+
}): string;
|
|
19
18
|
export declare function typografTransformer(lang: Lang, content: string): string;
|
|
@@ -9,46 +9,19 @@ export const createItemsParser = (fields) => (transformer, items) => items.map((
|
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
11
|
return Object.assign(Object.assign({}, item), fields.reduce((acc, fieldName) => {
|
|
12
|
-
if (fieldName
|
|
13
|
-
const [firstProperty, secondProperty] = fieldName.split('.');
|
|
14
|
-
const root = item[firstProperty];
|
|
15
|
-
if (!root || typeof root !== 'object') {
|
|
16
|
-
return acc;
|
|
17
|
-
}
|
|
18
|
-
if (Array.isArray(root)) {
|
|
19
|
-
if (!acc[firstProperty]) {
|
|
20
|
-
// eslint-disable-next-line no-param-reassign
|
|
21
|
-
acc[firstProperty] = [];
|
|
22
|
-
}
|
|
23
|
-
// eslint-disable-next-line no-param-reassign
|
|
24
|
-
acc[firstProperty] = root.map((subItem) => (Object.assign(Object.assign({}, subItem), { [secondProperty]: typeof subItem[secondProperty] === 'string'
|
|
25
|
-
? transformer(subItem[secondProperty])
|
|
26
|
-
: subItem[secondProperty] })));
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// eslint-disable-next-line no-param-reassign
|
|
30
|
-
acc[firstProperty] = Object.assign(Object.assign({}, root), { [secondProperty]: typeof root[secondProperty] === 'string'
|
|
31
|
-
? transformer(root[secondProperty])
|
|
32
|
-
: root[secondProperty] });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else if (item[fieldName]) {
|
|
12
|
+
if (item[fieldName]) {
|
|
36
13
|
// eslint-disable-next-line no-param-reassign
|
|
37
|
-
acc[fieldName] =
|
|
38
|
-
typeof item[fieldName] === 'string'
|
|
39
|
-
? transformer(item[fieldName])
|
|
40
|
-
: item[fieldName];
|
|
14
|
+
acc[fieldName] = transformer(item[fieldName]);
|
|
41
15
|
}
|
|
42
16
|
return acc;
|
|
43
17
|
}, {}));
|
|
44
18
|
}
|
|
45
19
|
});
|
|
46
|
-
export function yfmTransformer(lang, content, options = {}
|
|
20
|
+
export function yfmTransformer(lang, content, options = {}) {
|
|
47
21
|
const { plugins = [] } = options;
|
|
48
22
|
const { html } = fullTransform(content, {
|
|
49
23
|
lang,
|
|
50
24
|
plugins: [...defaultPlugins, ...plugins],
|
|
51
|
-
renderInline,
|
|
52
25
|
});
|
|
53
26
|
return html;
|
|
54
27
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TitleItemProps } from '../models';
|
|
2
|
-
import { Parser, Transformer, TransformerRaw, yfmTransformer } from './common';
|
|
2
|
+
import { Parser, Transformer, TransformerRaw, typografTransformer, yfmTransformer } from './common';
|
|
3
3
|
export declare const blockHeaderTransformer: ({
|
|
4
4
|
fields: string[];
|
|
5
|
-
transformer: typeof
|
|
5
|
+
transformer: typeof typografTransformer;
|
|
6
6
|
parser: (transformer: Transformer, title: TitleItemProps | string) => string | {
|
|
7
7
|
text: string;
|
|
8
8
|
navTitle?: string | undefined;
|
|
@@ -14,18 +14,15 @@ export declare const blockHeaderTransformer: ({
|
|
|
14
14
|
custom?: import("react").ReactNode;
|
|
15
15
|
onClick?: (() => void) | undefined;
|
|
16
16
|
};
|
|
17
|
-
renderInline: boolean;
|
|
18
17
|
} | {
|
|
19
18
|
fields: string[];
|
|
20
19
|
transformer: typeof yfmTransformer;
|
|
21
20
|
parser?: undefined;
|
|
22
|
-
renderInline?: undefined;
|
|
23
21
|
})[];
|
|
24
22
|
interface BlockConfig {
|
|
25
23
|
transformer: TransformerRaw;
|
|
26
24
|
fields?: string[];
|
|
27
25
|
parser?: Parser;
|
|
28
|
-
renderInline?: boolean;
|
|
29
26
|
}
|
|
30
27
|
export type BlocksConfig = Record<string, BlockConfig | BlockConfig[]>;
|
|
31
28
|
export declare const config: BlocksConfig;
|