@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
@@ -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,16 @@
1
+ import React from 'react';
2
+ import { ClassNameProps, NavigationItemModel } from '../../../models';
3
+ import { ItemColumnName } from '../../constants';
4
+ type NavigationListItemProps = {
5
+ item: NavigationItemModel;
6
+ index: number;
7
+ column: ItemColumnName;
8
+ activeItemId?: string;
9
+ itemPositions?: number[];
10
+ itemRefs?: React.MutableRefObject<(HTMLLIElement | null)[]>;
11
+ highlightActiveItem?: boolean;
12
+ hidePopup: () => void;
13
+ onActiveItemChange: (id?: string) => void;
14
+ } & ClassNameProps;
15
+ export declare const NavigationListItem: ({ item, itemRefs, className, index, activeItemId, highlightActiveItem, hidePopup, itemPositions, column, onActiveItemChange, }: NavigationListItemProps) => JSX.Element;
16
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationListItem = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importStar(require("react"));
6
+ const utils_1 = require("../../../utils");
7
+ const models_1 = require("../../../models");
8
+ const utils_2 = require("../../utils");
9
+ const NavigationDropdownItem_1 = tslib_1.__importDefault(require("../NavigationDropdownItem/NavigationDropdownItem"));
10
+ const NavigationItem_1 = tslib_1.__importDefault(require("../NavigationItem/NavigationItem"));
11
+ const b = (0, utils_1.block)('navigation');
12
+ const NavigationListItem = ({ item, itemRefs, className, index, activeItemId, highlightActiveItem, hidePopup, itemPositions, column, onActiveItemChange, }) => {
13
+ var _a;
14
+ const ref = (0, react_1.useRef)(null);
15
+ const id = `${column}-${index}`;
16
+ const isActive = id === activeItemId;
17
+ const onClick = (0, utils_2.getItemClickHandler)({
18
+ column,
19
+ index,
20
+ activeItemId,
21
+ onActiveItemChange,
22
+ });
23
+ return (react_1.default.createElement("li", { ref: itemRefs ? (el) => itemRefs.current.push(el) : ref, className: className },
24
+ item.type === models_1.NavigationItemType.Dropdown ? (react_1.default.createElement(NavigationDropdownItem_1.default, { 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_1.default.createElement(NavigationItem_1.default, { data: item, onClick: onClick })),
25
+ highlightActiveItem && isActive && (react_1.default.createElement("div", { className: b('slider-container') },
26
+ react_1.default.createElement("div", { className: b('slider') })))));
27
+ };
28
+ exports.NavigationListItem = NavigationListItem;
@@ -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,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ItemColumnName = void 0;
4
+ var ItemColumnName;
5
+ (function (ItemColumnName) {
6
+ ItemColumnName["Left"] = "left";
7
+ ItemColumnName["Right"] = "right";
8
+ ItemColumnName["Top"] = "top";
9
+ ItemColumnName["Bottom"] = "bottom";
10
+ })(ItemColumnName = exports.ItemColumnName || (exports.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,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getItemClickHandler = void 0;
4
+ const getItemClickHandler = ({ column, index, onActiveItemChange, activeItemId }) => (e) => {
5
+ const id = `${column}-${index}`;
6
+ if (e) {
7
+ e.stopPropagation();
8
+ }
9
+ onActiveItemChange(id === activeItemId ? undefined : `${column}-${index}`);
10
+ };
11
+ exports.getItemClickHandler = getItemClickHandler;
@@ -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
  };
@@ -493,10 +493,6 @@ exports.MapProps = {
493
493
  zoom: {
494
494
  type: 'number',
495
495
  },
496
- center: {
497
- type: 'array',
498
- items: { type: 'number' },
499
- },
500
496
  address: {
501
497
  type: 'string',
502
498
  },
@@ -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;
@@ -21,7 +21,7 @@ unpredictable css rules order in build */
21
21
  line-height: var(--yc-text-header-1-line-height);
22
22
  color: var(--pc-text-header-color);
23
23
  font-weight: var(--yc-text-accent-font-weight);
24
- display: flex;
24
+ display: block;
25
25
  position: relative;
26
26
  margin-bottom: 8px;
27
27
  }
@@ -42,13 +42,13 @@ unpredictable css rules order in build */
42
42
  font-size: var(--yc-text-caption-2-font-size);
43
43
  line-height: var(--yc-text-caption-2-line-height);
44
44
  position: relative;
45
- top: 5px;
45
+ top: -3px;
46
46
  height: 16px;
47
47
  margin-left: 8px;
48
- padding: 0 5px;
48
+ padding: 1.5px 5px 2px;
49
49
  color: var(--yc-color-base-background);
50
50
  background-color: var(--yc-my-color-brand-normal);
51
- border-radius: 3px;
51
+ border-radius: 4px;
52
52
  }
53
53
  .pc-ExtendedFeaturesBlock__item-text, .pc-ExtendedFeaturesBlock__item-link {
54
54
  font-size: var(--yc-text-body-2-font-size);
@@ -30,7 +30,7 @@ export const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DE
30
30
  React.createElement("div", { className: b('container') },
31
31
  itemTitle && (React.createElement("h5", { className: b('item-title') },
32
32
  React.createElement(HTML, null, itemTitle),
33
- label && (React.createElement("div", { className: b('item-label') }, label)))),
33
+ label && (React.createElement("span", { className: b('item-label') }, label)))),
34
34
  React.createElement(Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 }, buttons: buttons, additionalInfo: additionalInfo }))));
35
35
  })))));
36
36
  };
@@ -6,12 +6,6 @@ export declare const Map: {
6
6
  zoom: {
7
7
  type: string;
8
8
  };
9
- center: {
10
- type: string;
11
- items: {
12
- type: string;
13
- };
14
- };
15
9
  address: {
16
10
  type: string;
17
11
  };
@@ -70,12 +64,6 @@ export declare const MapBlock: {
70
64
  zoom: {
71
65
  type: string;
72
66
  };
73
- center: {
74
- type: string;
75
- items: {
76
- type: string;
77
- };
78
- };
79
67
  address: {
80
68
  type: string;
81
69
  };
@@ -7,7 +7,7 @@ export interface HTMLProps {
7
7
  }
8
8
  declare const HTML: ({ children, block, className }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
9
9
  dangerouslySetInnerHTML: {
10
- __html: string & (boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null);
10
+ __html: string | (string & React.ReactElement<any, string | React.JSXElementConstructor<any>>) | (string & React.ReactFragment) | (string & React.ReactPortal);
11
11
  };
12
12
  className: string | undefined;
13
13
  }, HTMLElement> | null;
@@ -5,18 +5,20 @@ import { MapsContext } from '../../context/mapsContext/mapsContext';
5
5
  import { LocaleContext } from '../../context/localeContext/localeContext';
6
6
  import { MobileContext } from '../../context/mobileContext';
7
7
  import { getMapHeight } from './helpers';
8
+ import { Lang } from '../../utils/configure';
8
9
  const b = block('map');
9
- function getScriptSrc(apiKey, scriptSrc, address, lang) {
10
- return `${scriptSrc}?key=${apiKey}&language=${lang}&q=${encodeURI(address)}`;
10
+ function getScriptSrc(params) {
11
+ const { apiKey, scriptSrc, address, lang, zoom } = params;
12
+ return `${scriptSrc}?key=${apiKey}&language=${lang}${zoom ? '&zoom=' + zoom : ''}&q=${encodeURI(address)}`;
11
13
  }
12
14
  const GoogleMap = (props) => {
13
- const { address } = props;
15
+ const { address, zoom } = props;
14
16
  const { apiKey, scriptSrc } = useContext(MapsContext);
15
- const { lang = 'ru' } = useContext(LocaleContext);
17
+ const { lang = Lang.Ru } = useContext(LocaleContext);
16
18
  const isMobile = useContext(MobileContext);
17
19
  const [height, setHeight] = useState(undefined);
18
20
  const ref = useRef(null);
19
- const src = useMemo(() => getScriptSrc(apiKey, scriptSrc, address, lang), [apiKey, scriptSrc, address, lang]);
21
+ const src = useMemo(() => getScriptSrc({ apiKey, scriptSrc, address, lang, zoom }), [apiKey, scriptSrc, address, lang, zoom]);
20
22
  useEffect(() => {
21
23
  const updateSize = _.debounce(() => {
22
24
  if (ref.current) {
@@ -7,9 +7,13 @@ unpredictable css rules order in build */
7
7
  overflow: hidden;
8
8
  display: flex;
9
9
  }
10
+ .pc-map_hidden {
11
+ opacity: 0;
12
+ }
10
13
  .pc-map__spinner {
11
14
  margin: 0 auto;
12
15
  align-self: center;
16
+ position: absolute;
13
17
  }
14
18
  .pc-map__wrapper {
15
19
  min-height: 300px;
@@ -17,4 +21,5 @@ unpredictable css rules order in build */
17
21
  flex-direction: column;
18
22
  align-items: center;
19
23
  justify-content: center;
24
+ position: relative;
20
25
  }
@@ -1,13 +1,15 @@
1
- import { YMapMarker } from '../../../models';
1
+ import { YMapProps, YMapMarker } from '../../../models';
2
+ type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;
2
3
  export declare class YMap {
3
4
  private ymap;
4
5
  private mapRef;
5
6
  private coords;
6
7
  constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null);
7
- showPlacemarks(markers: YMapMarker[]): Promise<void>;
8
+ showPlacemarks(props: PlacemarksProps): Promise<void>;
8
9
  findAddress(marker: YMapMarker): Promise<void>;
9
10
  findCoordinate(marker: YMapMarker): void;
10
11
  private drawPlaceMarkStyle;
11
12
  private recalcZoomAndCenter;
12
13
  private clearOldPlacemarks;
13
14
  }
15
+ export {};
@@ -19,9 +19,9 @@ export class YMap {
19
19
  this.ymap = ymap;
20
20
  this.mapRef = mapRef;
21
21
  }
22
- async showPlacemarks(markers) {
22
+ async showPlacemarks(props) {
23
23
  this.clearOldPlacemarks();
24
- for (const marker of markers) {
24
+ for (const marker of props.markers) {
25
25
  if (marker.address) {
26
26
  await this.findAddress(marker);
27
27
  }
@@ -29,7 +29,7 @@ export class YMap {
29
29
  this.findCoordinate(marker);
30
30
  }
31
31
  }
32
- this.recalcZoomAndCenter();
32
+ this.recalcZoomAndCenter(props);
33
33
  }
34
34
  async findAddress(marker) {
35
35
  try {
@@ -49,10 +49,7 @@ export class YMap {
49
49
  this.ymap.geoObjects.add(geoObject);
50
50
  }
51
51
  drawPlaceMarkStyle(geoObject, marker) {
52
- if (!marker.label) {
53
- return;
54
- }
55
- const { iconColor, preset = DEFAULT_PLACEMARKS_PRESET } = marker.label;
52
+ const { iconColor, preset = DEFAULT_PLACEMARKS_PRESET } = marker.label || {};
56
53
  let localIconColor = iconColor;
57
54
  // You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset
58
55
  if (!preset.includes('Stretchy') && !iconColor) {
@@ -65,9 +62,10 @@ export class YMap {
65
62
  }
66
63
  });
67
64
  }
68
- recalcZoomAndCenter() {
65
+ recalcZoomAndCenter(props) {
69
66
  var _a, _b;
70
67
  const coordsLength = this.coords.length;
68
+ const { zoom = 0 } = props;
71
69
  if (!coordsLength) {
72
70
  return;
73
71
  }
@@ -76,10 +74,20 @@ export class YMap {
76
74
  leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];
77
75
  rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];
78
76
  });
79
- const newMapParams = window.ymaps.util.bounds.getCenterAndZoom([leftBottom, rightTop], [(_a = this.mapRef) === null || _a === void 0 ? void 0 : _a.clientWidth, (_b = this.mapRef) === null || _b === void 0 ? void 0 : _b.clientHeight], undefined, { margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT });
77
+ let newMapParams = {
78
+ zoom,
79
+ center: [],
80
+ };
81
+ if (zoom) {
82
+ // compute only the center
83
+ newMapParams.center = window.ymaps.util.bounds.getCenter([leftBottom, rightTop]);
84
+ }
85
+ else {
86
+ newMapParams = window.ymaps.util.bounds.getCenterAndZoom([leftBottom, rightTop], [(_a = this.mapRef) === null || _a === void 0 ? void 0 : _a.clientWidth, (_b = this.mapRef) === null || _b === void 0 ? void 0 : _b.clientHeight], undefined, { margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT });
87
+ }
80
88
  this.ymap.setCenter(newMapParams.center);
81
89
  // Use default zoom for one placemark
82
- if (coordsLength > 1) {
90
+ if (coordsLength > 1 && !zoom) {
83
91
  this.ymap.setZoom(newMapParams.zoom);
84
92
  }
85
93
  }
@@ -13,8 +13,12 @@ import { getMapHeight } from '../helpers';
13
13
  const b = block('map');
14
14
  const DEFAULT_CONTAINER_ID = 'ymap';
15
15
  const DEFAULT_ZOOM = 9;
16
+ // Center - is a required parameter for creating a new map
17
+ // We use this init center to create a map
18
+ // The real center of the map will be calculated later, using the coordinates of the markers
19
+ const INITIAL_CENTER = [0, 0];
16
20
  const YandexMap = (props) => {
17
- const { markers, zoom, center, id } = props;
21
+ const { markers, zoom, id } = props;
18
22
  const { apiKey, scriptSrc, nonce } = useContext(MapsContext);
19
23
  const isMobile = useContext(MobileContext);
20
24
  const { lang = 'ru' } = useContext(LocaleContext);
@@ -23,6 +27,7 @@ const YandexMap = (props) => {
23
27
  const [height, setHeight] = useState(undefined);
24
28
  const ref = useRef(null);
25
29
  const [loading, setLoading] = useState(false);
30
+ const [ready, setReady] = useState(false);
26
31
  const [attemptsIndex, setAttemptsIndex] = useState(0);
27
32
  const onTryAgain = useCallback(() => {
28
33
  setAttemptsIndex(attemptsIndex + 1);
@@ -30,20 +35,17 @@ const YandexMap = (props) => {
30
35
  useEffect(() => {
31
36
  (async function () {
32
37
  var _a;
33
- if (!center) {
34
- return;
35
- }
36
38
  setLoading(true);
37
39
  await YMapsApiLoader.loadApi(apiKey, scriptSrc, lang, nonce);
38
40
  (_a = window.ymaps) === null || _a === void 0 ? void 0 : _a.ready(() => {
39
41
  setYmaps(new YMap(new window.ymaps.Map(containerId, {
40
- center,
42
+ center: INITIAL_CENTER,
41
43
  zoom: zoom || DEFAULT_ZOOM,
42
44
  }, { autoFitToViewport: 'always' }), ref.current));
43
45
  });
44
46
  setLoading(false);
45
47
  })();
46
- }, [apiKey, lang, scriptSrc, containerId, zoom, center, nonce, attemptsIndex, setLoading]);
48
+ }, [apiKey, lang, scriptSrc, containerId, zoom, nonce, attemptsIndex, setLoading]);
47
49
  useEffect(() => {
48
50
  const updateSize = _.debounce(() => {
49
51
  if (ref.current) {
@@ -58,12 +60,19 @@ const YandexMap = (props) => {
58
60
  }, [markers, ymap, setYmaps, isMobile]);
59
61
  useEffect(() => {
60
62
  if (ymap) {
61
- ymap.showPlacemarks(markers);
63
+ // show with computed center and placemarks
64
+ const showPlacemarks = async () => {
65
+ await ymap.showPlacemarks({ markers, zoom });
66
+ setReady(true);
67
+ };
68
+ showPlacemarks();
62
69
  }
63
70
  });
64
- if (!center)
71
+ if (!markers)
65
72
  return null;
66
73
  return (React.createElement(ErrorWrapper, { isError: YMapsApiLoader.status === MapApiStatus.Error, text: i18n('map-load-error'), buttonText: i18n('map-try-again'), handler: onTryAgain, className: b('wrapper') },
67
- React.createElement("div", { id: containerId, className: b(), ref: ref, style: { height } }, loading ? React.createElement(Spin, { size: "xl", className: b('spinner') }) : null)));
74
+ React.createElement("div", { className: b('wrapper') },
75
+ React.createElement("div", { id: containerId, className: b({ hidden: !ready }), ref: ref, style: { height } }),
76
+ loading ? React.createElement(Spin, { size: "xl", className: b('spinner') }) : null)));
68
77
  };
69
78
  export default YandexMap;
@@ -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;
@@ -41,6 +41,8 @@ unpredictable css rules order in build */
41
41
  .pc-header__right {
42
42
  flex: 0;
43
43
  justify-content: flex-end;
44
+ font-size: var(--yc-text-body-2-font-size);
45
+ line-height: var(--yc-text-body-2-line-height);
44
46
  }
45
47
  .pc-header__navigation-container {
46
48
  display: flex;
@@ -53,6 +55,9 @@ unpredictable css rules order in build */
53
55
  .pc-header__buttons {
54
56
  display: flex;
55
57
  align-items: center;
58
+ margin: 0;
59
+ padding: 0;
60
+ list-style: none;
56
61
  }
57
62
  @media (max-width: 768px) {
58
63
  .pc-header__buttons {
@@ -62,6 +67,24 @@ unpredictable css rules order in build */
62
67
  .pc-header__buttons > *:not(:last-child) {
63
68
  margin-right: 16px;
64
69
  }
70
+ .pc-header__buttons-item {
71
+ position: relative;
72
+ height: var(--header-height);
73
+ line-height: var(--header-height);
74
+ cursor: pointer;
75
+ outline: none;
76
+ color: inherit;
77
+ text-decoration: none;
78
+ }
79
+ .utilityfocus .pc-header__buttons-item:focus {
80
+ outline: 2px solid #ffdb4d;
81
+ }
82
+ .pc-header__buttons-item:hover, .pc-header__buttons-item:active {
83
+ color: var(--yc-color-text-link);
84
+ }
85
+ .pc-header__buttons-item:not(:last-child) {
86
+ margin-right: 20px;
87
+ }
65
88
  .pc-header__button {
66
89
  margin-top: 0;
67
90
  }
@@ -3,11 +3,12 @@ import { block } from '../../../utils';
3
3
  import { Col, Grid, Row } from '../../../grid';
4
4
  import OutsideClick from '../../../components/OutsideClick/OutsideClick';
5
5
  import Control from '../../../components/Control/Control';
6
+ import { NavigationClose, NavigationOpen } from '../../../icons';
7
+ import { ItemColumnName } from '../../constants';
6
8
  import Navigation from '../Navigation/Navigation';
7
9
  import MobileNavigation from '../MobileNavigation/MobileNavigation';
8
- import NavigationItem from '../NavigationItem/NavigationItem';
9
10
  import Logo from '../Logo/Logo';
10
- import { NavigationClose, NavigationOpen } from '../../../icons';
11
+ import { NavigationListItem } from '../NavigationListItem/NavigationListItem';
11
12
  import './Header.css';
12
13
  const b = block('header');
13
14
  const ICON_SIZE = 36;
@@ -24,10 +25,13 @@ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
24
25
  export const Header = ({ data, logo }) => {
25
26
  const { leftItems, rightItems } = data;
26
27
  const [isSidebarOpened, setIsSidebarOpened] = useState(false);
27
- const [activeItemIndex, setActiveItemIndex] = useState(-1);
28
- const onActiveItemChange = useCallback((index) => {
29
- setActiveItemIndex(index);
28
+ const [activeItemId, setactiveItemId] = useState(undefined);
29
+ const onActiveItemChange = useCallback((id) => {
30
+ setactiveItemId(id);
30
31
  }, []);
32
+ const hidePopup = useCallback(() => {
33
+ onActiveItemChange();
34
+ }, [onActiveItemChange]);
31
35
  const onSidebarOpenedChange = useCallback((isOpen) => {
32
36
  setIsSidebarOpened(isOpen);
33
37
  }, []);
@@ -41,11 +45,11 @@ export const Header = ({ data, logo }) => {
41
45
  logo && (React.createElement("div", { className: b('left') },
42
46
  React.createElement(Logo, Object.assign({}, logo, { className: b('logo') })))),
43
47
  React.createElement("div", { className: b('navigation-container') },
44
- React.createElement(Navigation, { className: b('navigation'), links: leftItems, activeItemIndex: activeItemIndex, onActiveItemChange: onActiveItemChange })),
48
+ React.createElement(Navigation, { className: b('navigation'), links: leftItems, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange })),
45
49
  React.createElement("div", { className: b('right') },
46
50
  React.createElement(MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
47
- rightItems && (React.createElement("div", { className: b('buttons') }, rightItems.map((button) => (React.createElement(NavigationItem, { key: button.text, data: button })))))),
51
+ rightItems && (React.createElement("ul", { className: b('buttons') }, rightItems.map((button, index) => (React.createElement(NavigationListItem, { key: index, className: b('buttons-item'), item: button, index: index, activeItemId: activeItemId, hidePopup: hidePopup, column: ItemColumnName.Right, onActiveItemChange: onActiveItemChange })))))),
48
52
  React.createElement(OutsideClick, { onOutsideClick: () => onSidebarOpenedChange(false) },
49
- React.createElement(MobileNavigation, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemIndex: activeItemIndex, onActiveItemChange: onActiveItemChange, onClose: hideSidebar })))))));
53
+ React.createElement(MobileNavigation, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, onClose: hideSidebar })))))));
50
54
  };
51
55
  export default Header;
@@ -24,7 +24,10 @@ unpredictable css rules order in build */
24
24
  .pc-mobile-navigation__button {
25
25
  margin-top: 24px;
26
26
  }
27
- .pc-mobile-navigation__links {
27
+ .pc-mobile-navigation__nav {
28
+ margin-bottom: 24px;
29
+ }
30
+ .pc-mobile-navigation__rows {
28
31
  position: relative;
29
32
  display: flex;
30
33
  flex-direction: column;
@@ -33,7 +36,7 @@ unpredictable css rules order in build */
33
36
  padding: 0;
34
37
  list-style: none;
35
38
  }
36
- .pc-mobile-navigation__links-item:not(:last-child) {
39
+ .pc-mobile-navigation__rows-item:not(:last-child) {
37
40
  margin-bottom: 24px;
38
41
  }
39
42
  .pc-mobile-navigation__dropdown-item:not(:last-child) {
@@ -6,9 +6,9 @@ export interface MobileNavigationProps {
6
6
  isOpened?: boolean;
7
7
  topItems?: NavigationItemModel[];
8
8
  bottomItems?: NavigationItemModel[];
9
- activeItemIndex: number;
9
+ activeItemId?: string;
10
10
  onClose: () => void;
11
- onActiveItemChange: (index: number) => void;
11
+ onActiveItemChange: (id?: string) => void;
12
12
  }
13
13
  declare const MobileNavigation: React.FC<MobileNavigationProps>;
14
14
  export default MobileNavigation;
@@ -3,6 +3,7 @@ import { Popup, Portal } from '@gravity-ui/uikit';
3
3
  import { block } from '../../../utils';
4
4
  import Foldable from '../../../components/Foldable/Foldable';
5
5
  import { NavigationItemType } from '../../../models';
6
+ import { ItemColumnName } from '../../constants';
6
7
  import NavigationItem from '../NavigationItem/NavigationItem';
7
8
  import './MobileNavigation.css';
8
9
  const b = block('mobile-navigation');
@@ -12,32 +13,31 @@ const MobileNavigationDropdown = ({ data, onItemClick, onToggle, isOpened = fals
12
13
  React.createElement(NavigationItem, { data: data, onClick: onToggle, isOpened: isOpened }),
13
14
  isOpened && (React.createElement(Popup, { anchorRef: ref, open: isOpened, className: b('popup') }, data.items.map((item) => (React.createElement(NavigationItem, { key: item.text, data: item, className: b('dropdown-item'), onClick: onItemClick })))))));
14
15
  };
15
- const MobileNavigationItem = ({ link, index, isActive, onActiveItemChange, onClose, }) => {
16
+ const MobileNavigationItem = ({ item, index, isOpened, activeItemId, onActiveItemChange, column, onClose, }) => {
17
+ const id = `${column}-${index}`;
18
+ const isActive = id === activeItemId && isOpened;
16
19
  const toggleActive = useCallback((e) => {
17
20
  e.stopPropagation();
18
21
  if (onActiveItemChange) {
19
- onActiveItemChange(isActive ? -1 : index);
22
+ onActiveItemChange(isActive ? undefined : `${column}-${index}`);
20
23
  }
21
- }, [isActive, index, onActiveItemChange]);
24
+ }, [onActiveItemChange, isActive, column, index]);
22
25
  const onItemClick = useCallback((e) => {
23
26
  toggleActive(e);
24
27
  onClose();
25
28
  }, [toggleActive, onClose]);
26
- return (React.createElement("li", { key: index, className: b('links-item') }, link.type === NavigationItemType.Dropdown ? (React.createElement(MobileNavigationDropdown, { data: link, onToggle: toggleActive, isOpened: isActive, onItemClick: onItemClick })) : (React.createElement(NavigationItem, { data: link, onClick: onItemClick }))));
29
+ return (React.createElement("li", { key: index, className: b('rows-item') }, item.type === NavigationItemType.Dropdown ? (React.createElement(MobileNavigationDropdown, { data: item, onToggle: toggleActive, isOpened: isActive, onItemClick: onItemClick })) : (React.createElement(NavigationItem, { data: item, onClick: onItemClick }))));
27
30
  };
28
31
  const MobileNavigation = (props) => {
29
32
  if (typeof window === 'undefined') {
30
33
  return null;
31
34
  }
32
- const { isOpened, topItems, bottomItems, activeItemIndex, onActiveItemChange, onClose } = props;
35
+ const { isOpened, topItems, bottomItems, activeItemId, onActiveItemChange, onClose } = props;
33
36
  return (React.createElement(Portal, null,
34
37
  React.createElement(Foldable, { key: topItems === null || topItems === void 0 ? void 0 : topItems.length, className: b(), isOpened: Boolean(isOpened) },
35
38
  React.createElement("div", { className: b('wrapper') },
36
- React.createElement("nav", null,
37
- React.createElement("ul", { className: b('links') }, topItems === null || topItems === void 0 ? void 0 : topItems.map((link, index) => {
38
- const isActive = index === activeItemIndex;
39
- return (React.createElement(MobileNavigationItem, { key: index, link: link, index: index, isActive: isOpened && isActive, onClose: onClose, onActiveItemChange: onActiveItemChange }));
40
- }))), bottomItems === null || bottomItems === void 0 ? void 0 :
41
- bottomItems.map((item) => (React.createElement(NavigationItem, { key: item.text, data: item, className: b('button') })))))));
39
+ React.createElement("nav", { className: b('nav') },
40
+ React.createElement("ul", { className: b('rows') }, topItems === null || topItems === void 0 ? void 0 : topItems.map((link, index) => (React.createElement(MobileNavigationItem, { key: index, item: link, column: ItemColumnName.Top, index: index, isOpened: isOpened, activeItemId: activeItemId, onClose: onClose, onActiveItemChange: onActiveItemChange }))))),
41
+ React.createElement("ul", { className: b('rows') }, bottomItems === null || bottomItems === void 0 ? void 0 : bottomItems.map((item, index) => (React.createElement(MobileNavigationItem, { key: index, item: item, column: ItemColumnName.Bottom, index: index, isOpened: isOpened, activeItemId: activeItemId, onClose: onClose, onActiveItemChange: onActiveItemChange }))))))));
42
42
  };
43
43
  export default MobileNavigation;
@@ -29,15 +29,4 @@ unpredictable css rules order in build */
29
29
  }
30
30
  .pc-navigation__links-item:not(:last-child) {
31
31
  margin-right: 20px;
32
- }
33
- .pc-navigation__slider-container {
34
- position: absolute;
35
- right: 0;
36
- bottom: 0;
37
- left: 0;
38
- }
39
- .pc-navigation__slider {
40
- width: 100%;
41
- height: 2px;
42
- background-color: var(--yc-color-text-link);
43
32
  }