@redocly/theme 0.19.9 → 0.21.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/lib/components/Menu/MenuItemSwitch.js +1 -4
- package/lib/components/Sidebar/BackButton.js +4 -1
- package/lib/components/Sidebar/Drilldown.js +4 -2
- package/lib/components/Sidebar/DrilldownMenu.js +8 -3
- package/lib/config.d.ts +8 -0
- package/lib/config.js +6 -0
- package/lib/globalStyle.js +2 -2
- package/package.json +1 -1
- package/src/components/Menu/MenuItemSwitch.tsx +1 -4
- package/src/components/Sidebar/BackButton.tsx +5 -1
- package/src/components/Sidebar/Drilldown.tsx +6 -3
- package/src/components/Sidebar/DrilldownMenu.tsx +11 -4
- package/src/config.ts +6 -0
- package/src/globalStyle.ts +2 -2
|
@@ -16,10 +16,7 @@ const MenuItem_1 = require("../../components/Menu/MenuItem");
|
|
|
16
16
|
function MenuItemSwitch(props) {
|
|
17
17
|
var _a;
|
|
18
18
|
const type = (0, getMenuType_1.getMenuType)(props.item);
|
|
19
|
-
const { Drilldown, handleBack, handleExpand, isExpanded: drilldownIsExpanded, prevActiveItem, } = (0, useDrilldown_1.useDrilldown)(
|
|
20
|
-
item: props.item,
|
|
21
|
-
activeItem: props.activeItem,
|
|
22
|
-
});
|
|
19
|
+
const { Drilldown, handleBack, handleExpand, isExpanded: drilldownIsExpanded, prevActiveItem, } = (0, useDrilldown_1.useDrilldown)(props);
|
|
23
20
|
const { MenuGroup, handleGroupClick, isExpanded } = (0, useMenuGroup_1.useMenuGroup)(props.item);
|
|
24
21
|
switch (type) {
|
|
25
22
|
case types_1.MenuType.Separator:
|
|
@@ -9,7 +9,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
9
9
|
const ArrowBack_1 = require("../../ui/ArrowBack");
|
|
10
10
|
function BackButton({ children, back, className, }) {
|
|
11
11
|
return (react_1.default.createElement(Button, { onClick: back, "data-component-name": "Sidebar/BackButton", className: className },
|
|
12
|
-
react_1.default.createElement(
|
|
12
|
+
react_1.default.createElement(ArrowBack, { dataComponentName: "Sidebar/ArrowBack" }),
|
|
13
13
|
children));
|
|
14
14
|
}
|
|
15
15
|
exports.BackButton = BackButton;
|
|
@@ -36,4 +36,7 @@ const Button = styled_components_1.default.button `
|
|
|
36
36
|
background: var(--sidebar-back-button-hover-background-color);
|
|
37
37
|
}
|
|
38
38
|
`;
|
|
39
|
+
const ArrowBack = (0, styled_components_1.default)(ArrowBack_1.ArrowBack) `
|
|
40
|
+
margin-right: var(--spacing-sm);
|
|
41
|
+
`;
|
|
39
42
|
//# sourceMappingURL=BackButton.js.map
|
|
@@ -21,11 +21,13 @@ const MenuItemLabel_1 = require("../../components/Menu/MenuItemLabel");
|
|
|
21
21
|
const SeparatorLine_1 = require("../../components/Separator/SeparatorLine");
|
|
22
22
|
const DrilldownMenuItem_1 = require("../../components/Sidebar/DrilldownMenuItem");
|
|
23
23
|
const DrilldownMenu_1 = require("../../components/Sidebar/DrilldownMenu");
|
|
24
|
+
const Menu_1 = require("../../components/Menu");
|
|
24
25
|
function Drilldown(_a) {
|
|
25
26
|
var { isExpanded, item, expand, className } = _a, props = __rest(_a, ["isExpanded", "item", "expand", "className"]);
|
|
26
27
|
return (react_1.default.createElement(Wrapper, { "data-component-name": "Sidebar/Drilldown", className: className },
|
|
27
|
-
react_1.default.createElement(
|
|
28
|
-
react_1.default.createElement(
|
|
28
|
+
react_1.default.createElement(Menu_1.MenuLinkItem, { item: item },
|
|
29
|
+
react_1.default.createElement(DrilldownLabel, { onClick: expand },
|
|
30
|
+
react_1.default.createElement(DrilldownMenuItem_1.DrilldownMenuItem, { item: item }))),
|
|
29
31
|
isExpanded ? react_1.default.createElement(DrilldownMenu_1.DrilldownMenu, Object.assign({ item: item }, props)) : null,
|
|
30
32
|
item.separatorLine ? react_1.default.createElement(SeparatorLine_1.SeparatorLine, null) : null));
|
|
31
33
|
}
|
|
@@ -32,16 +32,21 @@ const styled_components_1 = __importStar(require("styled-components"));
|
|
|
32
32
|
const BackButton_1 = require("../../components/Sidebar/BackButton");
|
|
33
33
|
const DrilldownMenuItem_1 = require("../../components/Sidebar/DrilldownMenuItem");
|
|
34
34
|
const hooks_1 = require("../../mocks/hooks");
|
|
35
|
+
const Menu_1 = require("../../components/Menu");
|
|
35
36
|
function DrilldownMenu({ item, back, prevActiveItem, children, className, }) {
|
|
36
37
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
37
38
|
const translationKeys = {
|
|
38
39
|
backLabel: 'theme.sidebar.menu.backLabel',
|
|
39
40
|
};
|
|
41
|
+
const label = item.label === (prevActiveItem === null || prevActiveItem === void 0 ? void 0 : prevActiveItem.label) || !(prevActiveItem === null || prevActiveItem === void 0 ? void 0 : prevActiveItem.label)
|
|
42
|
+
? translate(translationKeys.backLabel, 'Back')
|
|
43
|
+
: prevActiveItem === null || prevActiveItem === void 0 ? void 0 : prevActiveItem.label;
|
|
40
44
|
return (react_1.default.createElement(MenuContainer, { "data-component-name": "Sidebar/DrilldownMenu", className: className },
|
|
41
45
|
react_1.default.createElement(MenuContent, null,
|
|
42
46
|
react_1.default.createElement(MenuWrapper, null,
|
|
43
|
-
react_1.default.createElement(BackButton_1.BackButton, { back: back, "data-translation-key": translationKeys.backLabel },
|
|
44
|
-
react_1.default.createElement(
|
|
47
|
+
react_1.default.createElement(BackButton_1.BackButton, { back: back, "data-translation-key": translationKeys.backLabel }, label),
|
|
48
|
+
react_1.default.createElement(Menu_1.MenuLinkItem, { item: item },
|
|
49
|
+
react_1.default.createElement(DrilldownMenuItem_1.DrilldownMenuItem, { item: item }))),
|
|
45
50
|
children)));
|
|
46
51
|
}
|
|
47
52
|
exports.DrilldownMenu = DrilldownMenu;
|
|
@@ -52,6 +57,7 @@ const MenuContainer = styled_components_1.default.div `
|
|
|
52
57
|
width: 100%;
|
|
53
58
|
z-index: var(--z-index-raised);
|
|
54
59
|
background-color: var(--sidebar-item-drilldown-background-color);
|
|
60
|
+
padding: var(--sidebar-item-nested-offset) var(--sidebar-item-padding-horizontal);
|
|
55
61
|
`;
|
|
56
62
|
const slideInAnimation = (0, styled_components_1.keyframes) `
|
|
57
63
|
0% {
|
|
@@ -70,7 +76,6 @@ const MenuContent = styled_components_1.default.div `
|
|
|
70
76
|
`;
|
|
71
77
|
const MenuWrapper = styled_components_1.default.div `
|
|
72
78
|
padding: var(--sidebar-item-padding-vertical) var(--sidebar-item-padding-horizontal);
|
|
73
|
-
margin-bottom: calc(var(--sidebar-spacing-unit) * 3);
|
|
74
79
|
word-break: break-word;
|
|
75
80
|
`;
|
|
76
81
|
//# sourceMappingURL=DrilldownMenu.js.map
|
package/lib/config.d.ts
CHANGED
|
@@ -847,6 +847,14 @@ export declare const themeConfigSchema: {
|
|
|
847
847
|
};
|
|
848
848
|
readonly additionalProperties: false;
|
|
849
849
|
};
|
|
850
|
+
readonly seo: {
|
|
851
|
+
readonly type: "object";
|
|
852
|
+
readonly properties: {
|
|
853
|
+
readonly title: {
|
|
854
|
+
readonly type: "string";
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
};
|
|
850
858
|
readonly scripts: {
|
|
851
859
|
readonly type: "object";
|
|
852
860
|
readonly properties: {
|
package/lib/config.js
CHANGED
|
@@ -370,6 +370,12 @@ exports.themeConfigSchema = {
|
|
|
370
370
|
} }, hideConfigSchema.properties),
|
|
371
371
|
additionalProperties: false,
|
|
372
372
|
},
|
|
373
|
+
seo: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
properties: {
|
|
376
|
+
title: { type: 'string' },
|
|
377
|
+
},
|
|
378
|
+
},
|
|
373
379
|
scripts: {
|
|
374
380
|
type: 'object',
|
|
375
381
|
properties: {
|
package/lib/globalStyle.js
CHANGED
|
@@ -812,7 +812,7 @@ const pages = (0, styled_components_1.css) `
|
|
|
812
812
|
--page-404-description-text-color: var(--text-secondary);
|
|
813
813
|
--page-404-description-font-size: 1.5em; // @presenter FontSize
|
|
814
814
|
--page-404-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
815
|
-
--page-404-description-line-height: 1 // @presenter LineHeight
|
|
815
|
+
--page-404-description-line-height: 1; // @presenter LineHeight
|
|
816
816
|
--page-404-description-margin: 0px; // @presenter Spacing
|
|
817
817
|
|
|
818
818
|
--page-404-button-margin: 4em; // @presenter Spacing
|
|
@@ -833,7 +833,7 @@ const pages = (0, styled_components_1.css) `
|
|
|
833
833
|
--page-403-header-margin: 0; // @presenter Spacing
|
|
834
834
|
|
|
835
835
|
--page-403-description-text-color: var(--text-secondary);
|
|
836
|
-
--page-403-description-font-size:
|
|
836
|
+
--page-403-description-font-size: 1.5em; // @presenter FontSize
|
|
837
837
|
--page-403-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
838
838
|
--page-403-description-line-height: 1; // @presenter LineHeight
|
|
839
839
|
--page-403-description-margin: 0; // @presenter Spacing
|
package/package.json
CHANGED
|
@@ -20,10 +20,7 @@ export function MenuItemSwitch(props: PropsWithChildren<MenuItemProps>) {
|
|
|
20
20
|
handleExpand,
|
|
21
21
|
isExpanded: drilldownIsExpanded,
|
|
22
22
|
prevActiveItem,
|
|
23
|
-
} = useDrilldown(
|
|
24
|
-
item: props.item,
|
|
25
|
-
activeItem: props.activeItem,
|
|
26
|
-
});
|
|
23
|
+
} = useDrilldown(props);
|
|
27
24
|
|
|
28
25
|
const { MenuGroup, handleGroupClick, isExpanded } = useMenuGroup(props.item);
|
|
29
26
|
switch (type) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { ArrowBack } from '@theme/ui/ArrowBack';
|
|
4
|
+
import { ArrowBack as ThemeArrowBack } from '@theme/ui/ArrowBack';
|
|
5
5
|
|
|
6
6
|
interface BackButtonProps {
|
|
7
7
|
back: () => void;
|
|
@@ -44,3 +44,7 @@ const Button = styled.button`
|
|
|
44
44
|
background: var(--sidebar-back-button-hover-background-color);
|
|
45
45
|
}
|
|
46
46
|
`;
|
|
47
|
+
|
|
48
|
+
const ArrowBack = styled(ThemeArrowBack)`
|
|
49
|
+
margin-right: var(--spacing-sm);
|
|
50
|
+
`;
|
|
@@ -6,6 +6,7 @@ import { SeparatorLine } from '@theme/components/Separator/SeparatorLine';
|
|
|
6
6
|
import { DrilldownMenuItem } from '@theme/components/Sidebar/DrilldownMenuItem';
|
|
7
7
|
import { DrilldownMenu } from '@theme/components/Sidebar/DrilldownMenu';
|
|
8
8
|
import type { DrilldownMenuProps } from '@theme/components/Sidebar/types';
|
|
9
|
+
import { MenuLinkItem } from '@theme/components/Menu';
|
|
9
10
|
|
|
10
11
|
interface DrilldownProps extends DrilldownMenuProps {
|
|
11
12
|
isExpanded: boolean;
|
|
@@ -22,9 +23,11 @@ export function Drilldown({
|
|
|
22
23
|
}: React.PropsWithChildren<DrilldownProps>): JSX.Element {
|
|
23
24
|
return (
|
|
24
25
|
<Wrapper data-component-name="Sidebar/Drilldown" className={className}>
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
26
|
+
<MenuLinkItem item={item}>
|
|
27
|
+
<DrilldownLabel onClick={expand}>
|
|
28
|
+
<DrilldownMenuItem item={item} />
|
|
29
|
+
</DrilldownLabel>
|
|
30
|
+
</MenuLinkItem>
|
|
28
31
|
|
|
29
32
|
{isExpanded ? <DrilldownMenu item={item} {...props} /> : null}
|
|
30
33
|
|
|
@@ -5,6 +5,7 @@ import { BackButton } from '@theme/components/Sidebar/BackButton';
|
|
|
5
5
|
import { DrilldownMenuItem } from '@theme/components/Sidebar/DrilldownMenuItem';
|
|
6
6
|
import type { DrilldownMenuProps } from '@theme/components/Sidebar/types';
|
|
7
7
|
import { useTranslate } from '@portal/hooks';
|
|
8
|
+
import { MenuLinkItem } from '@theme/components/Menu';
|
|
8
9
|
|
|
9
10
|
export function DrilldownMenu({
|
|
10
11
|
item,
|
|
@@ -17,16 +18,22 @@ export function DrilldownMenu({
|
|
|
17
18
|
const translationKeys = {
|
|
18
19
|
backLabel: 'theme.sidebar.menu.backLabel',
|
|
19
20
|
};
|
|
21
|
+
const label =
|
|
22
|
+
item.label === prevActiveItem?.label || !prevActiveItem?.label
|
|
23
|
+
? translate(translationKeys.backLabel, 'Back')
|
|
24
|
+
: prevActiveItem?.label;
|
|
25
|
+
|
|
20
26
|
return (
|
|
21
27
|
<MenuContainer data-component-name="Sidebar/DrilldownMenu" className={className}>
|
|
22
28
|
<MenuContent>
|
|
23
29
|
<MenuWrapper>
|
|
24
30
|
<BackButton back={back} data-translation-key={translationKeys.backLabel}>
|
|
25
|
-
{
|
|
31
|
+
{label}
|
|
26
32
|
</BackButton>
|
|
27
|
-
<
|
|
33
|
+
<MenuLinkItem item={item}>
|
|
34
|
+
<DrilldownMenuItem item={item} />
|
|
35
|
+
</MenuLinkItem>
|
|
28
36
|
</MenuWrapper>
|
|
29
|
-
|
|
30
37
|
{children}
|
|
31
38
|
</MenuContent>
|
|
32
39
|
</MenuContainer>
|
|
@@ -40,6 +47,7 @@ const MenuContainer = styled.div`
|
|
|
40
47
|
width: 100%;
|
|
41
48
|
z-index: var(--z-index-raised);
|
|
42
49
|
background-color: var(--sidebar-item-drilldown-background-color);
|
|
50
|
+
padding: var(--sidebar-item-nested-offset) var(--sidebar-item-padding-horizontal);
|
|
43
51
|
`;
|
|
44
52
|
|
|
45
53
|
const slideInAnimation = keyframes`
|
|
@@ -61,6 +69,5 @@ const MenuContent = styled.div`
|
|
|
61
69
|
|
|
62
70
|
const MenuWrapper = styled.div`
|
|
63
71
|
padding: var(--sidebar-item-padding-vertical) var(--sidebar-item-padding-horizontal);
|
|
64
|
-
margin-bottom: calc(var(--sidebar-spacing-unit) * 3);
|
|
65
72
|
word-break: break-word;
|
|
66
73
|
`;
|
package/src/config.ts
CHANGED
package/src/globalStyle.ts
CHANGED
|
@@ -823,7 +823,7 @@ const pages = css`
|
|
|
823
823
|
--page-404-description-text-color: var(--text-secondary);
|
|
824
824
|
--page-404-description-font-size: 1.5em; // @presenter FontSize
|
|
825
825
|
--page-404-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
826
|
-
--page-404-description-line-height: 1 // @presenter LineHeight
|
|
826
|
+
--page-404-description-line-height: 1; // @presenter LineHeight
|
|
827
827
|
--page-404-description-margin: 0px; // @presenter Spacing
|
|
828
828
|
|
|
829
829
|
--page-404-button-margin: 4em; // @presenter Spacing
|
|
@@ -844,7 +844,7 @@ const pages = css`
|
|
|
844
844
|
--page-403-header-margin: 0; // @presenter Spacing
|
|
845
845
|
|
|
846
846
|
--page-403-description-text-color: var(--text-secondary);
|
|
847
|
-
--page-403-description-font-size:
|
|
847
|
+
--page-403-description-font-size: 1.5em; // @presenter FontSize
|
|
848
848
|
--page-403-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
849
849
|
--page-403-description-line-height: 1; // @presenter LineHeight
|
|
850
850
|
--page-403-description-margin: 0; // @presenter Spacing
|