@gravity-ui/page-constructor 1.7.0 → 1.7.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -2
- package/build/cjs/blocks/Tabs/Tabs.css +57 -24
- package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +29 -27
- package/build/cjs/components/ButtonTabs/ButtonTabs.css +12 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +13 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +26 -0
- package/build/cjs/components/Image/Image.css +4 -0
- package/build/cjs/components/Image/Image.js +3 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +1 -1
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +9 -8
- package/build/cjs/text-transform/blocks.js +11 -4
- package/build/cjs/text-transform/utils.js +1 -1
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -2
- package/build/esm/blocks/Tabs/Tabs.css +57 -24
- package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +29 -27
- package/build/esm/components/ButtonTabs/ButtonTabs.css +12 -0
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +14 -0
- package/build/esm/components/ButtonTabs/ButtonTabs.js +24 -0
- package/build/esm/components/Image/Image.css +4 -0
- package/build/esm/components/Image/Image.d.ts +1 -0
- package/build/esm/components/Image/Image.js +4 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +9 -8
- package/build/esm/text-transform/blocks.js +11 -4
- package/build/esm/text-transform/utils.js +1 -1
- package/package.json +5 -2
- package/server/models/constructor-items/blocks.d.ts +9 -8
- package/server/text-transform/blocks.js +11 -4
- package/server/text-transform/utils.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.7.1](https://github.com/gravity-ui/page-constructor/compare/v1.7.0...v1.7.1) (2022-11-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **ExtendedFeatures:** add props ([6254d62](https://github.com/gravity-ui/page-constructor/commit/6254d62b9ceded154d0fdcded9a554fd33772d13))
|
|
9
|
+
* storybook content ([b98eccc](https://github.com/gravity-ui/page-constructor/commit/b98ecccc96cfba2376552e4c9314a559913455d9))
|
|
10
|
+
|
|
3
11
|
## [1.7.0](https://github.com/gravity-ui/page-constructor/compare/v1.6.1...v1.7.0) (2022-11-10)
|
|
4
12
|
|
|
5
13
|
|
|
@@ -21,7 +21,7 @@ const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_S
|
|
|
21
21
|
return (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
|
|
22
22
|
react_1.default.createElement(components_1.BlockHeader, { title: title, description: description, className: b('header') }),
|
|
23
23
|
react_1.default.createElement("div", { className: b('items') },
|
|
24
|
-
react_1.default.createElement(grid_1.Row, null, items.map(({ title: itemTitle, text, link, links, label, icon }) => {
|
|
24
|
+
react_1.default.createElement(grid_1.Row, null, items.map(({ title: itemTitle, text, link, links, label, icon, buttons, additionalInfo, }) => {
|
|
25
25
|
const itemLinks = links || [];
|
|
26
26
|
const iconThemed = icon && (0, utils_1.getThemedValue)(icon, theme);
|
|
27
27
|
const iconData = iconThemed && (0, utils_2.getMediaImage)(iconThemed);
|
|
@@ -34,7 +34,7 @@ const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_S
|
|
|
34
34
|
itemTitle && (react_1.default.createElement("h5", { className: b('item-title') },
|
|
35
35
|
react_1.default.createElement(components_1.HTML, null, itemTitle),
|
|
36
36
|
label && (react_1.default.createElement("div", { className: b('item-label') }, label)))),
|
|
37
|
-
react_1.default.createElement(sub_blocks_1.Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 } }))));
|
|
37
|
+
react_1.default.createElement(sub_blocks_1.Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 }, buttons: buttons, additionalInfo: additionalInfo }))));
|
|
38
38
|
})))));
|
|
39
39
|
};
|
|
40
40
|
exports.ExtendedFeaturesBlock = ExtendedFeaturesBlock;
|
|
@@ -1,68 +1,101 @@
|
|
|
1
|
-
.pc-
|
|
1
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
/* use this for style redefinitions to awoid problems with
|
|
6
6
|
unpredictable css rules order in build */
|
|
7
|
-
.pc-
|
|
8
|
-
margin-bottom:
|
|
7
|
+
.pc-tabs-block__block-title {
|
|
8
|
+
margin-bottom: 24px;
|
|
9
9
|
}
|
|
10
|
-
.pc-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
margin-bottom: 32px;
|
|
10
|
+
.pc-tabs-block__block-title_centered {
|
|
11
|
+
margin: 0 auto 12px;
|
|
12
|
+
text-align: center;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
.pc-tabs-block__tabs_centered {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
.pc-tabs-block__row_reverse {
|
|
19
|
+
flex-direction: row-reverse;
|
|
20
|
+
}
|
|
21
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content-wrapper {
|
|
22
|
+
margin: 24px 32px 0 0;
|
|
23
|
+
}
|
|
24
|
+
.pc-tabs-block__image {
|
|
17
25
|
width: 100%;
|
|
18
26
|
height: auto;
|
|
19
27
|
object-fit: cover;
|
|
20
28
|
display: block;
|
|
21
29
|
}
|
|
22
|
-
.pc-
|
|
30
|
+
.pc-tabs-block__image, .pc-tabs-block__media {
|
|
23
31
|
box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
|
|
24
32
|
overflow-x: hidden;
|
|
25
33
|
border-radius: var(--pc-border-radius);
|
|
26
34
|
}
|
|
27
|
-
.pc-
|
|
35
|
+
.pc-tabs-block__caption {
|
|
28
36
|
font-size: var(--yc-text-body-2-font-size);
|
|
29
37
|
line-height: var(--yc-text-body-2-line-height);
|
|
30
38
|
margin: 12px 0 0;
|
|
31
39
|
color: var(--yc-color-text-secondary);
|
|
32
40
|
}
|
|
33
|
-
.pc-
|
|
41
|
+
.pc-tabs-block__content {
|
|
34
42
|
display: flex;
|
|
35
43
|
flex-direction: column;
|
|
36
44
|
}
|
|
37
|
-
.pc-
|
|
45
|
+
.pc-tabs-block__content_centered {
|
|
46
|
+
margin: 0 auto;
|
|
47
|
+
}
|
|
48
|
+
.pc-tabs-block__col_centered {
|
|
49
|
+
margin: 0 auto;
|
|
50
|
+
}
|
|
51
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
38
52
|
margin: 24px 0 0 32px;
|
|
39
53
|
}
|
|
40
|
-
.pc-
|
|
54
|
+
.pc-tabs-block__content-title {
|
|
41
55
|
margin: 0 auto 12px;
|
|
42
56
|
}
|
|
43
|
-
.pc-
|
|
57
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
44
58
|
font-size: var(--yc-text-header-1-font-size);
|
|
45
59
|
line-height: var(--yc-text-header-1-line-height);
|
|
46
60
|
color: var(--pc-text-header-color);
|
|
47
61
|
font-weight: var(--yc-text-accent-font-weight);
|
|
48
62
|
}
|
|
49
63
|
|
|
50
|
-
.pc-TabsBlock__tabs, .pc-TabsBlock__link {
|
|
51
|
-
font-size: var(--yc-text-body-2-font-size);
|
|
52
|
-
line-height: var(--yc-text-body-2-line-height);
|
|
53
|
-
}
|
|
54
64
|
@media (max-width: 769px) {
|
|
55
|
-
.pc-
|
|
65
|
+
.pc-tabs-block__tabs {
|
|
66
|
+
display: flex;
|
|
67
|
+
overflow: auto;
|
|
68
|
+
margin-left: -48px;
|
|
69
|
+
margin-right: -48px;
|
|
70
|
+
padding-left: 48px;
|
|
71
|
+
padding-right: 40px;
|
|
72
|
+
}
|
|
73
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
56
74
|
margin: 0 0 32px 0;
|
|
57
75
|
}
|
|
76
|
+
.pc-tabs-block__row_reverse {
|
|
77
|
+
flex-direction: column-reverse;
|
|
78
|
+
}
|
|
79
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content > * {
|
|
80
|
+
margin-top: 32px;
|
|
81
|
+
padding-bottom: 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
@media (max-width: 577px) {
|
|
85
|
+
.pc-tabs-block__tabs {
|
|
86
|
+
margin-left: -24px;
|
|
87
|
+
margin-right: -24px;
|
|
88
|
+
padding-left: 24px;
|
|
89
|
+
padding-right: 16px;
|
|
90
|
+
}
|
|
58
91
|
}
|
|
59
92
|
@media (min-width: 769px) {
|
|
60
|
-
.pc-
|
|
93
|
+
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__media {
|
|
61
94
|
position: relative;
|
|
62
95
|
top: 100px;
|
|
63
96
|
opacity: 0;
|
|
64
97
|
}
|
|
65
|
-
.pc-
|
|
98
|
+
.pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__media {
|
|
66
99
|
top: 0;
|
|
67
100
|
opacity: 1;
|
|
68
101
|
transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
@@ -70,12 +103,12 @@ unpredictable css rules order in build */
|
|
|
70
103
|
}
|
|
71
104
|
}
|
|
72
105
|
@media (min-width: 769px) {
|
|
73
|
-
.pc-
|
|
106
|
+
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__image {
|
|
74
107
|
position: relative;
|
|
75
108
|
top: 100px;
|
|
76
109
|
opacity: 0;
|
|
77
110
|
}
|
|
78
|
-
.pc-
|
|
111
|
+
.pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__image {
|
|
79
112
|
top: 0;
|
|
80
113
|
opacity: 1;
|
|
81
114
|
transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TabsBlockProps } from '../../models';
|
|
2
|
-
export declare const TabsBlock: ({ items, title, description, animated }: TabsBlockProps) => JSX.Element;
|
|
2
|
+
export declare const TabsBlock: ({ items, title, description, animated, tabsColSizes, centered, direction, }: TabsBlockProps) => JSX.Element;
|
|
3
3
|
export default TabsBlock;
|
|
@@ -3,53 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TabsBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
-
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
6
|
const utils_1 = require("../../utils");
|
|
8
7
|
const grid_1 = require("../../grid");
|
|
9
|
-
const YFMWrapper_1 = (0, tslib_1.__importDefault)(require("../../components/YFMWrapper/YFMWrapper"));
|
|
10
8
|
const AnimateBlock_1 = (0, tslib_1.__importDefault)(require("../../components/AnimateBlock/AnimateBlock"));
|
|
11
9
|
const BlockHeader_1 = (0, tslib_1.__importDefault)(require("../../components/BlockHeader/BlockHeader"));
|
|
12
10
|
const FullscreenImage_1 = (0, tslib_1.__importDefault)(require("../../components/FullscreenImage/FullscreenImage"));
|
|
13
11
|
const Media_1 = (0, tslib_1.__importDefault)(require("../../components/Media/Media"));
|
|
14
|
-
const Links_1 = (0, tslib_1.__importDefault)(require("../../components/Link/Links"));
|
|
15
12
|
const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
16
13
|
const utils_2 = require("../../components/Media/Image/utils");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const ButtonTabs_1 = (0, tslib_1.__importDefault)(require("../../components/ButtonTabs/ButtonTabs"));
|
|
15
|
+
const sub_blocks_1 = require("../../sub-blocks");
|
|
16
|
+
const b = (0, utils_1.block)('tabs-block');
|
|
17
|
+
const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', }) => {
|
|
19
18
|
const [activeTab, setActiveTab] = (0, react_1.useState)(items[0].tabName);
|
|
20
19
|
const [play, setPlay] = (0, react_1.useState)(false);
|
|
21
20
|
const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
|
|
22
21
|
const tabs = items.map(({ tabName }) => ({ title: tabName, id: tabName }));
|
|
23
22
|
const activeTabData = items.find(({ tabName }) => tabName === activeTab);
|
|
23
|
+
const isReverse = direction === 'content-media';
|
|
24
24
|
let imageProps;
|
|
25
25
|
if (activeTabData) {
|
|
26
26
|
const themedImage = (0, utils_1.getThemedValue)(activeTabData.image, theme);
|
|
27
27
|
imageProps = themedImage && (0, utils_2.getMediaImage)(themedImage);
|
|
28
28
|
}
|
|
29
29
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
30
|
+
const showText = Boolean(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.text);
|
|
31
|
+
const textContent = activeTabData && showText && (react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content', { centered: centered }) },
|
|
32
|
+
react_1.default.createElement("div", { className: b('content-wrapper', {
|
|
33
|
+
margin: Boolean(((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps) && !isReverse),
|
|
34
|
+
}) },
|
|
35
|
+
react_1.default.createElement(sub_blocks_1.Content, { title: activeTabData.title, text: activeTabData.text, additionalInfo: activeTabData.additionalInfo, size: "s", links: [
|
|
36
|
+
...(activeTabData.link ? [activeTabData.link] : []),
|
|
37
|
+
...(activeTabData.links || []),
|
|
38
|
+
], buttons: activeTabData.buttons, colSizes: { all: 12 } }))));
|
|
39
|
+
const mediaContent = showMedia && (react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: 8 }, orders: {
|
|
40
|
+
all: grid_1.GridColumnOrderClasses.Last,
|
|
41
|
+
md: grid_1.GridColumnOrderClasses.First,
|
|
42
|
+
}, className: b('col', { centered: centered }) },
|
|
43
|
+
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (react_1.default.createElement(Media_1.default, Object.assign({}, (0, utils_1.getThemedValue)(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play }))),
|
|
44
|
+
imageProps && (react_1.default.createElement(react_1.Fragment, null,
|
|
45
|
+
react_1.default.createElement(FullscreenImage_1.default, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
46
|
+
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && (react_1.default.createElement("p", { className: b('caption') }, activeTabData.caption))))));
|
|
30
47
|
return (react_1.default.createElement(AnimateBlock_1.default, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
31
|
-
react_1.default.createElement(BlockHeader_1.default, { title: title, description: description, className: b('block-title') }),
|
|
32
|
-
react_1.default.createElement(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (react_1.default.createElement(Media_1.default, Object.assign({}, (0, utils_1.getThemedValue)(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play }))),
|
|
39
|
-
imageProps && (react_1.default.createElement(react_1.Fragment, null,
|
|
40
|
-
react_1.default.createElement(FullscreenImage_1.default, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
41
|
-
activeTabData && (react_1.default.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
|
|
42
|
-
react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
|
|
43
|
-
react_1.default.createElement("div", { className: b('content-wrapper', {
|
|
44
|
-
margin: Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps),
|
|
45
|
-
}) },
|
|
46
|
-
react_1.default.createElement("h4", { className: b('content-title') },
|
|
47
|
-
react_1.default.createElement(YFMWrapper_1.default, { content: activeTabData.title, modifiers: { constructor: true } })),
|
|
48
|
-
react_1.default.createElement(YFMWrapper_1.default, { content: activeTabData.text, modifiers: { constructor: true } }),
|
|
49
|
-
react_1.default.createElement(Links_1.default, { links: [
|
|
50
|
-
...(activeTabData.link ? [activeTabData.link] : []),
|
|
51
|
-
...(activeTabData.links || []),
|
|
52
|
-
], className: b('link') })))))));
|
|
48
|
+
react_1.default.createElement(BlockHeader_1.default, { title: title, description: description, className: b('block-title', { centered: centered }), colSizes: centered ? { all: 12 } : { all: 12, sm: 8 } }),
|
|
49
|
+
react_1.default.createElement(grid_1.Row, null,
|
|
50
|
+
react_1.default.createElement(grid_1.Col, { sizes: tabsColSizes },
|
|
51
|
+
react_1.default.createElement(ButtonTabs_1.default, { items: tabs, onSelectTab: setActiveTab, activeTab: activeTab, className: b('tabs', { centered: centered }) }))),
|
|
52
|
+
activeTabData && (react_1.default.createElement(grid_1.Row, { className: b('row', { reverse: isReverse }) },
|
|
53
|
+
mediaContent,
|
|
54
|
+
textContent))));
|
|
53
55
|
};
|
|
54
56
|
exports.TabsBlock = TabsBlock;
|
|
55
57
|
exports.default = exports.TabsBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-button-tabs {
|
|
4
|
+
margin-bottom: 20px;
|
|
5
|
+
}
|
|
6
|
+
.pc-button-tabs__item {
|
|
7
|
+
margin-right: 8px;
|
|
8
|
+
margin-bottom: 12px;
|
|
9
|
+
}
|
|
10
|
+
.pc-button-tabs__item_active {
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonProps } from '../../models';
|
|
2
|
+
export interface ButtonTabsItemProps extends Omit<ButtonProps, 'url' | 'primary' | 'target' | 'text'> {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ButtonTabsProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
items: ButtonTabsItemProps[];
|
|
9
|
+
activeTab?: string;
|
|
10
|
+
onSelectTab?: (tabId: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const ButtonTabs: (props: ButtonTabsProps) => JSX.Element;
|
|
13
|
+
export default ButtonTabs;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const index_1 = require("../index");
|
|
7
|
+
const b = (0, utils_1.block)('button-tabs');
|
|
8
|
+
const ButtonTabs = (props) => {
|
|
9
|
+
const { className, items, activeTab, onSelectTab } = props;
|
|
10
|
+
const activeTabId = (0, react_1.useMemo)(() => {
|
|
11
|
+
if (activeTab) {
|
|
12
|
+
return activeTab;
|
|
13
|
+
}
|
|
14
|
+
return items[0].id;
|
|
15
|
+
}, [activeTab, items]);
|
|
16
|
+
const handleClick = (0, react_1.useCallback)((tabId) => {
|
|
17
|
+
if (onSelectTab) {
|
|
18
|
+
onSelectTab(tabId);
|
|
19
|
+
}
|
|
20
|
+
}, [onSelectTab]);
|
|
21
|
+
return (react_1.default.createElement("div", { className: b(null, className) }, items.map((item) => {
|
|
22
|
+
const isActive = item.id === activeTabId;
|
|
23
|
+
return (react_1.default.createElement(index_1.Button, { text: item.title, className: b('item', { active: isActive }), key: item.title, size: 'l', onClick: () => handleClick(item.id), theme: isActive ? 'monochrome' : 'normal' }));
|
|
24
|
+
})));
|
|
25
|
+
};
|
|
26
|
+
exports.default = ButtonTabs;
|
|
@@ -4,6 +4,8 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
5
5
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const b = (0, utils_1.block)('image');
|
|
7
9
|
const checkWebP = (src) => {
|
|
8
10
|
return src.endsWith('.webp') ? src : src + '.webp';
|
|
9
11
|
};
|
|
@@ -20,7 +22,7 @@ const Image = (props) => {
|
|
|
20
22
|
disableCompress ||
|
|
21
23
|
imageSrc.endsWith('.svg') ||
|
|
22
24
|
imgLoadingError;
|
|
23
|
-
return (react_1.default.createElement("picture",
|
|
25
|
+
return (react_1.default.createElement("picture", { className: b() },
|
|
24
26
|
mobile && (react_1.default.createElement(react_1.Fragment, null,
|
|
25
27
|
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)` })),
|
|
26
28
|
react_1.default.createElement("source", { srcSet: mobile, media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)` }))),
|
|
@@ -53,7 +53,7 @@ const VideoBlock = (props) => {
|
|
|
53
53
|
}, [src, attributes]);
|
|
54
54
|
(0, react_1.useEffect)(() => {
|
|
55
55
|
const updateSize = lodash_1.default.debounce(() => {
|
|
56
|
-
setHeight(ref.current ? Math.
|
|
56
|
+
setHeight(ref.current ? Math.floor(getHeight(ref.current.offsetWidth)) : undefined);
|
|
57
57
|
}, 100);
|
|
58
58
|
updateSize();
|
|
59
59
|
window.addEventListener('resize', updateSize);
|
|
@@ -11,7 +11,7 @@ export declare const blockMap: {
|
|
|
11
11
|
"info-block": (props: import("./models").InfoBlockProps) => JSX.Element;
|
|
12
12
|
"security-block": (props: import("./models").SecurityBlockProps) => JSX.Element;
|
|
13
13
|
"table-block": (props: import("./models").TableBlockProps) => JSX.Element;
|
|
14
|
-
"tabs-block": ({ items, title, description, animated }: import("./models").TabsBlockProps) => JSX.Element;
|
|
14
|
+
"tabs-block": ({ items, title, description, animated, tabsColSizes, centered, direction, }: import("./models").TabsBlockProps) => JSX.Element;
|
|
15
15
|
"link-table-block": ({ items, title, description, linkTheme }: import("./models").LinkTableBlockProps) => JSX.Element;
|
|
16
16
|
"header-block": (props: import("./models").WithChildren<import("./models").HeaderBlockProps & import("./models").ClassNameProps>) => JSX.Element;
|
|
17
17
|
"icons-block": ({ title, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
@@ -114,14 +114,12 @@ export interface SimpleBlockProps extends Animatable, Childable {
|
|
|
114
114
|
title: TitleBaseProps;
|
|
115
115
|
description: string;
|
|
116
116
|
}
|
|
117
|
-
export interface ExtendedFeaturesItem {
|
|
118
|
-
title
|
|
119
|
-
text?: string;
|
|
117
|
+
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
118
|
+
title: string;
|
|
120
119
|
label?: string;
|
|
121
120
|
icon?: ThemedImage;
|
|
122
121
|
/** @deprecated **/
|
|
123
122
|
link?: LinkProps;
|
|
124
|
-
links?: LinkProps[];
|
|
125
123
|
}
|
|
126
124
|
export interface ExtendedFeaturesProps extends Animatable {
|
|
127
125
|
items: ExtendedFeaturesItem[];
|
|
@@ -221,18 +219,21 @@ export interface TableBlockProps {
|
|
|
221
219
|
title: string;
|
|
222
220
|
table: TableProps;
|
|
223
221
|
}
|
|
224
|
-
export interface TabsBlockItem {
|
|
222
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
|
|
225
223
|
tabName: string;
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
/**
|
|
225
|
+
* @deprecated Use array links from ContentBlockProps instead
|
|
226
|
+
*/
|
|
228
227
|
link?: LinkProps;
|
|
229
228
|
image?: ThemedImage;
|
|
230
229
|
disableCompress?: boolean;
|
|
231
230
|
caption?: string;
|
|
232
231
|
media?: ThemedMediaProps;
|
|
233
|
-
links?: LinkProps[];
|
|
234
232
|
}
|
|
235
233
|
export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
234
|
+
tabsColSizes?: GridColumnSizesType;
|
|
235
|
+
centered?: boolean;
|
|
236
|
+
direction?: MediaDirection;
|
|
236
237
|
items: TabsBlockItem[];
|
|
237
238
|
}
|
|
238
239
|
export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
@@ -23,7 +23,6 @@ const createItemsParser = (fields) => (transformer, items) => items.map((item) =
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
exports.createItemsParser = createItemsParser;
|
|
26
|
-
const parseItems = (0, exports.createItemsParser)(['title', 'text']);
|
|
27
26
|
function parseTableBlock(transformer, content) {
|
|
28
27
|
const legend = content === null || content === void 0 ? void 0 : content.legend;
|
|
29
28
|
return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
|
|
@@ -49,9 +48,13 @@ function parseSlider(transformer, block) {
|
|
|
49
48
|
}
|
|
50
49
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
51
50
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
51
|
+
const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
52
|
+
var { title } = _a, rest = (0, tslib_1.__rest)(_a, ["title"]);
|
|
53
|
+
return (Object.assign({ title: title && parseTitle(transformer, title) }, rest));
|
|
54
|
+
});
|
|
52
55
|
function parsePriceDetailedBlock(transformer, block) {
|
|
53
56
|
const { priceType } = block;
|
|
54
|
-
|
|
57
|
+
block.items = block.items.map((item) => {
|
|
55
58
|
const { description, items: details = [] } = item;
|
|
56
59
|
if (priceType === 'marked-list') {
|
|
57
60
|
item.items = details.map((detail) => {
|
|
@@ -68,7 +71,6 @@ function parsePriceDetailedBlock(transformer, block) {
|
|
|
68
71
|
item.description = transformer(description);
|
|
69
72
|
return item;
|
|
70
73
|
});
|
|
71
|
-
block.items = transformedBlockItems;
|
|
72
74
|
return block;
|
|
73
75
|
}
|
|
74
76
|
const parseContentLayout = (transformer, content) => {
|
|
@@ -226,7 +228,12 @@ const config = {
|
|
|
226
228
|
{
|
|
227
229
|
fields: ['items'],
|
|
228
230
|
transformer: yfmTransformer,
|
|
229
|
-
parser:
|
|
231
|
+
parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
fields: ['items'],
|
|
235
|
+
transformer: typografTransformer,
|
|
236
|
+
parser: parseItemsTitle,
|
|
230
237
|
},
|
|
231
238
|
],
|
|
232
239
|
[models_1.BlockType.TableBlock]: [
|
|
@@ -26,7 +26,7 @@ exports.DEFAULT_ALLOWED_TAGS = [
|
|
|
26
26
|
];
|
|
27
27
|
exports.typografConfig = {
|
|
28
28
|
enabled: ['common/nbsp/afterNumber', 'common/nbsp/afterParagraphMark'],
|
|
29
|
-
disabled: ['common/symbols/cf'],
|
|
29
|
+
disabled: ['common/symbols/cf', 'ru/other/phone-number'],
|
|
30
30
|
};
|
|
31
31
|
exports.sanitizeStripOptions = {
|
|
32
32
|
allowedTags: [],
|
|
@@ -18,7 +18,7 @@ export const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DE
|
|
|
18
18
|
return (React.createElement(AnimateBlock, { className: b(), animate: animated },
|
|
19
19
|
React.createElement(BlockHeader, { title: title, description: description, className: b('header') }),
|
|
20
20
|
React.createElement("div", { className: b('items') },
|
|
21
|
-
React.createElement(Row, null, items.map(({ title: itemTitle, text, link, links, label, icon }) => {
|
|
21
|
+
React.createElement(Row, null, items.map(({ title: itemTitle, text, link, links, label, icon, buttons, additionalInfo, }) => {
|
|
22
22
|
const itemLinks = links || [];
|
|
23
23
|
const iconThemed = icon && getThemedValue(icon, theme);
|
|
24
24
|
const iconData = iconThemed && getMediaImage(iconThemed);
|
|
@@ -31,7 +31,7 @@ export const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DE
|
|
|
31
31
|
itemTitle && (React.createElement("h5", { className: b('item-title') },
|
|
32
32
|
React.createElement(HTML, null, itemTitle),
|
|
33
33
|
label && (React.createElement("div", { className: b('item-label') }, label)))),
|
|
34
|
-
React.createElement(Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 } }))));
|
|
34
|
+
React.createElement(Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 }, buttons: buttons, additionalInfo: additionalInfo }))));
|
|
35
35
|
})))));
|
|
36
36
|
};
|
|
37
37
|
export default ExtendedFeaturesBlock;
|
|
@@ -1,68 +1,101 @@
|
|
|
1
|
-
.pc-
|
|
1
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
/* use this for style redefinitions to awoid problems with
|
|
6
6
|
unpredictable css rules order in build */
|
|
7
|
-
.pc-
|
|
8
|
-
margin-bottom:
|
|
7
|
+
.pc-tabs-block__block-title {
|
|
8
|
+
margin-bottom: 24px;
|
|
9
9
|
}
|
|
10
|
-
.pc-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
margin-bottom: 32px;
|
|
10
|
+
.pc-tabs-block__block-title_centered {
|
|
11
|
+
margin: 0 auto 12px;
|
|
12
|
+
text-align: center;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
.pc-tabs-block__tabs_centered {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
.pc-tabs-block__row_reverse {
|
|
19
|
+
flex-direction: row-reverse;
|
|
20
|
+
}
|
|
21
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content-wrapper {
|
|
22
|
+
margin: 24px 32px 0 0;
|
|
23
|
+
}
|
|
24
|
+
.pc-tabs-block__image {
|
|
17
25
|
width: 100%;
|
|
18
26
|
height: auto;
|
|
19
27
|
object-fit: cover;
|
|
20
28
|
display: block;
|
|
21
29
|
}
|
|
22
|
-
.pc-
|
|
30
|
+
.pc-tabs-block__image, .pc-tabs-block__media {
|
|
23
31
|
box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
|
|
24
32
|
overflow-x: hidden;
|
|
25
33
|
border-radius: var(--pc-border-radius);
|
|
26
34
|
}
|
|
27
|
-
.pc-
|
|
35
|
+
.pc-tabs-block__caption {
|
|
28
36
|
font-size: var(--yc-text-body-2-font-size);
|
|
29
37
|
line-height: var(--yc-text-body-2-line-height);
|
|
30
38
|
margin: 12px 0 0;
|
|
31
39
|
color: var(--yc-color-text-secondary);
|
|
32
40
|
}
|
|
33
|
-
.pc-
|
|
41
|
+
.pc-tabs-block__content {
|
|
34
42
|
display: flex;
|
|
35
43
|
flex-direction: column;
|
|
36
44
|
}
|
|
37
|
-
.pc-
|
|
45
|
+
.pc-tabs-block__content_centered {
|
|
46
|
+
margin: 0 auto;
|
|
47
|
+
}
|
|
48
|
+
.pc-tabs-block__col_centered {
|
|
49
|
+
margin: 0 auto;
|
|
50
|
+
}
|
|
51
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
38
52
|
margin: 24px 0 0 32px;
|
|
39
53
|
}
|
|
40
|
-
.pc-
|
|
54
|
+
.pc-tabs-block__content-title {
|
|
41
55
|
margin: 0 auto 12px;
|
|
42
56
|
}
|
|
43
|
-
.pc-
|
|
57
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
44
58
|
font-size: var(--yc-text-header-1-font-size);
|
|
45
59
|
line-height: var(--yc-text-header-1-line-height);
|
|
46
60
|
color: var(--pc-text-header-color);
|
|
47
61
|
font-weight: var(--yc-text-accent-font-weight);
|
|
48
62
|
}
|
|
49
63
|
|
|
50
|
-
.pc-TabsBlock__tabs, .pc-TabsBlock__link {
|
|
51
|
-
font-size: var(--yc-text-body-2-font-size);
|
|
52
|
-
line-height: var(--yc-text-body-2-line-height);
|
|
53
|
-
}
|
|
54
64
|
@media (max-width: 769px) {
|
|
55
|
-
.pc-
|
|
65
|
+
.pc-tabs-block__tabs {
|
|
66
|
+
display: flex;
|
|
67
|
+
overflow: auto;
|
|
68
|
+
margin-left: -48px;
|
|
69
|
+
margin-right: -48px;
|
|
70
|
+
padding-left: 48px;
|
|
71
|
+
padding-right: 40px;
|
|
72
|
+
}
|
|
73
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
56
74
|
margin: 0 0 32px 0;
|
|
57
75
|
}
|
|
76
|
+
.pc-tabs-block__row_reverse {
|
|
77
|
+
flex-direction: column-reverse;
|
|
78
|
+
}
|
|
79
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content > * {
|
|
80
|
+
margin-top: 32px;
|
|
81
|
+
padding-bottom: 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
@media (max-width: 577px) {
|
|
85
|
+
.pc-tabs-block__tabs {
|
|
86
|
+
margin-left: -24px;
|
|
87
|
+
margin-right: -24px;
|
|
88
|
+
padding-left: 24px;
|
|
89
|
+
padding-right: 16px;
|
|
90
|
+
}
|
|
58
91
|
}
|
|
59
92
|
@media (min-width: 769px) {
|
|
60
|
-
.pc-
|
|
93
|
+
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__media {
|
|
61
94
|
position: relative;
|
|
62
95
|
top: 100px;
|
|
63
96
|
opacity: 0;
|
|
64
97
|
}
|
|
65
|
-
.pc-
|
|
98
|
+
.pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__media {
|
|
66
99
|
top: 0;
|
|
67
100
|
opacity: 1;
|
|
68
101
|
transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
@@ -70,12 +103,12 @@ unpredictable css rules order in build */
|
|
|
70
103
|
}
|
|
71
104
|
}
|
|
72
105
|
@media (min-width: 769px) {
|
|
73
|
-
.pc-
|
|
106
|
+
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__image {
|
|
74
107
|
position: relative;
|
|
75
108
|
top: 100px;
|
|
76
109
|
opacity: 0;
|
|
77
110
|
}
|
|
78
|
-
.pc-
|
|
111
|
+
.pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__image {
|
|
79
112
|
top: 0;
|
|
80
113
|
opacity: 1;
|
|
81
114
|
transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TabsBlockProps } from '../../models';
|
|
2
2
|
import './Tabs.css';
|
|
3
|
-
export declare const TabsBlock: ({ items, title, description, animated }: TabsBlockProps) => JSX.Element;
|
|
3
|
+
export declare const TabsBlock: ({ items, title, description, animated, tabsColSizes, centered, direction, }: TabsBlockProps) => JSX.Element;
|
|
4
4
|
export default TabsBlock;
|
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
import React, { Fragment, useContext, useState } from 'react';
|
|
2
|
-
import { Tabs } from '@gravity-ui/uikit';
|
|
3
2
|
import { block, getThemedValue } from '../../utils';
|
|
4
3
|
import { Row, Col, GridColumnOrderClasses } from '../../grid';
|
|
5
|
-
import YFMWrapper from '../../components/YFMWrapper/YFMWrapper';
|
|
6
4
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
7
5
|
import BlockHeader from '../../components/BlockHeader/BlockHeader';
|
|
8
6
|
import FullScreenImage from '../../components/FullscreenImage/FullscreenImage';
|
|
9
7
|
import Media from '../../components/Media/Media';
|
|
10
|
-
import Links from '../../components/Link/Links';
|
|
11
8
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
12
9
|
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
10
|
+
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
11
|
+
import { Content } from '../../sub-blocks';
|
|
13
12
|
import './Tabs.css';
|
|
14
|
-
const b = block('
|
|
15
|
-
export const TabsBlock = ({ items, title, description, animated }) => {
|
|
13
|
+
const b = block('tabs-block');
|
|
14
|
+
export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', }) => {
|
|
16
15
|
const [activeTab, setActiveTab] = useState(items[0].tabName);
|
|
17
16
|
const [play, setPlay] = useState(false);
|
|
18
17
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
19
18
|
const tabs = items.map(({ tabName }) => ({ title: tabName, id: tabName }));
|
|
20
19
|
const activeTabData = items.find(({ tabName }) => tabName === activeTab);
|
|
20
|
+
const isReverse = direction === 'content-media';
|
|
21
21
|
let imageProps;
|
|
22
22
|
if (activeTabData) {
|
|
23
23
|
const themedImage = getThemedValue(activeTabData.image, theme);
|
|
24
24
|
imageProps = themedImage && getMediaImage(themedImage);
|
|
25
25
|
}
|
|
26
26
|
const showMedia = Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps);
|
|
27
|
+
const showText = Boolean(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.text);
|
|
28
|
+
const textContent = activeTabData && showText && (React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content', { centered: centered }) },
|
|
29
|
+
React.createElement("div", { className: b('content-wrapper', {
|
|
30
|
+
margin: Boolean(((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps) && !isReverse),
|
|
31
|
+
}) },
|
|
32
|
+
React.createElement(Content, { title: activeTabData.title, text: activeTabData.text, additionalInfo: activeTabData.additionalInfo, size: "s", links: [
|
|
33
|
+
...(activeTabData.link ? [activeTabData.link] : []),
|
|
34
|
+
...(activeTabData.links || []),
|
|
35
|
+
], buttons: activeTabData.buttons, colSizes: { all: 12 } }))));
|
|
36
|
+
const mediaContent = showMedia && (React.createElement(Col, { sizes: { all: 12, md: 8 }, orders: {
|
|
37
|
+
all: GridColumnOrderClasses.Last,
|
|
38
|
+
md: GridColumnOrderClasses.First,
|
|
39
|
+
}, className: b('col', { centered: centered }) },
|
|
40
|
+
(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 }))),
|
|
41
|
+
imageProps && (React.createElement(Fragment, null,
|
|
42
|
+
React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
43
|
+
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && (React.createElement("p", { className: b('caption') }, activeTabData.caption))))));
|
|
27
44
|
return (React.createElement(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated },
|
|
28
|
-
React.createElement(BlockHeader, { title: title, description: description, className: b('block-title') }),
|
|
29
|
-
React.createElement(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(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 }))),
|
|
36
|
-
imageProps && (React.createElement(Fragment, null,
|
|
37
|
-
React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
38
|
-
activeTabData && (React.createElement("p", { className: b('caption') }, activeTabData.caption)))))),
|
|
39
|
-
React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b('content') },
|
|
40
|
-
React.createElement("div", { className: b('content-wrapper', {
|
|
41
|
-
margin: Boolean((activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) || imageProps),
|
|
42
|
-
}) },
|
|
43
|
-
React.createElement("h4", { className: b('content-title') },
|
|
44
|
-
React.createElement(YFMWrapper, { content: activeTabData.title, modifiers: { constructor: true } })),
|
|
45
|
-
React.createElement(YFMWrapper, { content: activeTabData.text, modifiers: { constructor: true } }),
|
|
46
|
-
React.createElement(Links, { links: [
|
|
47
|
-
...(activeTabData.link ? [activeTabData.link] : []),
|
|
48
|
-
...(activeTabData.links || []),
|
|
49
|
-
], className: b('link') })))))));
|
|
45
|
+
React.createElement(BlockHeader, { title: title, description: description, className: b('block-title', { centered: centered }), colSizes: centered ? { all: 12 } : { all: 12, sm: 8 } }),
|
|
46
|
+
React.createElement(Row, null,
|
|
47
|
+
React.createElement(Col, { sizes: tabsColSizes },
|
|
48
|
+
React.createElement(ButtonTabs, { items: tabs, onSelectTab: setActiveTab, activeTab: activeTab, className: b('tabs', { centered: centered }) }))),
|
|
49
|
+
activeTabData && (React.createElement(Row, { className: b('row', { reverse: isReverse }) },
|
|
50
|
+
mediaContent,
|
|
51
|
+
textContent))));
|
|
50
52
|
};
|
|
51
53
|
export default TabsBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-button-tabs {
|
|
4
|
+
margin-bottom: 20px;
|
|
5
|
+
}
|
|
6
|
+
.pc-button-tabs__item {
|
|
7
|
+
margin-right: 8px;
|
|
8
|
+
margin-bottom: 12px;
|
|
9
|
+
}
|
|
10
|
+
.pc-button-tabs__item_active {
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ButtonProps } from '../../models';
|
|
2
|
+
import './ButtonTabs.css';
|
|
3
|
+
export interface ButtonTabsItemProps extends Omit<ButtonProps, 'url' | 'primary' | 'target' | 'text'> {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ButtonTabsProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
items: ButtonTabsItemProps[];
|
|
10
|
+
activeTab?: string;
|
|
11
|
+
onSelectTab?: (tabId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const ButtonTabs: (props: ButtonTabsProps) => JSX.Element;
|
|
14
|
+
export default ButtonTabs;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { block } from '../../utils';
|
|
3
|
+
import { Button } from '../index';
|
|
4
|
+
import './ButtonTabs.css';
|
|
5
|
+
const b = block('button-tabs');
|
|
6
|
+
const ButtonTabs = (props) => {
|
|
7
|
+
const { className, items, activeTab, onSelectTab } = props;
|
|
8
|
+
const activeTabId = useMemo(() => {
|
|
9
|
+
if (activeTab) {
|
|
10
|
+
return activeTab;
|
|
11
|
+
}
|
|
12
|
+
return items[0].id;
|
|
13
|
+
}, [activeTab, items]);
|
|
14
|
+
const handleClick = useCallback((tabId) => {
|
|
15
|
+
if (onSelectTab) {
|
|
16
|
+
onSelectTab(tabId);
|
|
17
|
+
}
|
|
18
|
+
}, [onSelectTab]);
|
|
19
|
+
return (React.createElement("div", { className: b(null, className) }, items.map((item) => {
|
|
20
|
+
const isActive = item.id === activeTabId;
|
|
21
|
+
return (React.createElement(Button, { text: item.title, className: b('item', { active: isActive }), key: item.title, size: 'l', onClick: () => handleClick(item.id), theme: isActive ? 'monochrome' : 'normal' }));
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
export default ButtonTabs;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
2
|
import { ImageDeviceProps, ImageObjectProps } from '../../models';
|
|
3
|
+
import './Image.css';
|
|
3
4
|
export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps> {
|
|
4
5
|
style?: CSSProperties;
|
|
5
6
|
className?: string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React, { useContext, useState, Fragment } from 'react';
|
|
2
2
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
3
3
|
import { BREAKPOINTS } from '../../constants';
|
|
4
|
+
import { block } from '../../utils';
|
|
5
|
+
import './Image.css';
|
|
6
|
+
const b = block('image');
|
|
4
7
|
const checkWebP = (src) => {
|
|
5
8
|
return src.endsWith('.webp') ? src : src + '.webp';
|
|
6
9
|
};
|
|
@@ -17,7 +20,7 @@ const Image = (props) => {
|
|
|
17
20
|
disableCompress ||
|
|
18
21
|
imageSrc.endsWith('.svg') ||
|
|
19
22
|
imgLoadingError;
|
|
20
|
-
return (React.createElement("picture",
|
|
23
|
+
return (React.createElement("picture", { className: b() },
|
|
21
24
|
mobile && (React.createElement(Fragment, null,
|
|
22
25
|
!disableWebp && (React.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${BREAKPOINTS.sm}px)` })),
|
|
23
26
|
React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)` }))),
|
|
@@ -50,7 +50,7 @@ const VideoBlock = (props) => {
|
|
|
50
50
|
}, [src, attributes]);
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
const updateSize = _.debounce(() => {
|
|
53
|
-
setHeight(ref.current ? Math.
|
|
53
|
+
setHeight(ref.current ? Math.floor(getHeight(ref.current.offsetWidth)) : undefined);
|
|
54
54
|
}, 100);
|
|
55
55
|
updateSize();
|
|
56
56
|
window.addEventListener('resize', updateSize);
|
|
@@ -11,7 +11,7 @@ export declare const blockMap: {
|
|
|
11
11
|
"info-block": (props: import("./models").InfoBlockProps) => JSX.Element;
|
|
12
12
|
"security-block": (props: import("./models").SecurityBlockProps) => JSX.Element;
|
|
13
13
|
"table-block": (props: import("./models").TableBlockProps) => JSX.Element;
|
|
14
|
-
"tabs-block": ({ items, title, description, animated }: import("./models").TabsBlockProps) => JSX.Element;
|
|
14
|
+
"tabs-block": ({ items, title, description, animated, tabsColSizes, centered, direction, }: import("./models").TabsBlockProps) => JSX.Element;
|
|
15
15
|
"link-table-block": ({ items, title, description, linkTheme }: import("./models").LinkTableBlockProps) => JSX.Element;
|
|
16
16
|
"header-block": (props: import("./models").WithChildren<import("./models").HeaderBlockProps & import("./models").ClassNameProps>) => JSX.Element;
|
|
17
17
|
"icons-block": ({ title, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
@@ -114,14 +114,12 @@ export interface SimpleBlockProps extends Animatable, Childable {
|
|
|
114
114
|
title: TitleBaseProps;
|
|
115
115
|
description: string;
|
|
116
116
|
}
|
|
117
|
-
export interface ExtendedFeaturesItem {
|
|
118
|
-
title
|
|
119
|
-
text?: string;
|
|
117
|
+
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
118
|
+
title: string;
|
|
120
119
|
label?: string;
|
|
121
120
|
icon?: ThemedImage;
|
|
122
121
|
/** @deprecated **/
|
|
123
122
|
link?: LinkProps;
|
|
124
|
-
links?: LinkProps[];
|
|
125
123
|
}
|
|
126
124
|
export interface ExtendedFeaturesProps extends Animatable {
|
|
127
125
|
items: ExtendedFeaturesItem[];
|
|
@@ -221,18 +219,21 @@ export interface TableBlockProps {
|
|
|
221
219
|
title: string;
|
|
222
220
|
table: TableProps;
|
|
223
221
|
}
|
|
224
|
-
export interface TabsBlockItem {
|
|
222
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
|
|
225
223
|
tabName: string;
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
/**
|
|
225
|
+
* @deprecated Use array links from ContentBlockProps instead
|
|
226
|
+
*/
|
|
228
227
|
link?: LinkProps;
|
|
229
228
|
image?: ThemedImage;
|
|
230
229
|
disableCompress?: boolean;
|
|
231
230
|
caption?: string;
|
|
232
231
|
media?: ThemedMediaProps;
|
|
233
|
-
links?: LinkProps[];
|
|
234
232
|
}
|
|
235
233
|
export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
234
|
+
tabsColSizes?: GridColumnSizesType;
|
|
235
|
+
centered?: boolean;
|
|
236
|
+
direction?: MediaDirection;
|
|
236
237
|
items: TabsBlockItem[];
|
|
237
238
|
}
|
|
238
239
|
export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
@@ -19,7 +19,6 @@ export const createItemsParser = (fields) => (transformer, items) => items.map((
|
|
|
19
19
|
}, {}));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const parseItems = createItemsParser(['title', 'text']);
|
|
23
22
|
function parseTableBlock(transformer, content) {
|
|
24
23
|
const legend = content === null || content === void 0 ? void 0 : content.legend;
|
|
25
24
|
return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
|
|
@@ -45,9 +44,13 @@ function parseSlider(transformer, block) {
|
|
|
45
44
|
}
|
|
46
45
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
47
46
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
47
|
+
const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
48
|
+
var { title } = _a, rest = __rest(_a, ["title"]);
|
|
49
|
+
return (Object.assign({ title: title && parseTitle(transformer, title) }, rest));
|
|
50
|
+
});
|
|
48
51
|
function parsePriceDetailedBlock(transformer, block) {
|
|
49
52
|
const { priceType } = block;
|
|
50
|
-
|
|
53
|
+
block.items = block.items.map((item) => {
|
|
51
54
|
const { description, items: details = [] } = item;
|
|
52
55
|
if (priceType === 'marked-list') {
|
|
53
56
|
item.items = details.map((detail) => {
|
|
@@ -64,7 +67,6 @@ function parsePriceDetailedBlock(transformer, block) {
|
|
|
64
67
|
item.description = transformer(description);
|
|
65
68
|
return item;
|
|
66
69
|
});
|
|
67
|
-
block.items = transformedBlockItems;
|
|
68
70
|
return block;
|
|
69
71
|
}
|
|
70
72
|
const parseContentLayout = (transformer, content) => {
|
|
@@ -220,7 +222,12 @@ const config = {
|
|
|
220
222
|
{
|
|
221
223
|
fields: ['items'],
|
|
222
224
|
transformer: yfmTransformer,
|
|
223
|
-
parser:
|
|
225
|
+
parser: createItemsParser(['text', 'additionalInfo']),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
fields: ['items'],
|
|
229
|
+
transformer: typografTransformer,
|
|
230
|
+
parser: parseItemsTitle,
|
|
224
231
|
},
|
|
225
232
|
],
|
|
226
233
|
[BlockType.TableBlock]: [
|
|
@@ -23,7 +23,7 @@ export const DEFAULT_ALLOWED_TAGS = [
|
|
|
23
23
|
];
|
|
24
24
|
export const typografConfig = {
|
|
25
25
|
enabled: ['common/nbsp/afterNumber', 'common/nbsp/afterParagraphMark'],
|
|
26
|
-
disabled: ['common/symbols/cf'],
|
|
26
|
+
disabled: ['common/symbols/cf', 'ru/other/phone-number'],
|
|
27
27
|
};
|
|
28
28
|
export const sanitizeStripOptions = {
|
|
29
29
|
allowedTags: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1-alpha.1",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"typograf": "^6.14.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"react": "^16.0.0",
|
|
60
|
+
"react": "^16.0.0 || ^17.0.0",
|
|
61
61
|
"@gravity-ui/uikit": "^3.0.1",
|
|
62
62
|
"@doc-tools/transform": "^2.6.1"
|
|
63
63
|
},
|
|
@@ -121,5 +121,8 @@
|
|
|
121
121
|
"*.{json,yaml,yml,md}": [
|
|
122
122
|
"prettier --write"
|
|
123
123
|
]
|
|
124
|
+
},
|
|
125
|
+
"publishConfig": {
|
|
126
|
+
"tag": "alpha"
|
|
124
127
|
}
|
|
125
128
|
}
|
|
@@ -114,14 +114,12 @@ export interface SimpleBlockProps extends Animatable, Childable {
|
|
|
114
114
|
title: TitleBaseProps;
|
|
115
115
|
description: string;
|
|
116
116
|
}
|
|
117
|
-
export interface ExtendedFeaturesItem {
|
|
118
|
-
title
|
|
119
|
-
text?: string;
|
|
117
|
+
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
118
|
+
title: string;
|
|
120
119
|
label?: string;
|
|
121
120
|
icon?: ThemedImage;
|
|
122
121
|
/** @deprecated **/
|
|
123
122
|
link?: LinkProps;
|
|
124
|
-
links?: LinkProps[];
|
|
125
123
|
}
|
|
126
124
|
export interface ExtendedFeaturesProps extends Animatable {
|
|
127
125
|
items: ExtendedFeaturesItem[];
|
|
@@ -221,18 +219,21 @@ export interface TableBlockProps {
|
|
|
221
219
|
title: string;
|
|
222
220
|
table: TableProps;
|
|
223
221
|
}
|
|
224
|
-
export interface TabsBlockItem {
|
|
222
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
|
|
225
223
|
tabName: string;
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
/**
|
|
225
|
+
* @deprecated Use array links from ContentBlockProps instead
|
|
226
|
+
*/
|
|
228
227
|
link?: LinkProps;
|
|
229
228
|
image?: ThemedImage;
|
|
230
229
|
disableCompress?: boolean;
|
|
231
230
|
caption?: string;
|
|
232
231
|
media?: ThemedMediaProps;
|
|
233
|
-
links?: LinkProps[];
|
|
234
232
|
}
|
|
235
233
|
export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
234
|
+
tabsColSizes?: GridColumnSizesType;
|
|
235
|
+
centered?: boolean;
|
|
236
|
+
direction?: MediaDirection;
|
|
236
237
|
items: TabsBlockItem[];
|
|
237
238
|
}
|
|
238
239
|
export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
@@ -36,7 +36,6 @@ const createItemsParser = (fields) => (transformer, items) => items.map((item) =
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
exports.createItemsParser = createItemsParser;
|
|
39
|
-
const parseItems = (0, exports.createItemsParser)(['title', 'text']);
|
|
40
39
|
function parseTableBlock(transformer, content) {
|
|
41
40
|
const legend = content === null || content === void 0 ? void 0 : content.legend;
|
|
42
41
|
return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
|
|
@@ -62,9 +61,13 @@ function parseSlider(transformer, block) {
|
|
|
62
61
|
}
|
|
63
62
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
64
63
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
64
|
+
const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
65
|
+
var { title } = _a, rest = __rest(_a, ["title"]);
|
|
66
|
+
return (Object.assign({ title: title && parseTitle(transformer, title) }, rest));
|
|
67
|
+
});
|
|
65
68
|
function parsePriceDetailedBlock(transformer, block) {
|
|
66
69
|
const { priceType } = block;
|
|
67
|
-
|
|
70
|
+
block.items = block.items.map((item) => {
|
|
68
71
|
const { description, items: details = [] } = item;
|
|
69
72
|
if (priceType === 'marked-list') {
|
|
70
73
|
item.items = details.map((detail) => {
|
|
@@ -81,7 +84,6 @@ function parsePriceDetailedBlock(transformer, block) {
|
|
|
81
84
|
item.description = transformer(description);
|
|
82
85
|
return item;
|
|
83
86
|
});
|
|
84
|
-
block.items = transformedBlockItems;
|
|
85
87
|
return block;
|
|
86
88
|
}
|
|
87
89
|
const parseContentLayout = (transformer, content) => {
|
|
@@ -239,7 +241,12 @@ const config = {
|
|
|
239
241
|
{
|
|
240
242
|
fields: ['items'],
|
|
241
243
|
transformer: yfmTransformer,
|
|
242
|
-
parser:
|
|
244
|
+
parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
fields: ['items'],
|
|
248
|
+
transformer: typografTransformer,
|
|
249
|
+
parser: parseItemsTitle,
|
|
243
250
|
},
|
|
244
251
|
],
|
|
245
252
|
[models_1.BlockType.TableBlock]: [
|
|
@@ -39,7 +39,7 @@ exports.DEFAULT_ALLOWED_TAGS = [
|
|
|
39
39
|
];
|
|
40
40
|
exports.typografConfig = {
|
|
41
41
|
enabled: ['common/nbsp/afterNumber', 'common/nbsp/afterParagraphMark'],
|
|
42
|
-
disabled: ['common/symbols/cf'],
|
|
42
|
+
disabled: ['common/symbols/cf', 'ru/other/phone-number'],
|
|
43
43
|
};
|
|
44
44
|
exports.sanitizeStripOptions = {
|
|
45
45
|
allowedTags: [],
|