@gravity-ui/page-constructor 4.3.0 → 4.5.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/build/cjs/components/ButtonTabs/ButtonTabs.js +6 -1
- package/build/cjs/components/CardBase/CardBase.css +4 -4
- package/build/cjs/components/HTML/HTML.d.ts +3 -1
- package/build/cjs/components/HTML/HTML.js +2 -1
- package/build/cjs/components/Table/Table.js +11 -5
- package/build/cjs/components/YFMWrapper/YFMWrapper.d.ts +3 -3
- package/build/cjs/components/YFMWrapper/YFMWrapper.js +1 -1
- package/build/cjs/constructor-items.d.ts +7 -0
- package/build/cjs/constructor-items.js +11 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +2 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.js +9 -4
- package/build/cjs/context/innerContext/InnerContext.d.ts +3 -1
- package/build/cjs/context/innerContext/InnerContext.js +2 -0
- package/build/cjs/editor/store/index.js +1 -1
- package/build/cjs/editor/utils/index.d.ts +1 -0
- package/build/cjs/grid/Col/Col.d.ts +2 -4
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -0
- package/build/cjs/models/constructor-items/common.d.ts +5 -2
- package/build/cjs/models/constructor.d.ts +1 -0
- package/build/cjs/models/navigation.d.ts +1 -0
- package/build/cjs/models/navigation.js +2 -1
- package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -15
- package/build/cjs/navigation/components/NavigationItem/index.d.ts +6 -0
- package/build/cjs/navigation/components/NavigationItem/index.js +14 -0
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +1 -2
- package/build/cjs/sub-blocks/Quote/Quote.css +0 -3
- package/build/cjs/utils/blocks.d.ts +2 -6
- package/build/cjs/utils/blocks.js +11 -16
- package/build/esm/components/ButtonTabs/ButtonTabs.js +6 -1
- package/build/esm/components/CardBase/CardBase.css +4 -4
- package/build/esm/components/HTML/HTML.d.ts +3 -1
- package/build/esm/components/HTML/HTML.js +2 -1
- package/build/esm/components/Table/Table.js +11 -5
- package/build/esm/components/YFMWrapper/YFMWrapper.d.ts +3 -3
- package/build/esm/components/YFMWrapper/YFMWrapper.js +1 -1
- package/build/esm/constructor-items.d.ts +7 -0
- package/build/esm/constructor-items.js +10 -1
- package/build/esm/containers/PageConstructor/PageConstructor.d.ts +2 -1
- package/build/esm/containers/PageConstructor/PageConstructor.js +12 -7
- package/build/esm/context/innerContext/InnerContext.d.ts +3 -1
- package/build/esm/context/innerContext/InnerContext.js +2 -0
- package/build/esm/editor/store/index.js +2 -2
- package/build/esm/editor/utils/index.d.ts +1 -0
- package/build/esm/grid/Col/Col.d.ts +2 -4
- package/build/esm/models/constructor-items/blocks.d.ts +4 -0
- package/build/esm/models/constructor-items/common.d.ts +5 -2
- package/build/esm/models/constructor.d.ts +1 -0
- package/build/esm/models/navigation.d.ts +1 -0
- package/build/esm/models/navigation.js +1 -0
- package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +4 -16
- package/build/esm/navigation/components/NavigationItem/index.d.ts +6 -0
- package/build/esm/navigation/components/NavigationItem/index.js +6 -0
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +1 -2
- package/build/esm/sub-blocks/Quote/Quote.css +0 -3
- package/build/esm/utils/blocks.d.ts +2 -6
- package/build/esm/utils/blocks.js +8 -11
- package/package.json +2 -1
- package/server/models/constructor-items/blocks.d.ts +4 -0
- package/server/models/constructor-items/common.d.ts +5 -2
- package/server/models/constructor.d.ts +1 -0
- package/server/models/navigation.d.ts +1 -0
- package/server/models/navigation.js +2 -1
- package/server/utils/blocks.d.ts +2 -6
- package/server/utils/blocks.js +11 -16
- package/styles/mixins.scss +3 -1
- package/widget/index.js +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ClassNameProps, Modifiers } from '../../models';
|
|
2
|
-
export interface YFMWrapperProps {
|
|
3
|
-
className?: string;
|
|
2
|
+
export interface YFMWrapperProps extends ClassNameProps {
|
|
4
3
|
content: string;
|
|
5
4
|
modifiers?: Modifiers;
|
|
6
5
|
itemProp?: string;
|
|
6
|
+
id?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const YFMWrapper: ({ content, modifiers, className, itemProp, }: YFMWrapperProps
|
|
8
|
+
declare const YFMWrapper: ({ content, modifiers, className, itemProp, id }: YFMWrapperProps) => JSX.Element;
|
|
9
9
|
export default YFMWrapper;
|
|
@@ -5,5 +5,5 @@ import block from 'bem-cn-lite';
|
|
|
5
5
|
import toSnakeCase from 'snakecase-keys';
|
|
6
6
|
import { HTML } from '../../components';
|
|
7
7
|
const yfm = block('yfm');
|
|
8
|
-
const YFMWrapper = ({ content, modifiers, className, itemProp, }) => (React.createElement(HTML, { className: yfm(modifiers ? toSnakeCase(modifiers) : {}, className), itemProp: itemProp }, content));
|
|
8
|
+
const YFMWrapper = ({ content, modifiers, className, itemProp, id }) => (React.createElement(HTML, { className: yfm(modifiers ? toSnakeCase(modifiers) : {}, className), itemProp: itemProp, id: id }, content));
|
|
9
9
|
export default YFMWrapper;
|
|
@@ -29,3 +29,10 @@ export declare const subBlockMap: {
|
|
|
29
29
|
content: (props: import("./models").ContentBlockProps & import("./models").ClassNameProps) => JSX.Element;
|
|
30
30
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
31
31
|
};
|
|
32
|
+
export declare const navItemMap: {
|
|
33
|
+
button: import("react").FC<Pick<import("./navigation/models").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
34
|
+
social: import("react").FC<import("./navigation/components/SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
|
|
35
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation/models").NavigationItemProps & import("./models").NavigationDropdownItem) => JSX.Element;
|
|
36
|
+
link: import("react").FC<import("./navigation/models").NavigationItemProps & import("./models").NavigationLinkItem>;
|
|
37
|
+
"github-button": ({ text, url, className, label, size, icon, }: import("./navigation/models").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
|
|
38
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './blocks';
|
|
2
|
-
import { BlockType, SubBlockType } from './models';
|
|
2
|
+
import { BlockType, NavigationItemType, SubBlockType } from './models';
|
|
3
|
+
import { GithubButton, NavigationButton, NavigationDropdown, NavigationLink, } from './navigation/components/NavigationItem';
|
|
4
|
+
import SocialIcon from './navigation/components/SocialIcon/SocialIcon';
|
|
3
5
|
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, LayoutItem, MediaCard, PriceDetailed, Quote, } from './sub-blocks';
|
|
4
6
|
export const blockMap = {
|
|
5
7
|
[BlockType.SliderBlock]: SliderBlock,
|
|
@@ -32,3 +34,10 @@ export const subBlockMap = {
|
|
|
32
34
|
[SubBlockType.Content]: Content,
|
|
33
35
|
[SubBlockType.Quote]: Quote,
|
|
34
36
|
};
|
|
37
|
+
export const navItemMap = {
|
|
38
|
+
[NavigationItemType.Button]: NavigationButton,
|
|
39
|
+
[NavigationItemType.Social]: SocialIcon,
|
|
40
|
+
[NavigationItemType.Dropdown]: NavigationDropdown,
|
|
41
|
+
[NavigationItemType.Link]: NavigationLink,
|
|
42
|
+
[NavigationItemType.GithubButton]: GithubButton,
|
|
43
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@doc-tools/transform/dist/js/yfm';
|
|
3
|
-
import { blockMap, subBlockMap } from '../../constructor-items';
|
|
3
|
+
import { blockMap, navItemMap, subBlockMap } from '../../constructor-items';
|
|
4
4
|
import { CustomConfig, CustomItems, NavigationData, PageContent, ShouldRenderBlock } from '../../models';
|
|
5
5
|
import './PageConstructor.css';
|
|
6
6
|
export type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;
|
|
7
|
+
export type NavItemMap = typeof navItemMap & CustomItems;
|
|
7
8
|
export interface PageConstructorProps {
|
|
8
9
|
content?: PageContent;
|
|
9
10
|
shouldRenderBlock?: ShouldRenderBlock;
|
|
@@ -4,14 +4,14 @@ import '@doc-tools/transform/dist/js/yfm';
|
|
|
4
4
|
import blockOrigin from 'bem-cn-lite';
|
|
5
5
|
import BackgroundMedia from '../../components/BackgroundMedia/BackgroundMedia';
|
|
6
6
|
import { UIKIT_ROOT_CLASS } from '../../components/constants';
|
|
7
|
-
import { blockMap, subBlockMap } from '../../constructor-items';
|
|
7
|
+
import { blockMap, navItemMap, subBlockMap } from '../../constructor-items';
|
|
8
8
|
import { AnimateContext } from '../../context/animateContext';
|
|
9
9
|
import { InnerContext } from '../../context/innerContext';
|
|
10
10
|
import { useTheme } from '../../context/theme';
|
|
11
11
|
import { Grid } from '../../grid';
|
|
12
|
-
import { BlockType, BlockTypes, HeaderBlockTypes, SubBlockTypes, } from '../../models';
|
|
12
|
+
import { BlockType, BlockTypes, HeaderBlockTypes, NavigationItemTypes, SubBlockTypes, } from '../../models';
|
|
13
13
|
import Layout from '../../navigation/containers/Layout/Layout';
|
|
14
|
-
import { block as cnBlock,
|
|
14
|
+
import { block as cnBlock, getCustomItems, getCustomTypes, getHeaderBlock, getOrderedBlocks, getThemedValue, } from '../../utils';
|
|
15
15
|
import { ConstructorBlocks } from './components/ConstructorBlocks';
|
|
16
16
|
import { ConstructorHeader } from './components/ConstructorItem';
|
|
17
17
|
import { ConstructorRow } from './components/ConstructorRow';
|
|
@@ -22,10 +22,15 @@ export const Constructor = (props) => {
|
|
|
22
22
|
const { content: { blocks = [], background = {} } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
|
|
23
23
|
const { context } = useMemo(() => ({
|
|
24
24
|
context: {
|
|
25
|
-
blockTypes: [...BlockTypes, ...
|
|
26
|
-
subBlockTypes: [...SubBlockTypes, ...
|
|
27
|
-
headerBlockTypes: [...HeaderBlockTypes, ...
|
|
28
|
-
|
|
25
|
+
blockTypes: [...BlockTypes, ...getCustomTypes(['blocks', 'headers'], custom)],
|
|
26
|
+
subBlockTypes: [...SubBlockTypes, ...getCustomTypes(['subBlocks'], custom)],
|
|
27
|
+
headerBlockTypes: [...HeaderBlockTypes, ...getCustomTypes(['headers'], custom)],
|
|
28
|
+
navigationBlockTypes: [
|
|
29
|
+
...NavigationItemTypes,
|
|
30
|
+
...getCustomTypes(['navigation'], custom),
|
|
31
|
+
],
|
|
32
|
+
itemMap: Object.assign(Object.assign(Object.assign({}, blockMap), subBlockMap), getCustomItems(['blocks', 'headers', 'subBlocks'], custom)),
|
|
33
|
+
navItemMap: Object.assign(Object.assign({}, navItemMap), getCustomItems(['navigation'], custom)),
|
|
29
34
|
loadables: custom === null || custom === void 0 ? void 0 : custom.loadable,
|
|
30
35
|
shouldRenderBlock,
|
|
31
36
|
customization: {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ItemMap } from '../../containers/PageConstructor/PageConstructor';
|
|
2
|
+
import { ItemMap, NavItemMap } from '../../containers/PageConstructor/PageConstructor';
|
|
3
3
|
import { CustomConfig, LoadableConfig, ShouldRenderBlock } from '../../models';
|
|
4
4
|
export interface InnerContextType {
|
|
5
5
|
blockTypes: string[];
|
|
6
6
|
subBlockTypes: string[];
|
|
7
7
|
headerBlockTypes: string[];
|
|
8
|
+
navigationBlockTypes: string[];
|
|
8
9
|
itemMap: ItemMap;
|
|
10
|
+
navItemMap: NavItemMap;
|
|
9
11
|
loadables?: LoadableConfig;
|
|
10
12
|
shouldRenderBlock?: ShouldRenderBlock;
|
|
11
13
|
customization?: Pick<CustomConfig, 'decorators'>;
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { useMemo, useReducer } from 'react';
|
|
3
3
|
import { DEFAULT_THEME } from '../../components/constants';
|
|
4
4
|
import { HeaderBlockTypes } from '../../models';
|
|
5
|
-
import {
|
|
5
|
+
import { getCustomTypes, getHeaderBlock } from '../../utils';
|
|
6
6
|
import { EditBlockControls } from '../components/EditBlock/EditBlock';
|
|
7
7
|
import { ViewModeItem } from '../types';
|
|
8
8
|
import { ADD_BLOCK, COPY_BLOCK, DELETE_BLOCK, ORDER_BLOCK, SELECT_BLOCK, UPDATE_CONTENT, UPDATE_THEME, UPDATE_VIEW_MODE, reducer, } from './reducer';
|
|
@@ -16,7 +16,7 @@ export function useEditorState({ content: intialContent, custom }) {
|
|
|
16
16
|
theme: DEFAULT_THEME,
|
|
17
17
|
});
|
|
18
18
|
return useMemo(() => {
|
|
19
|
-
const headerBlockTypes = [...HeaderBlockTypes, ...
|
|
19
|
+
const headerBlockTypes = [...HeaderBlockTypes, ...getCustomTypes(['headers'], custom)];
|
|
20
20
|
const contentHasHeader = Boolean(getHeaderBlock(content.blocks, headerBlockTypes));
|
|
21
21
|
const checkIsHeader = (type) => headerBlockTypes.includes(type);
|
|
22
22
|
const onAdd = (block) => {
|
|
@@ -8,6 +8,7 @@ export declare const addCustomDecorator: (decorators: BlockDecorator[], custom?:
|
|
|
8
8
|
blocks?: import("../../models").CustomItems | undefined;
|
|
9
9
|
subBlocks?: import("../../models").CustomItems | undefined;
|
|
10
10
|
headers?: import("../../models").CustomItems | undefined;
|
|
11
|
+
navigation?: import("../../models").CustomItems | undefined;
|
|
11
12
|
loadable?: import("../../models").LoadableConfig | undefined;
|
|
12
13
|
};
|
|
13
14
|
export declare const getBlockId: ({ index, type }: BlockDecorationProps) => string;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { QAProps, Refable } from '../../models
|
|
3
|
-
import { WithChildren } from '../../models/react';
|
|
2
|
+
import { QAProps, Refable, Roleable, WithChildren } from '../../models';
|
|
4
3
|
import { GridColumnClassParams } from '../types';
|
|
5
|
-
export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivElement>, QAProps {
|
|
4
|
+
export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivElement>, QAProps, Roleable {
|
|
6
5
|
style?: CSSProperties;
|
|
7
6
|
children?: React.ReactNode;
|
|
8
|
-
role?: React.AriaRole;
|
|
9
7
|
}
|
|
10
8
|
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "sizes" | "className" | "hidden" | "role" | "qa" | "reset" | "visible" | "offsets" | "orders" | "alignSelf" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -189,6 +189,10 @@ export interface TableProps {
|
|
|
189
189
|
legend?: string[];
|
|
190
190
|
justify?: Justify[];
|
|
191
191
|
marker?: LegendTableMarkerType;
|
|
192
|
+
/**
|
|
193
|
+
* Only as accessible name, not displayed explicitly
|
|
194
|
+
*/
|
|
195
|
+
caption?: string;
|
|
192
196
|
}
|
|
193
197
|
export interface TableBlockProps {
|
|
194
198
|
title: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -64,6 +64,9 @@ export interface Animatable {
|
|
|
64
64
|
export interface Tabbable {
|
|
65
65
|
tabIndex?: number;
|
|
66
66
|
}
|
|
67
|
+
export interface Roleable {
|
|
68
|
+
role?: React.AriaRole;
|
|
69
|
+
}
|
|
67
70
|
export interface Background {
|
|
68
71
|
image?: string;
|
|
69
72
|
color?: string;
|
|
@@ -129,7 +132,7 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
|
|
|
129
132
|
onClick?: () => void;
|
|
130
133
|
}
|
|
131
134
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
132
|
-
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
|
|
135
|
+
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {
|
|
133
136
|
text: string;
|
|
134
137
|
url: string;
|
|
135
138
|
primary?: boolean;
|
|
@@ -6,6 +6,7 @@ export var NavigationItemType;
|
|
|
6
6
|
NavigationItemType["Social"] = "social";
|
|
7
7
|
NavigationItemType["GithubButton"] = "github-button";
|
|
8
8
|
})(NavigationItemType || (NavigationItemType = {}));
|
|
9
|
+
export const NavigationItemTypes = Object.values(NavigationItemType);
|
|
9
10
|
export var NavigationGithubButtonIcon;
|
|
10
11
|
(function (NavigationGithubButtonIcon) {
|
|
11
12
|
NavigationGithubButtonIcon["heart"] = "octicon-heart";
|
|
@@ -7,5 +7,6 @@ const b = block('mobile-menu-button');
|
|
|
7
7
|
const ICON_SIZE = 36;
|
|
8
8
|
export const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => (React.createElement(Control, { className: b(), onClick: (e) => {
|
|
9
9
|
e.stopPropagation();
|
|
10
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
10
11
|
onSidebarOpenedChange(!isSidebarOpened);
|
|
11
12
|
}, size: "l", icon: isSidebarOpened ? NavigationClose : NavigationOpen, iconSize: ICON_SIZE }));
|
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
2
|
+
import React, { useContext, useMemo } from 'react';
|
|
3
3
|
import { omit } from 'lodash';
|
|
4
4
|
import { BlockIdContext } from '../../../context/blockIdContext';
|
|
5
|
+
import { InnerContext } from '../../../context/innerContext';
|
|
5
6
|
import { NavigationItemType } from '../../../models';
|
|
6
7
|
import { block } from '../../../utils';
|
|
7
|
-
import SocialIcon from '../SocialIcon/SocialIcon';
|
|
8
|
-
import { GithubButton } from './components/GithubButton/GithubButton';
|
|
9
|
-
import { NavigationButton } from './components/NavigationButton/NavigationButton';
|
|
10
|
-
import { NavigationDropdown } from './components/NavigationDropdown/NavigationDropdown';
|
|
11
|
-
import { NavigationLink } from './components/NavigationLink/NavigationLink';
|
|
12
8
|
import './NavigationItem.css';
|
|
13
9
|
const b = block('navigation-item');
|
|
14
10
|
const ANALYTICS_ID = 'navigation';
|
|
15
|
-
//todo: add types support form component in map
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
const NavigationItemsMap = {
|
|
18
|
-
[NavigationItemType.Button]: NavigationButton,
|
|
19
|
-
[NavigationItemType.Social]: SocialIcon,
|
|
20
|
-
[NavigationItemType.Dropdown]: NavigationDropdown,
|
|
21
|
-
[NavigationItemType.Link]: NavigationLink,
|
|
22
|
-
[NavigationItemType.GithubButton]: GithubButton,
|
|
23
|
-
};
|
|
24
11
|
const NavigationItem = (_a) => {
|
|
25
12
|
var { data, className, menuLayout } = _a, props = __rest(_a, ["data", "className", "menuLayout"]);
|
|
26
13
|
const { type = NavigationItemType.Link } = data;
|
|
27
|
-
const
|
|
14
|
+
const { navItemMap } = useContext(InnerContext);
|
|
15
|
+
const Component = navItemMap[type];
|
|
28
16
|
const componentProps = useMemo(() => {
|
|
29
17
|
const componentProperties = Object.assign(Object.assign({}, data), props);
|
|
30
18
|
if (type !== NavigationItemType.Dropdown) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GithubButton } from './components/GithubButton/GithubButton';
|
|
2
|
+
export { NavigationButton } from './components/NavigationButton/NavigationButton';
|
|
3
|
+
export { NavigationDropdown } from './components/NavigationDropdown/NavigationDropdown';
|
|
4
|
+
export { NavigationLink } from './components/NavigationLink/NavigationLink';
|
|
5
|
+
import NavigationItem from './NavigationItem';
|
|
6
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GithubButton } from './components/GithubButton/GithubButton';
|
|
2
|
+
export { NavigationButton } from './components/NavigationButton/NavigationButton';
|
|
3
|
+
export { NavigationDropdown } from './components/NavigationDropdown/NavigationDropdown';
|
|
4
|
+
export { NavigationLink } from './components/NavigationLink/NavigationLink';
|
|
5
|
+
import NavigationItem from './NavigationItem';
|
|
6
|
+
export default NavigationItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { getItemClickHandler } from '../../utils';
|
|
4
|
-
import NavigationItem from '../NavigationItem
|
|
4
|
+
import NavigationItem from '../NavigationItem';
|
|
5
5
|
const NavigationListItem = (_a) => {
|
|
6
6
|
var { column, index, activeItemId, onActiveItemChange } = _a, props = __rest(_a, ["column", "index", "activeItemId", "onActiveItemChange"]);
|
|
7
7
|
const id = `${column}-${index}`;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@gravity-ui/uikit';
|
|
3
3
|
import { block } from '../../../utils';
|
|
4
4
|
import { NavigationLayout } from '../../models';
|
|
5
|
-
import NavigationItem from '../NavigationItem
|
|
5
|
+
import NavigationItem from '../NavigationItem';
|
|
6
6
|
import './NavigationPopup.css';
|
|
7
7
|
const b = block('navigation-popup');
|
|
8
8
|
const OFFSET_RESET = [0, 0];
|
|
@@ -9,9 +9,8 @@ const BackgroundCard = (props) => {
|
|
|
9
9
|
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, } = props;
|
|
10
10
|
const theme = useTheme();
|
|
11
11
|
const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
|
|
12
|
-
const link = hasBackgroundColor || border === 'line' ? undefined : url;
|
|
13
12
|
const borderType = hasBackgroundColor ? 'none' : border;
|
|
14
|
-
return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url:
|
|
13
|
+
return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType },
|
|
15
14
|
React.createElement(CardBase.Content, null,
|
|
16
15
|
React.createElement(BackgroundImage, Object.assign({ className: b('image') }, getThemedValue(background, theme), { style: { backgroundColor } })),
|
|
17
16
|
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))));
|
|
@@ -31,9 +31,6 @@ unpredictable css rules order in build */
|
|
|
31
31
|
.pc-quote_border_line {
|
|
32
32
|
border: 1px solid var(--g-color-line-generic);
|
|
33
33
|
}
|
|
34
|
-
.pc-quote_border_line, .pc-quote_border_none {
|
|
35
|
-
cursor: default;
|
|
36
|
-
}
|
|
37
34
|
@media (min-width: 577px) {
|
|
38
35
|
.slick-slide:not(.slick-active) .pc-quote {
|
|
39
36
|
box-shadow: none;
|
|
@@ -2,12 +2,8 @@ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '
|
|
|
2
2
|
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h3" | "h4";
|
|
3
3
|
export declare function hasBlockTag(content: string): boolean;
|
|
4
4
|
export declare function getBlockKey(block: ConstructorBlock, index: number): string;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
[x: string]: any;
|
|
8
|
-
};
|
|
9
|
-
export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
|
|
10
|
-
export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
|
|
5
|
+
export declare const getCustomItems: (types: (keyof CustomConfig)[], customBlocks?: CustomConfig) => {};
|
|
6
|
+
export declare const getCustomTypes: (types: (keyof CustomConfig)[], customBlocks?: CustomConfig) => string[];
|
|
11
7
|
export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
|
|
12
8
|
export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
|
|
13
9
|
export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
|
|
@@ -56,18 +56,15 @@ export function hasBlockTag(content) {
|
|
|
56
56
|
export function getBlockKey(block, index) {
|
|
57
57
|
return `${block.type}-${index}`;
|
|
58
58
|
}
|
|
59
|
-
export const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export const getCustomItems = ({ blocks = {}, headers = {}, subBlocks = {} } = {}) => (Object.assign(Object.assign(Object.assign({}, blocks), headers), subBlocks));
|
|
64
|
-
export const getCustomSubBlockTypes = (customBlocks = {}) => {
|
|
65
|
-
const { subBlocks = {} } = customBlocks;
|
|
66
|
-
return Object.keys(subBlocks);
|
|
59
|
+
export const getCustomItems = (types, customBlocks = {}) => {
|
|
60
|
+
return types.reduce((result, type) => {
|
|
61
|
+
return Object.assign(result, customBlocks[type] || {});
|
|
62
|
+
}, {});
|
|
67
63
|
};
|
|
68
|
-
export const
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
export const getCustomTypes = (types, customBlocks = {}) => {
|
|
65
|
+
return types.reduce((result, type) => {
|
|
66
|
+
return result.concat(Object.keys(customBlocks[type] || {}));
|
|
67
|
+
}, []);
|
|
71
68
|
};
|
|
72
69
|
const getShareUrlWithParams = (url, params = {}) => {
|
|
73
70
|
const result = new URL(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"sanitize-html": "2.6.1",
|
|
100
100
|
"snakecase-keys": "^5.1.0",
|
|
101
101
|
"typograf": "^6.14.0",
|
|
102
|
+
"utility-types": "^3.10.0",
|
|
102
103
|
"uuid": "^9.0.0"
|
|
103
104
|
},
|
|
104
105
|
"peerDependencies": {
|
|
@@ -189,6 +189,10 @@ export interface TableProps {
|
|
|
189
189
|
legend?: string[];
|
|
190
190
|
justify?: Justify[];
|
|
191
191
|
marker?: LegendTableMarkerType;
|
|
192
|
+
/**
|
|
193
|
+
* Only as accessible name, not displayed explicitly
|
|
194
|
+
*/
|
|
195
|
+
caption?: string;
|
|
192
196
|
}
|
|
193
197
|
export interface TableBlockProps {
|
|
194
198
|
title: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -64,6 +64,9 @@ export interface Animatable {
|
|
|
64
64
|
export interface Tabbable {
|
|
65
65
|
tabIndex?: number;
|
|
66
66
|
}
|
|
67
|
+
export interface Roleable {
|
|
68
|
+
role?: React.AriaRole;
|
|
69
|
+
}
|
|
67
70
|
export interface Background {
|
|
68
71
|
image?: string;
|
|
69
72
|
color?: string;
|
|
@@ -129,7 +132,7 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
|
|
|
129
132
|
onClick?: () => void;
|
|
130
133
|
}
|
|
131
134
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
132
|
-
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
|
|
135
|
+
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {
|
|
133
136
|
text: string;
|
|
134
137
|
url: string;
|
|
135
138
|
primary?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NavigationGithubButtonIcon = exports.NavigationItemType = void 0;
|
|
3
|
+
exports.NavigationGithubButtonIcon = exports.NavigationItemTypes = exports.NavigationItemType = void 0;
|
|
4
4
|
var NavigationItemType;
|
|
5
5
|
(function (NavigationItemType) {
|
|
6
6
|
NavigationItemType["Link"] = "link";
|
|
@@ -9,6 +9,7 @@ var NavigationItemType;
|
|
|
9
9
|
NavigationItemType["Social"] = "social";
|
|
10
10
|
NavigationItemType["GithubButton"] = "github-button";
|
|
11
11
|
})(NavigationItemType = exports.NavigationItemType || (exports.NavigationItemType = {}));
|
|
12
|
+
exports.NavigationItemTypes = Object.values(NavigationItemType);
|
|
12
13
|
var NavigationGithubButtonIcon;
|
|
13
14
|
(function (NavigationGithubButtonIcon) {
|
|
14
15
|
NavigationGithubButtonIcon["heart"] = "octicon-heart";
|
package/server/utils/blocks.d.ts
CHANGED
|
@@ -2,12 +2,8 @@ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '
|
|
|
2
2
|
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h3" | "h4";
|
|
3
3
|
export declare function hasBlockTag(content: string): boolean;
|
|
4
4
|
export declare function getBlockKey(block: ConstructorBlock, index: number): string;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
[x: string]: any;
|
|
8
|
-
};
|
|
9
|
-
export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
|
|
10
|
-
export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
|
|
5
|
+
export declare const getCustomItems: (types: (keyof CustomConfig)[], customBlocks?: CustomConfig) => {};
|
|
6
|
+
export declare const getCustomTypes: (types: (keyof CustomConfig)[], customBlocks?: CustomConfig) => string[];
|
|
11
7
|
export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
|
|
12
8
|
export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
|
|
13
9
|
export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
|
package/server/utils/blocks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.
|
|
3
|
+
exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.getCustomTypes = exports.getCustomItems = exports.getBlockKey = exports.hasBlockTag = exports.getHeaderTag = void 0;
|
|
4
4
|
const models_1 = require("../models");
|
|
5
5
|
const BLOCK_ELEMENTS = [
|
|
6
6
|
'div',
|
|
@@ -62,23 +62,18 @@ function getBlockKey(block, index) {
|
|
|
62
62
|
return `${block.type}-${index}`;
|
|
63
63
|
}
|
|
64
64
|
exports.getBlockKey = getBlockKey;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
exports.getCustomBlockTypes = getCustomBlockTypes;
|
|
70
|
-
const getCustomItems = ({ blocks = {}, headers = {}, subBlocks = {} } = {}) => (Object.assign(Object.assign(Object.assign({}, blocks), headers), subBlocks));
|
|
71
|
-
exports.getCustomItems = getCustomItems;
|
|
72
|
-
const getCustomSubBlockTypes = (customBlocks = {}) => {
|
|
73
|
-
const { subBlocks = {} } = customBlocks;
|
|
74
|
-
return Object.keys(subBlocks);
|
|
65
|
+
const getCustomItems = (types, customBlocks = {}) => {
|
|
66
|
+
return types.reduce((result, type) => {
|
|
67
|
+
return Object.assign(result, customBlocks[type] || {});
|
|
68
|
+
}, {});
|
|
75
69
|
};
|
|
76
|
-
exports.
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
exports.getCustomItems = getCustomItems;
|
|
71
|
+
const getCustomTypes = (types, customBlocks = {}) => {
|
|
72
|
+
return types.reduce((result, type) => {
|
|
73
|
+
return result.concat(Object.keys(customBlocks[type] || {}));
|
|
74
|
+
}, []);
|
|
80
75
|
};
|
|
81
|
-
exports.
|
|
76
|
+
exports.getCustomTypes = getCustomTypes;
|
|
82
77
|
const getShareUrlWithParams = (url, params = {}) => {
|
|
83
78
|
const result = new URL(url);
|
|
84
79
|
Object.entries(params).forEach(([name, value]) => {
|