@redocly/theme 0.1.21 → 0.1.24
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/Button/Button.d.ts +2 -2
- package/Button/Button.js +3 -3
- package/CodeBlock/CodeBlock.d.ts +3 -1
- package/CodeBlock/CodeBlock.js +3 -1
- package/CopyButton/CopyButton.js +1 -1
- package/Footer/Footer.js +4 -1
- package/JsonViewer/JsonViewer.d.ts +6 -2
- package/JsonViewer/JsonViewer.js +3 -1
- package/Markdown/{StyledMarkdown.d.ts → MarkdownWrapper.d.ts} +1 -1
- package/Markdown/{StyledMarkdown.js → MarkdownWrapper.js} +3 -3
- package/Markdown/index.d.ts +1 -1
- package/Markdown/index.js +1 -1
- package/Navbar/Navbar.d.ts +1 -1
- package/Navbar/Navbar.js +6 -3
- package/OperationBadge/OperationBadge.d.ts +2 -1
- package/OperationBadge/OperationBadge.js +1 -0
- package/PageNavigation/NextPageLink.js +2 -3
- package/PageNavigation/PreviousPageLink.js +2 -3
- package/Panel/CodePanel.d.ts +5 -1
- package/Panel/CodePanel.js +3 -1
- package/Panel/ContentPanel.d.ts +5 -1
- package/Panel/ContentPanel.js +3 -1
- package/Panel/Panel.d.ts +3 -1
- package/Panel/Panel.js +3 -1
- package/Panel/PanelBody.d.ts +3 -1
- package/Panel/PanelBody.js +3 -1
- package/Panel/PanelComponent.js +1 -1
- package/Panel/PanelHeader.d.ts +3 -1
- package/Panel/PanelHeader.js +3 -1
- package/Panel/PanelHeaderTitle.d.ts +3 -1
- package/Panel/PanelHeaderTitle.js +3 -1
- package/SamplesPanelControls/SamplesPanelControls.d.ts +6 -2
- package/SamplesPanelControls/SamplesPanelControls.js +3 -1
- package/Search/ClearIcon.d.ts +3 -1
- package/Search/ClearIcon.js +3 -1
- package/Search/SearchIcon.d.ts +3 -1
- package/Search/SearchIcon.js +3 -1
- package/Search/SidebarSearch.d.ts +3 -1
- package/Search/SidebarSearch.js +3 -1
- package/Sidebar/ApiCallItem.d.ts +2 -1
- package/Sidebar/MenuContainer.d.ts +3 -1
- package/Sidebar/MenuContainer.js +3 -1
- package/Sidebar/SeparatorItem.d.ts +2 -0
- package/Sidebar/SeparatorItem.js +3 -1
- package/Sidebar/SidebarLayout.d.ts +1 -1
- package/Sidebar/SidebarLayout.js +5 -2
- package/SidebarLogo/SidebarLogo.js +1 -1
- package/SourceCode/SourceCode.js +2 -2
- package/Tooltip/Tooltip.js +1 -1
- package/Typography/H1.js +1 -1
- package/Typography/H2.js +1 -1
- package/Typography/H3.js +1 -1
- package/Typography/SectionHeader.d.ts +3 -1
- package/Typography/SectionHeader.js +3 -1
- package/icons/ShelfIcon/ShelfIcon.d.ts +3 -1
- package/icons/ShelfIcon/ShelfIcon.js +3 -1
- package/mocks/hooks/index.d.ts +9 -0
- package/mocks/hooks/index.js +16 -1
- package/package.json +1 -1
- package/settings.yaml +6 -0
- package/src/Button/Button.tsx +4 -2
- package/src/CodeBlock/CodeBlock.ts +3 -1
- package/src/CopyButton/CopyButton.tsx +6 -1
- package/src/Footer/Footer.tsx +5 -1
- package/src/JsonViewer/JsonViewer.tsx +3 -1
- package/src/Markdown/{StyledMarkdown.tsx → MarkdownWrapper.tsx} +2 -2
- package/src/Markdown/index.ts +1 -1
- package/src/Navbar/Navbar.tsx +8 -4
- package/src/OperationBadge/OperationBadge.ts +1 -0
- package/src/PageNavigation/NextPageLink.tsx +11 -7
- package/src/PageNavigation/PreviousPageLink.tsx +10 -6
- package/src/Panel/CodePanel.ts +3 -1
- package/src/Panel/ContentPanel.ts +3 -1
- package/src/Panel/Panel.ts +3 -1
- package/src/Panel/PanelBody.ts +3 -1
- package/src/Panel/PanelComponent.tsx +1 -0
- package/src/Panel/PanelHeader.ts +3 -1
- package/src/Panel/PanelHeaderTitle.ts +3 -1
- package/src/SamplesPanelControls/SamplesPanelControls.ts +3 -1
- package/src/Search/ClearIcon.tsx +3 -1
- package/src/Search/SearchIcon.tsx +3 -1
- package/src/Search/SidebarSearch.tsx +3 -1
- package/src/Sidebar/MenuContainer.tsx +3 -1
- package/src/Sidebar/SeparatorItem.tsx +3 -1
- package/src/Sidebar/SidebarLayout.tsx +9 -5
- package/src/SidebarLogo/SidebarLogo.tsx +5 -1
- package/src/SourceCode/SourceCode.tsx +9 -2
- package/src/Tooltip/Tooltip.tsx +1 -0
- package/src/Typography/H1.ts +1 -1
- package/src/Typography/H2.ts +1 -1
- package/src/Typography/H3.ts +1 -1
- package/src/Typography/SectionHeader.ts +3 -1
- package/src/icons/ShelfIcon/ShelfIcon.tsx +3 -1
- package/src/mocks/hooks/index.ts +21 -0
|
@@ -3,5 +3,5 @@ interface SidebarLayoutProps {
|
|
|
3
3
|
versions: React.ReactNode;
|
|
4
4
|
menu: React.ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element;
|
|
6
|
+
export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null;
|
|
7
7
|
export {};
|
package/Sidebar/SidebarLayout.js
CHANGED
|
@@ -21,10 +21,13 @@ function SidebarLayout(_a) {
|
|
|
21
21
|
var versions = _a.versions, menu = _a.menu;
|
|
22
22
|
var _b = (0, useMobileMenu_1.useMobileMenu)(), isOpen = _b[0], setIsOpen = _b[1];
|
|
23
23
|
var toggleMenu = function () { return setIsOpen(!isOpen); };
|
|
24
|
-
var _c = (0, hooks_1.useThemeSettings)(constants_1.DEFAULT_THEME_NAME)
|
|
24
|
+
var _c = (0, hooks_1.useThemeSettings)(constants_1.DEFAULT_THEME_NAME), search = _c.search, sidebar = _c.sidebar;
|
|
25
|
+
if (sidebar === null || sidebar === void 0 ? void 0 : sidebar.hide) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
25
28
|
return (react_1.default.createElement(Wrapper, { "data-component-name": "Sidebar/SidebarLayout" },
|
|
26
29
|
react_1.default.createElement(MobileSidebarButton_1.MobileSidebarButton, { opened: isOpen, onClick: toggleMenu }),
|
|
27
|
-
!hide && placement === 'sidebar' ? react_1.default.createElement(SidebarSearch_1.SidebarSearch, null) : null,
|
|
30
|
+
!(search === null || search === void 0 ? void 0 : search.hide) && (search === null || search === void 0 ? void 0 : search.placement) === 'sidebar' ? react_1.default.createElement(SidebarSearch_1.SidebarSearch, null) : null,
|
|
28
31
|
react_1.default.createElement(Sidebar_1.Sidebar, { animate: true, opened: isOpen },
|
|
29
32
|
versions,
|
|
30
33
|
react_1.default.createElement(MenuContainer_1.MenuContainer, null, menu))));
|
|
@@ -16,7 +16,7 @@ function SidebarLogo(_a) {
|
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
var logo = react_1.default.createElement(LogoImgEl, { src: imageUrl, alt: altText || 'logo' });
|
|
19
|
-
return (react_1.default.createElement(LogoWrap, { "data-cy": dataTestId, style: { backgroundColor: backgroundColor } }, href ? react_1.default.createElement(Link, { href: href }, logo) : logo));
|
|
19
|
+
return (react_1.default.createElement(LogoWrap, { "data-cy": dataTestId, style: { backgroundColor: backgroundColor }, "data-component-name": "SidebarLogo/SidebarLogo" }, href ? react_1.default.createElement(Link, { href: href }, logo) : logo));
|
|
20
20
|
}
|
|
21
21
|
exports.SidebarLogo = SidebarLogo;
|
|
22
22
|
var LogoImgEl = styled_components_1.default.img(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n max-height: var(--logo-max-height);\n max-width: var(--logo-max-width);\n padding: var(--logo-padding);\n width: 100%;\n display: block;\n"], ["\n max-height: var(--logo-max-height);\n max-width: var(--logo-max-width);\n padding: var(--logo-padding);\n width: 100%;\n display: block;\n"])));
|
package/SourceCode/SourceCode.js
CHANGED
|
@@ -18,13 +18,13 @@ function SourceCode(_a) {
|
|
|
18
18
|
var lang = _a.lang, source = _a.source, externalSource = _a.externalSource, withCopyButton = _a.withCopyButton, _d = _a.dataTestId, dataTestId = _d === void 0 ? 'source-code' : _d;
|
|
19
19
|
var _source = source || ((_c = (_b = externalSource === null || externalSource === void 0 ? void 0 : externalSource.sample) === null || _b === void 0 ? void 0 : _b.get) === null || _c === void 0 ? void 0 : _c.call(_b, externalSource)) || '';
|
|
20
20
|
if (withCopyButton) {
|
|
21
|
-
return (react_1.default.createElement(CopyButton_1.CopyButtonWrapper, { data: source }, function (_a) {
|
|
21
|
+
return (react_1.default.createElement(CopyButton_1.CopyButtonWrapper, { data: source, "data-component-name": "SourceCode/SourceCode" }, function (_a) {
|
|
22
22
|
var renderCopyButton = _a.renderCopyButton;
|
|
23
23
|
return (react_1.default.createElement(SamplesPanelControls_1.SampleControlsWrap, null,
|
|
24
24
|
react_1.default.createElement(SamplesPanelControls_1.SampleControls, { "data-cy": "copy-button" }, renderCopyButton()),
|
|
25
25
|
react_1.default.createElement(Code, { lang: lang, source: _source, dataTestId: dataTestId })));
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
|
-
return react_1.default.createElement(Code, { dataTestId: dataTestId, lang: lang, source: _source });
|
|
28
|
+
return (react_1.default.createElement(Code, { dataTestId: dataTestId, lang: lang, source: _source, "data-component-name": "SourceCode/SourceCode" }));
|
|
29
29
|
}
|
|
30
30
|
exports.SourceCode = SourceCode;
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -51,7 +51,7 @@ function TooltipComponent(_a) {
|
|
|
51
51
|
var handleLeave = (0, react_1.useCallback)(function () {
|
|
52
52
|
handleClose();
|
|
53
53
|
}, [handleClose]);
|
|
54
|
-
return (react_1.default.createElement(TooltipWrapper, { onMouseEnter: isControlled ? undefined : handleEnter, onMouseLeave: isControlled ? undefined : handleLeave, onClick: isControlled ? undefined : handleLeave, className: "tooltip-".concat(className) },
|
|
54
|
+
return (react_1.default.createElement(TooltipWrapper, { onMouseEnter: isControlled ? undefined : handleEnter, onMouseLeave: isControlled ? undefined : handleLeave, onClick: isControlled ? undefined : handleLeave, className: "tooltip-".concat(className), "data-component-name": "Tooltip/Tooltip" },
|
|
55
55
|
children,
|
|
56
56
|
isOpened && (react_1.default.createElement(TooltipBody, { "data-cy": dataTestId, placement: placement, width: width }, tip))));
|
|
57
57
|
}
|
package/Typography/H1.js
CHANGED
|
@@ -11,6 +11,6 @@ exports.H1 = void 0;
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
exports.H1 = styled_components_1.default.h1.attrs(function () { return ({
|
|
14
|
-
'data-component-name': '
|
|
14
|
+
'data-component-name': 'Typography/H1',
|
|
15
15
|
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--color-content);\n margin: 0 0 25px;\n\n ", ";\n"], ["\n color: var(--color-content);\n margin: 0 0 25px;\n\n ", ";\n"])), (0, utils_1.typography)('h1', 'h'));
|
|
16
16
|
var templateObject_1;
|
package/Typography/H2.js
CHANGED
|
@@ -11,6 +11,6 @@ exports.H2 = void 0;
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
exports.H2 = styled_components_1.default.h2.attrs(function () { return ({
|
|
14
|
-
'data-component-name': '
|
|
14
|
+
'data-component-name': 'Typography/H2',
|
|
15
15
|
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--color-content);\n margin: 0 0 20px;\n\n ", ";\n"], ["\n color: var(--color-content);\n margin: 0 0 20px;\n\n ", ";\n"])), (0, utils_1.typography)('h2', 'h'));
|
|
16
16
|
var templateObject_1;
|
package/Typography/H3.js
CHANGED
|
@@ -11,6 +11,6 @@ exports.H3 = void 0;
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
exports.H3 = styled_components_1.default.h3.attrs(function () { return ({
|
|
14
|
-
'data-component-name': '
|
|
14
|
+
'data-component-name': 'Typography/H3',
|
|
15
15
|
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--color-content);\n\n ", ";\n"], ["\n color: var(--color-content);\n\n ", ";\n"])), (0, utils_1.typography)('h3', 'h'));
|
|
16
16
|
var templateObject_1;
|
|
@@ -9,5 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.SectionHeader = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
exports.SectionHeader = styled_components_1.default.h2
|
|
12
|
+
exports.SectionHeader = styled_components_1.default.h2.attrs(function () { return ({
|
|
13
|
+
'data-component-name': 'Typography/SectionHeader',
|
|
14
|
+
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0 20px;\n font-family: var(--h-font-family);\n"], ["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0 20px;\n font-family: var(--h-font-family);\n"])));
|
|
13
15
|
var templateObject_1;
|
|
@@ -7,4 +7,6 @@ export interface ShelfIconProps {
|
|
|
7
7
|
direction: 'left' | 'right' | 'up' | 'down';
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
}
|
|
10
|
-
export declare const ShelfIcon: import("styled-components").StyledComponent<({ className, style }: ShelfIconProps) => JSX.Element, any, {
|
|
10
|
+
export declare const ShelfIcon: import("styled-components").StyledComponent<({ className, style }: ShelfIconProps) => JSX.Element, any, {
|
|
11
|
+
'data-component-name': string;
|
|
12
|
+
}, "data-component-name">;
|
|
@@ -43,7 +43,9 @@ var IntShelfIcon = function (_a) {
|
|
|
43
43
|
React.createElement("path", { d: "M0.205025 1.19467L3.00503 3.99467C3.27839 4.26804 3.72161 4.26804 3.99497 3.99467C4.26834 3.7213 4.26834 3.27809 3.99497 3.00472L1.19497 0.20472C0.921608 -0.0686469 0.478392 -0.0686469 0.205025 0.20472C-0.0683418 0.478087 -0.0683417 0.921303 0.205025 1.19467Z" }),
|
|
44
44
|
React.createElement("path", { d: "M3.00503 3.00501L0.205025 5.80501C-0.0683417 6.07838 -0.0683417 6.5216 0.205025 6.79496C0.478392 7.06833 0.921608 7.06833 1.19497 6.79496L3.99497 3.99496C4.26834 3.7216 4.26834 3.27838 3.99497 3.00501C3.72161 2.73165 3.27839 2.73165 3.00503 3.00501Z" })));
|
|
45
45
|
};
|
|
46
|
-
exports.ShelfIcon = (0, styled_components_1.default)(IntShelfIcon)(
|
|
46
|
+
exports.ShelfIcon = (0, styled_components_1.default)(IntShelfIcon).attrs(function () { return ({
|
|
47
|
+
'data-component-name': 'icons/ShelfIcon/ShelfIcon',
|
|
48
|
+
}); })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n vertical-align: middle;\n transition: transform 0.2s ease-out;\n"], ["\n ", "\n vertical-align: middle;\n transition: transform 0.2s ease-out;\n"])), function (_a) {
|
|
47
49
|
var _b = _a.size, size = _b === void 0 ? '9px' : _b, _c = _a.float, float = _c === void 0 ? '' : _c, direction = _a.direction, color = _a.color;
|
|
48
50
|
return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", ";\n width: ", ";\n float: ", ";\n transform: rotateZ(", ");\n fill: ", ";\n "], ["\n height: ", ";\n width: ", ";\n float: ", ";\n transform: rotateZ(", ");\n fill: ", ";\n "])), size, size, float, directionMap[direction], (0, utils_1.getCssColorVariable)(color));
|
|
49
51
|
});
|
package/mocks/hooks/index.d.ts
CHANGED
|
@@ -2,5 +2,14 @@ interface RawTheme {
|
|
|
2
2
|
name: string;
|
|
3
3
|
settings?: any;
|
|
4
4
|
}
|
|
5
|
+
interface PageLink {
|
|
6
|
+
label: string;
|
|
7
|
+
link: string;
|
|
8
|
+
type: 'link';
|
|
9
|
+
}
|
|
5
10
|
export declare function useThemeSettings(name: string): RawTheme['settings'];
|
|
11
|
+
export declare function useSidebarSiblingsData(): {
|
|
12
|
+
nextPage: PageLink;
|
|
13
|
+
prevPage: PageLink;
|
|
14
|
+
};
|
|
6
15
|
export {};
|
package/mocks/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useThemeSettings = void 0;
|
|
3
|
+
exports.useSidebarSiblingsData = exports.useThemeSettings = void 0;
|
|
4
4
|
function useThemeSettings(name) {
|
|
5
5
|
return {
|
|
6
6
|
name: name,
|
|
@@ -14,3 +14,18 @@ function useThemeSettings(name) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
exports.useThemeSettings = useThemeSettings;
|
|
17
|
+
function useSidebarSiblingsData() {
|
|
18
|
+
return {
|
|
19
|
+
nextPage: {
|
|
20
|
+
type: 'link',
|
|
21
|
+
label: 'Page',
|
|
22
|
+
link: '#next',
|
|
23
|
+
},
|
|
24
|
+
prevPage: {
|
|
25
|
+
type: 'link',
|
|
26
|
+
label: 'Page',
|
|
27
|
+
link: '#prev',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.useSidebarSiblingsData = useSidebarSiblingsData;
|
package/package.json
CHANGED
package/settings.yaml
CHANGED
package/src/Button/Button.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export interface ButtonProps {
|
|
|
16
16
|
size?: ButtonSize;
|
|
17
17
|
extraClass?: string;
|
|
18
18
|
to?: string;
|
|
19
|
-
onClick?: () => void;
|
|
19
|
+
onClick?: (e?: any) => void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const getBlink = (): Keyframes => keyframes`
|
|
@@ -127,7 +127,7 @@ const StyledButton = styled.button.attrs(({ color = 'default', extraClass }: But
|
|
|
127
127
|
`}
|
|
128
128
|
`;
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
const ButtonComponent: React.FC<ButtonProps> = (props) => {
|
|
131
131
|
if (props.to) {
|
|
132
132
|
return (
|
|
133
133
|
<Link to={props.to}>
|
|
@@ -138,3 +138,5 @@ export const Button: React.FC<ButtonProps> = (props) => {
|
|
|
138
138
|
return <StyledButton {...props} />;
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
|
+
|
|
142
|
+
export const Button = styled(ButtonComponent)``;
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { generateCodeBlockTokens } from '@theme/utils';
|
|
4
4
|
|
|
5
|
-
export const CodeBlock = styled.div
|
|
5
|
+
export const CodeBlock = styled.div.attrs(() => ({
|
|
6
|
+
'data-component-name': 'CodeBlock/CodeBlock',
|
|
7
|
+
}))`
|
|
6
8
|
max-height: var(--code-block-max-height, 600px);
|
|
7
9
|
word-break: var(--code-block-word-break, initial);
|
|
8
10
|
/**
|
|
@@ -19,7 +19,12 @@ export const CopyButton = ({ text, dataTestId = 'copy-button' }: CopyButtonProps
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<Button
|
|
22
|
+
<Button
|
|
23
|
+
color="secondary"
|
|
24
|
+
onClick={write}
|
|
25
|
+
data-cy={dataTestId}
|
|
26
|
+
data-component-name="CopyButton/CopyButton"
|
|
27
|
+
>
|
|
23
28
|
{title}
|
|
24
29
|
</Button>
|
|
25
30
|
);
|
package/src/Footer/Footer.tsx
CHANGED
|
@@ -4,13 +4,17 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { FooterColumns } from '@theme/Footer/FooterColumns';
|
|
5
5
|
import { FooterCopyright } from '@theme/Footer/FooterCopyright';
|
|
6
6
|
import type { NavGroupRecord } from '@theme/types/portal';
|
|
7
|
+
import { useThemeSettings } from '@portal/hooks';
|
|
8
|
+
import { USER_THEME_ALIAS } from '@portal/constants';
|
|
7
9
|
|
|
8
10
|
interface FooterProps {
|
|
9
11
|
data: NavGroupRecord;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export function Footer({ data: { columns, copyrightText } }: FooterProps): JSX.Element | null {
|
|
13
|
-
|
|
15
|
+
const { footer } = useThemeSettings(USER_THEME_ALIAS);
|
|
16
|
+
|
|
17
|
+
if (!(columns?.length || copyrightText) || footer?.hide) {
|
|
14
18
|
return null;
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -103,7 +103,9 @@ function JsonComponent({ data, jsonSampleExpandLevel, className }: JsonProps): J
|
|
|
103
103
|
|
|
104
104
|
export const Json = memo<JsonProps>(JsonComponent);
|
|
105
105
|
|
|
106
|
-
export const JsonViewer = styled(Json)
|
|
106
|
+
export const JsonViewer = styled(Json).attrs(() => ({
|
|
107
|
+
'data-component-name': 'JsonViewer/JsonViewer',
|
|
108
|
+
}))<JsonProps>`
|
|
107
109
|
.redoc-json code {
|
|
108
110
|
background-color: var(--samples-panel-controls-background-color);
|
|
109
111
|
color: var(--color-content-inverse);
|
|
@@ -95,8 +95,8 @@ export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation
|
|
|
95
95
|
`;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
export const
|
|
99
|
-
'data-component-name': 'Markdown/
|
|
98
|
+
export const MarkdownWrapper = styled.main.attrs(() => ({
|
|
99
|
+
'data-component-name': 'Markdown/MarkdownWrapper',
|
|
100
100
|
}))`
|
|
101
101
|
font-weight: var(--font-weight-regular);
|
|
102
102
|
padding: 0;
|
package/src/Markdown/index.ts
CHANGED
|
@@ -6,4 +6,4 @@ export * from '@theme/Markdown/Heading';
|
|
|
6
6
|
export * from '@theme/Markdown/MarkdownLayout';
|
|
7
7
|
export * from '@theme/Markdown/Mermaid';
|
|
8
8
|
export * from '@theme/Markdown/PageWrapper';
|
|
9
|
-
export * from '@theme/Markdown/
|
|
9
|
+
export * from '@theme/Markdown/MarkdownWrapper';
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -12,11 +12,15 @@ interface NavbarProps {
|
|
|
12
12
|
search: React.ReactNode;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
|
|
16
|
-
const
|
|
15
|
+
export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element | null {
|
|
16
|
+
const settings = useThemeSettings(USER_THEME_ALIAS);
|
|
17
|
+
const searchSettings = settings.search;
|
|
17
18
|
const hideSearch =
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
searchSettings?.hide || (searchSettings?.placement && searchSettings?.placement !== 'navbar');
|
|
20
|
+
|
|
21
|
+
if (settings?.navbar?.hide) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
return (
|
|
22
26
|
<NavbarContainer data-component-name="Navbar/Navbar">
|
|
@@ -2,6 +2,7 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
|
|
4
4
|
className: `operation-type ${props.type}`,
|
|
5
|
+
'data-component-name': 'OperationBadge/OperationBadge',
|
|
5
6
|
}))<{ type: string }>`
|
|
6
7
|
display: inline-flex;
|
|
7
8
|
align-items: center;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { DEFAULT_THEME_NAME } from '@portal/constants/';
|
|
3
|
+
import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
4
|
+
import { useThemeSettings, useSidebarSiblingsData } from '@portal/hooks';
|
|
5
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
7
6
|
import { Button } from '@theme/Button/Button';
|
|
8
7
|
|
|
9
8
|
interface NextPageType {
|
|
10
|
-
nextPage?:
|
|
9
|
+
nextPage?: ResolvedNavItemWithLink | null;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function NextPageLink(): JSX.Element {
|
|
14
|
-
const { nextPage }: NextPageType =
|
|
13
|
+
const { nextPage }: NextPageType = useSidebarSiblingsData() || {};
|
|
15
14
|
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
15
|
|
|
17
16
|
if (!nextPage || themeSettings?.navigation?.hide) {
|
|
@@ -21,7 +20,12 @@ export function NextPageLink(): JSX.Element {
|
|
|
21
20
|
const label = themeSettings?.navigation?.nextPageLink?.label || `Next to ${nextPage.label}`;
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
|
-
<Button
|
|
23
|
+
<Button
|
|
24
|
+
variant="outlined"
|
|
25
|
+
size="large"
|
|
26
|
+
to={nextPage.link}
|
|
27
|
+
data-component-name="PageNavigation/NextPageLink"
|
|
28
|
+
>
|
|
25
29
|
{label}
|
|
26
30
|
</Button>
|
|
27
31
|
);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { useThemeSettings } from '@portal/hooks';
|
|
3
|
+
import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
4
|
+
import { useThemeSettings, useSidebarSiblingsData } from '@portal/hooks';
|
|
6
5
|
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
7
6
|
import { Button } from '@theme/Button/Button';
|
|
8
7
|
|
|
9
8
|
interface PreviousPageType {
|
|
10
|
-
prevPage?:
|
|
9
|
+
prevPage?: ResolvedNavItemWithLink | null;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function PreviousPageLink(): JSX.Element {
|
|
14
|
-
const { prevPage }: PreviousPageType =
|
|
13
|
+
const { prevPage }: PreviousPageType = useSidebarSiblingsData() || {};
|
|
15
14
|
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
15
|
|
|
17
16
|
if (!prevPage || themeSettings?.navigation?.hide) {
|
|
@@ -21,7 +20,12 @@ export function PreviousPageLink(): JSX.Element {
|
|
|
21
20
|
const label = themeSettings?.navigation?.nextPageLink?.label || `Back to ${prevPage.label}`;
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
|
-
<Button
|
|
23
|
+
<Button
|
|
24
|
+
variant="outlined"
|
|
25
|
+
size="large"
|
|
26
|
+
to={prevPage.link}
|
|
27
|
+
data-component-name="PageNavigation/PreviousPageLink"
|
|
28
|
+
>
|
|
25
29
|
{label}
|
|
26
30
|
</Button>
|
|
27
31
|
);
|
package/src/Panel/CodePanel.ts
CHANGED
|
@@ -7,7 +7,9 @@ import { DarkHeader } from '@theme/Panel/DarkHeader';
|
|
|
7
7
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
8
8
|
import { PanelHeaderTitle } from '@theme/Panel/PanelHeaderTitle';
|
|
9
9
|
|
|
10
|
-
export const CodePanel = styled(Panel)
|
|
10
|
+
export const CodePanel = styled(Panel).attrs(() => ({
|
|
11
|
+
'data-component-name': 'Panel/CodePanel',
|
|
12
|
+
}))`
|
|
11
13
|
> ${PanelHeader} {
|
|
12
14
|
${DarkHeader};
|
|
13
15
|
min-height: 50px;
|
|
@@ -6,7 +6,9 @@ import { Panel } from '@theme/Panel/Panel';
|
|
|
6
6
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
7
7
|
import { PanelHeader } from '@theme/Panel/PanelHeader';
|
|
8
8
|
|
|
9
|
-
export const ContentPanel = styled(Panel)
|
|
9
|
+
export const ContentPanel = styled(Panel).attrs(() => ({
|
|
10
|
+
'data-component-name': 'Panel/ContentPanel',
|
|
11
|
+
}))`
|
|
10
12
|
border: 1px solid var(--global-border-color);
|
|
11
13
|
|
|
12
14
|
font-size: var(--font-size-base);
|
package/src/Panel/Panel.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { PanelHeader } from '@theme/Panel/PanelHeader';
|
|
|
4
4
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
5
5
|
import { PanelComponent } from '@theme/Panel/PanelComponent';
|
|
6
6
|
|
|
7
|
-
export const Panel = styled(PanelComponent)
|
|
7
|
+
export const Panel = styled(PanelComponent).attrs(() => ({
|
|
8
|
+
'data-component-name': 'Panel/Panel',
|
|
9
|
+
}))`
|
|
8
10
|
border-radius: var(--panels-border-radius);
|
|
9
11
|
|
|
10
12
|
${PanelHeader} + ${PanelBody} {
|
package/src/Panel/PanelBody.ts
CHANGED
|
@@ -18,7 +18,9 @@ interface PanelBodyProps {
|
|
|
18
18
|
hidden?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const PanelBody = styled.div
|
|
21
|
+
export const PanelBody = styled.div.attrs(() => ({
|
|
22
|
+
'data-component-name': 'Panel/PanelBody',
|
|
23
|
+
}))<PanelBodyProps>`
|
|
22
24
|
${({ animate }) => animate && showPanelAnimation};
|
|
23
25
|
${({ hidden }) => hidden && 'visibility: hidden'};
|
|
24
26
|
|
package/src/Panel/PanelHeader.ts
CHANGED
|
@@ -7,7 +7,9 @@ export interface PanelHeaderProps {
|
|
|
7
7
|
toggle?: (e: BaseSyntheticEvent) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const PanelHeader = styled.div
|
|
10
|
+
export const PanelHeader = styled.div.attrs(() => ({
|
|
11
|
+
'data-component-name': 'Panel/PanelHeader',
|
|
12
|
+
}))<PanelHeaderProps>`
|
|
11
13
|
position: relative;
|
|
12
14
|
z-index: 1;
|
|
13
15
|
display: flex;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const PanelHeaderTitle = styled.span
|
|
3
|
+
export const PanelHeaderTitle = styled.span.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Panel/PanelHeaderTitle',
|
|
5
|
+
}))`
|
|
4
6
|
line-height: 1;
|
|
5
7
|
margin-right: 5px;
|
|
6
8
|
font-weight: 700;
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { CodeBlock } from '@theme/CodeBlock';
|
|
4
4
|
|
|
5
|
-
export const SamplesControlButton = styled.button
|
|
5
|
+
export const SamplesControlButton = styled.button.attrs(() => ({
|
|
6
|
+
'data-component-name': 'SamplesPanelControls/SamplesPanelControls',
|
|
7
|
+
}))`
|
|
6
8
|
background-color: var(--samples-panel-controls-background-color);
|
|
7
9
|
border: 0;
|
|
8
10
|
outline: 0;
|
package/src/Search/ClearIcon.tsx
CHANGED
|
@@ -15,7 +15,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const ClearIcon = styled(Icon)
|
|
18
|
+
export const ClearIcon = styled(Icon).attrs(() => ({
|
|
19
|
+
'data-component-name': 'Search/ClearIcon',
|
|
20
|
+
}))`
|
|
19
21
|
position: absolute;
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
width: 0.5em;
|
|
@@ -15,7 +15,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const SearchIcon = styled(Icon)
|
|
18
|
+
export const SearchIcon = styled(Icon).attrs(() => ({
|
|
19
|
+
'data-component-name': 'Search/SearchIcon',
|
|
20
|
+
}))`
|
|
19
21
|
position: absolute;
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
width: 1em;
|
|
@@ -3,7 +3,9 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { Search } from '@theme/Search/Search';
|
|
4
4
|
import { Popover } from '@theme/Search/Popover';
|
|
5
5
|
|
|
6
|
-
export const SidebarSearch = styled(Search)
|
|
6
|
+
export const SidebarSearch = styled(Search).attrs(() => ({
|
|
7
|
+
'data-component-name': 'Search/SidebarSearch',
|
|
8
|
+
}))`
|
|
7
9
|
--search-input-text-color: var(--sidebar-item-active-color);
|
|
8
10
|
|
|
9
11
|
${Popover} {
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
4
4
|
|
|
5
|
-
export const SeparatorItem = styled(MenuItemLabel)
|
|
5
|
+
export const SeparatorItem = styled(MenuItemLabel).attrs(() => ({
|
|
6
|
+
'data-component-name': 'Sidebar/SeparatorItem',
|
|
7
|
+
}))`
|
|
6
8
|
cursor: default;
|
|
7
9
|
font-weight: var(--font-weight-bold);
|
|
8
10
|
color: var(--sidebar-separator-label-color);
|
|
@@ -5,8 +5,8 @@ import { Sidebar } from '@theme/Sidebar/Sidebar';
|
|
|
5
5
|
import { useMobileMenu } from '@theme/hooks/useMobileMenu';
|
|
6
6
|
import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
|
|
7
7
|
import { MenuContainer } from '@theme/Sidebar/MenuContainer';
|
|
8
|
-
import { useThemeSettings } from '@portal/hooks
|
|
9
|
-
import { DEFAULT_THEME_NAME } from '@portal/constants
|
|
8
|
+
import { useThemeSettings } from '@portal/hooks';
|
|
9
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
10
10
|
import { SidebarSearch } from '@theme/Search/SidebarSearch';
|
|
11
11
|
|
|
12
12
|
interface SidebarLayoutProps {
|
|
@@ -14,16 +14,20 @@ interface SidebarLayoutProps {
|
|
|
14
14
|
menu: React.ReactNode;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element {
|
|
17
|
+
export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null {
|
|
18
18
|
const [isOpen, setIsOpen] = useMobileMenu();
|
|
19
19
|
const toggleMenu = () => setIsOpen(!isOpen);
|
|
20
|
-
const {
|
|
20
|
+
const { search, sidebar } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
21
|
+
|
|
22
|
+
if (sidebar?.hide) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
return (
|
|
23
27
|
<Wrapper data-component-name="Sidebar/SidebarLayout">
|
|
24
28
|
<MobileSidebarButton opened={isOpen} onClick={toggleMenu} />
|
|
25
29
|
|
|
26
|
-
{!hide && placement === 'sidebar' ? <SidebarSearch /> : null}
|
|
30
|
+
{!search?.hide && search?.placement === 'sidebar' ? <SidebarSearch /> : null}
|
|
27
31
|
<Sidebar animate={true} opened={isOpen}>
|
|
28
32
|
{versions}
|
|
29
33
|
<MenuContainer>{menu}</MenuContainer>
|
|
@@ -23,7 +23,11 @@ export function SidebarLogo({
|
|
|
23
23
|
const logo = <LogoImgEl src={imageUrl} alt={altText || 'logo'} />;
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<LogoWrap
|
|
26
|
+
<LogoWrap
|
|
27
|
+
data-cy={dataTestId}
|
|
28
|
+
style={{ backgroundColor }}
|
|
29
|
+
data-component-name="SidebarLogo/SidebarLogo"
|
|
30
|
+
>
|
|
27
31
|
{href ? <Link href={href}>{logo}</Link> : logo}
|
|
28
32
|
</LogoWrap>
|
|
29
33
|
);
|
|
@@ -56,7 +56,7 @@ export function SourceCode({
|
|
|
56
56
|
const _source = source || externalSource?.sample?.get?.(externalSource) || '';
|
|
57
57
|
if (withCopyButton) {
|
|
58
58
|
return (
|
|
59
|
-
<CopyButtonWrapper data={source}>
|
|
59
|
+
<CopyButtonWrapper data={source} data-component-name="SourceCode/SourceCode">
|
|
60
60
|
{({ renderCopyButton }) => (
|
|
61
61
|
<SampleControlsWrap>
|
|
62
62
|
<SampleControls data-cy="copy-button">{renderCopyButton()}</SampleControls>
|
|
@@ -67,5 +67,12 @@ export function SourceCode({
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return (
|
|
71
|
+
<Code
|
|
72
|
+
dataTestId={dataTestId}
|
|
73
|
+
lang={lang}
|
|
74
|
+
source={_source}
|
|
75
|
+
data-component-name="SourceCode/SourceCode"
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
71
78
|
}
|