@gravity-ui/page-constructor 1.7.0-alpha.5 → 1.7.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/Tabs/Tabs.css +49 -23
- 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 +27 -0
- package/build/cjs/components/Image/Image.css +3 -0
- package/build/cjs/components/Image/Image.js +3 -1
- package/build/cjs/components/RouterLink/RouterLink.d.ts +0 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +1 -1
- package/build/cjs/components/index.d.ts +0 -1
- package/build/cjs/components/index.js +1 -3
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +0 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.js +2 -4
- package/build/cjs/context/locationContext/locationContext.d.ts +0 -1
- package/build/cjs/icons/index.d.ts +0 -3
- package/build/cjs/icons/index.js +0 -3
- package/build/cjs/models/constructor-items/blocks.d.ts +7 -4
- package/build/cjs/models/index.d.ts +0 -1
- package/build/cjs/models/index.js +0 -1
- package/build/cjs/text-transform/blocks.js +11 -4
- package/build/cjs/text-transform/utils.js +1 -1
- package/build/esm/blocks/Tabs/Tabs.css +49 -23
- 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 +25 -0
- package/build/esm/components/Image/Image.css +3 -0
- package/build/esm/components/Image/Image.d.ts +1 -0
- package/build/esm/components/Image/Image.js +4 -1
- package/build/esm/components/RouterLink/RouterLink.d.ts +0 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +1 -1
- package/build/esm/components/index.d.ts +0 -1
- package/build/esm/components/index.js +0 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/containers/PageConstructor/PageConstructor.d.ts +0 -2
- package/build/esm/containers/PageConstructor/PageConstructor.js +2 -4
- package/build/esm/context/locationContext/locationContext.d.ts +0 -1
- package/build/esm/icons/index.d.ts +0 -3
- package/build/esm/icons/index.js +0 -3
- package/build/esm/models/constructor-items/blocks.d.ts +7 -4
- package/build/esm/models/index.d.ts +0 -1
- package/build/esm/models/index.js +0 -1
- package/build/esm/text-transform/blocks.js +11 -4
- package/build/esm/text-transform/utils.js +1 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +7 -4
- package/server/models/index.d.ts +0 -1
- package/server/models/index.js +0 -1
- package/server/text-transform/blocks.js +11 -4
- package/server/text-transform/utils.js +1 -1
- package/styles/mixins.scss +0 -38
- package/build/cjs/components/navigation/components/Header/Header.css +0 -85
- package/build/cjs/components/navigation/components/Header/Header.d.ts +0 -28
- package/build/cjs/components/navigation/components/Header/Header.js +0 -81
- package/build/cjs/components/navigation/components/Logo/Logo.css +0 -23
- package/build/cjs/components/navigation/components/Logo/Logo.d.ts +0 -7
- package/build/cjs/components/navigation/components/Logo/Logo.js +0 -17
- package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.css +0 -58
- package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +0 -13
- package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.js +0 -45
- package/build/cjs/components/navigation/components/Navigation/Navigation.css +0 -43
- package/build/cjs/components/navigation/components/Navigation/Navigation.d.ts +0 -11
- package/build/cjs/components/navigation/components/Navigation/Navigation.js +0 -70
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.css +0 -41
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.d.ts +0 -12
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +0 -55
- package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.css +0 -33
- package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +0 -10
- package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.js +0 -46
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.css +0 -20
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.d.ts +0 -7
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +0 -14
- package/build/cjs/icons/NavigationArrow.d.ts +0 -2
- package/build/cjs/icons/NavigationArrow.js +0 -9
- package/build/cjs/icons/NavigationClose.d.ts +0 -2
- package/build/cjs/icons/NavigationClose.js +0 -9
- package/build/cjs/icons/NavigationOpen.d.ts +0 -2
- package/build/cjs/icons/NavigationOpen.js +0 -11
- package/build/cjs/models/navigation.d.ts +0 -59
- package/build/cjs/models/navigation.js +0 -10
- package/build/esm/components/navigation/components/Header/Header.css +0 -85
- package/build/esm/components/navigation/components/Header/Header.d.ts +0 -29
- package/build/esm/components/navigation/components/Header/Header.js +0 -79
- package/build/esm/components/navigation/components/Logo/Logo.css +0 -23
- package/build/esm/components/navigation/components/Logo/Logo.d.ts +0 -8
- package/build/esm/components/navigation/components/Logo/Logo.js +0 -15
- package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.css +0 -58
- package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +0 -14
- package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.js +0 -43
- package/build/esm/components/navigation/components/Navigation/Navigation.css +0 -43
- package/build/esm/components/navigation/components/Navigation/Navigation.d.ts +0 -12
- package/build/esm/components/navigation/components/Navigation/Navigation.js +0 -69
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.css +0 -41
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.d.ts +0 -13
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +0 -54
- package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.css +0 -33
- package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +0 -11
- package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.js +0 -42
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.css +0 -20
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.d.ts +0 -8
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +0 -12
- package/build/esm/icons/NavigationArrow.d.ts +0 -2
- package/build/esm/icons/NavigationArrow.js +0 -4
- package/build/esm/icons/NavigationClose.d.ts +0 -2
- package/build/esm/icons/NavigationClose.js +0 -4
- package/build/esm/icons/NavigationOpen.d.ts +0 -2
- package/build/esm/icons/NavigationOpen.js +0 -6
- package/build/esm/models/navigation.d.ts +0 -59
- package/build/esm/models/navigation.js +0 -7
- package/server/models/navigation.d.ts +0 -59
- package/server/models/navigation.js +0 -10
|
@@ -1,68 +1,94 @@
|
|
|
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-
|
|
7
|
+
.pc-tabs-block__block-title {
|
|
8
8
|
margin-bottom: 12px;
|
|
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-right: 32px;
|
|
23
|
+
margin-left: 0;
|
|
24
|
+
}
|
|
25
|
+
.pc-tabs-block__image {
|
|
17
26
|
width: 100%;
|
|
18
27
|
height: auto;
|
|
19
28
|
object-fit: cover;
|
|
20
29
|
display: block;
|
|
21
30
|
}
|
|
22
|
-
.pc-
|
|
31
|
+
.pc-tabs-block__image, .pc-tabs-block__media {
|
|
23
32
|
box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
|
|
24
33
|
overflow-x: hidden;
|
|
25
34
|
border-radius: var(--pc-border-radius);
|
|
26
35
|
}
|
|
27
|
-
.pc-
|
|
36
|
+
.pc-tabs-block__caption {
|
|
28
37
|
font-size: var(--yc-text-body-2-font-size);
|
|
29
38
|
line-height: var(--yc-text-body-2-line-height);
|
|
30
39
|
margin: 12px 0 0;
|
|
31
40
|
color: var(--yc-color-text-secondary);
|
|
32
41
|
}
|
|
33
|
-
.pc-
|
|
42
|
+
.pc-tabs-block__content {
|
|
34
43
|
display: flex;
|
|
35
44
|
flex-direction: column;
|
|
36
45
|
}
|
|
37
|
-
.pc-
|
|
46
|
+
.pc-tabs-block__content_centered {
|
|
47
|
+
margin: 0 auto;
|
|
48
|
+
}
|
|
49
|
+
.pc-tabs-block__col_centered {
|
|
50
|
+
margin: 0 auto;
|
|
51
|
+
}
|
|
52
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
38
53
|
margin: 24px 0 0 32px;
|
|
39
54
|
}
|
|
40
|
-
.pc-
|
|
55
|
+
.pc-tabs-block__content-title {
|
|
41
56
|
margin: 0 auto 12px;
|
|
42
57
|
}
|
|
43
|
-
.pc-
|
|
58
|
+
.pc-tabs-block__content-title.pc-tabs-block__content-title > * {
|
|
44
59
|
font-size: var(--yc-text-header-1-font-size);
|
|
45
60
|
line-height: var(--yc-text-header-1-line-height);
|
|
46
61
|
color: var(--pc-text-header-color);
|
|
47
62
|
font-weight: var(--yc-text-accent-font-weight);
|
|
48
63
|
}
|
|
49
64
|
|
|
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
65
|
@media (max-width: 769px) {
|
|
55
|
-
.pc-
|
|
66
|
+
.pc-tabs-block__tabs {
|
|
67
|
+
display: flex;
|
|
68
|
+
overflow: auto;
|
|
69
|
+
margin-left: -24px;
|
|
70
|
+
margin-right: -24px;
|
|
71
|
+
padding-left: 24px;
|
|
72
|
+
padding-right: 16px;
|
|
73
|
+
}
|
|
74
|
+
.pc-tabs-block__content-wrapper_margin {
|
|
56
75
|
margin: 0 0 32px 0;
|
|
57
76
|
}
|
|
77
|
+
.pc-tabs-block__row_reverse {
|
|
78
|
+
flex-direction: column-reverse;
|
|
79
|
+
}
|
|
80
|
+
.pc-tabs-block__row_reverse .pc-tabs-block__content > * {
|
|
81
|
+
margin-top: 32px;
|
|
82
|
+
padding-bottom: 0;
|
|
83
|
+
}
|
|
58
84
|
}
|
|
59
85
|
@media (min-width: 769px) {
|
|
60
|
-
.pc-
|
|
86
|
+
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__media {
|
|
61
87
|
position: relative;
|
|
62
88
|
top: 100px;
|
|
63
89
|
opacity: 0;
|
|
64
90
|
}
|
|
65
|
-
.pc-
|
|
91
|
+
.pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__media {
|
|
66
92
|
top: 0;
|
|
67
93
|
opacity: 1;
|
|
68
94
|
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 +96,12 @@ unpredictable css rules order in build */
|
|
|
70
96
|
}
|
|
71
97
|
}
|
|
72
98
|
@media (min-width: 769px) {
|
|
73
|
-
.pc-
|
|
99
|
+
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__image {
|
|
74
100
|
position: relative;
|
|
75
101
|
top: 100px;
|
|
76
102
|
opacity: 0;
|
|
77
103
|
}
|
|
78
|
-
.pc-
|
|
104
|
+
.pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__image {
|
|
79
105
|
top: 0;
|
|
80
106
|
opacity: 1;
|
|
81
107
|
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,25 @@
|
|
|
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 isMobile = useContext(MobileContext);
|
|
9
|
+
const activeTabId = useMemo(() => {
|
|
10
|
+
if (activeTab) {
|
|
11
|
+
return activeTab;
|
|
12
|
+
}
|
|
13
|
+
return items[0].id;
|
|
14
|
+
}, [activeTab, items]);
|
|
15
|
+
const handleClick = useCallback((tabId) => {
|
|
16
|
+
if (onSelectTab) {
|
|
17
|
+
onSelectTab(tabId);
|
|
18
|
+
}
|
|
19
|
+
}, [onSelectTab]);
|
|
20
|
+
return (React.createElement("div", { className: b(null, className) }, items.map((item) => {
|
|
21
|
+
const isActive = item.id === activeTabId;
|
|
22
|
+
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' }));
|
|
23
|
+
})));
|
|
24
|
+
};
|
|
25
|
+
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);
|
|
@@ -33,5 +33,4 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
|
|
|
33
33
|
export { default as Author } from './Author/Author';
|
|
34
34
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
35
35
|
export { default as HTML } from './HTML/HTML';
|
|
36
|
-
export { default as Header } from './navigation/components/Header/Header';
|
|
37
36
|
export type { RouterLinkProps } from './RouterLink/RouterLink';
|
|
@@ -33,4 +33,3 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
|
|
|
33
33
|
export { default as Author } from './Author/Author';
|
|
34
34
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
35
35
|
export { default as HTML } from './HTML/HTML';
|
|
36
|
-
export { default as Header } from './navigation/components/Header/Header';
|
|
@@ -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;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShouldRenderBlock, CustomConfig, PageContent, CustomItems } from '../../models';
|
|
3
3
|
import { blockMap, subBlockMap } from '../../constructor-items';
|
|
4
|
-
import { NavigationData } from '../../models/navigation';
|
|
5
4
|
import '@doc-tools/transform/dist/js/yfm';
|
|
6
5
|
import './PageConstructor.css';
|
|
7
6
|
export declare type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;
|
|
@@ -10,7 +9,6 @@ export interface PageConstructorProps {
|
|
|
10
9
|
shouldRenderBlock?: ShouldRenderBlock;
|
|
11
10
|
custom?: CustomConfig;
|
|
12
11
|
renderMenu?: () => React.ReactNode;
|
|
13
|
-
navigationData?: NavigationData;
|
|
14
12
|
}
|
|
15
13
|
export declare const Constructor: (props: PageConstructorProps) => JSX.Element;
|
|
16
14
|
export declare const PageConstructor: (props: PageConstructorProps) => JSX.Element;
|
|
@@ -12,7 +12,6 @@ import { ConstructorRow } from './components/ConstructorRow';
|
|
|
12
12
|
import { ConstructorFootnotes } from './components/ConstructorFootnotes';
|
|
13
13
|
import { ConstructorHeader } from './components/ConstructorItem';
|
|
14
14
|
import { ConstructorBlocks } from './components/ConstructorBlocks';
|
|
15
|
-
import Header from '../../components/navigation/components/Header/Header';
|
|
16
15
|
import '@doc-tools/transform/dist/js/yfm';
|
|
17
16
|
import './PageConstructor.css';
|
|
18
17
|
const b = cnBlock('page-constructor');
|
|
@@ -29,7 +28,7 @@ export const Constructor = (props) => {
|
|
|
29
28
|
});
|
|
30
29
|
}, [props.custom]);
|
|
31
30
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
32
|
-
const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock,
|
|
31
|
+
const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, } = props;
|
|
33
32
|
const hasFootnotes = footnotes.length > 0;
|
|
34
33
|
const isHeaderBlock = (block) => headerBlockTypes.includes(block.type);
|
|
35
34
|
const header = blocks === null || blocks === void 0 ? void 0 : blocks.find(isHeaderBlock);
|
|
@@ -38,8 +37,7 @@ export const Constructor = (props) => {
|
|
|
38
37
|
return (React.createElement(InnerContext.Provider, { value: context },
|
|
39
38
|
React.createElement("div", { className: b() },
|
|
40
39
|
React.createElement("div", { className: b('wrapper') },
|
|
41
|
-
|
|
42
|
-
(navigationData === null || navigationData === void 0 ? void 0 : navigationData.header) && (React.createElement(Header, { logo: navigationData === null || navigationData === void 0 ? void 0 : navigationData.logo, data: navigationData === null || navigationData === void 0 ? void 0 : navigationData.header })),
|
|
40
|
+
React.createElement(BackgroundMedia, Object.assign({}, themedBackground, { className: b('background') })),
|
|
43
41
|
renderMenu && renderMenu(),
|
|
44
42
|
header && React.createElement(ConstructorHeader, { data: header }),
|
|
45
43
|
React.createElement(Grid, null,
|
package/build/esm/icons/index.js
CHANGED
|
@@ -221,18 +221,21 @@ export interface TableBlockProps {
|
|
|
221
221
|
title: string;
|
|
222
222
|
table: TableProps;
|
|
223
223
|
}
|
|
224
|
-
export interface TabsBlockItem {
|
|
224
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
|
|
225
225
|
tabName: string;
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated Use array links from ContentBlockProps instead
|
|
228
|
+
*/
|
|
228
229
|
link?: LinkProps;
|
|
229
230
|
image?: ThemedImage;
|
|
230
231
|
disableCompress?: boolean;
|
|
231
232
|
caption?: string;
|
|
232
233
|
media?: ThemedMediaProps;
|
|
233
|
-
links?: LinkProps[];
|
|
234
234
|
}
|
|
235
235
|
export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
236
|
+
tabsColSizes?: GridColumnSizesType;
|
|
237
|
+
centered?: boolean;
|
|
238
|
+
direction?: MediaDirection;
|
|
236
239
|
items: TabsBlockItem[];
|
|
237
240
|
}
|
|
238
241
|
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
|
@@ -221,18 +221,21 @@ export interface TableBlockProps {
|
|
|
221
221
|
title: string;
|
|
222
222
|
table: TableProps;
|
|
223
223
|
}
|
|
224
|
-
export interface TabsBlockItem {
|
|
224
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
|
|
225
225
|
tabName: string;
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated Use array links from ContentBlockProps instead
|
|
228
|
+
*/
|
|
228
229
|
link?: LinkProps;
|
|
229
230
|
image?: ThemedImage;
|
|
230
231
|
disableCompress?: boolean;
|
|
231
232
|
caption?: string;
|
|
232
233
|
media?: ThemedMediaProps;
|
|
233
|
-
links?: LinkProps[];
|
|
234
234
|
}
|
|
235
235
|
export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
236
|
+
tabsColSizes?: GridColumnSizesType;
|
|
237
|
+
centered?: boolean;
|
|
238
|
+
direction?: MediaDirection;
|
|
236
239
|
items: TabsBlockItem[];
|
|
237
240
|
}
|
|
238
241
|
export interface LinkTableBlockProps extends BlockHeaderProps {
|
package/server/models/index.d.ts
CHANGED
package/server/models/index.js
CHANGED
|
@@ -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: [],
|