@gravity-ui/page-constructor 5.12.0 → 5.14.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 (150) hide show
  1. package/build/cjs/blocks/ContentLayout/schema.d.ts +4 -0
  2. package/build/cjs/blocks/Form/schema.d.ts +4 -0
  3. package/build/cjs/blocks/Info/schema.d.ts +8 -0
  4. package/build/cjs/blocks/Map/schema.d.ts +4 -0
  5. package/build/cjs/blocks/Media/schema.d.ts +8 -0
  6. package/build/cjs/blocks/Questions/schema.d.ts +4 -0
  7. package/build/cjs/blocks/Tabs/schema.d.ts +4 -0
  8. package/build/cjs/components/IconWrapper/IconWrapper.css +4 -2
  9. package/build/cjs/components/IconWrapper/IconWrapper.d.ts +2 -2
  10. package/build/cjs/components/IconWrapper/IconWrapper.js +3 -3
  11. package/build/cjs/constructor-items.d.ts +1 -1
  12. package/build/cjs/editor/components/AddBlock/AddBlock.css +1 -2
  13. package/build/cjs/editor/components/CodeEditor/CodeEditor.css +3 -1
  14. package/build/cjs/editor/components/ControlPanel/ControlPanel.css +2 -4
  15. package/build/cjs/editor/components/ControlPanel/ControlPanel.d.ts +4 -2
  16. package/build/cjs/editor/components/ControlPanel/ControlPanel.js +24 -15
  17. package/build/cjs/editor/components/ControlPanel/i18n/en.json +2 -1
  18. package/build/cjs/editor/components/ControlPanel/i18n/index.d.ts +1 -1
  19. package/build/cjs/editor/components/ControlPanel/i18n/ru.json +2 -1
  20. package/build/cjs/editor/components/Layout/Layout.css +10 -6
  21. package/build/cjs/editor/components/Layout/Layout.d.ts +4 -7
  22. package/build/cjs/editor/components/Layout/Layout.js +8 -10
  23. package/build/cjs/editor/components/PageSettings/PageSettings.css +26 -0
  24. package/build/cjs/editor/components/PageSettings/PageSettings.d.ts +11 -0
  25. package/build/cjs/editor/components/PageSettings/PageSettings.js +30 -0
  26. package/build/cjs/editor/components/PageSettings/i18n/en.json +3 -0
  27. package/build/cjs/editor/components/PageSettings/i18n/index.d.ts +1 -0
  28. package/build/cjs/editor/components/PageSettings/i18n/index.js +9 -0
  29. package/build/cjs/editor/components/PageSettings/i18n/ru.json +3 -0
  30. package/build/cjs/editor/containers/Editor/Editor.css +17 -0
  31. package/build/cjs/editor/containers/Editor/Editor.d.ts +1 -1
  32. package/build/cjs/editor/containers/Editor/Editor.js +17 -65
  33. package/build/cjs/editor/containers/Editor/hooks/useCode.d.ts +14 -0
  34. package/build/cjs/editor/containers/{Form/hooks.js → Editor/hooks/useCode.js} +4 -14
  35. package/build/cjs/editor/containers/Editor/hooks/useEditorState.d.ts +49 -0
  36. package/build/cjs/editor/containers/Editor/hooks/useEditorState.js +99 -0
  37. package/build/cjs/editor/containers/Form/Form.css +0 -10
  38. package/build/cjs/editor/containers/Form/Form.d.ts +1 -8
  39. package/build/cjs/editor/containers/Form/Form.js +14 -39
  40. package/build/cjs/editor/store/main/index.js +1 -1
  41. package/build/cjs/editor/store/settings/index.d.ts +3 -3
  42. package/build/cjs/editor/store/settings/index.js +4 -4
  43. package/build/cjs/editor/store/settings/reducer.d.ts +9 -9
  44. package/build/cjs/editor/store/settings/reducer.js +6 -6
  45. package/build/cjs/editor/types/index.d.ts +3 -4
  46. package/build/cjs/editor/types/index.js +7 -8
  47. package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
  48. package/build/cjs/models/constructor-items/sub-blocks.d.ts +3 -3
  49. package/build/cjs/schema/constants.d.ts +4 -0
  50. package/build/cjs/schema/validators/common.d.ts +6 -0
  51. package/build/cjs/schema/validators/common.js +8 -1
  52. package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.css +3 -6
  53. package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -5
  54. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -2
  55. package/build/cjs/sub-blocks/BasicCard/BasicCard.css +4 -4
  56. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -6
  57. package/build/cjs/sub-blocks/BasicCard/schema.js +2 -2
  58. package/build/cjs/sub-blocks/Content/Content.css +11 -0
  59. package/build/cjs/sub-blocks/Content/Content.js +2 -2
  60. package/build/cjs/sub-blocks/Content/schema.d.ts +8 -0
  61. package/build/cjs/sub-blocks/Content/schema.js +4 -0
  62. package/build/cjs/sub-blocks/ImageCard/ImageCard.css +2 -0
  63. package/build/cjs/sub-blocks/ImageCard/ImageCard.js +4 -2
  64. package/build/cjs/sub-blocks/ImageCard/schema.d.ts +4 -0
  65. package/build/cjs/sub-blocks/ImageCard/schema.js +2 -2
  66. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +3 -2
  67. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  68. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -6
  69. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +4 -0
  70. package/build/cjs/sub-blocks/LayoutItem/schema.js +1 -4
  71. package/build/esm/blocks/ContentLayout/schema.d.ts +4 -0
  72. package/build/esm/blocks/Form/schema.d.ts +4 -0
  73. package/build/esm/blocks/Info/schema.d.ts +8 -0
  74. package/build/esm/blocks/Map/schema.d.ts +4 -0
  75. package/build/esm/blocks/Media/schema.d.ts +8 -0
  76. package/build/esm/blocks/Questions/schema.d.ts +4 -0
  77. package/build/esm/blocks/Tabs/schema.d.ts +4 -0
  78. package/build/esm/components/IconWrapper/IconWrapper.css +4 -2
  79. package/build/esm/components/IconWrapper/IconWrapper.d.ts +2 -2
  80. package/build/esm/components/IconWrapper/IconWrapper.js +3 -3
  81. package/build/esm/constructor-items.d.ts +1 -1
  82. package/build/esm/editor/components/AddBlock/AddBlock.css +1 -2
  83. package/build/esm/editor/components/CodeEditor/CodeEditor.css +3 -1
  84. package/build/esm/editor/components/ControlPanel/ControlPanel.css +2 -4
  85. package/build/esm/editor/components/ControlPanel/ControlPanel.d.ts +4 -2
  86. package/build/esm/editor/components/ControlPanel/ControlPanel.js +26 -17
  87. package/build/esm/editor/components/ControlPanel/i18n/en.json +2 -1
  88. package/build/esm/editor/components/ControlPanel/i18n/index.d.ts +1 -1
  89. package/build/esm/editor/components/ControlPanel/i18n/ru.json +2 -1
  90. package/build/esm/editor/components/Layout/Layout.css +10 -6
  91. package/build/esm/editor/components/Layout/Layout.d.ts +4 -7
  92. package/build/esm/editor/components/Layout/Layout.js +9 -11
  93. package/build/esm/editor/components/PageSettings/PageSettings.css +26 -0
  94. package/build/esm/editor/components/PageSettings/PageSettings.d.ts +12 -0
  95. package/build/esm/editor/components/PageSettings/PageSettings.js +27 -0
  96. package/build/esm/editor/components/PageSettings/i18n/en.json +3 -0
  97. package/build/esm/editor/components/PageSettings/i18n/index.d.ts +1 -0
  98. package/build/esm/editor/components/PageSettings/i18n/index.js +5 -0
  99. package/build/esm/editor/components/PageSettings/i18n/ru.json +3 -0
  100. package/build/esm/editor/containers/Editor/Editor.css +17 -0
  101. package/build/esm/editor/containers/Editor/Editor.d.ts +2 -1
  102. package/build/esm/editor/containers/Editor/Editor.js +18 -66
  103. package/build/esm/editor/containers/Editor/hooks/useCode.d.ts +14 -0
  104. package/build/esm/editor/containers/{Form/hooks.js → Editor/hooks/useCode.js} +4 -14
  105. package/build/esm/editor/containers/Editor/hooks/useEditorState.d.ts +49 -0
  106. package/build/esm/editor/containers/Editor/hooks/useEditorState.js +95 -0
  107. package/build/esm/editor/containers/Form/Form.css +0 -10
  108. package/build/esm/editor/containers/Form/Form.d.ts +1 -8
  109. package/build/esm/editor/containers/Form/Form.js +16 -42
  110. package/build/esm/editor/store/main/index.js +1 -1
  111. package/build/esm/editor/store/settings/index.d.ts +3 -3
  112. package/build/esm/editor/store/settings/index.js +5 -5
  113. package/build/esm/editor/store/settings/reducer.d.ts +9 -9
  114. package/build/esm/editor/store/settings/reducer.js +6 -6
  115. package/build/esm/editor/types/index.d.ts +3 -4
  116. package/build/esm/editor/types/index.js +6 -7
  117. package/build/esm/models/constructor-items/blocks.d.ts +1 -0
  118. package/build/esm/models/constructor-items/sub-blocks.d.ts +3 -3
  119. package/build/esm/schema/constants.d.ts +4 -0
  120. package/build/esm/schema/validators/common.d.ts +6 -0
  121. package/build/esm/schema/validators/common.js +6 -0
  122. package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.css +3 -6
  123. package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -6
  124. package/build/esm/sub-blocks/BackgroundCard/schema.js +3 -3
  125. package/build/esm/sub-blocks/BasicCard/BasicCard.css +4 -4
  126. package/build/esm/sub-blocks/BasicCard/BasicCard.js +4 -7
  127. package/build/esm/sub-blocks/BasicCard/schema.js +3 -3
  128. package/build/esm/sub-blocks/Content/Content.css +11 -0
  129. package/build/esm/sub-blocks/Content/Content.js +2 -2
  130. package/build/esm/sub-blocks/Content/schema.d.ts +8 -0
  131. package/build/esm/sub-blocks/Content/schema.js +4 -0
  132. package/build/esm/sub-blocks/ImageCard/ImageCard.css +2 -0
  133. package/build/esm/sub-blocks/ImageCard/ImageCard.js +4 -2
  134. package/build/esm/sub-blocks/ImageCard/schema.d.ts +4 -0
  135. package/build/esm/sub-blocks/ImageCard/schema.js +3 -3
  136. package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +3 -2
  137. package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  138. package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +5 -7
  139. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +4 -0
  140. package/build/esm/sub-blocks/LayoutItem/schema.js +2 -5
  141. package/package.json +1 -1
  142. package/server/models/constructor-items/blocks.d.ts +1 -0
  143. package/server/models/constructor-items/sub-blocks.d.ts +3 -3
  144. package/widget/index.js +1 -1
  145. package/build/cjs/editor/components/PagePropsForm/PagePropsForm.d.ts +0 -10
  146. package/build/cjs/editor/components/PagePropsForm/PagePropsForm.js +0 -17
  147. package/build/cjs/editor/containers/Form/hooks.d.ts +0 -8
  148. package/build/esm/editor/components/PagePropsForm/PagePropsForm.d.ts +0 -10
  149. package/build/esm/editor/components/PagePropsForm/PagePropsForm.js +0 -13
  150. package/build/esm/editor/containers/Form/hooks.d.ts +0 -8
@@ -1,19 +1,23 @@
1
1
  import { Theme } from '../../../models';
2
- import { FormTab, ViewModeItem } from '../../types';
3
- export declare const UPDATE_FORM_TAB = "UPDATE_FORM_TAB";
2
+ import { EditModeItem, ViewModeItem } from '../../types';
4
3
  export declare const UPDATE_CODE_FULLSCREEN_MODE_ON = "UPDATE_CODE_FULLSCREEN_MODE_ON";
5
4
  export declare const UPDATE_VIEW_MODE = "UPDATE_VIEW_MODE";
5
+ export declare const UPDATE_EDIT_MODE = "UPDATE_EDIT_MODE";
6
6
  export declare const UPDATE_THEME = "UPDATE_THEME";
7
7
  interface EditorSettingsState {
8
8
  theme: Theme;
9
9
  viewMode: ViewModeItem;
10
+ editMode: EditModeItem;
10
11
  codeFullscreeModeOn: boolean;
11
- formTab: FormTab;
12
12
  }
13
13
  interface UpdateViewMode {
14
14
  type: typeof UPDATE_VIEW_MODE;
15
15
  payload: ViewModeItem;
16
16
  }
17
+ interface UpdateEditMode {
18
+ type: typeof UPDATE_EDIT_MODE;
19
+ payload: EditModeItem;
20
+ }
17
21
  interface UpdateTheme {
18
22
  type: typeof UPDATE_THEME;
19
23
  payload: Theme;
@@ -22,16 +26,12 @@ interface UpdateCodeFullscreenModeOn {
22
26
  type: typeof UPDATE_CODE_FULLSCREEN_MODE_ON;
23
27
  payload: boolean;
24
28
  }
25
- interface UpdateFormTab {
26
- type: typeof UPDATE_FORM_TAB;
27
- payload: FormTab;
28
- }
29
- export type EditorSettingsAction = UpdateViewMode | UpdateTheme | UpdateCodeFullscreenModeOn | UpdateFormTab;
29
+ export type EditorSettingsAction = UpdateViewMode | UpdateEditMode | UpdateTheme | UpdateCodeFullscreenModeOn;
30
30
  export declare const reducer: (state: EditorSettingsState, action: EditorSettingsAction) => EditorSettingsState;
31
31
  export declare const initialState: {
32
32
  viewMode: ViewModeItem;
33
+ editMode: EditModeItem;
33
34
  theme: Theme;
34
35
  codeFullscreeModeOn: boolean;
35
- formTab: FormTab;
36
36
  };
37
37
  export {};
@@ -1,28 +1,28 @@
1
1
  import { DEFAULT_THEME } from '../../../components/constants';
2
- import { FormTab, ViewModeItem } from '../../types';
2
+ import { EditModeItem, ViewModeItem } from '../../types';
3
3
  // actions
4
- export const UPDATE_FORM_TAB = 'UPDATE_FORM_TAB';
5
4
  export const UPDATE_CODE_FULLSCREEN_MODE_ON = 'UPDATE_CODE_FULLSCREEN_MODE_ON';
6
5
  export const UPDATE_VIEW_MODE = 'UPDATE_VIEW_MODE';
6
+ export const UPDATE_EDIT_MODE = 'UPDATE_EDIT_MODE';
7
7
  export const UPDATE_THEME = 'UPDATE_THEME';
8
8
  // reducer
9
9
  export const reducer = (state, action) => {
10
10
  switch (action.type) {
11
11
  case UPDATE_VIEW_MODE:
12
12
  return Object.assign(Object.assign({}, state), { viewMode: action.payload });
13
+ case UPDATE_EDIT_MODE:
14
+ return Object.assign(Object.assign({}, state), { editMode: action.payload });
13
15
  case UPDATE_THEME:
14
16
  return Object.assign(Object.assign({}, state), { theme: action.payload });
15
17
  case UPDATE_CODE_FULLSCREEN_MODE_ON:
16
18
  return Object.assign(Object.assign({}, state), { codeFullscreeModeOn: action.payload });
17
- case UPDATE_FORM_TAB:
18
- return Object.assign(Object.assign({}, state), { formTab: action.payload });
19
19
  default:
20
20
  return state;
21
21
  }
22
22
  };
23
23
  export const initialState = {
24
- viewMode: ViewModeItem.Edititng,
24
+ viewMode: ViewModeItem.Desktop,
25
+ editMode: EditModeItem.Form,
25
26
  theme: DEFAULT_THEME,
26
27
  codeFullscreeModeOn: false,
27
- formTab: FormTab.Blocks,
28
28
  };
@@ -29,14 +29,13 @@ export interface EditBlockProps extends EditBlockEditorProps, BlockDecorationPro
29
29
  isHeader?: boolean;
30
30
  }
31
31
  export declare enum ViewModeItem {
32
- Edititng = "editing",
33
32
  Desktop = "desktop",
34
33
  Tablet = "tablet",
35
34
  Mobile = "mobile"
36
35
  }
37
- export declare enum FormTab {
38
- Blocks = "blocks",
39
- Page = "page",
36
+ export declare enum EditModeItem {
37
+ View = "view",
38
+ Form = "form",
40
39
  Code = "code"
41
40
  }
42
41
  export {};
@@ -1,13 +1,12 @@
1
1
  export var ViewModeItem;
2
2
  (function (ViewModeItem) {
3
- ViewModeItem["Edititng"] = "editing";
4
3
  ViewModeItem["Desktop"] = "desktop";
5
4
  ViewModeItem["Tablet"] = "tablet";
6
5
  ViewModeItem["Mobile"] = "mobile";
7
6
  })(ViewModeItem || (ViewModeItem = {}));
8
- export var FormTab;
9
- (function (FormTab) {
10
- FormTab["Blocks"] = "blocks";
11
- FormTab["Page"] = "page";
12
- FormTab["Code"] = "code";
13
- })(FormTab || (FormTab = {}));
7
+ export var EditModeItem;
8
+ (function (EditModeItem) {
9
+ EditModeItem["View"] = "view";
10
+ EditModeItem["Form"] = "form";
11
+ EditModeItem["Code"] = "code";
12
+ })(EditModeItem || (EditModeItem = {}));
@@ -302,6 +302,7 @@ export interface ContentBlockProps {
302
302
  centered?: boolean;
303
303
  theme?: ContentTheme;
304
304
  list?: ContentItemProps[];
305
+ controlPosition?: 'default' | 'bottom';
305
306
  }
306
307
  export declare enum PCShareSocialNetwork {
307
308
  Vk = "vk",
@@ -96,14 +96,14 @@ export interface QuoteProps extends Themable, CardBaseProps {
96
96
  quoteType?: QuoteType;
97
97
  button?: ButtonProps;
98
98
  }
99
- export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
99
+ export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
100
100
  url?: string;
101
101
  urlTitle?: string;
102
102
  background?: ThemeSupporting<ImageObjectProps>;
103
103
  paddingBottom?: 's' | 'm' | 'l' | 'xl';
104
104
  backgroundColor?: string;
105
105
  }
106
- export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
106
+ export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'controlPosition'> {
107
107
  url: string;
108
108
  urlTitle?: string;
109
109
  icon?: ImageProps;
@@ -141,7 +141,7 @@ export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, Analyt
141
141
  fullscreen?: boolean;
142
142
  icon?: PositionedIcon;
143
143
  }
144
- export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
144
+ export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
145
145
  image: ImageProps;
146
146
  enableImageBorderRadius?: boolean;
147
147
  margins?: ImageCardMargins;
@@ -118,6 +118,10 @@ export declare const cardSchemas: {
118
118
  };
119
119
  };
120
120
  } | undefined;
121
+ controlPosition: {
122
+ type: string; /** @deprecated */
123
+ enum: string[];
124
+ };
121
125
  border: {
122
126
  type: string;
123
127
  enum: string[];
@@ -29,6 +29,12 @@ export declare const BaseProps: {
29
29
  type: string;
30
30
  };
31
31
  };
32
+ export declare const CardLayoutProps: {
33
+ controlPosition: {
34
+ type: string;
35
+ enum: string[];
36
+ };
37
+ };
32
38
  export declare const containerSizesObject: {
33
39
  type: string;
34
40
  additionalProperties: boolean;
@@ -32,6 +32,12 @@ export const BaseProps = {
32
32
  type: 'string',
33
33
  },
34
34
  };
35
+ export const CardLayoutProps = {
36
+ controlPosition: {
37
+ type: 'string',
38
+ enum: ['content', 'footer'],
39
+ },
40
+ };
35
41
  export const containerSizesObject = {
36
42
  type: 'object',
37
43
  additionalProperties: false,
@@ -26,6 +26,9 @@ unpredictable css rules order in build */
26
26
  cursor: default;
27
27
  border: none;
28
28
  }
29
+ .pc-background-card__content {
30
+ display: flex;
31
+ }
29
32
  .pc-background-card__image {
30
33
  position: absolute;
31
34
  top: 0;
@@ -37,12 +40,6 @@ unpredictable css rules order in build */
37
40
  object-fit: cover;
38
41
  object-position: left;
39
42
  }
40
- .pc-background-card__footer {
41
- margin-top: 0px;
42
- }
43
- .pc-background-card__links, .pc-background-card__buttons {
44
- margin-top: 16px;
45
- }
46
43
 
47
44
  a.pc-background-card_theme_light {
48
45
  background-color: var(--pc-color-base-silver);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useUniqId } from '@gravity-ui/uikit';
3
- import { BackgroundImage, Buttons, CardBase, Links } from '../../components/';
3
+ import { BackgroundImage, CardBase } from '../../components/';
4
4
  import { useTheme } from '../../context/theme';
5
5
  import { block, getThemedValue } from '../../utils';
6
6
  import Content from '../Content/Content';
@@ -13,12 +13,9 @@ const BackgroundCard = (props) => {
13
13
  const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
14
14
  const borderType = hasBackgroundColor ? 'none' : border;
15
15
  const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
16
- return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
16
+ return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
17
17
  React.createElement(CardBase.Content, null,
18
18
  React.createElement(BackgroundImage, Object.assign({ className: b('image') }, getThemedValue(background, theme), { style: { backgroundColor } })),
19
- React.createElement(Content, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: areControlsInFooter ? undefined : links, buttons: areControlsInFooter ? undefined : buttons, list: list, colSizes: { all: 12, md: 12 } })),
20
- areControlsInFooter && (links || buttons) && (React.createElement(CardBase.Footer, null,
21
- React.createElement(Links, { className: b('links'), size: "s", links: links, titleId: titleId }),
22
- React.createElement(Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId })))));
19
+ React.createElement(Content, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, list: list, colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' }))));
23
20
  };
24
21
  export default BackgroundCard;
@@ -1,14 +1,14 @@
1
1
  import omit from 'lodash/omit';
2
2
  import { ImageObjectProps } from '../../components/Image/schema';
3
- import { BaseProps, CardBase, withTheme } from '../../schema/validators/common';
3
+ import { BaseProps, CardBase, CardLayoutProps, withTheme } from '../../schema/validators/common';
4
4
  import { AnalyticsEventSchema } from '../../schema/validators/event';
5
5
  import { ContentBase } from '../Content/schema';
6
- const BackgroundCardContentProps = omit(ContentBase, ['size']);
6
+ const BackgroundCardContentProps = omit(ContentBase, ['size', 'controlPosition']);
7
7
  export const BackgroundCard = {
8
8
  'background-card': {
9
9
  additionalProperties: false,
10
10
  required: ['title', 'text'],
11
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), BackgroundCardContentProps), { url: {
11
+ properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), CardLayoutProps), BackgroundCardContentProps), { url: {
12
12
  type: 'string',
13
13
  }, urlTitle: {
14
14
  type: 'string',
@@ -4,9 +4,9 @@ unpredictable css rules order in build */
4
4
  min-height: auto;
5
5
  }
6
6
 
7
- .pc-basic-card__footer {
8
- margin-top: 0px;
7
+ .pc-basic-card__content {
8
+ display: flex;
9
9
  }
10
- .pc-basic-card__links, .pc-basic-card__buttons {
11
- margin-top: 16px;
10
+ .pc-basic-card__wrapper {
11
+ flex: auto;
12
12
  }
@@ -1,7 +1,7 @@
1
1
  import { __rest } from "tslib";
2
2
  import React from 'react';
3
3
  import { useUniqId } from '@gravity-ui/uikit';
4
- import { Buttons, CardBase, IconWrapper, Links } from '../../components';
4
+ import { CardBase, IconWrapper } from '../../components';
5
5
  import { IconPosition } from '../../models/constructor-items/sub-blocks';
6
6
  import { block } from '../../utils';
7
7
  import Content from '../Content/Content';
@@ -12,12 +12,9 @@ const BasicCard = (props) => {
12
12
  const titleId = useUniqId();
13
13
  const descriptionId = useUniqId();
14
14
  const areControlsInFooter = controlPosition === 'footer';
15
- return (React.createElement(CardBase, Object.assign({ className: b() }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
15
+ return (React.createElement(CardBase, Object.assign({ className: b(), contentClassName: b('content') }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
16
16
  React.createElement(CardBase.Content, null,
17
- React.createElement(IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined },
18
- React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: areControlsInFooter ? undefined : links, list: list, buttons: areControlsInFooter ? undefined : buttons, size: "s", colSizes: { all: 12, md: 12 } }))),
19
- areControlsInFooter && (buttons || links) && (React.createElement(CardBase.Footer, { className: b('footer') },
20
- React.createElement(Links, { className: b('links'), size: "s", links: links, titleId: titleId }),
21
- React.createElement(Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId })))));
17
+ React.createElement(IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined, className: b('wrapper') },
18
+ React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size: "s", colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' })))));
22
19
  };
23
20
  export default BasicCard;
@@ -1,13 +1,13 @@
1
1
  import omit from 'lodash/omit';
2
2
  import { ImageProps } from '../../components/Image/schema';
3
- import { BaseProps, CardBase } from '../../schema/validators/common';
3
+ import { BaseProps, CardBase, CardLayoutProps } from '../../schema/validators/common';
4
4
  import { ContentBase } from '../Content/schema';
5
- const BasicCardContentProps = omit(ContentBase, ['size', 'theme']);
5
+ const BasicCardContentProps = omit(ContentBase, ['size', 'theme', 'controlPosition']);
6
6
  export const BasicCard = {
7
7
  'basic-card': {
8
8
  additionalProperties: false,
9
9
  required: [],
10
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), BasicCardContentProps), { url: {
10
+ properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), CardLayoutProps), BasicCardContentProps), { url: {
11
11
  type: 'string',
12
12
  }, urlTitle: {
13
13
  type: 'string',
@@ -9,6 +9,8 @@ unpredictable css rules order in build */
9
9
  --pc-monochrome-button-background-color: #262626;
10
10
  --pc-monochrome-button-background-color-hover: #393939;
11
11
  --pc-monochrome-button-color: var(--g-color-text-light-primary);
12
+ display: flex;
13
+ flex-direction: column;
12
14
  }
13
15
  .pc-content__notice .yfm ol,
14
16
  .pc-content__notice .yfm ul, .pc-content__text .yfm ol,
@@ -145,4 +147,13 @@ unpredictable css rules order in build */
145
147
  }
146
148
  .pc-content_theme_light .pc-content__title a:hover {
147
149
  color: var(--g-color-text-dark-secondary);
150
+ }
151
+ .pc-content_control-position_bottom .pc-content__notice:has(+ .pc-content__buttons), .pc-content_control-position_bottom .pc-content__notice:has(+ .pc-content__link),
152
+ .pc-content_control-position_bottom .pc-content__list:has(+ .pc-content__buttons),
153
+ .pc-content_control-position_bottom .pc-content__list:has(+ .pc-content__link),
154
+ .pc-content_control-position_bottom .pc-content__text:has(+ .pc-content__buttons),
155
+ .pc-content_control-position_bottom .pc-content__text:has(+ .pc-content__link),
156
+ .pc-content_control-position_bottom .pc-content__title:has(+ .pc-content__buttons),
157
+ .pc-content_control-position_bottom .pc-content__title:has(+ .pc-content__link) {
158
+ margin-bottom: auto;
148
159
  }
@@ -16,7 +16,7 @@ function getTextSize(size) {
16
16
  }
17
17
  }
18
18
  const Content = (props) => {
19
- const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, } = props;
19
+ const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, controlPosition, } = props;
20
20
  const qaAttributes = getQaAttrubutes(qa, ['links', 'link', 'buttons', 'button', 'list']);
21
21
  const titleProps = !title || typeof title === 'string'
22
22
  ? { text: title, textSize: getTextSize(size) }
@@ -24,7 +24,7 @@ const Content = (props) => {
24
24
  const hasTitle = Boolean(title);
25
25
  const defaultTitleId = useUniqId();
26
26
  const titleId = titleIdFromProps || defaultTitleId;
27
- return (React.createElement(Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
27
+ return (React.createElement(Col, { className: b({ size, centered, theme, 'control-position': controlPosition }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
28
28
  title && (React.createElement(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })),
29
29
  text && (React.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
30
30
  React.createElement(YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId }))),
@@ -119,6 +119,10 @@ export declare const ContentBase: {
119
119
  };
120
120
  };
121
121
  };
122
+ controlPosition: {
123
+ type: string;
124
+ enum: string[];
125
+ };
122
126
  };
123
127
  export declare const ContentBlock: {
124
128
  content: {
@@ -210,6 +214,10 @@ export declare const ContentBlock: {
210
214
  };
211
215
  };
212
216
  };
217
+ controlPosition: {
218
+ type: string;
219
+ enum: string[];
220
+ };
213
221
  };
214
222
  };
215
223
  };
@@ -47,6 +47,10 @@ export const ContentBase = {
47
47
  enum: contentThemes,
48
48
  },
49
49
  list: filteredArray(ContentItem),
50
+ controlPosition: {
51
+ type: 'string',
52
+ enum: ['default', 'bottom'],
53
+ },
50
54
  };
51
55
  export const ContentBlock = {
52
56
  content: {
@@ -17,7 +17,9 @@ unpredictable css rules order in build */
17
17
  border: 1px solid var(--g-color-line-generic);
18
18
  }
19
19
  .pc-image-card .pc-image-card__content {
20
+ display: flex;
20
21
  padding: 32px;
22
+ flex: auto;
21
23
  }
22
24
  .pc-image-card .pc-image-card__image_inner {
23
25
  width: 100%;
@@ -7,8 +7,10 @@ import { block } from '../../utils';
7
7
  import Content from '../Content/Content';
8
8
  import './ImageCard.css';
9
9
  const b = block('image-card');
10
+ const CONTENT_COL_SIZES = { all: 12, md: 12 };
10
11
  const ImageCard = (props) => {
11
- const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = ImageCardDirection.Direct, margins, backgroundColor, url, target, urlTitle, additionalInfo, links, buttons, list, theme: cardTheme = 'default', size = 's', } = props;
12
+ const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = ImageCardDirection.Direct, margins, backgroundColor, url, target, urlTitle, additionalInfo, links, buttons, list, theme: cardTheme = 'default', size = 's', controlPosition = 'content', } = props;
13
+ const areControlsInFooter = controlPosition === 'footer';
12
14
  const hasContent = Boolean(text || title || buttons || links || list);
13
15
  const imageProps = getMediaImage(image);
14
16
  const titleId = useUniqId();
@@ -16,7 +18,7 @@ const ImageCard = (props) => {
16
18
  React.createElement("div", { className: b('image', { margins }) },
17
19
  React.createElement(Image, Object.assign({ className: b('image_inner', { radius: enableImageBorderRadius }) }, imageProps))),
18
20
  hasContent && (React.createElement("div", { className: b('content') },
19
- React.createElement(Content, { titleId: titleId, title: title, text: text, links: links, buttons: buttons, list: list, theme: cardTheme, additionalInfo: additionalInfo, size: size, colSizes: { all: 12, md: 12 } })))));
21
+ React.createElement(Content, { titleId: titleId, title: title, text: text, links: links, buttons: buttons, list: list, theme: cardTheme, additionalInfo: additionalInfo, size: size, colSizes: CONTENT_COL_SIZES, controlPosition: areControlsInFooter ? 'bottom' : 'default' })))));
20
22
  return url ? (React.createElement(Link, { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: b({ border, 'with-content': hasContent, direction }), title: urlTitle, extraProps: {
21
23
  draggable: false,
22
24
  onDragStart: (e) => e.preventDefault(),
@@ -116,6 +116,10 @@ export declare const ImageCard: {
116
116
  };
117
117
  };
118
118
  } | undefined;
119
+ controlPosition: {
120
+ type: string;
121
+ enum: string[];
122
+ };
119
123
  border: {
120
124
  type: string;
121
125
  enum: string[];
@@ -1,13 +1,13 @@
1
1
  import omit from 'lodash/omit';
2
- import { BaseProps, CardBase } from '../../schema/validators/common';
2
+ import { BaseProps, CardBase, CardLayoutProps } from '../../schema/validators/common';
3
3
  import { ImageProps } from '../../schema/validators/components';
4
4
  import { ContentBase } from '../Content/schema';
5
- const ImageCardBlockContentProps = omit(ContentBase, ['centered', 'colSizes']);
5
+ const ImageCardBlockContentProps = omit(ContentBase, ['centered', 'colSizes', 'controlPosition']);
6
6
  export const ImageCard = {
7
7
  'image-card': {
8
8
  additionalProperties: false,
9
9
  required: ['image'],
10
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), ImageCardBlockContentProps), { image: ImageProps, direction: {
10
+ properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), CardLayoutProps), ImageCardBlockContentProps), { image: ImageProps, direction: {
11
11
  type: 'string',
12
12
  enum: ['direct', 'reverse'],
13
13
  }, margins: {
@@ -17,12 +17,13 @@ unpredictable css rules order in build */
17
17
  margin: 16px 0 -8px 0;
18
18
  }
19
19
  .pc-layout-item__content {
20
+ display: flex;
20
21
  flex: auto;
21
22
  margin: 16px 16px 0 0;
22
23
  }
23
24
  .pc-layout-item__content_no-media {
24
25
  margin: 0;
25
26
  }
26
- .pc-layout-item__links, .pc-layout-item__buttons {
27
- margin-top: 16px;
27
+ .pc-layout-item__wrapper {
28
+ flex: auto;
28
29
  }
@@ -1,4 +1,4 @@
1
1
  import { LayoutItemProps } from '../../models';
2
2
  import './LayoutItem.css';
3
- declare const LayoutItem: ({ content: { links, buttons, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: LayoutItemProps) => JSX.Element;
3
+ declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: LayoutItemProps) => JSX.Element;
4
4
  export default LayoutItem;
@@ -1,7 +1,7 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useMemo } from 'react';
3
3
  import { useUniqId } from '@gravity-ui/uikit';
4
- import { Buttons, FullscreenMedia, IconWrapper, Links, Media, MetaInfo } from '../../components';
4
+ import { FullscreenMedia, IconWrapper, Media, MetaInfo } from '../../components';
5
5
  import { useTheme } from '../../context/theme';
6
6
  import { block, getThemedValue } from '../../utils';
7
7
  import Content from '../Content/Content';
@@ -9,11 +9,11 @@ import { getLayoutItemLinks, hasFullscreen, showFullscreenIcon } from './utils';
9
9
  import './LayoutItem.css';
10
10
  const b = block('layout-item');
11
11
  const LayoutItem = (_a) => {
12
- var _b = _a.content, { links, buttons } = _b, content = __rest(_b, ["links", "buttons"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
12
+ var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
13
13
  const normalizedLinks = useMemo(() => getLayoutItemLinks(links), [links]);
14
14
  const areControlsInFooter = controlPosition === 'footer';
15
15
  const theme = useTheme();
16
- const contentProps = Object.assign(Object.assign(Object.assign({}, content), (areControlsInFooter ? {} : { links: normalizedLinks, buttons })), { size: 's', colSizes: { all: 12, md: 12 } });
16
+ const contentProps = Object.assign(Object.assign({ controlPosition: areControlsInFooter ? 'bottom' : 'default' }, content), { links: normalizedLinks, size: 's', colSizes: { all: 12, md: 12 } });
17
17
  const titleId = useUniqId();
18
18
  const renderMedia = () => {
19
19
  if (!media) {
@@ -29,9 +29,7 @@ const LayoutItem = (_a) => {
29
29
  renderMedia(),
30
30
  metaInfo && React.createElement(MetaInfo, { items: metaInfo, className: b('meta-info') }),
31
31
  React.createElement("div", { className: b('content', { 'no-media': !media }) },
32
- React.createElement(IconWrapper, { icon: icon },
33
- React.createElement(Content, Object.assign({}, contentProps, { titleId: titleId })))),
34
- areControlsInFooter && links && (React.createElement(Links, { className: b('links'), size: "s", links: links, titleId: titleId })),
35
- areControlsInFooter && buttons && (React.createElement(Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId }))));
32
+ React.createElement(IconWrapper, { icon: icon, className: b('wrapper') },
33
+ React.createElement(Content, Object.assign({}, contentProps, { titleId: titleId }))))));
36
34
  };
37
35
  export default LayoutItem;
@@ -358,6 +358,10 @@ export declare const LayoutItem: {
358
358
  };
359
359
  };
360
360
  };
361
+ controlPosition: {
362
+ type: string;
363
+ enum: string[];
364
+ };
361
365
  }>;
362
366
  metaInfo: {
363
367
  type: string;
@@ -1,13 +1,13 @@
1
1
  import omit from 'lodash/omit';
2
2
  import metaInfo from '../../components/MetaInfo/schema';
3
- import { BaseProps, MediaProps } from '../../schema/validators/common';
3
+ import { BaseProps, CardLayoutProps, MediaProps } from '../../schema/validators/common';
4
4
  import { AnalyticsEventSchema } from '../../schema/validators/event';
5
5
  import { ContentBase } from '../../sub-blocks/Content/schema';
6
6
  export const LayoutItem = {
7
7
  type: 'object',
8
8
  additionalProperties: false,
9
9
  required: ['content', 'media'],
10
- properties: Object.assign(Object.assign({}, BaseProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
10
+ properties: Object.assign(Object.assign(Object.assign({}, BaseProps), CardLayoutProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
11
11
  type: 'boolean',
12
12
  }, fullscreen: {
13
13
  type: 'boolean',
@@ -20,8 +20,5 @@ export const LayoutItem = {
20
20
  optionName: 'list',
21
21
  },
22
22
  ],
23
- }, controlPosition: {
24
- type: 'string',
25
- enum: ['content', 'footer'],
26
23
  } }),
27
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "5.12.0",
3
+ "version": "5.14.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -302,6 +302,7 @@ export interface ContentBlockProps {
302
302
  centered?: boolean;
303
303
  theme?: ContentTheme;
304
304
  list?: ContentItemProps[];
305
+ controlPosition?: 'default' | 'bottom';
305
306
  }
306
307
  export declare enum PCShareSocialNetwork {
307
308
  Vk = "vk",
@@ -96,14 +96,14 @@ export interface QuoteProps extends Themable, CardBaseProps {
96
96
  quoteType?: QuoteType;
97
97
  button?: ButtonProps;
98
98
  }
99
- export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
99
+ export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
100
100
  url?: string;
101
101
  urlTitle?: string;
102
102
  background?: ThemeSupporting<ImageObjectProps>;
103
103
  paddingBottom?: 's' | 'm' | 'l' | 'xl';
104
104
  backgroundColor?: string;
105
105
  }
106
- export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
106
+ export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'controlPosition'> {
107
107
  url: string;
108
108
  urlTitle?: string;
109
109
  icon?: ImageProps;
@@ -141,7 +141,7 @@ export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, Analyt
141
141
  fullscreen?: boolean;
142
142
  icon?: PositionedIcon;
143
143
  }
144
- export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
144
+ export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
145
145
  image: ImageProps;
146
146
  enableImageBorderRadius?: boolean;
147
147
  margins?: ImageCardMargins;