@gravity-ui/page-constructor 4.36.0-alpha.1 → 4.37.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/README.md +10 -0
- package/build/cjs/blocks/Companies/Companies.css +0 -16
- package/build/cjs/blocks/Companies/Companies.d.ts +1 -1
- package/build/cjs/blocks/Companies/Companies.js +2 -2
- package/build/cjs/blocks/Icons/Icons.d.ts +1 -1
- package/build/cjs/blocks/Icons/Icons.js +2 -2
- package/build/cjs/blocks/Tabs/Tabs.css +37 -3
- package/build/cjs/blocks/Tabs/Tabs.js +18 -21
- package/build/cjs/components/Image/Image.d.ts +1 -2
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/components/ImageBase/ImageBase.d.ts +1 -2
- package/build/cjs/components/Media/Image/Image.d.ts +0 -1
- package/build/cjs/components/Media/Image/Image.js +2 -2
- package/build/cjs/components/Media/Media.js +3 -4
- package/build/cjs/components/RootCn/index.d.ts +4 -0
- package/build/cjs/components/RootCn/index.js +11 -0
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +0 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +2 -2
- package/build/cjs/constructor-items.d.ts +2 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.js +2 -3
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +2 -0
- package/build/cjs/navigation/components/Navigation/Navigation.css +0 -3
- package/build/cjs/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/cjs/navigation/components/Navigation/Navigation.js +2 -2
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +2 -2
- package/build/cjs/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +7 -0
- package/build/cjs/navigation/components/NavigationItem/hooks/useNavigationItemMap.js +13 -0
- package/build/cjs/navigation/components/Standalone/index.d.ts +3 -0
- package/build/cjs/navigation/components/Standalone/index.js +9 -0
- package/build/cjs/navigation/containers/Layout/Layout.css +7 -2
- package/build/cjs/navigation/containers/Layout/Layout.js +1 -1
- package/build/cjs/navigation/index.d.ts +1 -0
- package/build/cjs/navigation/index.js +8 -0
- package/build/cjs/text-transform/config.js +2 -7
- package/build/cjs/utils/cn.d.ts +1 -0
- package/build/cjs/utils/cn.js +3 -1
- package/build/esm/blocks/Companies/Companies.css +0 -16
- package/build/esm/blocks/Companies/Companies.d.ts +1 -1
- package/build/esm/blocks/Companies/Companies.js +3 -3
- package/build/esm/blocks/Icons/Icons.d.ts +1 -1
- package/build/esm/blocks/Icons/Icons.js +2 -2
- package/build/esm/blocks/Tabs/Tabs.css +37 -3
- package/build/esm/blocks/Tabs/Tabs.js +19 -22
- package/build/esm/components/Image/Image.d.ts +1 -2
- package/build/esm/components/Image/Image.js +3 -3
- package/build/esm/components/ImageBase/ImageBase.d.ts +1 -2
- package/build/esm/components/Media/Image/Image.d.ts +0 -1
- package/build/esm/components/Media/Image/Image.js +2 -2
- package/build/esm/components/Media/Media.js +3 -4
- package/build/esm/components/RootCn/index.d.ts +4 -0
- package/build/esm/components/RootCn/index.js +8 -0
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +0 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +2 -2
- package/build/esm/constructor-items.d.ts +2 -2
- package/build/esm/containers/PageConstructor/PageConstructor.js +3 -4
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/models/constructor-items/blocks.d.ts +2 -0
- package/build/esm/navigation/components/Navigation/Navigation.css +0 -3
- package/build/esm/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/esm/navigation/components/Navigation/Navigation.js +2 -2
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +3 -3
- package/build/esm/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +7 -0
- package/build/esm/navigation/components/NavigationItem/hooks/useNavigationItemMap.js +8 -0
- package/build/esm/navigation/components/Standalone/index.d.ts +3 -0
- package/build/esm/navigation/components/Standalone/index.js +6 -0
- package/build/esm/navigation/containers/Layout/Layout.css +7 -2
- package/build/esm/navigation/containers/Layout/Layout.js +1 -1
- package/build/esm/navigation/index.d.ts +1 -0
- package/build/esm/navigation/index.js +1 -0
- package/build/esm/text-transform/config.js +2 -7
- package/build/esm/utils/cn.d.ts +1 -0
- package/build/esm/utils/cn.js +2 -0
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +2 -0
- package/server/text-transform/config.js +2 -7
- package/server/utils/cn.d.ts +1 -0
- package/server/utils/cn.js +3 -1
- package/widget/index.js +1 -1
- package/build/cjs/blocks/Tabs/TabsTextContent/TabsTextContent.css +0 -24
- package/build/cjs/blocks/Tabs/TabsTextContent/TabsTextContent.d.ts +0 -10
- package/build/cjs/blocks/Tabs/TabsTextContent/TabsTextContent.js +0 -17
- package/build/esm/blocks/Tabs/TabsTextContent/TabsTextContent.css +0 -24
- package/build/esm/blocks/Tabs/TabsTextContent/TabsTextContent.d.ts +0 -11
- package/build/esm/blocks/Tabs/TabsTextContent/TabsTextContent.js +0 -13
|
@@ -156,6 +156,7 @@ exports.config = {
|
|
|
156
156
|
},
|
|
157
157
|
],
|
|
158
158
|
[models_1.BlockType.SliderBlock]: exports.blockHeaderTransformer,
|
|
159
|
+
[models_1.BlockType.CompaniesBlock]: exports.blockHeaderTransformer,
|
|
159
160
|
[models_1.BlockType.QuestionsBlock]: [
|
|
160
161
|
{
|
|
161
162
|
fields: ['title'],
|
|
@@ -301,11 +302,5 @@ exports.config = {
|
|
|
301
302
|
},
|
|
302
303
|
],
|
|
303
304
|
[models_1.BlockType.CardLayoutBlock]: exports.blockHeaderTransformer,
|
|
304
|
-
[models_1.BlockType.IconsBlock]:
|
|
305
|
-
{
|
|
306
|
-
fields: ['title'],
|
|
307
|
-
transformer: common_1.typografTransformer,
|
|
308
|
-
parser: parseTitle,
|
|
309
|
-
},
|
|
310
|
-
],
|
|
305
|
+
[models_1.BlockType.IconsBlock]: exports.blockHeaderTransformer,
|
|
311
306
|
};
|
package/build/cjs/utils/cn.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const NAMESPACE = "pc-";
|
|
2
2
|
export declare const cn: import("@bem-react/classname").ClassNameInitilizer;
|
|
3
3
|
export declare const block: import("@bem-react/classname").ClassNameInitilizer;
|
|
4
|
+
export declare const rootCn: import("@bem-react/classname").ClassNameFormatter;
|
|
4
5
|
export type CnBlock = ReturnType<typeof cn>;
|
package/build/cjs/utils/cn.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.block = exports.cn = exports.NAMESPACE = void 0;
|
|
3
|
+
exports.rootCn = exports.block = exports.cn = exports.NAMESPACE = void 0;
|
|
4
4
|
const classname_1 = require("@bem-react/classname");
|
|
5
|
+
const constants_1 = require("../components/constants");
|
|
5
6
|
exports.NAMESPACE = 'pc-';
|
|
6
7
|
exports.cn = (0, classname_1.withNaming)({ e: '__', m: '_' });
|
|
7
8
|
exports.block = (0, classname_1.withNaming)({ n: exports.NAMESPACE, e: '__', m: '_' });
|
|
9
|
+
exports.rootCn = (0, exports.cn)(constants_1.UIKIT_ROOT_CLASS);
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
.pc-companies-block__title {
|
|
2
|
-
margin: 0;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
/* use this for style redefinitions to awoid problems with
|
|
6
2
|
unpredictable css rules order in build */
|
|
7
3
|
.pc-companies-block {
|
|
8
4
|
text-align: center;
|
|
9
5
|
}
|
|
10
|
-
.pc-companies-block__title {
|
|
11
|
-
font-size: var(--g-text-display-2-font-size);
|
|
12
|
-
line-height: var(--g-text-display-2-line-height);
|
|
13
|
-
color: var(--pc-text-header-color);
|
|
14
|
-
font-weight: var(--g-text-accent-font-weight);
|
|
15
|
-
}
|
|
16
|
-
@media (max-width: 576px) {
|
|
17
|
-
.pc-companies-block__title {
|
|
18
|
-
font-size: var(--g-text-display-1-font-size);
|
|
19
|
-
line-height: var(--g-text-display-1-line-height);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
6
|
.pc-companies-block__images {
|
|
23
7
|
margin-top: 32px;
|
|
24
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CompaniesBlockProps } from '../../models';
|
|
2
2
|
import './Companies.css';
|
|
3
|
-
export declare const CompaniesBlock: ({ title, images, animated }: CompaniesBlockProps) => JSX.Element;
|
|
3
|
+
export declare const CompaniesBlock: ({ title, description, images, animated }: CompaniesBlockProps) => JSX.Element;
|
|
4
4
|
export default CompaniesBlock;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image } from '../../components';
|
|
2
|
+
import { Image, Title } from '../../components';
|
|
3
3
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
4
4
|
import { useTheme } from '../../context/theme';
|
|
5
5
|
import { block, getThemedValue } from '../../utils';
|
|
6
6
|
import './Companies.css';
|
|
7
7
|
const b = block('companies-block');
|
|
8
|
-
export const CompaniesBlock = ({ title, images, animated }) => {
|
|
8
|
+
export const CompaniesBlock = ({ title, description, images, animated }) => {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const themedImages = getThemedValue(images, theme) || {};
|
|
11
11
|
return (React.createElement(AnimateBlock, { className: b(), offset: 150, animate: animated },
|
|
12
12
|
React.createElement("div", { className: b('content') },
|
|
13
|
-
React.createElement(
|
|
13
|
+
React.createElement(Title, { title: title, subtitle: description, colSizes: { all: 12, sm: 12 } }),
|
|
14
14
|
React.createElement("div", { className: b('images') },
|
|
15
15
|
React.createElement(Image, Object.assign({}, themedImages, { className: b('image') }))))));
|
|
16
16
|
};
|
|
@@ -8,14 +8,14 @@ const b = block('icons-block');
|
|
|
8
8
|
const getItemContent = (item) => (React.createElement(Fragment, null,
|
|
9
9
|
React.createElement(Image, { className: b('image'), src: item.src }),
|
|
10
10
|
React.createElement("p", { className: b('text') }, item.text)));
|
|
11
|
-
const Icons = ({ title, size = 's', items }) => {
|
|
11
|
+
const Icons = ({ title, description, size = 's', items }) => {
|
|
12
12
|
const { hostname } = useContext(LocationContext);
|
|
13
13
|
const handleAnalytics = useAnalytics();
|
|
14
14
|
const onClick = useCallback(({ analyticsEvents, url }) => {
|
|
15
15
|
handleAnalytics(analyticsEvents, { url });
|
|
16
16
|
}, [handleAnalytics]);
|
|
17
17
|
return (React.createElement("div", { className: b({ size }) },
|
|
18
|
-
title && React.createElement(Title, { className: b('header'), title: title, colSizes: { all: 12 } }),
|
|
18
|
+
(title || description) && (React.createElement(Title, { className: b('header'), title: title, subtitle: description, colSizes: { all: 12 } })),
|
|
19
19
|
items.map((item) => {
|
|
20
20
|
const itemContent = getItemContent(item);
|
|
21
21
|
const { url, text } = item;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
2
|
+
margin: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
/* use this for style redefinitions to awoid problems with
|
|
2
6
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-tabs-
|
|
7
|
+
.pc-tabs-block__block-title {
|
|
4
8
|
margin-bottom: 24px;
|
|
5
9
|
}
|
|
6
|
-
.pc-tabs-
|
|
10
|
+
.pc-tabs-block__block-title_centered {
|
|
7
11
|
text-align: center;
|
|
8
12
|
}
|
|
9
|
-
.pc-tabs-
|
|
13
|
+
.pc-tabs-block__block-title_centered > * {
|
|
10
14
|
margin: 0 auto;
|
|
11
15
|
}
|
|
12
16
|
.pc-tabs-block__tabs {
|
|
@@ -40,6 +44,9 @@ unpredictable css rules order in build */
|
|
|
40
44
|
.pc-tabs-block__row_reverse {
|
|
41
45
|
flex-direction: row-reverse;
|
|
42
46
|
}
|
|
47
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content-wrapper {
|
|
48
|
+
margin: 24px 32px 0 0;
|
|
49
|
+
}
|
|
43
50
|
.pc-tabs-block__image {
|
|
44
51
|
width: 100%;
|
|
45
52
|
height: auto;
|
|
@@ -57,13 +64,40 @@ unpredictable css rules order in build */
|
|
|
57
64
|
margin: 12px 0 0;
|
|
58
65
|
color: var(--g-color-text-secondary);
|
|
59
66
|
}
|
|
67
|
+
.pc-tabs-block__content {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
}
|
|
71
|
+
.pc-tabs-block__content_centered {
|
|
72
|
+
margin: 0 auto;
|
|
73
|
+
}
|
|
60
74
|
.pc-tabs-block__col_centered {
|
|
61
75
|
margin: 0 auto;
|
|
62
76
|
}
|
|
77
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
78
|
+
margin: 24px 0 0 32px;
|
|
79
|
+
}
|
|
80
|
+
.pc-tabs-block__content-title {
|
|
81
|
+
margin: 0 auto 12px;
|
|
82
|
+
}
|
|
83
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
84
|
+
font-size: var(--g-text-header-1-font-size);
|
|
85
|
+
line-height: var(--g-text-header-1-line-height);
|
|
86
|
+
color: var(--pc-text-header-color);
|
|
87
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
88
|
+
}
|
|
89
|
+
|
|
63
90
|
@media (max-width: 769px) {
|
|
91
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
92
|
+
margin: 0 0 32px 0;
|
|
93
|
+
}
|
|
64
94
|
.pc-tabs-block__row_reverse {
|
|
65
95
|
flex-direction: column-reverse;
|
|
66
96
|
}
|
|
97
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content > * {
|
|
98
|
+
margin-top: 32px;
|
|
99
|
+
padding-bottom: 0;
|
|
100
|
+
}
|
|
67
101
|
}
|
|
68
102
|
@media (min-width: 769px) {
|
|
69
103
|
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__media {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment,
|
|
1
|
+
import React, { Fragment, useRef, useState } from 'react';
|
|
2
2
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
3
3
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
4
4
|
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
@@ -9,12 +9,12 @@ import Title from '../../components/Title/Title';
|
|
|
9
9
|
import { getHeight } from '../../components/VideoBlock/VideoBlock';
|
|
10
10
|
import { useTheme } from '../../context/theme';
|
|
11
11
|
import { Col, GridColumnOrderClasses, Row } from '../../grid';
|
|
12
|
+
import { Content } from '../../sub-blocks';
|
|
12
13
|
import { block, getThemedValue } from '../../utils';
|
|
13
|
-
import TabsTextContent from './TabsTextContent/TabsTextContent';
|
|
14
14
|
import './Tabs.css';
|
|
15
15
|
const b = block('tabs-block');
|
|
16
16
|
export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', contentSize = 's', }) => {
|
|
17
|
-
var _a
|
|
17
|
+
var _a;
|
|
18
18
|
const [activeTab, setActiveTab] = useState(items[0].tabName);
|
|
19
19
|
const [play, setPlay] = useState(false);
|
|
20
20
|
const theme = useTheme();
|
|
@@ -23,24 +23,11 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
23
23
|
const isReverse = direction === 'content-media';
|
|
24
24
|
const ref = useRef(null);
|
|
25
25
|
const mediaWidth = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
26
|
+
const mediaHeight = mediaWidth && getHeight(mediaWidth);
|
|
26
27
|
const captionId = useUniqId();
|
|
27
|
-
const themedMedia = getThemedValue(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media, theme);
|
|
28
|
-
const mediaVideoHeight = mediaWidth && getHeight(mediaWidth);
|
|
29
|
-
const setVideoHeight = !(themedMedia === null || themedMedia === void 0 ? void 0 : themedMedia.image) && !(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.image);
|
|
30
|
-
const [minImageHeight, setMinImageHeight] = useState((_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.offsetHeight);
|
|
31
|
-
// TODO remove property support activeTabData?.image. Use only activeTabData?.media?.image
|
|
32
28
|
let imageProps;
|
|
33
|
-
const handleImageHeight = useCallback(() => {
|
|
34
|
-
var _a;
|
|
35
|
-
setMinImageHeight((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetHeight);
|
|
36
|
-
}, []);
|
|
37
|
-
const onSelectTab = (id, e) => {
|
|
38
|
-
setActiveTab(id);
|
|
39
|
-
handleImageHeight();
|
|
40
|
-
e.currentTarget.scrollIntoView({ inline: 'center', behavior: 'smooth', block: 'nearest' });
|
|
41
|
-
};
|
|
42
29
|
if (activeTabData) {
|
|
43
|
-
const themedImage = getThemedValue(activeTabData
|
|
30
|
+
const themedImage = getThemedValue(activeTabData.image, theme);
|
|
44
31
|
imageProps = themedImage && getMediaImage(themedImage);
|
|
45
32
|
if (activeTabData.caption && imageProps) {
|
|
46
33
|
Object.assign(imageProps, {
|
|
@@ -50,18 +37,28 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
50
37
|
}
|
|
51
38
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
52
39
|
const showText = Boolean(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.text);
|
|
53
|
-
const textContent = activeTabData && showText && (React.createElement(
|
|
40
|
+
const textContent = activeTabData && showText && (React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content', { centered: centered }) },
|
|
41
|
+
React.createElement("div", { className: b('content-wrapper', {
|
|
42
|
+
margin: Boolean(((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps) && !isReverse),
|
|
43
|
+
}) },
|
|
44
|
+
React.createElement(Content, { title: activeTabData.title, text: activeTabData.text, additionalInfo: activeTabData.additionalInfo, size: contentSize, links: [
|
|
45
|
+
...(activeTabData.link ? [activeTabData.link] : []),
|
|
46
|
+
...(activeTabData.links || []),
|
|
47
|
+
], buttons: activeTabData.buttons, colSizes: { all: 12 } }))));
|
|
54
48
|
const mediaContent = showMedia && (React.createElement(Col, { sizes: { all: 12, md: 8 }, orders: {
|
|
55
49
|
all: GridColumnOrderClasses.Last,
|
|
56
50
|
md: GridColumnOrderClasses.First,
|
|
57
51
|
}, className: b('col', { centered: centered }) },
|
|
58
|
-
React.createElement("div", {
|
|
59
|
-
React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: setVideoHeight ? mediaVideoHeight : undefined, handleImageLoad: handleImageHeight }))))),
|
|
52
|
+
React.createElement("div", { ref: ref }, (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: mediaHeight })))),
|
|
60
53
|
imageProps && (React.createElement(Fragment, null,
|
|
61
54
|
React.createElement(FullscreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })))),
|
|
62
55
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && (React.createElement("p", { className: b('caption'), id: captionId }, activeTabData.caption))));
|
|
56
|
+
const onSelectTab = (id, e) => {
|
|
57
|
+
setActiveTab(id);
|
|
58
|
+
e.currentTarget.scrollIntoView({ inline: 'center', behavior: 'smooth', block: 'nearest' });
|
|
59
|
+
};
|
|
63
60
|
return (React.createElement(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
64
|
-
React.createElement(Title, { title: title, subtitle: description, className: b('title', { centered: centered }) }),
|
|
61
|
+
React.createElement(Title, { title: title, subtitle: description, className: b('block-title', { centered: centered }) }),
|
|
65
62
|
React.createElement(Row, null,
|
|
66
63
|
React.createElement(Col, { sizes: tabsColSizes },
|
|
67
64
|
React.createElement(ButtonTabs, { items: tabs, onSelectTab: onSelectTab, activeTab: activeTab, className: b('tabs', { centered: centered }) }))),
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { CSSProperties, MouseEventHandler
|
|
1
|
+
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
2
|
import { ImageDeviceProps, ImageObjectProps, QAProps } from '../../models';
|
|
3
3
|
export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps>, QAProps {
|
|
4
4
|
style?: CSSProperties;
|
|
5
5
|
className?: string;
|
|
6
6
|
onClick?: MouseEventHandler;
|
|
7
|
-
onLoad?: ReactEventHandler<HTMLDivElement>;
|
|
8
7
|
containerClassName?: string;
|
|
9
8
|
}
|
|
10
9
|
export interface DeviceSpecificFragmentProps extends QAProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment, useContext, useState
|
|
1
|
+
import React, { Fragment, useContext, useState } from 'react';
|
|
2
2
|
import { BREAKPOINTS } from '../../constants';
|
|
3
3
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
4
4
|
import { getQaAttrubutes } from '../../utils';
|
|
@@ -12,7 +12,7 @@ const DeviceSpecificFragment = ({ disableWebp, src, breakpoint, qa, }) => (React
|
|
|
12
12
|
React.createElement("source", { srcSet: src, media: `(max-width: ${breakpoint}px)`, "data-qa": qa })));
|
|
13
13
|
const Image = (props) => {
|
|
14
14
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
15
|
-
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick,
|
|
15
|
+
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa, } = props;
|
|
16
16
|
const [imgLoadingError, setImgLoadingError] = useState(false);
|
|
17
17
|
const src = imageSrc || desktop;
|
|
18
18
|
if (!src) {
|
|
@@ -27,6 +27,6 @@ const Image = (props) => {
|
|
|
27
27
|
mobile && (React.createElement(DeviceSpecificFragment, { src: mobile, disableWebp: disableWebp, breakpoint: BREAKPOINTS.sm, qa: qaAttributes.mobileSource })),
|
|
28
28
|
tablet && (React.createElement(DeviceSpecificFragment, { src: tablet, disableWebp: disableWebp, breakpoint: BREAKPOINTS.md, qa: qaAttributes.tabletSource })),
|
|
29
29
|
src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.desktopSourceCompressed })),
|
|
30
|
-
React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true)
|
|
30
|
+
React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
31
31
|
};
|
|
32
32
|
export default Image;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { CSSProperties, MouseEventHandler
|
|
1
|
+
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
2
|
import { ImageObjectProps } from '../../models';
|
|
3
3
|
export interface ImageBaseProps extends Partial<ImageObjectProps> {
|
|
4
4
|
style?: CSSProperties;
|
|
5
5
|
className?: string;
|
|
6
6
|
onClick?: MouseEventHandler;
|
|
7
|
-
onLoad?: ReactEventHandler<HTMLDivElement>;
|
|
8
7
|
onError?: () => void;
|
|
9
8
|
}
|
|
10
9
|
export declare const ImageBase: (props: ImageBaseProps) => JSX.Element;
|
|
@@ -12,7 +12,7 @@ import './Image.css';
|
|
|
12
12
|
const b = block('media-component-image');
|
|
13
13
|
export const defaultAnimatedDivQa = 'animated-div';
|
|
14
14
|
const Image = (props) => {
|
|
15
|
-
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, qa,
|
|
15
|
+
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, qa, } = props;
|
|
16
16
|
const qaAttributes = getQaAttrubutes(qa, 'fullscreen-image', 'animate', 'background-image', 'image-view', 'slider-block');
|
|
17
17
|
const [scrollY, setScrollY] = useState(0);
|
|
18
18
|
const [{ springScrollY }, springSetScrollY] = useSpring(() => ({
|
|
@@ -46,7 +46,7 @@ const Image = (props) => {
|
|
|
46
46
|
};
|
|
47
47
|
const imageOnly = (oneImage) => {
|
|
48
48
|
const imageData = getMediaImage(oneImage);
|
|
49
|
-
return (React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.imageView
|
|
49
|
+
return (React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.imageView })));
|
|
50
50
|
};
|
|
51
51
|
const imageSlider = (imageArray) => {
|
|
52
52
|
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
@@ -8,13 +8,13 @@ import Video from './Video/Video';
|
|
|
8
8
|
import './Media.css';
|
|
9
9
|
const b = block('Media');
|
|
10
10
|
export const Media = (props) => {
|
|
11
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, ratio, autoplay,
|
|
11
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, ratio, autoplay, } = props;
|
|
12
12
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
13
|
const qaAttributes = getQaAttrubutes(qa, 'video');
|
|
14
14
|
const content = useMemo(() => {
|
|
15
15
|
let result = [];
|
|
16
16
|
if (image) {
|
|
17
|
-
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image
|
|
17
|
+
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image }));
|
|
18
18
|
}
|
|
19
19
|
if (video) {
|
|
20
20
|
const videoProps = {
|
|
@@ -40,7 +40,7 @@ export const Media = (props) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
if (youtube) {
|
|
43
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen, analyticsEvents: analyticsEvents, autoplay: autoplay
|
|
43
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen, analyticsEvents: analyticsEvents, autoplay: autoplay }));
|
|
44
44
|
}
|
|
45
45
|
if (dataLens) {
|
|
46
46
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -69,7 +69,6 @@ export const Media = (props) => {
|
|
|
69
69
|
ratio,
|
|
70
70
|
youtubeClassName,
|
|
71
71
|
autoplay,
|
|
72
|
-
handleImageLoad,
|
|
73
72
|
]);
|
|
74
73
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa }, content));
|
|
75
74
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTheme } from '../../context/theme';
|
|
3
|
+
import { rootCn } from '../../utils';
|
|
4
|
+
const RootCn = ({ className, children }) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return React.createElement("div", { className: rootCn({ theme }, className) }, children);
|
|
7
|
+
};
|
|
8
|
+
export default RootCn;
|
|
@@ -17,7 +17,6 @@ export interface VideoBlockProps extends AnalyticsEventsBase {
|
|
|
17
17
|
height?: number;
|
|
18
18
|
fullscreen?: boolean;
|
|
19
19
|
autoplay?: boolean;
|
|
20
|
-
handleImageLoad?: () => void;
|
|
21
20
|
}
|
|
22
21
|
declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
|
|
23
22
|
export default VideoBlock;
|
|
@@ -37,7 +37,7 @@ export function getHeight(width) {
|
|
|
37
37
|
return (width / 16) * 9;
|
|
38
38
|
}
|
|
39
39
|
const VideoBlock = (props) => {
|
|
40
|
-
const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen, analyticsEvents, autoplay,
|
|
40
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen, analyticsEvents, autoplay, } = props;
|
|
41
41
|
const handleAnalytics = useAnalytics(DefaultEventNames.VideoPreview);
|
|
42
42
|
const src = getVideoSrc(stream, record);
|
|
43
43
|
const ref = useRef(null);
|
|
@@ -91,7 +91,7 @@ const VideoBlock = (props) => {
|
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullscreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
94
|
-
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper')
|
|
94
|
+
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
95
95
|
playButton || (React.createElement("button", { title: "Play", className: b('button') },
|
|
96
96
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
97
97
|
};
|
|
@@ -4,13 +4,13 @@ export declare const blockMap: {
|
|
|
4
4
|
"promo-features-block": (props: import("./models").PromoFeaturesProps) => JSX.Element;
|
|
5
5
|
"questions-block": (props: import("./models").QuestionsProps) => JSX.Element;
|
|
6
6
|
"banner-block": (props: import("./models").BannerBlockProps) => JSX.Element;
|
|
7
|
-
"companies-block": ({ title, images, animated }: import("./models").CompaniesBlockProps) => JSX.Element;
|
|
7
|
+
"companies-block": ({ title, description, images, animated }: import("./models").CompaniesBlockProps) => JSX.Element;
|
|
8
8
|
"media-block": (props: import("./models").MediaBlockProps) => JSX.Element;
|
|
9
9
|
"info-block": (props: import("./models").InfoBlockProps) => JSX.Element;
|
|
10
10
|
"table-block": (props: import("./models").TableBlockProps) => JSX.Element;
|
|
11
11
|
"tabs-block": ({ items, title, description, animated, tabsColSizes, centered, direction, contentSize, }: import("./models").TabsBlockProps) => JSX.Element;
|
|
12
12
|
"header-block": (props: import("./models").WithChildren<import("./models").HeaderBlockProps & import("./models").ClassNameProps>) => JSX.Element;
|
|
13
|
-
"icons-block": ({ title, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
13
|
+
"icons-block": ({ title, description, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
14
14
|
"header-slider-block": ({ items, arrows, ...props }: import("./models").HeaderSliderBlockProps) => JSX.Element;
|
|
15
15
|
"card-layout-block": import("react").FC<import("./blocks/CardLayout/CardLayout").CardLayoutBlockProps>;
|
|
16
16
|
"content-layout-block": (props: import("./models").ContentLayoutBlockProps) => JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import '@doc-tools/transform/dist/js/yfm';
|
|
4
4
|
import BackgroundMedia from '../../components/BackgroundMedia/BackgroundMedia';
|
|
5
|
-
import
|
|
5
|
+
import RootCn from '../../components/RootCn';
|
|
6
6
|
import { blockMap, navItemMap, subBlockMap } from '../../constructor-items';
|
|
7
7
|
import { AnimateContext } from '../../context/animateContext';
|
|
8
8
|
import { InnerContext } from '../../context/innerContext';
|
|
@@ -10,13 +10,12 @@ import { useTheme } from '../../context/theme';
|
|
|
10
10
|
import { Grid } from '../../grid';
|
|
11
11
|
import { BlockType, BlockTypes, HeaderBlockTypes, NavigationItemTypes, SubBlockTypes, } from '../../models';
|
|
12
12
|
import Layout from '../../navigation/containers/Layout/Layout';
|
|
13
|
-
import {
|
|
13
|
+
import { block as cnBlock, getCustomItems, getCustomTypes, getHeaderBlock, getOrderedBlocks, getThemedValue, } from '../../utils';
|
|
14
14
|
import { ConstructorBlocks } from './components/ConstructorBlocks';
|
|
15
15
|
import { ConstructorHeader } from './components/ConstructorItem';
|
|
16
16
|
import { ConstructorRow } from './components/ConstructorRow';
|
|
17
17
|
import './PageConstructor.css';
|
|
18
18
|
const b = cnBlock('page-constructor');
|
|
19
|
-
const ycr = blockOrigin(UIKIT_ROOT_CLASS);
|
|
20
19
|
export const Constructor = (props) => {
|
|
21
20
|
const { content: { blocks = [], background = {} } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
|
|
22
21
|
const { context } = useMemo(() => ({
|
|
@@ -42,7 +41,7 @@ export const Constructor = (props) => {
|
|
|
42
41
|
const restBlocks = getOrderedBlocks(blocks, context.headerBlockTypes);
|
|
43
42
|
const themedBackground = getThemedValue(background, theme);
|
|
44
43
|
return (React.createElement(InnerContext.Provider, { value: context },
|
|
45
|
-
React.createElement(
|
|
44
|
+
React.createElement(RootCn, null,
|
|
46
45
|
React.createElement("div", { className: b('wrapper') },
|
|
47
46
|
themedBackground && (React.createElement(BackgroundMedia, Object.assign({}, themedBackground, { className: b('background') }))),
|
|
48
47
|
React.createElement(Layout, { navigation: navigation },
|
package/build/esm/index.d.ts
CHANGED
package/build/esm/index.js
CHANGED
|
@@ -154,6 +154,7 @@ export interface BannerBlockProps extends BannerCardProps, Animatable {
|
|
|
154
154
|
}
|
|
155
155
|
export interface CompaniesBlockProps extends Animatable {
|
|
156
156
|
title: string;
|
|
157
|
+
description?: string;
|
|
157
158
|
images: ThemeSupporting<ImageDeviceProps>;
|
|
158
159
|
}
|
|
159
160
|
export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
|
|
@@ -254,6 +255,7 @@ export interface IconsBlockItemProps extends AnalyticsEventsBase {
|
|
|
254
255
|
}
|
|
255
256
|
export interface IconsBlockProps {
|
|
256
257
|
title?: string;
|
|
258
|
+
description?: string;
|
|
257
259
|
size?: 's' | 'm' | 'l';
|
|
258
260
|
items: IconsBlockItemProps[];
|
|
259
261
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HeaderData, ThemedNavigationLogoData } from '../../../models';
|
|
2
|
+
import { ClassNameProps, HeaderData, ThemedNavigationLogoData } from '../../../models';
|
|
3
3
|
import './Navigation.css';
|
|
4
|
-
export interface NavigationProps {
|
|
4
|
+
export interface NavigationProps extends ClassNameProps {
|
|
5
5
|
logo: ThemedNavigationLogoData;
|
|
6
6
|
data: HeaderData;
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ import DesktopNavigation from '../DesktopNavigation/DesktopNavigation';
|
|
|
8
8
|
import MobileNavigation from '../MobileNavigation/MobileNavigation';
|
|
9
9
|
import './Navigation.css';
|
|
10
10
|
const b = block('navigation');
|
|
11
|
-
export const Navigation = ({ data, logo }) => {
|
|
11
|
+
export const Navigation = ({ data, logo, className }) => {
|
|
12
12
|
const { leftItems, rightItems, iconSize = 20, withBorder = false } = data;
|
|
13
13
|
const [isSidebarOpened, setIsSidebarOpened] = useState(false);
|
|
14
14
|
const [activeItemId, setActiveItemId] = useState(undefined);
|
|
@@ -30,7 +30,7 @@ export const Navigation = ({ data, logo }) => {
|
|
|
30
30
|
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
31
31
|
return () => window.removeEventListener('scroll', scrollHandler);
|
|
32
32
|
});
|
|
33
|
-
return (React.createElement(Grid, { className: b({ 'with-border': showBorder }) },
|
|
33
|
+
return (React.createElement(Grid, { className: b({ 'with-border': showBorder }, className) },
|
|
34
34
|
React.createElement(Row, null,
|
|
35
35
|
React.createElement(Col, null,
|
|
36
36
|
React.createElement("nav", null,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import omit from 'lodash/omit';
|
|
4
4
|
import { BlockIdContext } from '../../../context/blockIdContext';
|
|
5
|
-
import { InnerContext } from '../../../context/innerContext';
|
|
6
5
|
import { NavigationItemType } from '../../../models';
|
|
7
6
|
import { block } from '../../../utils';
|
|
7
|
+
import { useNavigationItemMap } from './hooks/useNavigationItemMap';
|
|
8
8
|
import './NavigationItem.css';
|
|
9
9
|
const b = block('navigation-item');
|
|
10
10
|
const ANALYTICS_ID = 'navigation';
|
|
11
11
|
const NavigationItem = (_a) => {
|
|
12
12
|
var { data, className, menuLayout } = _a, props = __rest(_a, ["data", "className", "menuLayout"]);
|
|
13
13
|
const { type = NavigationItemType.Link } = data;
|
|
14
|
-
const
|
|
14
|
+
const navItemMap = useNavigationItemMap();
|
|
15
15
|
const Component = navItemMap[type];
|
|
16
16
|
const componentProps = useMemo(() => {
|
|
17
17
|
const componentProperties = Object.assign(Object.assign({}, data), props);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useNavigationItemMap: () => {
|
|
2
|
+
button: import("react").FC<Pick<import("../../../models").NavigationItemProps, "className"> & import("../../../..").ButtonProps>;
|
|
3
|
+
social: import("react").FC<import("../../SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
|
|
4
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("../../../models").NavigationItemProps & import("../../../..").NavigationDropdownItem) => JSX.Element;
|
|
5
|
+
link: import("react").FC<import("../../../models").NavigationItemProps & import("../../../..").NavigationLinkItem>;
|
|
6
|
+
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("../../../models").NavigationItemProps & import("../../../..").NavigationGithubButton) => JSX.Element;
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import isEmpty from 'lodash/isEmpty';
|
|
3
|
+
import { navItemMap as NavItemMapDefault } from '../../../../constructor-items';
|
|
4
|
+
import { InnerContext } from '../../../../context/innerContext';
|
|
5
|
+
export const useNavigationItemMap = () => {
|
|
6
|
+
const { navItemMap } = useContext(InnerContext);
|
|
7
|
+
return isEmpty(navItemMap) ? NavItemMapDefault : navItemMap;
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import RootCn from '../../../components/RootCn';
|
|
3
|
+
import Navigation from './../../components/Navigation/Navigation';
|
|
4
|
+
const Standalone = (props) => (React.createElement(RootCn, null,
|
|
5
|
+
React.createElement(Navigation, Object.assign({}, props))));
|
|
6
|
+
export default Standalone;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
.layout {
|
|
1
|
+
.pc-layout {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
min-height: 100vh;
|
|
5
5
|
}
|
|
6
|
-
.layout__content {
|
|
6
|
+
.pc-layout__content {
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-grow: 1;
|
|
9
9
|
flex-direction: column;
|
|
10
|
+
}
|
|
11
|
+
.pc-layout__navigation {
|
|
12
|
+
position: sticky;
|
|
13
|
+
z-index: 98;
|
|
14
|
+
top: 0;
|
|
10
15
|
}
|