@gravity-ui/page-constructor 4.0.0 → 4.1.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 (41) hide show
  1. package/build/cjs/containers/Loadable/Loadable.d.ts +2 -2
  2. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -2
  3. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts +2 -2
  4. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -2
  5. package/build/cjs/editor/components/BlockForm/BlockForm.d.ts +2 -2
  6. package/build/cjs/editor/store/reducer.d.ts +2 -2
  7. package/build/cjs/editor/store/utils.d.ts +5 -5
  8. package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -0
  9. package/build/cjs/models/constructor-items/sub-blocks.js +6 -1
  10. package/build/cjs/models/constructor.d.ts +3 -3
  11. package/build/cjs/models/customization.d.ts +1 -1
  12. package/build/cjs/schema/constants.d.ts +4 -0
  13. package/build/cjs/sub-blocks/BasicCard/BasicCard.css +15 -0
  14. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +5 -3
  15. package/build/cjs/sub-blocks/BasicCard/schema.d.ts +4 -0
  16. package/build/cjs/sub-blocks/BasicCard/schema.js +3 -0
  17. package/build/cjs/utils/blocks.d.ts +3 -4
  18. package/build/esm/containers/Loadable/Loadable.d.ts +2 -2
  19. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -2
  20. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts +2 -2
  21. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -2
  22. package/build/esm/editor/components/BlockForm/BlockForm.d.ts +2 -2
  23. package/build/esm/editor/store/reducer.d.ts +2 -2
  24. package/build/esm/editor/store/utils.d.ts +5 -5
  25. package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -0
  26. package/build/esm/models/constructor-items/sub-blocks.js +5 -0
  27. package/build/esm/models/constructor.d.ts +3 -3
  28. package/build/esm/models/customization.d.ts +1 -1
  29. package/build/esm/schema/constants.d.ts +4 -0
  30. package/build/esm/sub-blocks/BasicCard/BasicCard.css +15 -0
  31. package/build/esm/sub-blocks/BasicCard/BasicCard.js +5 -3
  32. package/build/esm/sub-blocks/BasicCard/schema.d.ts +4 -0
  33. package/build/esm/sub-blocks/BasicCard/schema.js +3 -0
  34. package/build/esm/utils/blocks.d.ts +3 -4
  35. package/package.json +2 -2
  36. package/server/models/constructor-items/sub-blocks.d.ts +5 -0
  37. package/server/models/constructor-items/sub-blocks.js +6 -1
  38. package/server/models/constructor.d.ts +3 -3
  39. package/server/models/customization.d.ts +1 -1
  40. package/server/utils/blocks.d.ts +3 -4
  41. package/widget/index.js +1 -1
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { ConstructorItem, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
2
+ import { ConstructorBlock, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
3
3
  export interface LoadableState {
4
4
  loading: boolean;
5
5
  error: boolean;
@@ -8,7 +8,7 @@ export interface LoadableState {
8
8
  export interface LoadableComponentsProps extends Omit<PropsWithChildren<LoadableProps>, 'source'> {
9
9
  Component: CustomItem;
10
10
  ChildComponent: CustomItem;
11
- block: ConstructorItem;
11
+ block: ConstructorBlock;
12
12
  blockKey: string;
13
13
  fetch: FetchLoadableData;
14
14
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Block, BlockDecorationProps, WithChildren } from '../../../../models';
2
+ import { BlockDecorationProps, ConstructorBlock as ConstructorBlockType, WithChildren } from '../../../../models';
3
3
  interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
4
- data: Block;
4
+ data: ConstructorBlockType;
5
5
  }
6
6
  export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { ConstructorItem as ConstructorItemType } from '../../../../models';
2
+ import { ConstructorBlock as ConstructorBlockType } from '../../../../models';
3
3
  export interface ConstructorBlocksProps {
4
- items: ConstructorItemType[];
4
+ items: ConstructorBlockType[];
5
5
  }
6
6
  export declare const ConstructorBlocks: React.FC<ConstructorBlocksProps>;
@@ -1,6 +1,6 @@
1
- import { ConstructorItem as ConstructorItemType, WithChildren } from '../../../../models';
1
+ import { ConstructorBlock, WithChildren } from '../../../../models';
2
2
  export interface ConstructorItemProps {
3
- data: ConstructorItemType;
3
+ data: ConstructorBlock;
4
4
  blockKey: string;
5
5
  }
6
6
  export declare const ConstructorItem: ({ data, blockKey, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Block } from '../../../models';
2
+ import { Block, ConstructorBlock } from '../../../models';
3
3
  import { CustomSpec } from '../../dynamic-forms-custom/parser/types';
4
4
  interface BlockFormProps {
5
- data: Block;
5
+ data: ConstructorBlock;
6
6
  spec: CustomSpec;
7
7
  onChange: (data: Block) => void;
8
8
  onSelect: () => void;
@@ -1,4 +1,4 @@
1
- import { Block, PageContent, Theme } from '../../models';
1
+ import { ConstructorBlock, PageContent, Theme } from '../../models';
2
2
  import { ViewModeItem } from '../types';
3
3
  export type EditorBlockId = number | string;
4
4
  interface EditorState {
@@ -13,7 +13,7 @@ interface OrderBlockParams {
13
13
  newIndex: number;
14
14
  }
15
15
  interface AddBlockParams {
16
- block: Block;
16
+ block: ConstructorBlock;
17
17
  index: number;
18
18
  }
19
19
  export declare const SELECT_BLOCK = "SELECT_BLOCK";
@@ -1,12 +1,12 @@
1
- import { Block, PageContent } from '../../models';
1
+ import { ConstructorBlock, PageContent } from '../../models';
2
2
  import { EditorBlockId } from './reducer';
3
- export declare const changeBlocksOrder: (array: Block[], oldIndex: number, newIndex: number) => Block[];
4
- export declare const duplicateBlock: (array: Block[], index: number) => Block[];
3
+ export declare const changeBlocksOrder: (array: ConstructorBlock[], oldIndex: number, newIndex: number) => ConstructorBlock[];
4
+ export declare const duplicateBlock: (array: ConstructorBlock[], index: number) => ConstructorBlock[];
5
5
  export declare const getNewBlockIndex: (id: EditorBlockId, orderedBlocksCount: number) => number;
6
- export declare const addBlock: (array: Block[], block: Block, index: number) => Block[];
6
+ export declare const addBlock: (array: ConstructorBlock[], block: ConstructorBlock, index: number) => ConstructorBlock[];
7
7
  export declare const addEditorProps: (content: PageContent) => {
8
8
  animated: boolean;
9
- blocks: Block[];
9
+ blocks: ConstructorBlock[];
10
10
  menu?: import("../../models").Menu | undefined;
11
11
  background?: import("../../models").ThemedMediaProps | undefined;
12
12
  };
@@ -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);
@@ -1,13 +1,14 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
6
6
  export interface Menu {
7
7
  title: string;
8
8
  }
9
+ export type ConstructorBlock = ConstructorItem | CustomBlock;
9
10
  export interface PageContent extends Animatable {
10
- blocks: Block[];
11
+ blocks: ConstructorBlock[];
11
12
  menu?: Menu;
12
13
  background?: ThemedMediaProps;
13
14
  }
@@ -18,7 +19,6 @@ export interface CustomBlock {
18
19
  type: string;
19
20
  [key: string]: unknown;
20
21
  }
21
- export type ConstructorBlock = ConstructorItem | CustomBlock;
22
22
  export type LoadableData = any;
23
23
  export type FetchLoadableDataParams = {
24
24
  blockKey: string;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, BlockType } from './constructor-items';
3
3
  export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
4
- type: BlockType;
4
+ type: BlockType | string;
5
5
  index?: number;
6
6
  }
7
7
  export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -26,6 +26,10 @@ export declare const cardSchemas: {
26
26
  type: string;
27
27
  enum: string[];
28
28
  };
29
+ iconPosition: {
30
+ type: string;
31
+ enum: string[];
32
+ };
29
33
  title: {
30
34
  oneOf: ({
31
35
  type: string;
@@ -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
- iconProps && react_1.default.createElement(Image_1.default, Object.assign({}, iconProps, { className: b('icon') })),
17
- react_1.default.createElement(__1.Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s" }))));
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;
@@ -24,6 +24,10 @@ export declare const BasicCard: {
24
24
  type: string;
25
25
  enum: string[];
26
26
  };
27
+ iconPosition: {
28
+ type: string;
29
+ enum: string[];
30
+ };
27
31
  title: {
28
32
  oneOf: ({
29
33
  type: string;
@@ -16,6 +16,9 @@ exports.BasicCard = {
16
16
  }, icon: schema_1.ImageProps, target: {
17
17
  type: 'string',
18
18
  enum: ['_blank', '_parent', '_top', '_self'],
19
+ }, iconPosition: {
20
+ type: 'string',
21
+ enum: ['top', 'left'],
19
22
  } }),
20
23
  },
21
24
  };
@@ -1,5 +1,4 @@
1
- import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
2
- import { ConstructorBlock } from '../models/constructor';
1
+ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
3
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
4
3
  export declare function hasBlockTag(content: string): boolean;
5
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
@@ -9,6 +8,6 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
9
8
  };
10
9
  export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
11
10
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
12
- export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
13
- export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
11
+ export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
+ export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
14
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { ConstructorItem, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
2
+ import { ConstructorBlock, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
3
3
  import './Loadable.css';
4
4
  export interface LoadableState {
5
5
  loading: boolean;
@@ -9,7 +9,7 @@ export interface LoadableState {
9
9
  export interface LoadableComponentsProps extends Omit<PropsWithChildren<LoadableProps>, 'source'> {
10
10
  Component: CustomItem;
11
11
  ChildComponent: CustomItem;
12
- block: ConstructorItem;
12
+ block: ConstructorBlock;
13
13
  blockKey: string;
14
14
  fetch: FetchLoadableData;
15
15
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Block, BlockDecorationProps, WithChildren } from '../../../../models';
2
+ import { BlockDecorationProps, ConstructorBlock as ConstructorBlockType, WithChildren } from '../../../../models';
3
3
  interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
4
- data: Block;
4
+ data: ConstructorBlockType;
5
5
  }
6
6
  export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { ConstructorItem as ConstructorItemType } from '../../../../models';
2
+ import { ConstructorBlock as ConstructorBlockType } from '../../../../models';
3
3
  export interface ConstructorBlocksProps {
4
- items: ConstructorItemType[];
4
+ items: ConstructorBlockType[];
5
5
  }
6
6
  export declare const ConstructorBlocks: React.FC<ConstructorBlocksProps>;
@@ -1,6 +1,6 @@
1
- import { ConstructorItem as ConstructorItemType, WithChildren } from '../../../../models';
1
+ import { ConstructorBlock, WithChildren } from '../../../../models';
2
2
  export interface ConstructorItemProps {
3
- data: ConstructorItemType;
3
+ data: ConstructorBlock;
4
4
  blockKey: string;
5
5
  }
6
6
  export declare const ConstructorItem: ({ data, blockKey, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Block } from '../../../models';
2
+ import { Block, ConstructorBlock } from '../../../models';
3
3
  import { CustomSpec } from '../../dynamic-forms-custom/parser/types';
4
4
  interface BlockFormProps {
5
- data: Block;
5
+ data: ConstructorBlock;
6
6
  spec: CustomSpec;
7
7
  onChange: (data: Block) => void;
8
8
  onSelect: () => void;
@@ -1,4 +1,4 @@
1
- import { Block, PageContent, Theme } from '../../models';
1
+ import { ConstructorBlock, PageContent, Theme } from '../../models';
2
2
  import { ViewModeItem } from '../types';
3
3
  export type EditorBlockId = number | string;
4
4
  interface EditorState {
@@ -13,7 +13,7 @@ interface OrderBlockParams {
13
13
  newIndex: number;
14
14
  }
15
15
  interface AddBlockParams {
16
- block: Block;
16
+ block: ConstructorBlock;
17
17
  index: number;
18
18
  }
19
19
  export declare const SELECT_BLOCK = "SELECT_BLOCK";
@@ -1,12 +1,12 @@
1
- import { Block, PageContent } from '../../models';
1
+ import { ConstructorBlock, PageContent } from '../../models';
2
2
  import { EditorBlockId } from './reducer';
3
- export declare const changeBlocksOrder: (array: Block[], oldIndex: number, newIndex: number) => Block[];
4
- export declare const duplicateBlock: (array: Block[], index: number) => Block[];
3
+ export declare const changeBlocksOrder: (array: ConstructorBlock[], oldIndex: number, newIndex: number) => ConstructorBlock[];
4
+ export declare const duplicateBlock: (array: ConstructorBlock[], index: number) => ConstructorBlock[];
5
5
  export declare const getNewBlockIndex: (id: EditorBlockId, orderedBlocksCount: number) => number;
6
- export declare const addBlock: (array: Block[], block: Block, index: number) => Block[];
6
+ export declare const addBlock: (array: ConstructorBlock[], block: ConstructorBlock, index: number) => ConstructorBlock[];
7
7
  export declare const addEditorProps: (content: PageContent) => {
8
8
  animated: boolean;
9
- blocks: Block[];
9
+ blocks: ConstructorBlock[];
10
10
  menu?: import("../../models").Menu | undefined;
11
11
  background?: import("../../models").ThemedMediaProps | undefined;
12
12
  };
@@ -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);
@@ -1,13 +1,14 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
6
6
  export interface Menu {
7
7
  title: string;
8
8
  }
9
+ export type ConstructorBlock = ConstructorItem | CustomBlock;
9
10
  export interface PageContent extends Animatable {
10
- blocks: Block[];
11
+ blocks: ConstructorBlock[];
11
12
  menu?: Menu;
12
13
  background?: ThemedMediaProps;
13
14
  }
@@ -18,7 +19,6 @@ export interface CustomBlock {
18
19
  type: string;
19
20
  [key: string]: unknown;
20
21
  }
21
- export type ConstructorBlock = ConstructorItem | CustomBlock;
22
22
  export type LoadableData = any;
23
23
  export type FetchLoadableDataParams = {
24
24
  blockKey: string;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, BlockType } from './constructor-items';
3
3
  export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
4
- type: BlockType;
4
+ type: BlockType | string;
5
5
  index?: number;
6
6
  }
7
7
  export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -26,6 +26,10 @@ export declare const cardSchemas: {
26
26
  type: string;
27
27
  enum: string[];
28
28
  };
29
+ iconPosition: {
30
+ type: string;
31
+ enum: string[];
32
+ };
29
33
  title: {
30
34
  oneOf: ({
31
35
  type: string;
@@ -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
- iconProps && React.createElement(Image, Object.assign({}, iconProps, { className: b('icon') })),
16
- React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s" }))));
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;
@@ -24,6 +24,10 @@ export declare const BasicCard: {
24
24
  type: string;
25
25
  enum: string[];
26
26
  };
27
+ iconPosition: {
28
+ type: string;
29
+ enum: string[];
30
+ };
27
31
  title: {
28
32
  oneOf: ({
29
33
  type: string;
@@ -12,6 +12,9 @@ export const BasicCard = {
12
12
  }, icon: ImageProps, target: {
13
13
  type: 'string',
14
14
  enum: ['_blank', '_parent', '_top', '_self'],
15
+ }, iconPosition: {
16
+ type: 'string',
17
+ enum: ['top', 'left'],
15
18
  } }),
16
19
  },
17
20
  };
@@ -1,5 +1,4 @@
1
- import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
2
- import { ConstructorBlock } from '../models/constructor';
1
+ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
3
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
4
3
  export declare function hasBlockTag(content: string): boolean;
5
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
@@ -9,6 +8,6 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
9
8
  };
10
9
  export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
11
10
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
12
- export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
13
- export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
11
+ export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
+ export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
14
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
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": "^1.11.0",
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);
@@ -1,13 +1,14 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
6
6
  export interface Menu {
7
7
  title: string;
8
8
  }
9
+ export type ConstructorBlock = ConstructorItem | CustomBlock;
9
10
  export interface PageContent extends Animatable {
10
- blocks: Block[];
11
+ blocks: ConstructorBlock[];
11
12
  menu?: Menu;
12
13
  background?: ThemedMediaProps;
13
14
  }
@@ -18,7 +19,6 @@ export interface CustomBlock {
18
19
  type: string;
19
20
  [key: string]: unknown;
20
21
  }
21
- export type ConstructorBlock = ConstructorItem | CustomBlock;
22
22
  export type LoadableData = any;
23
23
  export type FetchLoadableDataParams = {
24
24
  blockKey: string;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, BlockType } from './constructor-items';
3
3
  export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
4
- type: BlockType;
4
+ type: BlockType | string;
5
5
  index?: number;
6
6
  }
7
7
  export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -1,5 +1,4 @@
1
- import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
2
- import { ConstructorBlock } from '../models/constructor';
1
+ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
3
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
4
3
  export declare function hasBlockTag(content: string): boolean;
5
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
@@ -9,6 +8,6 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
9
8
  };
10
9
  export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
11
10
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
12
- export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
13
- export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
11
+ export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
+ export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
14
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;