@gravity-ui/page-constructor 2.0.0-beta.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.css +4 -4
  3. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +1 -1
  4. package/build/cjs/blocks/Map/schema.d.ts +0 -12
  5. package/build/cjs/components/HTML/HTML.d.ts +1 -1
  6. package/build/cjs/components/Map/GoogleMap.js +7 -5
  7. package/build/cjs/components/Map/Map.css +5 -0
  8. package/build/cjs/components/Map/YMap/YMap.d.ts +4 -2
  9. package/build/cjs/components/Map/YMap/YMap.js +18 -10
  10. package/build/cjs/components/Map/YMap/YandexMap.js +18 -9
  11. package/build/cjs/models/constructor-items/common.d.ts +0 -2
  12. package/build/cjs/navigation/components/Header/Header.css +23 -0
  13. package/build/cjs/navigation/components/Header/Header.js +12 -8
  14. package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.css +5 -2
  15. package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.d.ts +2 -2
  16. package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.js +11 -11
  17. package/build/cjs/navigation/components/Navigation/Navigation.css +0 -11
  18. package/build/cjs/navigation/components/Navigation/Navigation.d.ts +4 -11
  19. package/build/cjs/navigation/components/Navigation/Navigation.js +5 -23
  20. package/build/cjs/navigation/components/NavigationDropdownItem/NavigationDropdownItem.d.ts +11 -0
  21. package/build/cjs/navigation/components/NavigationDropdownItem/NavigationDropdownItem.js +14 -0
  22. package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.css +11 -0
  23. package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.d.ts +16 -0
  24. package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +28 -0
  25. package/build/cjs/navigation/constants.d.ts +6 -0
  26. package/build/cjs/navigation/constants.js +10 -0
  27. package/build/cjs/navigation/utils.d.ts +10 -0
  28. package/build/cjs/navigation/utils.js +11 -0
  29. package/build/cjs/schema/validators/common.d.ts +0 -6
  30. package/build/cjs/schema/validators/common.js +0 -4
  31. package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +1 -0
  32. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.css +4 -4
  33. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +1 -1
  34. package/build/esm/blocks/Map/schema.d.ts +0 -12
  35. package/build/esm/components/HTML/HTML.d.ts +1 -1
  36. package/build/esm/components/Map/GoogleMap.js +7 -5
  37. package/build/esm/components/Map/Map.css +5 -0
  38. package/build/esm/components/Map/YMap/YMap.d.ts +4 -2
  39. package/build/esm/components/Map/YMap/YMap.js +18 -10
  40. package/build/esm/components/Map/YMap/YandexMap.js +18 -9
  41. package/build/esm/models/constructor-items/common.d.ts +0 -2
  42. package/build/esm/navigation/components/Header/Header.css +23 -0
  43. package/build/esm/navigation/components/Header/Header.js +12 -8
  44. package/build/esm/navigation/components/MobileNavigation/MobileNavigation.css +5 -2
  45. package/build/esm/navigation/components/MobileNavigation/MobileNavigation.d.ts +2 -2
  46. package/build/esm/navigation/components/MobileNavigation/MobileNavigation.js +11 -11
  47. package/build/esm/navigation/components/Navigation/Navigation.css +0 -11
  48. package/build/esm/navigation/components/Navigation/Navigation.d.ts +4 -11
  49. package/build/esm/navigation/components/Navigation/Navigation.js +6 -25
  50. package/build/esm/navigation/components/NavigationDropdownItem/NavigationDropdownItem.d.ts +11 -0
  51. package/build/esm/navigation/components/NavigationDropdownItem/NavigationDropdownItem.js +12 -0
  52. package/build/esm/navigation/components/NavigationListItem/NavigationListItem.css +11 -0
  53. package/build/esm/navigation/components/NavigationListItem/NavigationListItem.d.ts +17 -0
  54. package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +24 -0
  55. package/build/esm/navigation/constants.d.ts +6 -0
  56. package/build/esm/navigation/constants.js +7 -0
  57. package/build/esm/navigation/utils.d.ts +10 -0
  58. package/build/esm/navigation/utils.js +7 -0
  59. package/build/esm/schema/validators/common.d.ts +0 -6
  60. package/build/esm/schema/validators/common.js +0 -4
  61. package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +1 -0
  62. package/package.json +2 -5
  63. package/server/models/constructor-items/common.d.ts +0 -2
@@ -1,19 +1,12 @@
1
- import React, { MouseEventHandler } from 'react';
2
- import { NavigationDropdownItem, NavigationItemModel } from '../../../models/navigation';
1
+ import React from 'react';
2
+ import { NavigationItemModel } from '../../../models/navigation';
3
3
  import './Navigation.css';
4
4
  export interface NavigationProps {
5
5
  links: NavigationItemModel[];
6
- activeItemIndex: number;
7
- onActiveItemChange: (index: number) => void;
6
+ activeItemId?: string;
8
7
  className?: string;
9
8
  highlightActiveItem?: boolean;
10
- }
11
- export interface NavigationDropdownProps {
12
- data: NavigationDropdownItem;
13
- onClick: MouseEventHandler;
14
- isActive: boolean;
15
- position: number;
16
- hidePopup: () => void;
9
+ onActiveItemChange: (id?: string) => void;
17
10
  }
18
11
  declare const Navigation: React.FC<NavigationProps>;
19
12
  export default Navigation;
@@ -1,32 +1,20 @@
1
- import { __rest } from "tslib";
2
1
  import _ from 'lodash';
3
- import React, { Fragment, useState, useEffect, useCallback, useContext, useRef, } from 'react';
2
+ import React, { useState, useEffect, useCallback, useContext, useRef } from 'react';
4
3
  import { block } from '../../../utils';
5
4
  import OverflowScroller from '../../../components/OverflowScroller/OverflowScroller';
6
- import { NavigationItemType, } from '../../../models/navigation';
7
- import NavigationPopup from '../NavigationPopup/NavigationPopup';
8
- import NavigationItem from '../NavigationItem/NavigationItem';
9
5
  import { LocationContext } from '../../../context/locationContext';
6
+ import { ItemColumnName } from '../../constants';
7
+ import { NavigationListItem } from '../NavigationListItem/NavigationListItem';
10
8
  import './Navigation.css';
11
9
  const b = block('navigation');
12
- const NavigationDropdown = ({ data, isActive, position, hidePopup, onClick, }) => {
13
- const { text, items } = data, popupProps = __rest(data, ["text", "items"]);
14
- return (React.createElement(Fragment, null,
15
- React.createElement(NavigationItem, { className: b('link'), onClick: onClick, isOpened: isActive, data: { text, type: NavigationItemType.Dropdown } }),
16
- isActive && (React.createElement(NavigationPopup, Object.assign({ left: position, onClose: hidePopup, items: items }, popupProps)))));
17
- };
18
- const Navigation = ({ className, onActiveItemChange, links, activeItemIndex, highlightActiveItem, }) => {
10
+ const Navigation = ({ className, onActiveItemChange, links, activeItemId, highlightActiveItem, }) => {
19
11
  const { asPath, pathname } = useContext(LocationContext);
20
12
  const itemRefs = useRef([]);
21
13
  const [itemPositions, setItemPosition] = useState([]);
22
14
  const [lastLeftScroll, setLastLeftScroll] = useState(0);
23
15
  const hidePopup = useCallback(() => {
24
- onActiveItemChange(-1);
16
+ onActiveItemChange();
25
17
  }, [onActiveItemChange]);
26
- const getItemClickHandler = useCallback((index) => (e) => {
27
- e.stopPropagation();
28
- onActiveItemChange(index === activeItemIndex ? -1 : index);
29
- }, [activeItemIndex, onActiveItemChange]);
30
18
  const calculateItemPositions = useCallback(() => {
31
19
  if (itemRefs.current.length) {
32
20
  const currentItemPositions = itemRefs.current.map((itemRef) => (itemRef && itemRef.getBoundingClientRect().left) || 0);
@@ -56,13 +44,6 @@ const Navigation = ({ className, onActiveItemChange, links, activeItemIndex, hig
56
44
  }, [hidePopup, asPath, pathname]);
57
45
  return (React.createElement(OverflowScroller, { className: b(null, className), onScrollStart: hidePopup, onScrollEnd: calculateItemPositions },
58
46
  React.createElement("nav", null,
59
- React.createElement("ul", { className: b('links') }, links.map((link, index) => {
60
- const isActive = index === activeItemIndex;
61
- const onClick = getItemClickHandler(index);
62
- return (React.createElement("li", { ref: (el) => itemRefs.current.push(el), key: index, className: b('links-item') },
63
- link.type === NavigationItemType.Dropdown ? (React.createElement(NavigationDropdown, { data: link, onClick: onClick, isActive: isActive, position: itemPositions[index], hidePopup: hidePopup })) : (React.createElement(NavigationItem, { data: link, onClick: onClick })),
64
- highlightActiveItem && isActive && (React.createElement("div", { className: b('slider-container') },
65
- React.createElement("div", { className: b('slider') })))));
66
- })))));
47
+ React.createElement("ul", { className: b('links') }, links.map((link, index) => (React.createElement(NavigationListItem, { key: index, className: b('links-item'), item: link, itemRefs: itemRefs, index: index, activeItemId: activeItemId, highlightActiveItem: highlightActiveItem, hidePopup: hidePopup, itemPositions: itemPositions, column: ItemColumnName.Left, onActiveItemChange: onActiveItemChange })))))));
67
48
  };
68
49
  export default Navigation;
@@ -0,0 +1,11 @@
1
+ import React, { MouseEventHandler } from 'react';
2
+ import { NavigationDropdownItem } from '../../../models';
3
+ export interface NavigationDropdownProps {
4
+ data: NavigationDropdownItem;
5
+ onClick: MouseEventHandler;
6
+ isActive: boolean;
7
+ position: number;
8
+ hidePopup: () => void;
9
+ }
10
+ declare const NavigationDropdown: React.FC<NavigationDropdownProps>;
11
+ export default NavigationDropdown;
@@ -0,0 +1,12 @@
1
+ import { __rest } from "tslib";
2
+ import React, { Fragment } from 'react';
3
+ import { NavigationItemType } from '../../../models';
4
+ import NavigationItem from '../NavigationItem/NavigationItem';
5
+ import NavigationPopup from '../NavigationPopup/NavigationPopup';
6
+ const NavigationDropdown = ({ data, isActive, position, hidePopup, onClick, }) => {
7
+ const { text, icon, items } = data, popupProps = __rest(data, ["text", "icon", "items"]);
8
+ return (React.createElement(Fragment, null,
9
+ React.createElement(NavigationItem, { onClick: onClick, isOpened: isActive, data: { text, type: NavigationItemType.Dropdown, icon } }),
10
+ isActive && (React.createElement(NavigationPopup, Object.assign({ left: position, onClose: hidePopup, items: items }, popupProps)))));
11
+ };
12
+ export default NavigationDropdown;
@@ -0,0 +1,11 @@
1
+ .pc-navigation-list-item__slider-container {
2
+ position: absolute;
3
+ right: 0;
4
+ bottom: 0;
5
+ left: 0;
6
+ }
7
+ .pc-navigation-list-item__slider {
8
+ width: 100%;
9
+ height: 2px;
10
+ background-color: var(--yc-color-text-link);
11
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ClassNameProps, NavigationItemModel } from '../../../models';
3
+ import { ItemColumnName } from '../../constants';
4
+ import './NavigationListItem.css';
5
+ type NavigationListItemProps = {
6
+ item: NavigationItemModel;
7
+ index: number;
8
+ column: ItemColumnName;
9
+ activeItemId?: string;
10
+ itemPositions?: number[];
11
+ itemRefs?: React.MutableRefObject<(HTMLLIElement | null)[]>;
12
+ highlightActiveItem?: boolean;
13
+ hidePopup: () => void;
14
+ onActiveItemChange: (id?: string) => void;
15
+ } & ClassNameProps;
16
+ export declare const NavigationListItem: ({ item, itemRefs, className, index, activeItemId, highlightActiveItem, hidePopup, itemPositions, column, onActiveItemChange, }: NavigationListItemProps) => JSX.Element;
17
+ export {};
@@ -0,0 +1,24 @@
1
+ import React, { useRef } from 'react';
2
+ import { block } from '../../../utils';
3
+ import { NavigationItemType } from '../../../models';
4
+ import { getItemClickHandler } from '../../utils';
5
+ import NavigationDropdownItem from '../NavigationDropdownItem/NavigationDropdownItem';
6
+ import NavigationItem from '../NavigationItem/NavigationItem';
7
+ import './NavigationListItem.css';
8
+ const b = block('navigation');
9
+ export const NavigationListItem = ({ item, itemRefs, className, index, activeItemId, highlightActiveItem, hidePopup, itemPositions, column, onActiveItemChange, }) => {
10
+ var _a;
11
+ const ref = useRef(null);
12
+ const id = `${column}-${index}`;
13
+ const isActive = id === activeItemId;
14
+ const onClick = getItemClickHandler({
15
+ column,
16
+ index,
17
+ activeItemId,
18
+ onActiveItemChange,
19
+ });
20
+ return (React.createElement("li", { ref: itemRefs ? (el) => itemRefs.current.push(el) : ref, className: className },
21
+ item.type === NavigationItemType.Dropdown ? (React.createElement(NavigationDropdownItem, { data: item, onClick: onClick, isActive: isActive, position: (itemPositions === null || itemPositions === void 0 ? void 0 : itemPositions[index]) || ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left) || 0, hidePopup: hidePopup })) : (React.createElement(NavigationItem, { data: item, onClick: onClick })),
22
+ highlightActiveItem && isActive && (React.createElement("div", { className: b('slider-container') },
23
+ React.createElement("div", { className: b('slider') })))));
24
+ };
@@ -0,0 +1,6 @@
1
+ export declare enum ItemColumnName {
2
+ Left = "left",
3
+ Right = "right",
4
+ Top = "top",
5
+ Bottom = "bottom"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var ItemColumnName;
2
+ (function (ItemColumnName) {
3
+ ItemColumnName["Left"] = "left";
4
+ ItemColumnName["Right"] = "right";
5
+ ItemColumnName["Top"] = "top";
6
+ ItemColumnName["Bottom"] = "bottom";
7
+ })(ItemColumnName || (ItemColumnName = {}));
@@ -0,0 +1,10 @@
1
+ import { MouseEventHandler } from 'react';
2
+ import { ItemColumnName } from './constants';
3
+ type GetItemClickHandlerArgs = {
4
+ column: ItemColumnName;
5
+ index: number;
6
+ activeItemId?: string;
7
+ onActiveItemChange: (id?: string) => void;
8
+ };
9
+ export declare const getItemClickHandler: ({ column, index, onActiveItemChange, }: GetItemClickHandlerArgs) => MouseEventHandler;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ export const getItemClickHandler = ({ column, index, onActiveItemChange, activeItemId }) => (e) => {
2
+ const id = `${column}-${index}`;
3
+ if (e) {
4
+ e.stopPropagation();
5
+ }
6
+ onActiveItemChange(id === activeItemId ? undefined : `${column}-${index}`);
7
+ };
@@ -1168,12 +1168,6 @@ export declare const MapProps: {
1168
1168
  zoom: {
1169
1169
  type: string;
1170
1170
  };
1171
- center: {
1172
- type: string;
1173
- items: {
1174
- type: string;
1175
- };
1176
- };
1177
1171
  address: {
1178
1172
  type: string;
1179
1173
  };
@@ -489,10 +489,6 @@ export const MapProps = {
489
489
  zoom: {
490
490
  type: 'number',
491
491
  },
492
- center: {
493
- type: 'array',
494
- items: { type: 'number' },
495
- },
496
492
  address: {
497
493
  type: 'string',
498
494
  },
@@ -268,6 +268,7 @@ unpredictable css rules order in build */
268
268
  .pc-hubspot-form .hs-button.primary {
269
269
  margin: 0;
270
270
  padding: 0;
271
+ font-family: var(--yc-text-body-font-family);
271
272
  font-size: inherit;
272
273
  font-weight: 400;
273
274
  color: inherit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -50,7 +50,7 @@
50
50
  "bem-cn-lite": "^4.0.0",
51
51
  "github-buttons": "2.23.0",
52
52
  "lodash": "^4.17.21",
53
- "react-player": "^2.9.0",
53
+ "react-player": "^2.12.0",
54
54
  "react-slick": "^0.28.1",
55
55
  "react-spring": "^9.3.0",
56
56
  "react-transition-group": "^4.4.2",
@@ -137,8 +137,5 @@
137
137
  "*.{json,yaml,yml,md}": [
138
138
  "prettier --write"
139
139
  ]
140
- },
141
- "publishConfig": {
142
- "tag": "beta"
143
140
  }
144
141
  }
@@ -189,7 +189,6 @@ export interface MediaProps extends Animatable, Partial<MediaComponentDataLensPr
189
189
  export type Coordinate = number[];
190
190
  export interface MapBaseProps {
191
191
  zoom?: number;
192
- center?: Coordinate;
193
192
  }
194
193
  export interface GMapProps extends MapBaseProps {
195
194
  address: string;
@@ -197,7 +196,6 @@ export interface GMapProps extends MapBaseProps {
197
196
  export interface YMapProps extends MapBaseProps {
198
197
  markers: YMapMarker[];
199
198
  id: string;
200
- center: Coordinate;
201
199
  }
202
200
  export interface YMapMarker {
203
201
  address?: string;