@gravity-ui/page-constructor 1.18.0 → 1.18.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.18.1](https://github.com/gravity-ui/page-constructor/compare/v1.18.0...v1.18.1) (2023-02-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add mixin for navigation item and refactor ([#179](https://github.com/gravity-ui/page-constructor/issues/179)) ([3709fcd](https://github.com/gravity-ui/page-constructor/commit/3709fcdcaa2149ed287fb9ef0250dfca1181c842))
9
+
3
10
  ## [1.18.0](https://github.com/gravity-ui/page-constructor/compare/v1.17.0...v1.18.0) (2023-02-28)
4
11
 
5
12
 
@@ -2,14 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
- const utils_1 = require("../../../utils");
6
5
  const models_1 = require("../../../models");
7
6
  const SocialIcon_1 = tslib_1.__importDefault(require("../SocialIcon/SocialIcon"));
8
7
  const NavigationButton_1 = require("./components/NavigationButton/NavigationButton");
9
8
  const NavigationDropdown_1 = require("./components/NavigationDropdown/NavigationDropdown");
10
9
  const NavigationLink_1 = require("./components/NavigationLink/NavigationLink");
11
10
  const GithubStars_1 = require("./components/GithubStars/GithubStars");
12
- const b = (0, utils_1.block)('navigation-item');
13
11
  //todo: add types support form component in map
14
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
13
  const NavigationItemsMap = {
@@ -23,7 +21,7 @@ const NavigationItem = (_a) => {
23
21
  var { data, className } = _a, props = tslib_1.__rest(_a, ["data", "className"]);
24
22
  const { type = models_1.NavigationItemType.Link } = data;
25
23
  const Component = NavigationItemsMap[type];
26
- const componentProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({ className: b(null, className) }, data), props)), [className, data, props]);
24
+ const componentProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({ className }, data), props)), [className, data, props]);
27
25
  return react_1.default.createElement(Component, Object.assign({}, componentProps));
28
26
  };
29
27
  exports.default = NavigationItem;
@@ -1,4 +1,8 @@
1
1
  .pc-github-stars {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ white-space: nowrap;
2
6
  display: flex;
3
7
  align-items: center;
4
8
  height: 100%;
@@ -1,4 +1,10 @@
1
1
  .pc-navigation-dropdown {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ white-space: nowrap;
6
+ }
7
+ .pc-navigation-dropdown__arrow {
2
8
  margin-left: 7px;
3
9
  color: var(--yc-color-text-secondary);
4
10
  }
@@ -10,10 +10,10 @@ const utils_2 = require("../../../../../components/Media/Image/utils");
10
10
  const b = (0, utils_1.block)('navigation-dropdown');
11
11
  const TOGGLE_ARROW_SIZE = 12;
12
12
  const NavigationDropdown = (_a) => {
13
- var { text, icon, isOpened } = _a, props = tslib_1.__rest(_a, ["text", "icon", "isOpened"]);
13
+ var { text, icon, isOpened, className } = _a, props = tslib_1.__rest(_a, ["text", "icon", "isOpened", "className"]);
14
14
  const iconData = icon && (0, utils_2.getMediaImage)(icon);
15
- return (react_1.default.createElement("span", Object.assign({}, props),
15
+ return (react_1.default.createElement("span", Object.assign({}, props, { className: b(null, className) }),
16
16
  react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData }),
17
- react_1.default.createElement(components_1.ToggleArrow, { className: b(), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
17
+ react_1.default.createElement(components_1.ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
18
18
  };
19
19
  exports.NavigationDropdown = NavigationDropdown;
@@ -5,6 +5,10 @@ unpredictable css rules order in build */
5
5
  color: inherit;
6
6
  text-decoration: none;
7
7
  outline: none;
8
+ position: relative;
9
+ display: flex;
10
+ align-items: center;
11
+ white-space: nowrap;
8
12
  }
9
13
  .utilityfocus .pc-navigation-link:focus {
10
14
  outline: 2px solid #ffdb4d;
@@ -1,6 +1,5 @@
1
1
  import React, { MouseEventHandler } from 'react';
2
2
  import { NavigationItemData } from '../../../models';
3
- import './NavigationItem.css';
4
3
  export interface NavigationItemProps {
5
4
  data: NavigationItemData;
6
5
  className?: string;
@@ -1,14 +1,11 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useMemo } from 'react';
3
- import { block } from '../../../utils';
4
3
  import { NavigationItemType } from '../../../models';
5
4
  import SocialIcon from '../SocialIcon/SocialIcon';
6
5
  import { NavigationButton } from './components/NavigationButton/NavigationButton';
7
6
  import { NavigationDropdown } from './components/NavigationDropdown/NavigationDropdown';
8
7
  import { NavigationLink } from './components/NavigationLink/NavigationLink';
9
8
  import { GithubStars } from './components/GithubStars/GithubStars';
10
- import './NavigationItem.css';
11
- const b = block('navigation-item');
12
9
  //todo: add types support form component in map
13
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
11
  const NavigationItemsMap = {
@@ -22,7 +19,7 @@ const NavigationItem = (_a) => {
22
19
  var { data, className } = _a, props = __rest(_a, ["data", "className"]);
23
20
  const { type = NavigationItemType.Link } = data;
24
21
  const Component = NavigationItemsMap[type];
25
- const componentProps = useMemo(() => (Object.assign(Object.assign({ className: b(null, className) }, data), props)), [className, data, props]);
22
+ const componentProps = useMemo(() => (Object.assign(Object.assign({ className }, data), props)), [className, data, props]);
26
23
  return React.createElement(Component, Object.assign({}, componentProps));
27
24
  };
28
25
  export default NavigationItem;
@@ -1,4 +1,8 @@
1
1
  .pc-github-stars {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ white-space: nowrap;
2
6
  display: flex;
3
7
  align-items: center;
4
8
  height: 100%;
@@ -1,4 +1,10 @@
1
1
  .pc-navigation-dropdown {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ white-space: nowrap;
6
+ }
7
+ .pc-navigation-dropdown__arrow {
2
8
  margin-left: 7px;
3
9
  color: var(--yc-color-text-secondary);
4
10
  }
@@ -8,9 +8,9 @@ import './NavigationDropdown.css';
8
8
  const b = block('navigation-dropdown');
9
9
  const TOGGLE_ARROW_SIZE = 12;
10
10
  export const NavigationDropdown = (_a) => {
11
- var { text, icon, isOpened } = _a, props = __rest(_a, ["text", "icon", "isOpened"]);
11
+ var { text, icon, isOpened, className } = _a, props = __rest(_a, ["text", "icon", "isOpened", "className"]);
12
12
  const iconData = icon && getMediaImage(icon);
13
- return (React.createElement("span", Object.assign({}, props),
13
+ return (React.createElement("span", Object.assign({}, props, { className: b(null, className) }),
14
14
  React.createElement(ContentWrapper, { text: text, icon: iconData }),
15
- React.createElement(ToggleArrow, { className: b(), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
15
+ React.createElement(ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
16
16
  };
@@ -5,6 +5,10 @@ unpredictable css rules order in build */
5
5
  color: inherit;
6
6
  text-decoration: none;
7
7
  outline: none;
8
+ position: relative;
9
+ display: flex;
10
+ align-items: center;
11
+ white-space: nowrap;
8
12
  }
9
13
  .utilityfocus .pc-navigation-link:focus {
10
14
  outline: 2px solid #ffdb4d;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +0,0 @@
1
- .pc-navigation-item {
2
- position: relative;
3
- display: flex;
4
- align-items: center;
5
- white-space: nowrap;
6
- }
@@ -1,6 +0,0 @@
1
- .pc-navigation-item {
2
- position: relative;
3
- display: flex;
4
- align-items: center;
5
- white-space: nowrap;
6
- }