@gravity-ui/page-constructor 1.6.1 → 1.7.0-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.
Files changed (87) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.css +6 -1
  3. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +26 -12
  4. package/build/cjs/components/RouterLink/RouterLink.d.ts +1 -0
  5. package/build/cjs/components/index.d.ts +1 -0
  6. package/build/cjs/components/index.js +3 -1
  7. package/build/cjs/components/navigation/components/Header/Header.css +85 -0
  8. package/build/cjs/components/navigation/components/Header/Header.d.ts +28 -0
  9. package/build/cjs/components/navigation/components/Header/Header.js +81 -0
  10. package/build/cjs/components/navigation/components/Logo/Logo.css +18 -0
  11. package/build/cjs/components/navigation/components/Logo/Logo.d.ts +7 -0
  12. package/build/cjs/components/navigation/components/Logo/Logo.js +13 -0
  13. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
  14. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +13 -0
  15. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.js +45 -0
  16. package/build/cjs/components/navigation/components/Navigation/Navigation.css +43 -0
  17. package/build/cjs/components/navigation/components/Navigation/Navigation.d.ts +11 -0
  18. package/build/cjs/components/navigation/components/Navigation/Navigation.js +70 -0
  19. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.css +40 -0
  20. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.d.ts +12 -0
  21. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +47 -0
  22. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
  23. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +24 -0
  24. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.js +57 -0
  25. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
  26. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.d.ts +7 -0
  27. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +10 -0
  28. package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +2 -0
  29. package/build/cjs/containers/PageConstructor/PageConstructor.js +4 -2
  30. package/build/cjs/context/locationContext/locationContext.d.ts +1 -0
  31. package/build/cjs/icons/NavigationArrow.d.ts +2 -0
  32. package/build/cjs/icons/NavigationArrow.js +9 -0
  33. package/build/cjs/icons/NavigationClose.d.ts +2 -0
  34. package/build/cjs/icons/NavigationClose.js +9 -0
  35. package/build/cjs/icons/NavigationOpen.d.ts +2 -0
  36. package/build/cjs/icons/NavigationOpen.js +11 -0
  37. package/build/cjs/icons/index.d.ts +3 -0
  38. package/build/cjs/icons/index.js +3 -0
  39. package/build/cjs/models/constructor-items/blocks.d.ts +3 -1
  40. package/build/cjs/models/navigation.d.ts +59 -0
  41. package/build/cjs/models/navigation.js +10 -0
  42. package/build/cjs/text-transform/blocks.js +6 -1
  43. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.css +6 -1
  44. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +28 -14
  45. package/build/esm/components/RouterLink/RouterLink.d.ts +1 -0
  46. package/build/esm/components/index.d.ts +1 -0
  47. package/build/esm/components/index.js +1 -0
  48. package/build/esm/components/navigation/components/Header/Header.css +85 -0
  49. package/build/esm/components/navigation/components/Header/Header.d.ts +29 -0
  50. package/build/esm/components/navigation/components/Header/Header.js +79 -0
  51. package/build/esm/components/navigation/components/Logo/Logo.css +18 -0
  52. package/build/esm/components/navigation/components/Logo/Logo.d.ts +8 -0
  53. package/build/esm/components/navigation/components/Logo/Logo.js +11 -0
  54. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
  55. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +14 -0
  56. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.js +43 -0
  57. package/build/esm/components/navigation/components/Navigation/Navigation.css +43 -0
  58. package/build/esm/components/navigation/components/Navigation/Navigation.d.ts +12 -0
  59. package/build/esm/components/navigation/components/Navigation/Navigation.js +69 -0
  60. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.css +40 -0
  61. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.d.ts +13 -0
  62. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +46 -0
  63. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
  64. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +25 -0
  65. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.js +54 -0
  66. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
  67. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.d.ts +8 -0
  68. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +8 -0
  69. package/build/esm/containers/PageConstructor/PageConstructor.d.ts +2 -0
  70. package/build/esm/containers/PageConstructor/PageConstructor.js +4 -2
  71. package/build/esm/context/locationContext/locationContext.d.ts +1 -0
  72. package/build/esm/icons/NavigationArrow.d.ts +2 -0
  73. package/build/esm/icons/NavigationArrow.js +4 -0
  74. package/build/esm/icons/NavigationClose.d.ts +2 -0
  75. package/build/esm/icons/NavigationClose.js +4 -0
  76. package/build/esm/icons/NavigationOpen.d.ts +2 -0
  77. package/build/esm/icons/NavigationOpen.js +6 -0
  78. package/build/esm/icons/index.d.ts +3 -0
  79. package/build/esm/icons/index.js +3 -0
  80. package/build/esm/models/constructor-items/blocks.d.ts +3 -1
  81. package/build/esm/models/navigation.d.ts +59 -0
  82. package/build/esm/models/navigation.js +7 -0
  83. package/build/esm/text-transform/blocks.js +6 -1
  84. package/package.json +4 -1
  85. package/server/models/constructor-items/blocks.d.ts +3 -1
  86. package/server/text-transform/blocks.js +6 -1
  87. package/styles/mixins.scss +38 -0
@@ -1,6 +1,7 @@
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';
4
5
  import '@doc-tools/transform/dist/js/yfm';
5
6
  import './PageConstructor.css';
6
7
  export declare type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;
@@ -9,6 +10,7 @@ export interface PageConstructorProps {
9
10
  shouldRenderBlock?: ShouldRenderBlock;
10
11
  custom?: CustomConfig;
11
12
  renderMenu?: () => React.ReactNode;
13
+ navigationData?: NavigationData;
12
14
  }
13
15
  export declare const Constructor: (props: PageConstructorProps) => JSX.Element;
14
16
  export declare const PageConstructor: (props: PageConstructorProps) => JSX.Element;
@@ -12,6 +12,7 @@ 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';
15
16
  import '@doc-tools/transform/dist/js/yfm';
16
17
  import './PageConstructor.css';
17
18
  const b = cnBlock('page-constructor');
@@ -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, navigationData, } = 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,7 +38,8 @@ 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
+ themedBackground && (React.createElement(BackgroundMedia, Object.assign({}, themedBackground, { className: b('background') }))),
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 })),
41
43
  renderMenu && renderMenu(),
42
44
  header && React.createElement(ConstructorHeader, { data: header }),
43
45
  React.createElement(Grid, null,
@@ -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';
@@ -118,8 +118,10 @@ export interface ExtendedFeaturesItem {
118
118
  title?: string;
119
119
  text?: string;
120
120
  label?: string;
121
- icon?: string;
121
+ icon?: ThemedImage;
122
+ /** @deprecated **/
122
123
  link?: LinkProps;
124
+ links?: LinkProps[];
123
125
  }
124
126
  export interface ExtendedFeaturesProps extends Animatable {
125
127
  items: ExtendedFeaturesItem[];
@@ -0,0 +1,59 @@
1
+ import { ButtonProps } from '../components/Button/Button';
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?: string;
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: string;
31
+ url: string;
32
+ }
33
+ export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
34
+ export interface NavigationLogo extends Omit<NavigationItemBase, 'text'> {
35
+ icon: string;
36
+ text?: string;
37
+ }
38
+ export interface HeaderData {
39
+ leftItems: NavigationItem[];
40
+ rightItems?: NavigationItem[];
41
+ }
42
+ export interface FooterColumn {
43
+ title: string;
44
+ links: NavigationItem[];
45
+ }
46
+ export interface FooterUnderline {
47
+ links?: NavigationItem[];
48
+ copyright?: string;
49
+ }
50
+ export interface FooterData {
51
+ columns: FooterColumn[];
52
+ social?: NavigationSocialItem[];
53
+ underline?: FooterUnderline;
54
+ }
55
+ export interface NavigationData {
56
+ logo: NavigationLogo;
57
+ header: HeaderData;
58
+ footer?: FooterData;
59
+ }
@@ -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 = {}));
@@ -149,7 +149,12 @@ const config = {
149
149
  {
150
150
  fields: ['items'],
151
151
  transformer: typografTransformer,
152
- parser: parseFeatures,
152
+ parser: createItemsParser(['title']),
153
+ },
154
+ {
155
+ fields: ['items'],
156
+ transformer: yfmTransformer,
157
+ parser: createItemsParser(['text', 'additionalInfo']),
153
158
  },
154
159
  ],
155
160
  [BlockType.PromoFeaturesBlock]: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "1.6.1",
3
+ "version": "1.7.0-alpha.1",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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
  }
@@ -118,8 +118,10 @@ export interface ExtendedFeaturesItem {
118
118
  title?: string;
119
119
  text?: string;
120
120
  label?: string;
121
- icon?: string;
121
+ icon?: ThemedImage;
122
+ /** @deprecated **/
122
123
  link?: LinkProps;
124
+ links?: LinkProps[];
123
125
  }
124
126
  export interface ExtendedFeaturesProps extends Animatable {
125
127
  items: ExtendedFeaturesItem[];
@@ -168,7 +168,12 @@ const config = {
168
168
  {
169
169
  fields: ['items'],
170
170
  transformer: typografTransformer,
171
- parser: parseFeatures,
171
+ parser: (0, exports.createItemsParser)(['title']),
172
+ },
173
+ {
174
+ fields: ['items'],
175
+ transformer: yfmTransformer,
176
+ parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
172
177
  },
173
178
  ],
174
179
  [models_1.BlockType.PromoFeaturesBlock]: {
@@ -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
+ }