@gravity-ui/page-constructor 1.7.0-alpha.7 → 1.7.0-alpha.9

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.
Files changed (127) hide show
  1. package/README.md +58 -36
  2. package/build/cjs/blocks/Tabs/Tabs.css +23 -49
  3. package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
  4. package/build/cjs/blocks/Tabs/Tabs.js +27 -29
  5. package/build/cjs/components/Image/Image.js +1 -3
  6. package/build/cjs/components/OverflowScroller/OverflowScroller.css +2 -0
  7. package/build/cjs/components/RouterLink/RouterLink.d.ts +1 -0
  8. package/build/cjs/components/VideoBlock/VideoBlock.js +1 -1
  9. package/build/cjs/components/index.d.ts +2 -0
  10. package/build/cjs/components/index.js +40 -39
  11. package/build/cjs/components/navigation/components/Header/Header.css +85 -0
  12. package/build/cjs/components/navigation/components/Header/Header.d.ts +8 -0
  13. package/build/cjs/components/navigation/components/Header/Header.js +51 -0
  14. package/build/cjs/components/navigation/components/Logo/Logo.css +23 -0
  15. package/build/cjs/components/navigation/components/Logo/Logo.d.ts +7 -0
  16. package/build/cjs/components/navigation/components/Logo/Logo.js +17 -0
  17. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
  18. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +13 -0
  19. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.js +45 -0
  20. package/build/cjs/components/navigation/components/Navigation/Navigation.css +43 -0
  21. package/build/cjs/components/navigation/components/Navigation/Navigation.d.ts +18 -0
  22. package/build/cjs/components/navigation/components/Navigation/Navigation.js +69 -0
  23. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.css +41 -0
  24. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.d.ts +10 -0
  25. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +59 -0
  26. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
  27. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +10 -0
  28. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.js +45 -0
  29. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
  30. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.d.ts +7 -0
  31. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +14 -0
  32. package/build/cjs/components/navigation/components/index.d.ts +7 -0
  33. package/build/cjs/components/navigation/components/index.js +20 -0
  34. package/build/cjs/components/navigation/containers/Layout/Layout.css +10 -0
  35. package/build/cjs/components/navigation/containers/Layout/Layout.d.ts +8 -0
  36. package/build/cjs/components/navigation/containers/Layout/Layout.js +11 -0
  37. package/build/cjs/constructor-items.d.ts +1 -1
  38. package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +3 -2
  39. package/build/cjs/containers/PageConstructor/PageConstructor.js +12 -10
  40. package/build/cjs/context/locationContext/locationContext.d.ts +1 -0
  41. package/build/cjs/icons/NavigationArrow.d.ts +2 -0
  42. package/build/cjs/icons/NavigationArrow.js +9 -0
  43. package/build/cjs/icons/NavigationClose.d.ts +2 -0
  44. package/build/cjs/icons/NavigationClose.js +9 -0
  45. package/build/cjs/icons/NavigationOpen.d.ts +2 -0
  46. package/build/cjs/icons/NavigationOpen.js +11 -0
  47. package/build/cjs/icons/index.d.ts +3 -0
  48. package/build/cjs/icons/index.js +3 -0
  49. package/build/cjs/models/constructor-items/blocks.d.ts +4 -7
  50. package/build/cjs/models/index.d.ts +1 -0
  51. package/build/cjs/models/index.js +1 -0
  52. package/build/cjs/models/navigation.d.ts +62 -0
  53. package/build/cjs/models/navigation.js +10 -0
  54. package/build/cjs/text-transform/blocks.js +4 -11
  55. package/build/cjs/text-transform/utils.js +1 -1
  56. package/build/esm/blocks/Tabs/Tabs.css +23 -49
  57. package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
  58. package/build/esm/blocks/Tabs/Tabs.js +27 -29
  59. package/build/esm/components/Image/Image.d.ts +0 -1
  60. package/build/esm/components/Image/Image.js +1 -4
  61. package/build/esm/components/OverflowScroller/OverflowScroller.css +2 -0
  62. package/build/esm/components/RouterLink/RouterLink.d.ts +1 -0
  63. package/build/esm/components/VideoBlock/VideoBlock.js +1 -1
  64. package/build/esm/components/index.d.ts +2 -0
  65. package/build/esm/components/index.js +2 -0
  66. package/build/esm/components/navigation/components/Header/Header.css +85 -0
  67. package/build/esm/components/navigation/components/Header/Header.d.ts +9 -0
  68. package/build/esm/components/navigation/components/Header/Header.js +47 -0
  69. package/build/esm/components/navigation/components/Logo/Logo.css +23 -0
  70. package/build/esm/components/navigation/components/Logo/Logo.d.ts +8 -0
  71. package/build/esm/components/navigation/components/Logo/Logo.js +15 -0
  72. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
  73. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +14 -0
  74. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.js +43 -0
  75. package/build/esm/components/navigation/components/Navigation/Navigation.css +43 -0
  76. package/build/esm/components/navigation/components/Navigation/Navigation.d.ts +19 -0
  77. package/build/esm/components/navigation/components/Navigation/Navigation.js +68 -0
  78. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.css +41 -0
  79. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.d.ts +11 -0
  80. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +58 -0
  81. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
  82. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +11 -0
  83. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.js +41 -0
  84. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
  85. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.d.ts +8 -0
  86. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +12 -0
  87. package/build/esm/components/navigation/components/index.d.ts +7 -0
  88. package/build/esm/components/navigation/components/index.js +7 -0
  89. package/build/esm/components/navigation/containers/Layout/Layout.css +10 -0
  90. package/build/esm/components/navigation/containers/Layout/Layout.d.ts +9 -0
  91. package/build/esm/components/navigation/containers/Layout/Layout.js +9 -0
  92. package/build/esm/constructor-items.d.ts +1 -1
  93. package/build/esm/containers/PageConstructor/PageConstructor.d.ts +3 -2
  94. package/build/esm/containers/PageConstructor/PageConstructor.js +12 -10
  95. package/build/esm/context/locationContext/locationContext.d.ts +1 -0
  96. package/build/esm/icons/NavigationArrow.d.ts +2 -0
  97. package/build/esm/icons/NavigationArrow.js +4 -0
  98. package/build/esm/icons/NavigationClose.d.ts +2 -0
  99. package/build/esm/icons/NavigationClose.js +4 -0
  100. package/build/esm/icons/NavigationOpen.d.ts +2 -0
  101. package/build/esm/icons/NavigationOpen.js +6 -0
  102. package/build/esm/icons/index.d.ts +3 -0
  103. package/build/esm/icons/index.js +3 -0
  104. package/build/esm/models/constructor-items/blocks.d.ts +4 -7
  105. package/build/esm/models/index.d.ts +1 -0
  106. package/build/esm/models/index.js +1 -0
  107. package/build/esm/models/navigation.d.ts +62 -0
  108. package/build/esm/models/navigation.js +7 -0
  109. package/build/esm/text-transform/blocks.js +4 -11
  110. package/build/esm/text-transform/utils.js +1 -1
  111. package/package.json +1 -4
  112. package/server/models/constructor-items/blocks.d.ts +4 -7
  113. package/server/models/index.d.ts +1 -0
  114. package/server/models/index.js +1 -0
  115. package/server/models/navigation.d.ts +62 -0
  116. package/server/models/navigation.js +10 -0
  117. package/server/text-transform/blocks.js +4 -11
  118. package/server/text-transform/utils.js +1 -1
  119. package/styles/mixins.scss +38 -0
  120. package/build/cjs/components/ButtonTabs/ButtonTabs.css +0 -12
  121. package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +0 -13
  122. package/build/cjs/components/ButtonTabs/ButtonTabs.js +0 -27
  123. package/build/cjs/components/Image/Image.css +0 -3
  124. package/build/esm/components/ButtonTabs/ButtonTabs.css +0 -12
  125. package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +0 -14
  126. package/build/esm/components/ButtonTabs/ButtonTabs.js +0 -25
  127. package/build/esm/components/Image/Image.css +0 -3
@@ -0,0 +1,20 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-social-icon {
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
7
+ width: 40px;
8
+ height: 40px;
9
+ margin-right: 8px;
10
+ color: var(--yc-color-base-background);
11
+ border-radius: 50%;
12
+ background-color: var(--yc-color-base-generic);
13
+ }
14
+ .pc-social-icon:hover {
15
+ background-color: var(--yc-color-base-generic-hover);
16
+ }
17
+ .pc-social-icon__icon {
18
+ width: 16px;
19
+ height: 16px;
20
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { NavigationSocialItem } from '../../../../models';
3
+ import './SocialIcon.css';
4
+ export interface NavigationSocialItemProps extends NavigationSocialItem {
5
+ className?: string;
6
+ }
7
+ declare const SocialIcon: React.FC<NavigationSocialItemProps>;
8
+ export default SocialIcon;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { block } from '../../../../utils';
3
+ import { Image } from '../../../index';
4
+ import { getMediaImage } from '../../../Media/Image/utils';
5
+ import './SocialIcon.css';
6
+ const b = block('social-icon');
7
+ const SocialIcon = ({ icon, url, className }) => {
8
+ const iconData = getMediaImage(icon);
9
+ return (React.createElement("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
10
+ React.createElement(Image, Object.assign({ className: b('icon') }, iconData))));
11
+ };
12
+ export default SocialIcon;
@@ -0,0 +1,7 @@
1
+ export { default as Header } from './Header/Header';
2
+ export { default as NavigationItem } from './NavigationItem/NavigationItem';
3
+ export { default as Logo } from './Logo/Logo';
4
+ export { default as MobileNavigation } from './MobileNavigation/MobileNavigation';
5
+ export { default as Navigation } from './Navigation/Navigation';
6
+ export { default as NavigationPopup } from './NavigationPopup/NavigationPopup';
7
+ export { default as SocialIcon } from './SocialIcon/SocialIcon';
@@ -0,0 +1,7 @@
1
+ export { default as Header } from './Header/Header';
2
+ export { default as NavigationItem } from './NavigationItem/NavigationItem';
3
+ export { default as Logo } from './Logo/Logo';
4
+ export { default as MobileNavigation } from './MobileNavigation/MobileNavigation';
5
+ export { default as Navigation } from './Navigation/Navigation';
6
+ export { default as NavigationPopup } from './NavigationPopup/NavigationPopup';
7
+ export { default as SocialIcon } from './SocialIcon/SocialIcon';
@@ -0,0 +1,10 @@
1
+ .layout {
2
+ display: flex;
3
+ flex-direction: column;
4
+ min-height: 100vh;
5
+ }
6
+ .layout__content {
7
+ display: flex;
8
+ flex-grow: 1;
9
+ flex-direction: column;
10
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { NavigationData } from '../../../../models';
3
+ import './Layout.css';
4
+ export interface LayoutProps {
5
+ navigation?: NavigationData;
6
+ children?: React.ReactNode;
7
+ }
8
+ declare const Layout: React.FC<LayoutProps>;
9
+ export default Layout;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { block } from '../../../../utils';
3
+ import Header from '../../components/Header/Header';
4
+ import './Layout.css';
5
+ const b = block('layout');
6
+ const Layout = ({ children, navigation }) => (React.createElement("div", { className: b() },
7
+ navigation && React.createElement(Header, { data: navigation.header, logo: navigation.logo }),
8
+ React.createElement("main", { className: b('content') }, children)));
9
+ export default Layout;
@@ -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, tabsColSizes, centered, direction, }: import("./models").TabsBlockProps) => JSX.Element;
14
+ "tabs-block": ({ items, title, description, animated }: 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,7 @@
1
1
  import React from 'react';
2
- import { ShouldRenderBlock, CustomConfig, PageContent, CustomItems } from '../../models';
3
- import { blockMap, subBlockMap } from '../../constructor-items';
4
2
  import '@doc-tools/transform/dist/js/yfm';
3
+ import { ShouldRenderBlock, CustomConfig, PageContent, CustomItems, NavigationData } from '../../models';
4
+ import { blockMap, subBlockMap } from '../../constructor-items';
5
5
  import './PageConstructor.css';
6
6
  export declare type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;
7
7
  export interface PageConstructorProps {
@@ -9,6 +9,7 @@ export interface PageConstructorProps {
9
9
  shouldRenderBlock?: ShouldRenderBlock;
10
10
  custom?: CustomConfig;
11
11
  renderMenu?: () => React.ReactNode;
12
+ navigation?: NavigationData;
12
13
  }
13
14
  export declare const Constructor: (props: PageConstructorProps) => JSX.Element;
14
15
  export declare const PageConstructor: (props: PageConstructorProps) => JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useContext, useMemo } from 'react';
3
+ import '@doc-tools/transform/dist/js/yfm';
3
4
  import { HeaderBlockTypes, BlockTypes, } from '../../models';
4
5
  import { blockMap, subBlockMap } from '../../constructor-items';
5
6
  import { Grid } from '../../grid';
@@ -12,7 +13,7 @@ import { ConstructorRow } from './components/ConstructorRow';
12
13
  import { ConstructorFootnotes } from './components/ConstructorFootnotes';
13
14
  import { ConstructorHeader } from './components/ConstructorItem';
14
15
  import { ConstructorBlocks } from './components/ConstructorBlocks';
15
- import '@doc-tools/transform/dist/js/yfm';
16
+ import Layout from '../../components/navigation/containers/Layout/Layout';
16
17
  import './PageConstructor.css';
17
18
  const b = cnBlock('page-constructor');
18
19
  export const Constructor = (props) => {
@@ -28,7 +29,7 @@ export const Constructor = (props) => {
28
29
  });
29
30
  }, [props.custom]);
30
31
  const { themeValue: theme } = useContext(ThemeValueContext);
31
- const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, } = props;
32
+ const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, navigation, } = props;
32
33
  const hasFootnotes = footnotes.length > 0;
33
34
  const isHeaderBlock = (block) => headerBlockTypes.includes(block.type);
34
35
  const header = blocks === null || blocks === void 0 ? void 0 : blocks.find(isHeaderBlock);
@@ -37,14 +38,15 @@ export const Constructor = (props) => {
37
38
  return (React.createElement(InnerContext.Provider, { value: context },
38
39
  React.createElement("div", { className: b() },
39
40
  React.createElement("div", { className: b('wrapper') },
40
- React.createElement(BackgroundMedia, Object.assign({}, themedBackground, { className: b('background') })),
41
- renderMenu && renderMenu(),
42
- header && React.createElement(ConstructorHeader, { data: header }),
43
- React.createElement(Grid, null,
44
- restBlocks && (React.createElement(ConstructorRow, null,
45
- React.createElement(ConstructorBlocks, { items: restBlocks, shouldRenderBlock: shouldRenderBlock }))),
46
- hasFootnotes && (React.createElement(ConstructorRow, null,
47
- React.createElement(ConstructorFootnotes, { items: footnotes }))))))));
41
+ themedBackground && (React.createElement(BackgroundMedia, Object.assign({}, themedBackground, { className: b('background') }))),
42
+ React.createElement(Layout, { navigation: navigation },
43
+ renderMenu && renderMenu(),
44
+ header && React.createElement(ConstructorHeader, { data: header }),
45
+ React.createElement(Grid, null,
46
+ restBlocks && (React.createElement(ConstructorRow, null,
47
+ React.createElement(ConstructorBlocks, { items: restBlocks, shouldRenderBlock: shouldRenderBlock }))),
48
+ hasFootnotes && (React.createElement(ConstructorRow, null,
49
+ React.createElement(ConstructorFootnotes, { items: footnotes })))))))));
48
50
  };
49
51
  export const PageConstructor = (props) => {
50
52
  const { content: { animated = true } = {} } = props, rest = __rest(props, ["content"]);
@@ -16,5 +16,6 @@ export declare type LocationContextProps = {
16
16
  pathname?: string;
17
17
  hostname?: string;
18
18
  Link?: RouterLink;
19
+ asPath?: string;
19
20
  };
20
21
  export declare const LocationContext: React.Context<LocationContextProps>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NavigationArrow: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { a11yHiddenSvgProps } from '../utils/svg';
3
+ export const NavigationArrow = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", fill: "none", viewBox: "0 0 9 9" }, a11yHiddenSvgProps, props),
4
+ React.createElement("path", { d: "M3 1H8M8 1V6M8 1L1 8", stroke: "currentColor", strokeOpacity: "0.7", strokeWidth: "1.2", strokeLinecap: "square" })));
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NavigationClose: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { a11yHiddenSvgProps } from '../utils/svg';
3
+ export const NavigationClose = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "36", height: "36", fill: "none" }, a11yHiddenSvgProps, props),
4
+ React.createElement("path", { d: "M26 10 10 26m16 0L10 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })));
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NavigationOpen: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { a11yHiddenSvgProps } from '../utils/svg';
3
+ export const NavigationOpen = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "36", height: "36", fill: "none" }, a11yHiddenSvgProps, props),
4
+ React.createElement("rect", { x: "8", y: "10", width: "20", height: "2", rx: "1", fill: "currentColor" }),
5
+ React.createElement("rect", { x: "8", y: "17", width: "20", height: "2", rx: "1", fill: "currentColor" }),
6
+ React.createElement("rect", { x: "8", y: "24", width: "20", height: "2", rx: "1", fill: "currentColor" })));
@@ -6,3 +6,6 @@ export * from './Github';
6
6
  export * from './NavigationChevron';
7
7
  export * from './PlayVideo';
8
8
  export * from './PreviewClose';
9
+ export * from './NavigationClose';
10
+ export * from './NavigationOpen';
11
+ export * from './NavigationArrow';
@@ -6,3 +6,6 @@ export * from './Github';
6
6
  export * from './NavigationChevron';
7
7
  export * from './PlayVideo';
8
8
  export * from './PreviewClose';
9
+ export * from './NavigationClose';
10
+ export * from './NavigationOpen';
11
+ export * from './NavigationArrow';
@@ -221,21 +221,18 @@ export interface TableBlockProps {
221
221
  title: string;
222
222
  table: TableProps;
223
223
  }
224
- export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
224
+ export interface TabsBlockItem {
225
225
  tabName: string;
226
- /**
227
- * @deprecated Use array links from ContentBlockProps instead
228
- */
226
+ title: string;
227
+ text: string;
229
228
  link?: LinkProps;
230
229
  image?: ThemedImage;
231
230
  disableCompress?: boolean;
232
231
  caption?: string;
233
232
  media?: ThemedMediaProps;
233
+ links?: LinkProps[];
234
234
  }
235
235
  export interface TabsBlockProps extends BlockHeaderProps, Animatable {
236
- tabsColSizes?: GridColumnSizesType;
237
- centered?: boolean;
238
- direction?: MediaDirection;
239
236
  items: TabsBlockItem[];
240
237
  }
241
238
  export interface LinkTableBlockProps extends BlockHeaderProps {
@@ -4,3 +4,4 @@ export * from './common';
4
4
  export * from './components';
5
5
  export * from './guards';
6
6
  export * from './react';
7
+ export * from './navigation';
@@ -4,3 +4,4 @@ export * from './common';
4
4
  export * from './components';
5
5
  export * from './guards';
6
6
  export * from './react';
7
+ export * from './navigation';
@@ -0,0 +1,62 @@
1
+ import { ImageProps, ButtonProps } from './constructor-items';
2
+ export declare enum NavigationItemType {
3
+ Link = "link",
4
+ Dropdown = "dropdown",
5
+ Button = "button",
6
+ Social = "social"
7
+ }
8
+ export interface NavigationItemBase {
9
+ text: string;
10
+ icon?: ImageProps;
11
+ url?: string;
12
+ }
13
+ export interface NavigationLinkItem extends NavigationItemBase {
14
+ type: NavigationItemType.Link;
15
+ url: string;
16
+ arrow?: boolean;
17
+ target?: string;
18
+ }
19
+ export interface NavigationButtonItem extends ButtonProps {
20
+ type: NavigationItemType.Button;
21
+ url: string;
22
+ target?: string;
23
+ }
24
+ export interface NavigationDropdownItem extends NavigationItemBase {
25
+ type: NavigationItemType.Dropdown;
26
+ items: NavigationLinkItem[];
27
+ }
28
+ export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
29
+ type: NavigationItemType.Social;
30
+ icon: ImageProps;
31
+ url: string;
32
+ }
33
+ export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
34
+ export declare type NavigationItemData = NavigationLinkItem | NavigationButtonItem | NavigationSocialItem | DropdownItemData;
35
+ export declare type DropdownItemData = Omit<NavigationDropdownItem, 'items'>;
36
+ export interface NavigationLogo {
37
+ icon: ImageProps;
38
+ text?: string;
39
+ url?: string;
40
+ }
41
+ export interface HeaderData {
42
+ leftItems: NavigationItem[];
43
+ rightItems?: NavigationItem[];
44
+ }
45
+ export interface FooterColumn {
46
+ title: string;
47
+ links: NavigationItem[];
48
+ }
49
+ export interface FooterUnderline {
50
+ links?: NavigationItem[];
51
+ copyright?: string;
52
+ }
53
+ export interface FooterData {
54
+ columns: FooterColumn[];
55
+ social?: NavigationSocialItem[];
56
+ underline?: FooterUnderline;
57
+ }
58
+ export interface NavigationData {
59
+ logo: NavigationLogo;
60
+ header: HeaderData;
61
+ footer?: FooterData;
62
+ }
@@ -0,0 +1,7 @@
1
+ export var NavigationItemType;
2
+ (function (NavigationItemType) {
3
+ NavigationItemType["Link"] = "link";
4
+ NavigationItemType["Dropdown"] = "dropdown";
5
+ NavigationItemType["Button"] = "button";
6
+ NavigationItemType["Social"] = "social";
7
+ })(NavigationItemType || (NavigationItemType = {}));
@@ -19,6 +19,7 @@ export const createItemsParser = (fields) => (transformer, items) => items.map((
19
19
  }, {}));
20
20
  }
21
21
  });
22
+ const parseItems = createItemsParser(['title', 'text']);
22
23
  function parseTableBlock(transformer, content) {
23
24
  const legend = content === null || content === void 0 ? void 0 : content.legend;
24
25
  return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
@@ -44,13 +45,9 @@ function parseSlider(transformer, block) {
44
45
  }
45
46
  const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
46
47
  ? 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
- });
51
48
  function parsePriceDetailedBlock(transformer, block) {
52
49
  const { priceType } = block;
53
- block.items = block.items.map((item) => {
50
+ const transformedBlockItems = block.items.map((item) => {
54
51
  const { description, items: details = [] } = item;
55
52
  if (priceType === 'marked-list') {
56
53
  item.items = details.map((detail) => {
@@ -67,6 +64,7 @@ function parsePriceDetailedBlock(transformer, block) {
67
64
  item.description = transformer(description);
68
65
  return item;
69
66
  });
67
+ block.items = transformedBlockItems;
70
68
  return block;
71
69
  }
72
70
  const parseContentLayout = (transformer, content) => {
@@ -222,12 +220,7 @@ const config = {
222
220
  {
223
221
  fields: ['items'],
224
222
  transformer: yfmTransformer,
225
- parser: createItemsParser(['text', 'additionalInfo']),
226
- },
227
- {
228
- fields: ['items'],
229
- transformer: typografTransformer,
230
- parser: parseItemsTitle,
223
+ parser: parseItems,
231
224
  },
232
225
  ],
233
226
  [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', 'ru/other/phone-number'],
26
+ disabled: ['common/symbols/cf'],
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.0-alpha.7",
3
+ "version": "1.7.0-alpha.9",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -121,8 +121,5 @@
121
121
  "*.{json,yaml,yml,md}": [
122
122
  "prettier --write"
123
123
  ]
124
- },
125
- "publishConfig": {
126
- "tag": "alpha"
127
124
  }
128
125
  }
@@ -221,21 +221,18 @@ export interface TableBlockProps {
221
221
  title: string;
222
222
  table: TableProps;
223
223
  }
224
- export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'> {
224
+ export interface TabsBlockItem {
225
225
  tabName: string;
226
- /**
227
- * @deprecated Use array links from ContentBlockProps instead
228
- */
226
+ title: string;
227
+ text: string;
229
228
  link?: LinkProps;
230
229
  image?: ThemedImage;
231
230
  disableCompress?: boolean;
232
231
  caption?: string;
233
232
  media?: ThemedMediaProps;
233
+ links?: LinkProps[];
234
234
  }
235
235
  export interface TabsBlockProps extends BlockHeaderProps, Animatable {
236
- tabsColSizes?: GridColumnSizesType;
237
- centered?: boolean;
238
- direction?: MediaDirection;
239
236
  items: TabsBlockItem[];
240
237
  }
241
238
  export interface LinkTableBlockProps extends BlockHeaderProps {
@@ -4,3 +4,4 @@ export * from './common';
4
4
  export * from './components';
5
5
  export * from './guards';
6
6
  export * from './react';
7
+ export * from './navigation';
@@ -16,3 +16,4 @@ __exportStar(require("./common"), exports);
16
16
  __exportStar(require("./components"), exports);
17
17
  __exportStar(require("./guards"), exports);
18
18
  __exportStar(require("./react"), exports);
19
+ __exportStar(require("./navigation"), exports);
@@ -0,0 +1,62 @@
1
+ import { ImageProps, ButtonProps } from './constructor-items';
2
+ export declare enum NavigationItemType {
3
+ Link = "link",
4
+ Dropdown = "dropdown",
5
+ Button = "button",
6
+ Social = "social"
7
+ }
8
+ export interface NavigationItemBase {
9
+ text: string;
10
+ icon?: ImageProps;
11
+ url?: string;
12
+ }
13
+ export interface NavigationLinkItem extends NavigationItemBase {
14
+ type: NavigationItemType.Link;
15
+ url: string;
16
+ arrow?: boolean;
17
+ target?: string;
18
+ }
19
+ export interface NavigationButtonItem extends ButtonProps {
20
+ type: NavigationItemType.Button;
21
+ url: string;
22
+ target?: string;
23
+ }
24
+ export interface NavigationDropdownItem extends NavigationItemBase {
25
+ type: NavigationItemType.Dropdown;
26
+ items: NavigationLinkItem[];
27
+ }
28
+ export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
29
+ type: NavigationItemType.Social;
30
+ icon: ImageProps;
31
+ url: string;
32
+ }
33
+ export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
34
+ export declare type NavigationItemData = NavigationLinkItem | NavigationButtonItem | NavigationSocialItem | DropdownItemData;
35
+ export declare type DropdownItemData = Omit<NavigationDropdownItem, 'items'>;
36
+ export interface NavigationLogo {
37
+ icon: ImageProps;
38
+ text?: string;
39
+ url?: string;
40
+ }
41
+ export interface HeaderData {
42
+ leftItems: NavigationItem[];
43
+ rightItems?: NavigationItem[];
44
+ }
45
+ export interface FooterColumn {
46
+ title: string;
47
+ links: NavigationItem[];
48
+ }
49
+ export interface FooterUnderline {
50
+ links?: NavigationItem[];
51
+ copyright?: string;
52
+ }
53
+ export interface FooterData {
54
+ columns: FooterColumn[];
55
+ social?: NavigationSocialItem[];
56
+ underline?: FooterUnderline;
57
+ }
58
+ export interface NavigationData {
59
+ logo: NavigationLogo;
60
+ header: HeaderData;
61
+ footer?: FooterData;
62
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationItemType = void 0;
4
+ var NavigationItemType;
5
+ (function (NavigationItemType) {
6
+ NavigationItemType["Link"] = "link";
7
+ NavigationItemType["Dropdown"] = "dropdown";
8
+ NavigationItemType["Button"] = "button";
9
+ NavigationItemType["Social"] = "social";
10
+ })(NavigationItemType = exports.NavigationItemType || (exports.NavigationItemType = {}));
@@ -36,6 +36,7 @@ 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']);
39
40
  function parseTableBlock(transformer, content) {
40
41
  const legend = content === null || content === void 0 ? void 0 : content.legend;
41
42
  return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
@@ -61,13 +62,9 @@ function parseSlider(transformer, block) {
61
62
  }
62
63
  const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
63
64
  ? 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
- });
68
65
  function parsePriceDetailedBlock(transformer, block) {
69
66
  const { priceType } = block;
70
- block.items = block.items.map((item) => {
67
+ const transformedBlockItems = block.items.map((item) => {
71
68
  const { description, items: details = [] } = item;
72
69
  if (priceType === 'marked-list') {
73
70
  item.items = details.map((detail) => {
@@ -84,6 +81,7 @@ function parsePriceDetailedBlock(transformer, block) {
84
81
  item.description = transformer(description);
85
82
  return item;
86
83
  });
84
+ block.items = transformedBlockItems;
87
85
  return block;
88
86
  }
89
87
  const parseContentLayout = (transformer, content) => {
@@ -241,12 +239,7 @@ const config = {
241
239
  {
242
240
  fields: ['items'],
243
241
  transformer: yfmTransformer,
244
- parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
245
- },
246
- {
247
- fields: ['items'],
248
- transformer: typografTransformer,
249
- parser: parseItemsTitle,
242
+ parser: parseItems,
250
243
  },
251
244
  ],
252
245
  [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', 'ru/other/phone-number'],
42
+ disabled: ['common/symbols/cf'],
43
43
  };
44
44
  exports.sanitizeStripOptions = {
45
45
  allowedTags: [],
@@ -442,3 +442,41 @@ unpredictable css rules order in build */
442
442
  @mixin font-feature-settings {
443
443
  font-feature-settings: 'liga', 'kern', 'pnum' on, 'lnum' on, 'ss03' on;
444
444
  }
445
+
446
+ @mixin navigation-popup {
447
+ z-index: 101;
448
+
449
+ display: flex;
450
+ flex-direction: column;
451
+
452
+ min-width: 220px;
453
+ padding: $indentXS;
454
+
455
+ border: 1px solid var(--yc-color-line-generic);
456
+ border-top-width: 0;
457
+ border-radius: calc(#{$borderRadius} / 2);
458
+ background: var(--yc-color-base-float);
459
+ box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
460
+ }
461
+
462
+ @mixin navigation-item {
463
+ color: var(--yc-color-text-primary);
464
+ @include reset-link-style();
465
+ @include islands-focus();
466
+
467
+ &:hover,
468
+ &_active {
469
+ color: var(--yc-color-text-link);
470
+ }
471
+ }
472
+
473
+ @mixin navigation-link() {
474
+ cursor: pointer;
475
+ @include islands-focus();
476
+ @include reset-link-style();
477
+
478
+ &:hover,
479
+ &:active {
480
+ color: var(--yc-color-text-link);
481
+ }
482
+ }
@@ -1,12 +0,0 @@
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
- }