@gravity-ui/page-constructor 4.0.1 → 4.1.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/build/cjs/blocks/Icons/Icons.js +7 -3
- package/build/cjs/components/MetaInfo/MetaInfo.d.ts +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -0
- package/build/cjs/models/constructor-items/sub-blocks.js +6 -1
- package/build/cjs/schema/constants.d.ts +4 -0
- package/build/cjs/sub-blocks/BasicCard/BasicCard.css +15 -0
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +5 -3
- package/build/cjs/sub-blocks/BasicCard/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/BasicCard/schema.js +3 -0
- package/build/esm/blocks/Icons/Icons.js +8 -4
- package/build/esm/components/MetaInfo/MetaInfo.d.ts +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -0
- package/build/esm/models/constructor-items/sub-blocks.js +5 -0
- package/build/esm/schema/constants.d.ts +4 -0
- package/build/esm/sub-blocks/BasicCard/BasicCard.css +15 -0
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +5 -3
- package/build/esm/sub-blocks/BasicCard/schema.d.ts +4 -0
- package/build/esm/sub-blocks/BasicCard/schema.js +3 -0
- package/package.json +2 -2
- package/server/models/constructor-items/sub-blocks.d.ts +5 -0
- package/server/models/constructor-items/sub-blocks.js +6 -1
- package/widget/index.js +1 -1
|
@@ -6,12 +6,16 @@ const components_1 = require("../../components");
|
|
|
6
6
|
const locationContext_1 = require("../../context/locationContext");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('icons-block');
|
|
9
|
+
const getItemContent = (item) => (react_1.default.createElement(react_1.Fragment, null,
|
|
10
|
+
react_1.default.createElement(components_1.Image, { className: b('image'), src: item.src }),
|
|
11
|
+
react_1.default.createElement("p", { className: b('text') }, item.text)));
|
|
9
12
|
const Icons = ({ title, size = 's', items }) => {
|
|
10
13
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
11
14
|
return (react_1.default.createElement("div", { className: b({ size }) },
|
|
12
15
|
title && react_1.default.createElement(components_1.Title, { className: b('header'), title: title, colSizes: { all: 12 } }),
|
|
13
|
-
items.map((item) =>
|
|
14
|
-
|
|
15
|
-
react_1.default.createElement("
|
|
16
|
+
items.map((item) => {
|
|
17
|
+
const itemContent = getItemContent(item);
|
|
18
|
+
return item.url ? (react_1.default.createElement("a", Object.assign({ className: b('item'), key: item.url, href: item.url }, (0, utils_1.getLinkProps)(item.url, hostname)), itemContent)) : (react_1.default.createElement("div", { className: b('item'), key: item.url }, itemContent));
|
|
19
|
+
})));
|
|
16
20
|
};
|
|
17
21
|
exports.default = Icons;
|
|
@@ -23,6 +23,10 @@ export declare enum SubBlockType {
|
|
|
23
23
|
*/
|
|
24
24
|
Card = "card"
|
|
25
25
|
}
|
|
26
|
+
export declare enum IconPosition {
|
|
27
|
+
Top = "top",
|
|
28
|
+
Left = "left"
|
|
29
|
+
}
|
|
26
30
|
export declare const SubBlockTypes: SubBlockType[];
|
|
27
31
|
export interface DividerProps {
|
|
28
32
|
size?: DividerSize;
|
|
@@ -77,6 +81,7 @@ export interface BasicCardProps extends CardBaseProps, Omit<ContentBlockProps, '
|
|
|
77
81
|
url: string;
|
|
78
82
|
icon?: ImageProps;
|
|
79
83
|
target?: string;
|
|
84
|
+
iconPosition?: IconPosition;
|
|
80
85
|
}
|
|
81
86
|
export interface BannerCardProps {
|
|
82
87
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubBlockTypes = exports.SubBlockType = void 0;
|
|
3
|
+
exports.SubBlockTypes = exports.IconPosition = exports.SubBlockType = void 0;
|
|
4
4
|
var SubBlockType;
|
|
5
5
|
(function (SubBlockType) {
|
|
6
6
|
SubBlockType["Divider"] = "divider";
|
|
@@ -21,4 +21,9 @@ var SubBlockType;
|
|
|
21
21
|
*/
|
|
22
22
|
SubBlockType["Card"] = "card";
|
|
23
23
|
})(SubBlockType = exports.SubBlockType || (exports.SubBlockType = {}));
|
|
24
|
+
var IconPosition;
|
|
25
|
+
(function (IconPosition) {
|
|
26
|
+
IconPosition["Top"] = "top";
|
|
27
|
+
IconPosition["Left"] = "left";
|
|
28
|
+
})(IconPosition = exports.IconPosition || (exports.IconPosition = {}));
|
|
24
29
|
exports.SubBlockTypes = Object.values(SubBlockType);
|
|
@@ -10,4 +10,19 @@ unpredictable css rules order in build */
|
|
|
10
10
|
height: 32px;
|
|
11
11
|
object-fit: contain;
|
|
12
12
|
display: block;
|
|
13
|
+
}
|
|
14
|
+
.pc-basic-card__icon_icon-position_left {
|
|
15
|
+
height: 22px;
|
|
16
|
+
width: 22px;
|
|
17
|
+
margin: 1px 12px 1px 0px;
|
|
18
|
+
}
|
|
19
|
+
.pc-basic-card__content {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
}
|
|
23
|
+
.pc-basic-card__content_icon-position_left {
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
}
|
|
26
|
+
.pc-basic-card_content-layout_left.pc-basic-card_content-layout_left {
|
|
27
|
+
flex: 1 0 0;
|
|
13
28
|
}
|
|
@@ -6,14 +6,16 @@ const __1 = require("../");
|
|
|
6
6
|
const CardBase_1 = tslib_1.__importDefault(require("../../components/CardBase/CardBase"));
|
|
7
7
|
const Image_1 = tslib_1.__importDefault(require("../../components/Image/Image"));
|
|
8
8
|
const utils_1 = require("../../components/Media/Image/utils");
|
|
9
|
+
const sub_blocks_1 = require("../../models/constructor-items/sub-blocks");
|
|
9
10
|
const utils_2 = require("../../utils");
|
|
10
11
|
const b = (0, utils_2.block)('basic-card');
|
|
11
12
|
const BasicCard = (props) => {
|
|
12
|
-
const { title, text, icon, additionalInfo, links, buttons } = props, cardParams = tslib_1.__rest(props, ["title", "text", "icon", "additionalInfo", "links", "buttons"]);
|
|
13
|
+
const { title, text, icon, additionalInfo, links, buttons, iconPosition = sub_blocks_1.IconPosition.Top } = props, cardParams = tslib_1.__rest(props, ["title", "text", "icon", "additionalInfo", "links", "buttons", "iconPosition"]);
|
|
13
14
|
const iconProps = icon && (0, utils_1.getMediaImage)(icon);
|
|
14
15
|
return (react_1.default.createElement(CardBase_1.default, Object.assign({ className: b() }, cardParams),
|
|
15
16
|
react_1.default.createElement(CardBase_1.default.Content, null,
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
react_1.default.createElement("div", { className: b('content', { ['icon-position']: iconPosition }) },
|
|
18
|
+
iconProps && (react_1.default.createElement(Image_1.default, Object.assign({}, iconProps, { className: b('icon', { ['icon-position']: iconPosition }) }))),
|
|
19
|
+
react_1.default.createElement(__1.Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s", className: b({ ['content-layout']: iconPosition }) })))));
|
|
18
20
|
};
|
|
19
21
|
exports.default = BasicCard;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { Fragment, useContext } from 'react';
|
|
2
2
|
import { Image, Title } from '../../components';
|
|
3
3
|
import { LocationContext } from '../../context/locationContext';
|
|
4
4
|
import { block, getLinkProps } from '../../utils';
|
|
5
5
|
import './Icons.css';
|
|
6
6
|
const b = block('icons-block');
|
|
7
|
+
const getItemContent = (item) => (React.createElement(Fragment, null,
|
|
8
|
+
React.createElement(Image, { className: b('image'), src: item.src }),
|
|
9
|
+
React.createElement("p", { className: b('text') }, item.text)));
|
|
7
10
|
const Icons = ({ title, size = 's', items }) => {
|
|
8
11
|
const { hostname } = useContext(LocationContext);
|
|
9
12
|
return (React.createElement("div", { className: b({ size }) },
|
|
10
13
|
title && React.createElement(Title, { className: b('header'), title: title, colSizes: { all: 12 } }),
|
|
11
|
-
items.map((item) =>
|
|
12
|
-
|
|
13
|
-
React.createElement("
|
|
14
|
+
items.map((item) => {
|
|
15
|
+
const itemContent = getItemContent(item);
|
|
16
|
+
return item.url ? (React.createElement("a", Object.assign({ className: b('item'), key: item.url, href: item.url }, getLinkProps(item.url, hostname)), itemContent)) : (React.createElement("div", { className: b('item'), key: item.url }, itemContent));
|
|
17
|
+
})));
|
|
14
18
|
};
|
|
15
19
|
export default Icons;
|
|
@@ -23,6 +23,10 @@ export declare enum SubBlockType {
|
|
|
23
23
|
*/
|
|
24
24
|
Card = "card"
|
|
25
25
|
}
|
|
26
|
+
export declare enum IconPosition {
|
|
27
|
+
Top = "top",
|
|
28
|
+
Left = "left"
|
|
29
|
+
}
|
|
26
30
|
export declare const SubBlockTypes: SubBlockType[];
|
|
27
31
|
export interface DividerProps {
|
|
28
32
|
size?: DividerSize;
|
|
@@ -77,6 +81,7 @@ export interface BasicCardProps extends CardBaseProps, Omit<ContentBlockProps, '
|
|
|
77
81
|
url: string;
|
|
78
82
|
icon?: ImageProps;
|
|
79
83
|
target?: string;
|
|
84
|
+
iconPosition?: IconPosition;
|
|
80
85
|
}
|
|
81
86
|
export interface BannerCardProps {
|
|
82
87
|
title: string;
|
|
@@ -18,4 +18,9 @@ export var SubBlockType;
|
|
|
18
18
|
*/
|
|
19
19
|
SubBlockType["Card"] = "card";
|
|
20
20
|
})(SubBlockType || (SubBlockType = {}));
|
|
21
|
+
export var IconPosition;
|
|
22
|
+
(function (IconPosition) {
|
|
23
|
+
IconPosition["Top"] = "top";
|
|
24
|
+
IconPosition["Left"] = "left";
|
|
25
|
+
})(IconPosition || (IconPosition = {}));
|
|
21
26
|
export const SubBlockTypes = Object.values(SubBlockType);
|
|
@@ -10,4 +10,19 @@ unpredictable css rules order in build */
|
|
|
10
10
|
height: 32px;
|
|
11
11
|
object-fit: contain;
|
|
12
12
|
display: block;
|
|
13
|
+
}
|
|
14
|
+
.pc-basic-card__icon_icon-position_left {
|
|
15
|
+
height: 22px;
|
|
16
|
+
width: 22px;
|
|
17
|
+
margin: 1px 12px 1px 0px;
|
|
18
|
+
}
|
|
19
|
+
.pc-basic-card__content {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
}
|
|
23
|
+
.pc-basic-card__content_icon-position_left {
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
}
|
|
26
|
+
.pc-basic-card_content-layout_left.pc-basic-card_content-layout_left {
|
|
27
|
+
flex: 1 0 0;
|
|
13
28
|
}
|
|
@@ -4,15 +4,17 @@ import { Content } from '../';
|
|
|
4
4
|
import CardBase from '../../components/CardBase/CardBase';
|
|
5
5
|
import Image from '../../components/Image/Image';
|
|
6
6
|
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
7
|
+
import { IconPosition } from '../../models/constructor-items/sub-blocks';
|
|
7
8
|
import { block } from '../../utils';
|
|
8
9
|
import './BasicCard.css';
|
|
9
10
|
const b = block('basic-card');
|
|
10
11
|
const BasicCard = (props) => {
|
|
11
|
-
const { title, text, icon, additionalInfo, links, buttons } = props, cardParams = __rest(props, ["title", "text", "icon", "additionalInfo", "links", "buttons"]);
|
|
12
|
+
const { title, text, icon, additionalInfo, links, buttons, iconPosition = IconPosition.Top } = props, cardParams = __rest(props, ["title", "text", "icon", "additionalInfo", "links", "buttons", "iconPosition"]);
|
|
12
13
|
const iconProps = icon && getMediaImage(icon);
|
|
13
14
|
return (React.createElement(CardBase, Object.assign({ className: b() }, cardParams),
|
|
14
15
|
React.createElement(CardBase.Content, null,
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
React.createElement("div", { className: b('content', { ['icon-position']: iconPosition }) },
|
|
17
|
+
iconProps && (React.createElement(Image, Object.assign({}, iconProps, { className: b('icon', { ['icon-position']: iconPosition }) }))),
|
|
18
|
+
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s", className: b({ ['content-layout']: iconPosition }) })))));
|
|
17
19
|
};
|
|
18
20
|
export default BasicCard;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@gravity-ui/components": "^2.0.0",
|
|
84
|
-
"@gravity-ui/dynamic-forms": "^
|
|
84
|
+
"@gravity-ui/dynamic-forms": "^2.0.0",
|
|
85
85
|
"@gravity-ui/i18n": "^1.0.0",
|
|
86
86
|
"ajv": "^8.12.0",
|
|
87
87
|
"bem-cn-lite": "^4.0.0",
|
|
@@ -23,6 +23,10 @@ export declare enum SubBlockType {
|
|
|
23
23
|
*/
|
|
24
24
|
Card = "card"
|
|
25
25
|
}
|
|
26
|
+
export declare enum IconPosition {
|
|
27
|
+
Top = "top",
|
|
28
|
+
Left = "left"
|
|
29
|
+
}
|
|
26
30
|
export declare const SubBlockTypes: SubBlockType[];
|
|
27
31
|
export interface DividerProps {
|
|
28
32
|
size?: DividerSize;
|
|
@@ -77,6 +81,7 @@ export interface BasicCardProps extends CardBaseProps, Omit<ContentBlockProps, '
|
|
|
77
81
|
url: string;
|
|
78
82
|
icon?: ImageProps;
|
|
79
83
|
target?: string;
|
|
84
|
+
iconPosition?: IconPosition;
|
|
80
85
|
}
|
|
81
86
|
export interface BannerCardProps {
|
|
82
87
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubBlockTypes = exports.SubBlockType = void 0;
|
|
3
|
+
exports.SubBlockTypes = exports.IconPosition = exports.SubBlockType = void 0;
|
|
4
4
|
var SubBlockType;
|
|
5
5
|
(function (SubBlockType) {
|
|
6
6
|
SubBlockType["Divider"] = "divider";
|
|
@@ -21,4 +21,9 @@ var SubBlockType;
|
|
|
21
21
|
*/
|
|
22
22
|
SubBlockType["Card"] = "card";
|
|
23
23
|
})(SubBlockType = exports.SubBlockType || (exports.SubBlockType = {}));
|
|
24
|
+
var IconPosition;
|
|
25
|
+
(function (IconPosition) {
|
|
26
|
+
IconPosition["Top"] = "top";
|
|
27
|
+
IconPosition["Left"] = "left";
|
|
28
|
+
})(IconPosition = exports.IconPosition || (exports.IconPosition = {}));
|
|
24
29
|
exports.SubBlockTypes = Object.values(SubBlockType);
|