@gravity-ui/page-constructor 3.1.1 → 3.2.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.1.2](https://github.com/gravity-ui/page-constructor/compare/v3.1.1...v3.1.2) (2023-06-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * icon size in navigation popup ([#382](https://github.com/gravity-ui/page-constructor/issues/382)) ([cb7c7b1](https://github.com/gravity-ui/page-constructor/commit/cb7c7b1031777c92f6d303c5a5f2c3de2ad1c2d8))
9
+
3
10
  ## [3.1.1](https://github.com/gravity-ui/page-constructor/compare/v3.1.0...v3.1.1) (2023-06-07)
4
11
 
5
12
 
@@ -7,6 +7,7 @@ const Control_1 = tslib_1.__importDefault(require("../../../components/Control/C
7
7
  const OutsideClick_1 = tslib_1.__importDefault(require("../../../components/OutsideClick/OutsideClick"));
8
8
  const grid_1 = require("../../../grid");
9
9
  const icons_1 = require("../../../icons");
10
+ const models_1 = require("../../../models");
10
11
  const utils_1 = require("../../../utils");
11
12
  const constants_1 = require("../../constants");
12
13
  const Logo_1 = tslib_1.__importDefault(require("../Logo/Logo"));
@@ -26,15 +27,21 @@ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
26
27
  }, size: "l" }, iconProps)));
27
28
  };
28
29
  const iconSizeKey = 'iconSize';
30
+ const isButtonItem = (item) => item.type === models_1.NavigationItemType.Button;
31
+ const isDropdownItem = (item) => item.type === models_1.NavigationItemType.Dropdown;
29
32
  const Header = ({ data, logo }) => {
30
33
  const { leftItems, rightItems, iconSize = 20 } = data;
31
34
  const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
32
35
  const [activeItemId, setactiveItemId] = (0, react_1.useState)(undefined);
33
36
  const getNavigationItemWithIconSize = (0, react_1.useCallback)((item) => {
34
- if (!(iconSizeKey in item)) {
35
- return Object.assign(Object.assign({}, item), { iconSize });
37
+ const newItem = Object.assign({}, item);
38
+ if ('items' in newItem && isDropdownItem(newItem)) {
39
+ newItem.items = newItem.items.map(getNavigationItemWithIconSize);
36
40
  }
37
- return item;
41
+ if (!(iconSizeKey in newItem) && !isButtonItem(newItem)) {
42
+ newItem.iconSize = iconSize;
43
+ }
44
+ return newItem;
38
45
  }, [iconSize]);
39
46
  const leftItemsWithIconSize = (0, react_1.useMemo)(() => leftItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, leftItems]);
40
47
  const rightItemsWithIconSize = (0, react_1.useMemo)(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, rightItems]);
@@ -26,7 +26,12 @@ exports.DEFAULT_ALLOWED_TAGS = [
26
26
  ];
27
27
  exports.typografConfig = {
28
28
  enabled: ['common/nbsp/afterNumber', 'common/nbsp/afterParagraphMark'],
29
- disabled: ['common/symbols/cf', 'ru/other/phone-number'],
29
+ disabled: [
30
+ 'common/symbols/cf',
31
+ 'ru/other/phone-number',
32
+ 'common/space/afterColon',
33
+ 'common/space/afterSemicolon',
34
+ ],
30
35
  };
31
36
  exports.sanitizeStripOptions = {
32
37
  allowedTags: [],
@@ -3,6 +3,7 @@ import Control from '../../../components/Control/Control';
3
3
  import OutsideClick from '../../../components/OutsideClick/OutsideClick';
4
4
  import { Col, Grid, Row } from '../../../grid';
5
5
  import { NavigationClose, NavigationOpen } from '../../../icons';
6
+ import { NavigationItemType, } from '../../../models';
6
7
  import { block } from '../../../utils';
7
8
  import { ItemColumnName } from '../../constants';
8
9
  import Logo from '../Logo/Logo';
@@ -23,15 +24,21 @@ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
23
24
  }, size: "l" }, iconProps)));
24
25
  };
25
26
  const iconSizeKey = 'iconSize';
27
+ const isButtonItem = (item) => item.type === NavigationItemType.Button;
28
+ const isDropdownItem = (item) => item.type === NavigationItemType.Dropdown;
26
29
  export const Header = ({ data, logo }) => {
27
30
  const { leftItems, rightItems, iconSize = 20 } = data;
28
31
  const [isSidebarOpened, setIsSidebarOpened] = useState(false);
29
32
  const [activeItemId, setactiveItemId] = useState(undefined);
30
33
  const getNavigationItemWithIconSize = useCallback((item) => {
31
- if (!(iconSizeKey in item)) {
32
- return Object.assign(Object.assign({}, item), { iconSize });
34
+ const newItem = Object.assign({}, item);
35
+ if ('items' in newItem && isDropdownItem(newItem)) {
36
+ newItem.items = newItem.items.map(getNavigationItemWithIconSize);
33
37
  }
34
- return item;
38
+ if (!(iconSizeKey in newItem) && !isButtonItem(newItem)) {
39
+ newItem.iconSize = iconSize;
40
+ }
41
+ return newItem;
35
42
  }, [iconSize]);
36
43
  const leftItemsWithIconSize = useMemo(() => leftItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, leftItems]);
37
44
  const rightItemsWithIconSize = useMemo(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, rightItems]);
@@ -23,7 +23,12 @@ 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: [
27
+ 'common/symbols/cf',
28
+ 'ru/other/phone-number',
29
+ 'common/space/afterColon',
30
+ 'common/space/afterSemicolon',
31
+ ],
27
32
  };
28
33
  export const sanitizeStripOptions = {
29
34
  allowedTags: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "3.1.1",
3
+ "version": "3.2.0-alpha.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -139,5 +139,8 @@
139
139
  "*.{json,yaml,yml,md}": [
140
140
  "prettier --write"
141
141
  ]
142
+ },
143
+ "publishConfig": {
144
+ "tag": "alpha"
142
145
  }
143
146
  }
@@ -39,7 +39,12 @@ 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: [
43
+ 'common/symbols/cf',
44
+ 'ru/other/phone-number',
45
+ 'common/space/afterColon',
46
+ 'common/space/afterSemicolon',
47
+ ],
43
48
  };
44
49
  exports.sanitizeStripOptions = {
45
50
  allowedTags: [],