@gravity-ui/page-constructor 1.14.0-alpha.7 → 1.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.
- package/CHANGELOG.md +21 -0
- package/build/cjs/blocks/Banner/schema.d.ts +0 -336
- package/build/cjs/blocks/Media/schema.d.ts +0 -112
- package/build/cjs/components/Button/Button.js +2 -5
- package/build/cjs/components/CardBase/CardBase.d.ts +0 -2
- package/build/cjs/components/CardBase/CardBase.js +1 -4
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -4
- package/build/cjs/components/Link/Link.js +1 -4
- package/build/cjs/components/YandexForm/YandexForm.d.ts +0 -2
- package/build/cjs/components/YandexForm/YandexForm.js +2 -13
- package/build/cjs/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/cjs/containers/PageConstructor/Provider.js +1 -3
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +0 -6
- package/build/cjs/hooks/useMetrika.d.ts +0 -6
- package/build/cjs/hooks/useMetrika.js +0 -8
- package/build/cjs/models/common.d.ts +0 -30
- package/build/cjs/models/common.js +0 -3
- package/build/cjs/models/constructor-items/common.d.ts +1 -4
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -2
- package/build/cjs/models/navigation.d.ts +1 -3
- package/build/cjs/navigation/components/Header/Header.css +5 -3
- package/build/cjs/navigation/components/Logo/Logo.css +5 -6
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -0
- package/build/cjs/navigation/schema.d.ts +60 -0
- package/build/cjs/navigation/schema.js +80 -0
- package/build/cjs/schema/index.d.ts +67 -0
- package/build/cjs/schema/index.js +2 -1
- package/build/cjs/schema/validators/common.d.ts +0 -236
- package/build/cjs/schema/validators/common.js +0 -10
- package/build/cjs/schema/validators/index.d.ts +2 -0
- package/build/cjs/schema/validators/index.js +2 -0
- package/build/cjs/schema/validators/navigation.d.ts +1 -0
- package/build/cjs/{context/analyticsContext/index.js → schema/validators/navigation.js} +1 -1
- package/build/cjs/sub-blocks/HubspotForm/index.js +2 -14
- package/build/cjs/text-transform/blocks.js +1 -10
- package/build/esm/blocks/Banner/schema.d.ts +0 -336
- package/build/esm/blocks/Media/schema.d.ts +0 -112
- package/build/esm/components/Button/Button.js +2 -5
- package/build/esm/components/CardBase/CardBase.d.ts +0 -2
- package/build/esm/components/CardBase/CardBase.js +1 -4
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -4
- package/build/esm/components/Link/Link.js +1 -4
- package/build/esm/components/YandexForm/YandexForm.d.ts +0 -2
- package/build/esm/components/YandexForm/YandexForm.js +2 -13
- package/build/esm/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/esm/containers/PageConstructor/Provider.js +1 -3
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +0 -6
- package/build/esm/hooks/useMetrika.d.ts +0 -6
- package/build/esm/hooks/useMetrika.js +0 -8
- package/build/esm/models/common.d.ts +0 -30
- package/build/esm/models/common.js +0 -3
- package/build/esm/models/constructor-items/common.d.ts +1 -4
- package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -2
- package/build/esm/models/navigation.d.ts +1 -3
- package/build/esm/navigation/components/Header/Header.css +5 -3
- package/build/esm/navigation/components/Logo/Logo.css +5 -6
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -0
- package/build/esm/navigation/schema.d.ts +60 -0
- package/build/esm/navigation/schema.js +77 -0
- package/build/esm/schema/index.d.ts +67 -0
- package/build/esm/schema/index.js +2 -1
- package/build/esm/schema/validators/common.d.ts +0 -236
- package/build/esm/schema/validators/common.js +0 -10
- package/build/esm/schema/validators/index.d.ts +2 -0
- package/build/esm/schema/validators/index.js +2 -0
- package/build/esm/schema/validators/navigation.d.ts +1 -0
- package/build/esm/schema/validators/navigation.js +1 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +2 -14
- package/build/esm/text-transform/blocks.js +1 -10
- package/package.json +1 -4
- package/server/models/common.d.ts +0 -30
- package/server/models/common.js +0 -3
- package/server/models/constructor-items/common.d.ts +1 -4
- package/server/models/constructor-items/sub-blocks.d.ts +1 -2
- package/server/models/navigation.d.ts +1 -3
- package/server/text-transform/blocks.js +1 -10
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +0 -6
- package/build/cjs/context/analyticsContext/analyticsContext.js +0 -6
- package/build/cjs/context/analyticsContext/index.d.ts +0 -1
- package/build/cjs/hooks/useAnalytics.d.ts +0 -2
- package/build/cjs/hooks/useAnalytics.js +0 -15
- package/build/cjs/schema/validators/event.d.ts +0 -54
- package/build/cjs/schema/validators/event.js +0 -57
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +0 -6
- package/build/esm/context/analyticsContext/analyticsContext.js +0 -2
- package/build/esm/context/analyticsContext/index.d.ts +0 -1
- package/build/esm/context/analyticsContext/index.js +0 -1
- package/build/esm/hooks/useAnalytics.d.ts +0 -2
- package/build/esm/hooks/useAnalytics.js +0 -11
- package/build/esm/schema/validators/event.d.ts +0 -54
- package/build/esm/schema/validators/event.js +0 -54
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MetrikaContextProps } from '../../context/metrikaContext';
|
|
2
|
-
import { AnalyticsContextProps } from '../../context/analyticsContext';
|
|
3
2
|
import { ProjectSettingsContextProps } from '../../context/projectSettingsContext';
|
|
4
3
|
import { SSRContextProps } from '../../context/ssrContext';
|
|
5
4
|
import { LocaleContextProps } from '../../context/localeContext';
|
|
@@ -14,6 +13,5 @@ export interface PageConstructorProviderProps {
|
|
|
14
13
|
ssrConfig?: SSRContextProps;
|
|
15
14
|
theme?: ConstructorTheme;
|
|
16
15
|
projectSettings?: ProjectSettingsContextProps;
|
|
17
|
-
analytics?: AnalyticsContextProps;
|
|
18
16
|
}
|
|
19
17
|
export declare const PageConstructorProvider: (props: WithChildren<PageConstructorProviderProps>) => JSX.Element;
|
|
@@ -4,7 +4,6 @@ exports.PageConstructorProvider = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
7
|
-
const analyticsContext_1 = require("../../context/analyticsContext");
|
|
8
7
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
9
8
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
10
9
|
const ssrContext_1 = require("../../context/ssrContext");
|
|
@@ -13,7 +12,7 @@ const locationContext_1 = require("../../context/locationContext");
|
|
|
13
12
|
const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
14
13
|
const constants_1 = require("../../components/constants");
|
|
15
14
|
const PageConstructorProvider = (props) => {
|
|
16
|
-
const { isMobile, locale = {}, location = {}, metrika = {},
|
|
15
|
+
const { isMobile, locale = {}, location = {}, metrika = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, } = props;
|
|
17
16
|
/* eslint-disable react/jsx-key */
|
|
18
17
|
const context = [
|
|
19
18
|
react_1.default.createElement(ThemeValueContext_1.ThemeValueContext.Provider, { value: { themeValue: theme } }),
|
|
@@ -22,7 +21,6 @@ const PageConstructorProvider = (props) => {
|
|
|
22
21
|
react_1.default.createElement(locationContext_1.LocationContext.Provider, { value: location }),
|
|
23
22
|
react_1.default.createElement(mobileContext_1.MobileContext.Provider, { value: Boolean(isMobile) }),
|
|
24
23
|
react_1.default.createElement(metrikaContext_1.MetrikaContext.Provider, { value: metrika }),
|
|
25
|
-
react_1.default.createElement(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
|
|
26
24
|
react_1.default.createElement(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.isServer } }),
|
|
27
25
|
].reduceRight((prev, provider) => react_1.default.cloneElement(provider, {}, prev), children);
|
|
28
26
|
/* eslint-enable react/jsx-key */
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Metrika, Pixel } from '../../models';
|
|
3
3
|
export interface MetrikaContextProps {
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Metrika will be deleted
|
|
6
|
-
*/
|
|
7
4
|
metrika?: Metrika;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Metrika will be deleted
|
|
10
|
-
*/
|
|
11
5
|
pixel?: Pixel;
|
|
12
6
|
}
|
|
13
7
|
export declare const MetrikaContext: React.Context<MetrikaContextProps>;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { ButtonPixel, MetrikaGoal, PixelEvent } from '../models';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Metrika will be deleted
|
|
4
|
-
*/
|
|
5
2
|
type UseMetrikaProps = {
|
|
6
3
|
metrikaGoals?: MetrikaGoal;
|
|
7
4
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
8
5
|
};
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated useMetrika will be deleted
|
|
11
|
-
*/
|
|
12
6
|
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents }: UseMetrikaProps) => void;
|
|
13
7
|
export {};
|
|
@@ -5,20 +5,12 @@ const react_1 = require("react");
|
|
|
5
5
|
const metrikaContext_1 = require("../context/metrikaContext");
|
|
6
6
|
const models_1 = require("../models");
|
|
7
7
|
const guards_1 = require("../models/guards");
|
|
8
|
-
// eslint-disable-next-line valid-jsdoc
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Metrika will be deleted, which uses this logic
|
|
11
|
-
*/
|
|
12
8
|
function isButtonPixel(pixelEvents) {
|
|
13
9
|
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
14
10
|
return true;
|
|
15
11
|
}
|
|
16
12
|
return false;
|
|
17
13
|
}
|
|
18
|
-
// eslint-disable-next-line valid-jsdoc
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated useMetrika will be deleted
|
|
21
|
-
*/
|
|
22
14
|
const useMetrika = () => {
|
|
23
15
|
const { metrika, pixel } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
24
16
|
return ({ metrikaGoals, pixelEvents }) => {
|
|
@@ -7,21 +7,12 @@ export declare enum Theme {
|
|
|
7
7
|
Light = "light",
|
|
8
8
|
Dark = "dark"
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Pixel will be deleted
|
|
12
|
-
*/
|
|
13
10
|
type PixelCommand = 'track' | 'trackCustom';
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Pixel will be deleted
|
|
16
|
-
*/
|
|
17
11
|
export interface PixelEvent {
|
|
18
12
|
command: PixelCommand;
|
|
19
13
|
event: PixelEventType | string;
|
|
20
14
|
data?: Object;
|
|
21
15
|
}
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Pixel will be deleted from package
|
|
24
|
-
*/
|
|
25
16
|
export declare enum PixelEventType {
|
|
26
17
|
AddPaymentInfo = "AddPaymentInfo",
|
|
27
18
|
AddToCart = "AddToCart",
|
|
@@ -45,17 +36,11 @@ export declare enum PixelEventType {
|
|
|
45
36
|
export type Modifiers = {
|
|
46
37
|
[name: string]: string | boolean | undefined;
|
|
47
38
|
};
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Pixel will be deleted
|
|
50
|
-
*/
|
|
51
39
|
export interface Pixel<TEvent = string> {
|
|
52
40
|
trackStandard: (event: TEvent, data?: Object) => void;
|
|
53
41
|
trackCustom: (event: string, data?: Object) => void;
|
|
54
42
|
track: (trackEvents: string | string[] | PixelEvent[] | PixelEvent) => void;
|
|
55
43
|
}
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated Metrika will be deleted
|
|
58
|
-
*/
|
|
59
44
|
export interface Metrika {
|
|
60
45
|
reachGoal: (counterName: string, ...args: any) => void;
|
|
61
46
|
reachGoals: (goals: MetrikaGoal, counterName?: string) => void;
|
|
@@ -64,19 +49,4 @@ export interface ClassNameProps {
|
|
|
64
49
|
className?: string;
|
|
65
50
|
}
|
|
66
51
|
export type Timeout = ReturnType<typeof setTimeout> | undefined;
|
|
67
|
-
export type AnalyticsParameter = {
|
|
68
|
-
key: string;
|
|
69
|
-
value: string;
|
|
70
|
-
};
|
|
71
|
-
export type AnalyticsEvent = {
|
|
72
|
-
name: string;
|
|
73
|
-
type?: string;
|
|
74
|
-
counters?: {
|
|
75
|
-
include?: string[];
|
|
76
|
-
exclude?: string[];
|
|
77
|
-
};
|
|
78
|
-
category?: string;
|
|
79
|
-
label?: string;
|
|
80
|
-
params?: AnalyticsParameter[];
|
|
81
|
-
};
|
|
82
52
|
export {};
|
|
@@ -6,9 +6,6 @@ var Theme;
|
|
|
6
6
|
Theme["Light"] = "light";
|
|
7
7
|
Theme["Dark"] = "dark";
|
|
8
8
|
})(Theme = exports.Theme || (exports.Theme = {}));
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Pixel will be deleted from package
|
|
11
|
-
*/
|
|
12
9
|
var PixelEventType;
|
|
13
10
|
(function (PixelEventType) {
|
|
14
11
|
PixelEventType["AddPaymentInfo"] = "AddPaymentInfo";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonView } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
|
-
import {
|
|
4
|
+
import { ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -121,7 +121,6 @@ export interface LinkProps extends Stylable {
|
|
|
121
121
|
target?: string;
|
|
122
122
|
metrikaGoals?: MetrikaGoal;
|
|
123
123
|
pixelEvents?: ButtonPixel;
|
|
124
|
-
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
125
124
|
}
|
|
126
125
|
export interface FileLinkProps extends ClassNameProps {
|
|
127
126
|
href: string;
|
|
@@ -140,7 +139,6 @@ export interface ButtonProps {
|
|
|
140
139
|
img?: ButtonImageProps | string;
|
|
141
140
|
metrikaGoals?: MetrikaGoal;
|
|
142
141
|
pixelEvents?: ButtonPixel;
|
|
143
|
-
analyticsEvents?: AnalyticsEvent[];
|
|
144
142
|
target?: string;
|
|
145
143
|
}
|
|
146
144
|
export interface ButtonImageProps {
|
|
@@ -224,7 +222,6 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
224
222
|
theme?: TextTheme;
|
|
225
223
|
metrikaGoals?: MetrikaGoal;
|
|
226
224
|
pixelEvents?: ButtonPixel;
|
|
227
|
-
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
228
225
|
}
|
|
229
226
|
export interface PreviewContentItemProps {
|
|
230
227
|
title: string;
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import {
|
|
6
|
+
import { PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -61,7 +61,6 @@ export interface HubspotFormProps extends HubspotEventHandlers {
|
|
|
61
61
|
onLoad?: (arg: HubspotEventData) => void;
|
|
62
62
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
63
63
|
hubspotEvents?: string[];
|
|
64
|
-
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
65
64
|
}
|
|
66
65
|
export interface PartnerProps extends CardBaseProps {
|
|
67
66
|
text: string;
|
|
@@ -11,7 +11,7 @@ export interface NavigationItemBase {
|
|
|
11
11
|
icon?: ImageProps;
|
|
12
12
|
url?: string;
|
|
13
13
|
}
|
|
14
|
-
export interface NavigationLinkItem extends NavigationItemBase {
|
|
14
|
+
export interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'> {
|
|
15
15
|
type: NavigationItemType.Link;
|
|
16
16
|
url: string;
|
|
17
17
|
arrow?: boolean;
|
|
@@ -19,8 +19,6 @@ export interface NavigationLinkItem extends NavigationItemBase {
|
|
|
19
19
|
}
|
|
20
20
|
export interface NavigationButtonItem extends ButtonProps {
|
|
21
21
|
type: NavigationItemType.Button;
|
|
22
|
-
url: string;
|
|
23
|
-
target?: string;
|
|
24
22
|
}
|
|
25
23
|
export interface NavigationDropdownItem extends NavigationItemBase {
|
|
26
24
|
type: NavigationItemType.Dropdown;
|
|
@@ -18,25 +18,27 @@ unpredictable css rules order in build */
|
|
|
18
18
|
height: var(--header-height);
|
|
19
19
|
}
|
|
20
20
|
@media (min-width: 769px) {
|
|
21
|
-
.pc-header__mobile-menu-button {
|
|
21
|
+
.pc-header__mobile-menu-button.pc-header__mobile-menu-button {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
25
26
|
.pc-header__navigation, .pc-header__left, .pc-header__right {
|
|
26
27
|
display: flex;
|
|
27
28
|
align-items: center;
|
|
28
29
|
}
|
|
29
|
-
.pc-header__navigation {
|
|
30
|
+
.pc-header__navigation.pc-header__navigation {
|
|
30
31
|
position: relative;
|
|
31
32
|
margin-right: 20px;
|
|
32
33
|
flex: 1 0 0;
|
|
33
34
|
justify-content: flex-start;
|
|
34
35
|
}
|
|
35
36
|
@media (max-width: 768px) {
|
|
36
|
-
.pc-header__navigation {
|
|
37
|
+
.pc-header__navigation.pc-header__navigation {
|
|
37
38
|
display: none;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
41
|
+
|
|
40
42
|
.pc-header__right {
|
|
41
43
|
flex: 0;
|
|
42
44
|
justify-content: flex-end;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-
|
|
1
|
+
.pc-logo__text {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -7,11 +7,6 @@ unpredictable css rules order in build */
|
|
|
7
7
|
.pc-logo {
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
|
-
font-weight: var(--yc-text-accent-font-weight);
|
|
11
|
-
font-size: var(--yc-text-header-1-font-size);
|
|
12
|
-
line-height: var(--yc-text-header-1-line-height);
|
|
13
|
-
color: var(--pc-text-header-color);
|
|
14
|
-
font-weight: var(--yc-text-accent-font-weight);
|
|
15
10
|
}
|
|
16
11
|
.pc-logo__icon {
|
|
17
12
|
display: flex;
|
|
@@ -19,5 +14,9 @@ unpredictable css rules order in build */
|
|
|
19
14
|
object-fit: contain;
|
|
20
15
|
}
|
|
21
16
|
.pc-logo__text {
|
|
17
|
+
font-size: var(--yc-text-header-1-font-size);
|
|
18
|
+
line-height: var(--yc-text-header-1-line-height);
|
|
19
|
+
color: var(--pc-text-header-color);
|
|
20
|
+
font-weight: var(--yc-text-accent-font-weight);
|
|
22
21
|
white-space: nowrap;
|
|
23
22
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const LogoProps: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
icon: {
|
|
7
|
+
oneOf: ({
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
when: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: string;
|
|
16
|
+
pattern: string;
|
|
17
|
+
})[];
|
|
18
|
+
};
|
|
19
|
+
text: {
|
|
20
|
+
type: string;
|
|
21
|
+
contentType: string;
|
|
22
|
+
};
|
|
23
|
+
url: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const NavigationHeaderProps: {
|
|
29
|
+
type: string;
|
|
30
|
+
additionalProperties: boolean;
|
|
31
|
+
required: string[];
|
|
32
|
+
properties: {
|
|
33
|
+
leftItems: {
|
|
34
|
+
oneOf: {
|
|
35
|
+
type: string;
|
|
36
|
+
items: {
|
|
37
|
+
type: string;
|
|
38
|
+
properties: {
|
|
39
|
+
when: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
rightItems: {
|
|
47
|
+
oneOf: {
|
|
48
|
+
type: string;
|
|
49
|
+
items: {
|
|
50
|
+
type: string;
|
|
51
|
+
properties: {
|
|
52
|
+
when: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationHeaderProps = exports.LogoProps = void 0;
|
|
4
|
+
const common_1 = require("../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../components/Image/schema");
|
|
6
|
+
const lodash_1 = require("lodash");
|
|
7
|
+
const utils_1 = require("../schema/validators/utils");
|
|
8
|
+
const NavigationItemType = {
|
|
9
|
+
type: 'string',
|
|
10
|
+
enum: ['link', 'button', 'dropdown'],
|
|
11
|
+
};
|
|
12
|
+
exports.LogoProps = {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
required: ['icon'],
|
|
16
|
+
properties: {
|
|
17
|
+
icon: schema_1.ImageProps,
|
|
18
|
+
text: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
contentType: 'text',
|
|
21
|
+
},
|
|
22
|
+
url: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const NavigationItemBaseProps = {
|
|
28
|
+
text: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
contentType: 'text',
|
|
31
|
+
},
|
|
32
|
+
url: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
},
|
|
35
|
+
icon: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
pattern: schema_1.urlPattern,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const NavigationItemBaseLinkProps = (0, lodash_1.omit)(NavigationItemBaseProps, ['url']);
|
|
41
|
+
const NavigationLinkItemProps = {
|
|
42
|
+
type: 'object',
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
required: ['type', 'text'],
|
|
45
|
+
properties: Object.assign(Object.assign({}, NavigationItemBaseLinkProps), { type: Object.assign({}, NavigationItemType), url: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
}, target: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
}, arrow: {
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
} }),
|
|
52
|
+
};
|
|
53
|
+
const NavigationButtonItemProps = {
|
|
54
|
+
type: 'object',
|
|
55
|
+
additionalProperties: false,
|
|
56
|
+
required: ['type', 'text', 'url'],
|
|
57
|
+
properties: Object.assign(Object.assign({}, common_1.ButtonProps), { type: Object.assign({}, NavigationItemType) }),
|
|
58
|
+
};
|
|
59
|
+
const NavigationDropdownItemProps = {
|
|
60
|
+
type: 'object',
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
required: ['type', 'items'],
|
|
63
|
+
properties: Object.assign(Object.assign({}, NavigationItemBaseProps), { type: Object.assign({}, NavigationItemType), items: (0, utils_1.filteredArray)(NavigationLinkItemProps) }),
|
|
64
|
+
};
|
|
65
|
+
const NavigationItemProps = {
|
|
66
|
+
oneOf: [
|
|
67
|
+
(0, utils_1.filteredArray)(NavigationLinkItemProps),
|
|
68
|
+
(0, utils_1.filteredArray)(NavigationButtonItemProps),
|
|
69
|
+
(0, utils_1.filteredArray)(NavigationDropdownItemProps),
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
exports.NavigationHeaderProps = {
|
|
73
|
+
type: 'object',
|
|
74
|
+
additionalProperties: false,
|
|
75
|
+
required: ['leftItems'],
|
|
76
|
+
properties: {
|
|
77
|
+
leftItems: NavigationItemProps,
|
|
78
|
+
rightItems: NavigationItemProps,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -31,6 +31,73 @@ export declare function generateDefaultSchema(config?: SchemaCustomConfig): {
|
|
|
31
31
|
additionalProperties: boolean;
|
|
32
32
|
required: string[];
|
|
33
33
|
properties: {
|
|
34
|
+
logo: {
|
|
35
|
+
oneOf: ({
|
|
36
|
+
type: string;
|
|
37
|
+
additionalProperties: boolean;
|
|
38
|
+
required: string[];
|
|
39
|
+
properties: {
|
|
40
|
+
icon: {
|
|
41
|
+
oneOf: ({
|
|
42
|
+
type: string;
|
|
43
|
+
properties: {
|
|
44
|
+
when: {
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
pattern: string;
|
|
51
|
+
})[];
|
|
52
|
+
};
|
|
53
|
+
text: {
|
|
54
|
+
type: string;
|
|
55
|
+
contentType: string;
|
|
56
|
+
};
|
|
57
|
+
url: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
} | {
|
|
62
|
+
type: string;
|
|
63
|
+
additionalProperties: boolean;
|
|
64
|
+
required: import("..").Theme[];
|
|
65
|
+
properties: {};
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
header: {
|
|
69
|
+
type: string;
|
|
70
|
+
additionalProperties: boolean;
|
|
71
|
+
required: string[];
|
|
72
|
+
properties: {
|
|
73
|
+
leftItems: {
|
|
74
|
+
oneOf: {
|
|
75
|
+
type: string;
|
|
76
|
+
items: {
|
|
77
|
+
type: string;
|
|
78
|
+
properties: {
|
|
79
|
+
when: {
|
|
80
|
+
type: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
rightItems: {
|
|
87
|
+
oneOf: {
|
|
88
|
+
type: string;
|
|
89
|
+
items: {
|
|
90
|
+
type: string;
|
|
91
|
+
properties: {
|
|
92
|
+
when: {
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}[];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
34
101
|
blocks: {
|
|
35
102
|
type: string;
|
|
36
103
|
items: {
|
|
@@ -7,6 +7,7 @@ const blocks_1 = require("./validators/blocks");
|
|
|
7
7
|
const sub_blocks_1 = require("./validators/sub-blocks");
|
|
8
8
|
const common_1 = require("./validators/common");
|
|
9
9
|
const utils_1 = require("./validators/utils");
|
|
10
|
+
const navigation_1 = require("./validators/navigation");
|
|
10
11
|
const getBlocksCases = (blocks) => {
|
|
11
12
|
return Object.values(blocks).reduce((acc, block) => (Object.assign(Object.assign({}, acc), block)));
|
|
12
13
|
};
|
|
@@ -88,7 +89,7 @@ function generateDefaultSchema(config) {
|
|
|
88
89
|
type: 'object',
|
|
89
90
|
additionalProperties: false,
|
|
90
91
|
required: ['blocks'],
|
|
91
|
-
properties: Object.assign(Object.assign(Object.assign({}, common_1.AnimatableProps), { blocks: {
|
|
92
|
+
properties: Object.assign(Object.assign(Object.assign({}, common_1.AnimatableProps), { logo: (0, common_1.withTheme)(navigation_1.LogoProps), header: navigation_1.NavigationHeaderProps, blocks: {
|
|
92
93
|
type: 'array',
|
|
93
94
|
items: {
|
|
94
95
|
$ref: '#/definitions/children',
|