@redocly/theme 0.2.2 → 0.4.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/Button/Button.js +3 -3
- package/CodeBlock/CodeBlock.js +1 -1
- package/ColorModeSwitcher/ColorModeSwitcher.d.ts +2 -0
- package/ColorModeSwitcher/ColorModeSwitcher.js +80 -0
- package/ColorModeSwitcher/index.d.ts +1 -0
- package/ColorModeSwitcher/index.js +17 -0
- package/CopyButton/CopyButtonWrapper.d.ts +2 -1
- package/CopyButton/CopyButtonWrapper.js +3 -2
- package/Footer/Footer.js +1 -1
- package/Footer/FooterColumn.js +4 -4
- package/Footer/FooterColumns.js +1 -1
- package/Footer/FooterCopyright.js +1 -1
- package/JsonViewer/JsonViewer.js +1 -1
- package/Markdown/Admonition.js +3 -3
- package/Markdown/CodeSample/CodeSample.js +3 -3
- package/Markdown/ContainerWrapper.d.ts +5 -0
- package/Markdown/ContainerWrapper.js +21 -0
- package/Markdown/Details.d.ts +6 -0
- package/Markdown/Details.js +22 -0
- package/Markdown/MarkdownLayout.d.ts +3 -1
- package/Markdown/MarkdownLayout.js +4 -4
- package/Markdown/MarkdownWrapper.js +3 -3
- package/Markdown/index.d.ts +1 -1
- package/Markdown/index.js +1 -1
- package/Navbar/MobileNavbarItem.js +1 -1
- package/Navbar/MobileNavbarMenu.js +6 -6
- package/Navbar/Navbar.d.ts +1 -0
- package/Navbar/Navbar.js +11 -7
- package/Navbar/NavbarDropdown.js +1 -1
- package/Navbar/NavbarItem.d.ts +3 -3
- package/Navbar/NavbarItem.js +17 -14
- package/Navbar/NavbarMenu.js +2 -2
- package/NavbarLogo/NavbarLogo.js +1 -1
- package/OperationBadge/OperationBadge.js +1 -1
- package/PageNavigation/PageNavigation.d.ts +6 -1
- package/PageNavigation/PageNavigation.js +4 -3
- package/Panel/Panel.d.ts +2 -1
- package/Panel/Panel.js +8 -3
- package/Panel/PanelBody.js +1 -1
- package/Panel/PanelComponent.d.ts +3 -2
- package/Panel/PanelComponent.js +3 -2
- package/Panel/PanelHeader.d.ts +1 -1
- package/Panel/PanelHeader.js +3 -3
- package/Panel/PanelHeaderTitle.js +1 -1
- package/Panel/index.d.ts +0 -3
- package/Panel/index.js +0 -3
- package/Profile/Profile.js +1 -1
- package/SamplesPanelControls/SamplesPanelControls.js +6 -4
- package/Search/Autocomplete.js +1 -1
- package/Search/Input.js +1 -1
- package/Search/Parameters.js +1 -1
- package/Search/Popover.js +1 -1
- package/Search/Search.js +1 -1
- package/Search/SearchItem.js +3 -3
- package/Search/utils.js +1 -1
- package/Sidebar/ApiCallItem.js +1 -1
- package/Sidebar/ArrowBack.js +1 -1
- package/Sidebar/BackButton.js +1 -1
- package/Sidebar/Drilldown.js +1 -1
- package/Sidebar/DrilldownMenu.js +2 -2
- package/Sidebar/DrilldownMenuItem.js +3 -3
- package/Sidebar/ExternalIcon.js +1 -1
- package/Sidebar/Menu.js +1 -1
- package/Sidebar/MenuContainer.js +1 -1
- package/Sidebar/MenuGroup.js +6 -2
- package/Sidebar/MenuItemLabel.js +1 -1
- package/Sidebar/MenuLink.js +1 -1
- package/Sidebar/SeparatorItem.js +1 -1
- package/Sidebar/SeparatorLine.js +1 -1
- package/Sidebar/Sidebar.js +1 -1
- package/SidebarLogo/SidebarLogo.js +1 -1
- package/SourceCode/SourceCode.js +5 -5
- package/TableOfContent/TableOfContent.js +5 -5
- 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.js +1 -1
- package/Typography/Typography.js +1 -1
- package/globalStyle.d.ts +1 -0
- package/globalStyle.js +29 -25
- package/hooks/useActiveHeading.js +6 -5
- package/icons/ArrowIcon/ArrowIcon.js +1 -1
- package/icons/ColorModeIcon/ColorModeIcon.d.ts +10 -0
- package/icons/ColorModeIcon/ColorModeIcon.js +30 -0
- package/icons/ColorModeIcon/index.d.ts +2 -0
- package/icons/ColorModeIcon/index.js +5 -0
- package/icons/index.d.ts +1 -0
- package/icons/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/mocks/hooks/index.js +4 -0
- package/package.json +1 -1
- package/src/Button/Button.tsx +14 -6
- package/src/CodeBlock/CodeBlock.ts +2 -4
- package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +48 -0
- package/src/ColorModeSwitcher/index.ts +1 -0
- package/src/CopyButton/CopyButtonWrapper.tsx +6 -3
- package/src/Footer/Footer.tsx +3 -2
- package/src/Footer/FooterColumn.tsx +13 -9
- package/src/Footer/FooterColumns.tsx +2 -2
- package/src/Footer/FooterCopyright.tsx +1 -1
- package/src/JsonViewer/JsonViewer.tsx +5 -5
- package/src/Markdown/Admonition.tsx +3 -2
- package/src/Markdown/CodeSample/CodeSample.tsx +18 -17
- package/src/Markdown/{ContentWrapper.tsx → ContainerWrapper.tsx} +4 -4
- package/src/Markdown/Details.tsx +19 -0
- package/src/Markdown/MarkdownLayout.tsx +8 -4
- package/src/Markdown/MarkdownWrapper.tsx +87 -47
- package/src/Markdown/index.ts +1 -1
- package/src/Navbar/MobileNavbarItem.tsx +1 -3
- package/src/Navbar/MobileNavbarMenu.tsx +19 -17
- package/src/Navbar/Navbar.tsx +20 -9
- package/src/Navbar/NavbarDropdown.tsx +2 -1
- package/src/Navbar/NavbarItem.tsx +41 -24
- package/src/Navbar/NavbarMenu.tsx +3 -3
- package/src/NavbarLogo/NavbarLogo.tsx +4 -4
- package/src/OperationBadge/OperationBadge.ts +8 -9
- package/src/PageNavigation/PageNavigation.tsx +11 -3
- package/src/Panel/Panel.ts +17 -3
- package/src/Panel/PanelBody.ts +13 -5
- package/src/Panel/PanelComponent.tsx +3 -0
- package/src/Panel/PanelHeader.ts +13 -6
- package/src/Panel/PanelHeaderTitle.ts +6 -4
- package/src/Panel/index.ts +0 -3
- package/src/Profile/Profile.tsx +1 -1
- package/src/SamplesPanelControls/SamplesPanelControls.ts +9 -9
- package/src/Search/Autocomplete.tsx +1 -1
- package/src/Search/Input.tsx +7 -2
- package/src/Search/Parameters.tsx +1 -1
- package/src/Search/Popover.tsx +3 -3
- package/src/Search/Search.tsx +3 -1
- package/src/Search/SearchItem.tsx +14 -9
- package/src/Search/utils.tsx +1 -1
- package/src/Sidebar/ApiCallItem.tsx +7 -0
- package/src/Sidebar/ArrowBack.tsx +1 -1
- package/src/Sidebar/BackButton.tsx +10 -5
- package/src/Sidebar/Drilldown.tsx +1 -3
- package/src/Sidebar/DrilldownMenu.tsx +2 -2
- package/src/Sidebar/DrilldownMenuItem.tsx +12 -8
- package/src/Sidebar/ExternalIcon.tsx +1 -1
- package/src/Sidebar/Menu.tsx +1 -1
- package/src/Sidebar/MenuContainer.tsx +1 -1
- package/src/Sidebar/MenuGroup.tsx +12 -2
- package/src/Sidebar/MenuItemLabel.tsx +7 -7
- package/src/Sidebar/MenuLink.tsx +1 -1
- package/src/Sidebar/SeparatorItem.tsx +5 -1
- package/src/Sidebar/SeparatorLine.tsx +2 -2
- package/src/Sidebar/Sidebar.tsx +4 -4
- package/src/SidebarLogo/SidebarLogo.tsx +3 -3
- package/src/SourceCode/SourceCode.tsx +4 -4
- package/src/TableOfContent/TableOfContent.tsx +18 -16
- package/src/Tooltip/Tooltip.tsx +2 -2
- package/src/Typography/H1.ts +2 -2
- package/src/Typography/H2.ts +2 -2
- package/src/Typography/H3.ts +2 -1
- package/src/Typography/SectionHeader.ts +4 -4
- package/src/Typography/Typography.ts +1 -1
- package/src/globalStyle.ts +1424 -337
- package/src/hooks/useActiveHeading.ts +41 -34
- package/src/icons/ArrowIcon/ArrowIcon.tsx +3 -3
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +53 -0
- package/src/icons/ColorModeIcon/index.ts +2 -0
- package/src/icons/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/mocks/hooks/index.ts +4 -0
- package/src/settings.yaml +6 -0
- package/src/ui/Background.tsx +1 -1
- package/src/ui/Dropdown.tsx +6 -6
- package/src/ui/Jumbotron.tsx +1 -1
- package/src/ui/Tiles/TileHeader.ts +5 -5
- package/src/ui/Tiles/TileText.tsx +1 -1
- package/src/ui/UniversalLink.tsx +1 -1
- package/src/utils/theme-helpers.ts +1 -1
- package/ui/Background.js +1 -1
- package/ui/Dropdown.js +4 -4
- package/ui/Jumbotron.js +1 -1
- package/ui/Tiles/TileHeader.js +1 -1
- package/ui/Tiles/TileText.js +1 -1
- package/ui/UniversalLink.js +1 -1
- package/utils/theme-helpers.js +1 -1
- package/Markdown/ContentWrapper.d.ts +0 -5
- package/Markdown/ContentWrapper.js +0 -21
- package/Panel/CodePanel.d.ts +0 -5
- package/Panel/CodePanel.js +0 -21
- package/Panel/ContentPanel.d.ts +0 -5
- package/Panel/ContentPanel.js +0 -20
- package/Panel/DarkHeader.d.ts +0 -1
- package/Panel/DarkHeader.js +0 -10
- package/src/Panel/CodePanel.ts +0 -34
- package/src/Panel/ContentPanel.ts +0 -44
- package/src/Panel/DarkHeader.ts +0 -8
|
@@ -34,14 +34,14 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
34
34
|
}
|
|
35
35
|
return visibleHeadings;
|
|
36
36
|
};
|
|
37
|
-
var getIndexFromId = function (id) {
|
|
37
|
+
var getIndexFromId = (0, react_1.useCallback)(function (id) {
|
|
38
38
|
return headingElements.findIndex(function (item) { return item.id === id; });
|
|
39
|
-
};
|
|
39
|
+
}, [headingElements]);
|
|
40
40
|
var findHeaders = function (allContent) {
|
|
41
41
|
var allHeaders = allContent.querySelectorAll('.heading-anchor');
|
|
42
42
|
return Array.from(allHeaders);
|
|
43
43
|
};
|
|
44
|
-
var intersectionCallback = function (headings) {
|
|
44
|
+
var intersectionCallback = (0, react_1.useCallback)(function (headings) {
|
|
45
45
|
var _a;
|
|
46
46
|
headingElementsRef.current = headings.reduce(function (map, headingElement) {
|
|
47
47
|
map[headingElement.target.id] = headingElement;
|
|
@@ -66,7 +66,7 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
66
66
|
return getIndexFromId(a.target.id) - getIndexFromId(b.target.id);
|
|
67
67
|
});
|
|
68
68
|
setHeading(visibleHeadings[0].target.id);
|
|
69
|
-
};
|
|
69
|
+
}, [getIndexFromId, headingElements]);
|
|
70
70
|
(0, react_1.useEffect)(function () {
|
|
71
71
|
if (!contentElement) {
|
|
72
72
|
return;
|
|
@@ -76,6 +76,7 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
76
76
|
setHeadingElements(findHeaders(contentElement));
|
|
77
77
|
});
|
|
78
78
|
return function () { return unlisten(); };
|
|
79
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
80
|
}, [contentElement]);
|
|
80
81
|
(0, react_1.useEffect)(function () {
|
|
81
82
|
if (!(headingElements === null || headingElements === void 0 ? void 0 : headingElements.length)) {
|
|
@@ -93,7 +94,7 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
96
|
return function () { return observer.disconnect(); };
|
|
96
|
-
}, [headingElements, displayedHeaders]);
|
|
97
|
+
}, [headingElements, displayedHeaders, intersectionCallback]);
|
|
97
98
|
return heading;
|
|
98
99
|
}
|
|
99
100
|
exports.useActiveHeading = useActiveHeading;
|
|
@@ -29,5 +29,5 @@ var Icon = function (_a) {
|
|
|
29
29
|
react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 7 5", className: className },
|
|
30
30
|
react_1.default.createElement("path", { d: "M3.5 2.51L5.806.205a.7.7 0 01.99.99l-2.8 2.8a.698.698 0 01-.99 0l-2.8-2.8a.7.7 0 11.99-.99L3.5 2.51z" }))));
|
|
31
31
|
};
|
|
32
|
-
exports.ArrowIcon = (0, styled_components_1.default)(Icon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: var(--sidebar-chevron-size);\n height: var(--sidebar-chevron-size);\n fill: var(--sidebar-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"], ["\n width: var(--sidebar-chevron-size);\n height: var(--sidebar-chevron-size);\n fill: var(--sidebar-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"])), directionToTransform);
|
|
32
|
+
exports.ArrowIcon = (0, styled_components_1.default)(Icon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: var(--sidebar-group-item-chevron-size);\n height: var(--sidebar-group-item-chevron-size);\n fill: var(--sidebar-group-item-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"], ["\n width: var(--sidebar-group-item-chevron-size);\n height: var(--sidebar-group-item-chevron-size);\n fill: var(--sidebar-group-item-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"])), directionToTransform);
|
|
33
33
|
var templateObject_1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ColorModeIconProps {
|
|
3
|
+
mode?: 'dark' | 'light' | string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare function Icon({ mode, className }: ColorModeIconProps): JSX.Element;
|
|
7
|
+
export declare const ColorModeIcon: import("styled-components").StyledComponent<typeof Icon, any, {
|
|
8
|
+
'data-component-name': string;
|
|
9
|
+
}, "data-component-name">;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ColorModeIcon = void 0;
|
|
11
|
+
var react_1 = __importDefault(require("react"));
|
|
12
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
13
|
+
function Icon(_a) {
|
|
14
|
+
var mode = _a.mode, className = _a.className;
|
|
15
|
+
switch (mode) {
|
|
16
|
+
case 'dark':
|
|
17
|
+
return (react_1.default.createElement("svg", { className: className, "data-testid": "dark", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
|
|
18
|
+
react_1.default.createElement("path", { d: "M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z" })));
|
|
19
|
+
case 'light':
|
|
20
|
+
return (react_1.default.createElement("svg", { "data-testid": "light", className: className, viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
|
|
21
|
+
react_1.default.createElement("path", { d: "M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z" })));
|
|
22
|
+
default:
|
|
23
|
+
return (react_1.default.createElement("svg", { "data-testid": "custom", className: className, viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
|
|
24
|
+
react_1.default.createElement("path", { d: "M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm0 13V2a6 6 0 1 1 0 12z" })));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ColorModeIcon = (0, styled_components_1.default)(Icon).attrs(function () { return ({
|
|
28
|
+
'data-component-name': 'icons/ColorModeIcon/ColorModeIcon',
|
|
29
|
+
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: var(--navbar-item-font-size);\n box-sizing: border-box;\n fill: var(--navbar-text-color);\n"], ["\n width: var(--navbar-item-font-size);\n box-sizing: border-box;\n fill: var(--navbar-text-color);\n"])));
|
|
30
|
+
var templateObject_1;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorModeIcon = void 0;
|
|
4
|
+
var ColorModeIcon_1 = require("../../icons/ColorModeIcon/ColorModeIcon");
|
|
5
|
+
Object.defineProperty(exports, "ColorModeIcon", { enumerable: true, get: function () { return ColorModeIcon_1.ColorModeIcon; } });
|
package/icons/index.d.ts
CHANGED
package/icons/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("../icons/ShelfIcon"), exports);
|
|
18
18
|
__exportStar(require("../icons/AlertIcon"), exports);
|
|
19
19
|
__exportStar(require("../icons/ArrowIcon"), exports);
|
|
20
|
+
__exportStar(require("../icons/ColorModeIcon"), exports);
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/mocks/hooks/index.js
CHANGED
|
@@ -8,6 +8,10 @@ function useThemeSettings(_) {
|
|
|
8
8
|
nextPageLink: { label: 'next page theme settings label' },
|
|
9
9
|
previousPageLink: { label: 'prev page theme settings label' },
|
|
10
10
|
},
|
|
11
|
+
colorMode: {
|
|
12
|
+
modes: ['light', 'dark'],
|
|
13
|
+
default: 'light',
|
|
14
|
+
},
|
|
11
15
|
};
|
|
12
16
|
}
|
|
13
17
|
exports.useThemeSettings = useThemeSettings;
|
package/package.json
CHANGED
package/src/Button/Button.tsx
CHANGED
|
@@ -57,7 +57,7 @@ export const baseButtonStyles = css`
|
|
|
57
57
|
box-shadow: var(--button-box-shadow);
|
|
58
58
|
|
|
59
59
|
&:hover {
|
|
60
|
-
box-shadow: var(--button-
|
|
60
|
+
box-shadow: var(--button-hover-box-shadow);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
&:active {
|
|
@@ -80,15 +80,21 @@ const StyledButton = styled.button.attrs(({ color = 'default', extraClass }: But
|
|
|
80
80
|
variant === 'outlined'
|
|
81
81
|
? css`
|
|
82
82
|
color: var(--button-background-color);
|
|
83
|
-
border: 2px solid var(--button-
|
|
83
|
+
border: 2px solid var(--button-border-color);
|
|
84
84
|
background-color: transparent;
|
|
85
85
|
&:hover {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
color: var(--button-hover-background-color);
|
|
87
|
+
border: 2px solid var(--button-hover-border-color);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
&:active {
|
|
91
|
-
|
|
91
|
+
color: var(--button-active-background-color);
|
|
92
|
+
border: 2px solid var(--button-active-border-color);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:disabled {
|
|
96
|
+
color: var(--button-disabled-background-color);
|
|
97
|
+
background-color: transparent;
|
|
92
98
|
}
|
|
93
99
|
`
|
|
94
100
|
: css`
|
|
@@ -125,7 +131,9 @@ const StyledButton = styled.button.attrs(({ color = 'default', extraClass }: But
|
|
|
125
131
|
&,
|
|
126
132
|
&:hover {
|
|
127
133
|
cursor: default;
|
|
128
|
-
color:
|
|
134
|
+
color: var(--button-disabled-color);
|
|
135
|
+
background-color: var(--button-disabled-background-color);
|
|
136
|
+
border-color: var(--button-disabled-background-color);
|
|
129
137
|
pointer-events: none;
|
|
130
138
|
}
|
|
131
139
|
`}
|
|
@@ -12,8 +12,6 @@ export const CodeBlock = styled.div.attrs(() => ({
|
|
|
12
12
|
*/
|
|
13
13
|
code[class*='language-'],
|
|
14
14
|
pre[class*='language-'] {
|
|
15
|
-
/* color: white;
|
|
16
|
-
background: none; */
|
|
17
15
|
text-shadow: 0 -0.1em 0.2em black;
|
|
18
16
|
text-align: left;
|
|
19
17
|
white-space: pre;
|
|
@@ -62,13 +60,13 @@ export const CodeBlock = styled.div.attrs(() => ({
|
|
|
62
60
|
.token.inserted {
|
|
63
61
|
& + a,
|
|
64
62
|
& + a:visited {
|
|
65
|
-
color:
|
|
63
|
+
color: var(--code-block-tokens-link-color);
|
|
66
64
|
text-decoration: underline;
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
.token.property.string {
|
|
71
|
-
color:
|
|
69
|
+
color: var(--code-block-tokens-property-string-color);
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
.token.important,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { useThemeSettings } from '@portal/hooks';
|
|
5
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
6
|
+
import { ColorModeIcon } from '@theme/icons/ColorModeIcon';
|
|
7
|
+
import { useMount } from '@theme/hooks';
|
|
8
|
+
|
|
9
|
+
export function ColorModeSwitcher(): JSX.Element | null {
|
|
10
|
+
const themeSettings = useThemeSettings(DEFAULT_THEME_NAME);
|
|
11
|
+
const colorMode = themeSettings.colorMode;
|
|
12
|
+
const [activeColorMode, setActiveColorMode] = useState('');
|
|
13
|
+
|
|
14
|
+
useMount(() => {
|
|
15
|
+
setActiveColorMode(document.documentElement.className || colorMode?.default);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (!colorMode?.modes || colorMode?.hide) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const handelChangeColorMode = () => {
|
|
23
|
+
const activeIndex = colorMode.modes.indexOf(activeColorMode);
|
|
24
|
+
const mode =
|
|
25
|
+
activeIndex < colorMode.modes.length - 1
|
|
26
|
+
? colorMode.modes[activeIndex + 1]
|
|
27
|
+
: colorMode.modes[0];
|
|
28
|
+
setActiveColorMode(mode);
|
|
29
|
+
localStorage.setItem('colorSchema', mode);
|
|
30
|
+
document.documentElement.className = mode;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Wrapper
|
|
35
|
+
data-component-name="ColorModeSwitcher/ColorModeSwitcher"
|
|
36
|
+
onClick={handelChangeColorMode}
|
|
37
|
+
>
|
|
38
|
+
<ColorModeIcon mode={activeColorMode} />
|
|
39
|
+
</Wrapper>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const Wrapper = styled.div`
|
|
44
|
+
margin-left: var(--navbar-item-padding-horizontal);
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@theme/ColorModeSwitcher/ColorModeSwitcher';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { SamplesControlButton } from '@theme/SamplesPanelControls';
|
|
4
|
-
import { Tooltip } from '@theme/Tooltip';
|
|
4
|
+
import { Tooltip, TooltipProps } from '@theme/Tooltip';
|
|
5
5
|
import { useControl } from '@theme/hooks';
|
|
6
6
|
import { ClipboardService } from '@theme/utils';
|
|
7
7
|
|
|
8
8
|
export interface CopyButtonWrapperProps {
|
|
9
9
|
data: unknown;
|
|
10
|
-
children: (props: {
|
|
10
|
+
children: (props: {
|
|
11
|
+
renderCopyButton: (placement?: TooltipProps['placement']) => JSX.Element;
|
|
12
|
+
}) => JSX.Element;
|
|
11
13
|
dataTestId?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -32,12 +34,13 @@ function CopyButtonWrapperComponent({
|
|
|
32
34
|
showTooltip();
|
|
33
35
|
};
|
|
34
36
|
|
|
35
|
-
const renderCopyButton = (): JSX.Element => {
|
|
37
|
+
const renderCopyButton = (placement: TooltipProps['placement'] = 'top'): JSX.Element => {
|
|
36
38
|
return (
|
|
37
39
|
<Tooltip
|
|
38
40
|
className="copy-button"
|
|
39
41
|
tip={ClipboardService.isSupported() ? 'Copied' : 'Not supported in your browser'}
|
|
40
42
|
isOpen={tooltip.isOpened}
|
|
43
|
+
placement={placement}
|
|
41
44
|
>
|
|
42
45
|
<SamplesControlButton onClick={copy} data-cy={dataTestId}>
|
|
43
46
|
Copy
|
package/src/Footer/Footer.tsx
CHANGED
|
@@ -29,11 +29,12 @@ export function Footer({ data: { columns, copyrightText } }: FooterProps): JSX.E
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const FooterContainer = styled.footer`
|
|
32
|
-
font-size:
|
|
32
|
+
font-size: var(--footer-font-size);
|
|
33
33
|
flex-shrink: 0;
|
|
34
34
|
background-color: var(--footer-background-color);
|
|
35
35
|
color: var(--footer-text-color);
|
|
36
|
-
font-family: var(--font-family
|
|
36
|
+
font-family: var(--footer-font-family);
|
|
37
|
+
font-weight: var(--footer-font-weight);
|
|
37
38
|
a,
|
|
38
39
|
a:hover {
|
|
39
40
|
color: var(--footer-text-color);
|
|
@@ -34,10 +34,11 @@ export function FooterColumn({ column }: FooterColumnProps): JSX.Element {
|
|
|
34
34
|
|
|
35
35
|
const FooterColumnTitle = styled.p`
|
|
36
36
|
display: inline-block;
|
|
37
|
-
font-weight: var(--font-weight
|
|
38
|
-
font-size:
|
|
39
|
-
margin-bottom:
|
|
40
|
-
font-family: var(--
|
|
37
|
+
font-weight: var(--footer-title-font-weight);
|
|
38
|
+
font-size: var(--footer-title-font-size);
|
|
39
|
+
margin-bottom: var(--footer-title-margin-vertical);
|
|
40
|
+
font-family: var(--footer-font-family);
|
|
41
|
+
color: var(--footer-title-text-color);
|
|
41
42
|
`;
|
|
42
43
|
|
|
43
44
|
const FooterSeparator = styled.div`
|
|
@@ -45,21 +46,24 @@ const FooterSeparator = styled.div`
|
|
|
45
46
|
margin: 10px 0 5px 0;
|
|
46
47
|
font-size: 0.75em;
|
|
47
48
|
text-transform: uppercase;
|
|
48
|
-
font-family: var(--
|
|
49
|
+
font-family: var(--footer-font-family);
|
|
49
50
|
`;
|
|
50
51
|
|
|
51
52
|
const FooterColumnContainer = styled.div`
|
|
52
53
|
display: flex;
|
|
53
54
|
flex-direction: column;
|
|
54
55
|
text-align: left;
|
|
55
|
-
margin:
|
|
56
|
-
width:
|
|
56
|
+
margin: var(--footer-column-margin-horizontal) var(--footer-column-margin-vertical);
|
|
57
|
+
width: var(--footer-column-width);
|
|
57
58
|
word-break: break-word;
|
|
58
59
|
`;
|
|
59
60
|
|
|
60
61
|
const FooterLink = styled(Link)`
|
|
61
62
|
font-weight: var(--font-weight-bold);
|
|
62
|
-
padding
|
|
63
|
-
color: var(--footer-text-color);
|
|
63
|
+
padding: var(--footer-item-padding-vertical) var(--footer-item-padding-horizontal);
|
|
64
|
+
color: var(--footer-link-text-color);
|
|
64
65
|
text-decoration: none;
|
|
66
|
+
&:hover {
|
|
67
|
+
color: var(--footer-link-hover-color);
|
|
68
|
+
}
|
|
65
69
|
`;
|
|
@@ -26,11 +26,11 @@ export function FooterColumns({ columns }: FooterColumnsProps): JSX.Element | nu
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export const FooterColumnsContainer = styled.div`
|
|
29
|
-
padding:
|
|
29
|
+
padding: var(--footer-padding-vertical) var(--footer-padding-horizontal);
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-direction: column;
|
|
32
32
|
justify-content: center;
|
|
33
|
-
max-width:
|
|
33
|
+
max-width: var(--footer-container-max-width);
|
|
34
34
|
margin: 0 auto;
|
|
35
35
|
|
|
36
36
|
${({ theme }) => theme.mediaQueries.small} {
|
|
@@ -115,8 +115,8 @@ export const JsonViewer = styled(Json).attrs(() => ({
|
|
|
115
115
|
'data-component-name': 'JsonViewer/JsonViewer',
|
|
116
116
|
}))<JsonProps>`
|
|
117
117
|
.redoc-json code {
|
|
118
|
-
background-color: var(--samples-
|
|
119
|
-
color: var(--color-
|
|
118
|
+
background-color: var(--panel-samples-code-block-background-color);
|
|
119
|
+
color: var(--text-color-inverse);
|
|
120
120
|
padding: inherit;
|
|
121
121
|
border: none;
|
|
122
122
|
}
|
|
@@ -125,9 +125,9 @@ export const JsonViewer = styled(Json).attrs(() => ({
|
|
|
125
125
|
overflow-x: auto;
|
|
126
126
|
position: relative;
|
|
127
127
|
padding: 10px;
|
|
128
|
-
border-radius: var(--
|
|
129
|
-
background-color: var(--samples-
|
|
130
|
-
color: var(--color-
|
|
128
|
+
border-radius: var(--border-radius);
|
|
129
|
+
background-color: var(--panel-samples-code-block-background-color);
|
|
130
|
+
color: var(--text-color-inverse);
|
|
131
131
|
font-size: var(--code-font-size);
|
|
132
132
|
font-family: var(--code-font-family);
|
|
133
133
|
white-space: var(--code-wrap, pre);
|
|
@@ -39,6 +39,7 @@ const Wrapper = styled.div<AdmonitionTypeProps>`
|
|
|
39
39
|
${({ type }) => `
|
|
40
40
|
background-color: var(--admonition-${type}-background-color);
|
|
41
41
|
color: var(--admonition-${type}-text-color);
|
|
42
|
+
border: var(--admonition-${type}-border);
|
|
42
43
|
`}
|
|
43
44
|
`;
|
|
44
45
|
|
|
@@ -47,13 +48,13 @@ const Heading = styled.h5<AdmonitionTypeProps>`
|
|
|
47
48
|
margin: 0 0 10px;
|
|
48
49
|
|
|
49
50
|
letter-spacing: var(--admonition-heading-letter-spacing);
|
|
50
|
-
color: ${({ type }) => `var(--admonition-${type}-text-color)`};
|
|
51
|
+
color: ${({ type }) => `var(--admonition-${type}-heading-text-color)`};
|
|
51
52
|
|
|
52
53
|
&& {
|
|
53
54
|
font-size: var(--admonition-heading-font-size);
|
|
54
55
|
font-weight: var(--admonition-heading-font-weight);
|
|
55
56
|
line-height: var(--admonition-line-height);
|
|
56
|
-
transform: var(--admonition-heading-transform);
|
|
57
|
+
text-transform: var(--admonition-heading-transform);
|
|
57
58
|
}
|
|
58
59
|
`;
|
|
59
60
|
|
|
@@ -40,17 +40,20 @@ const CodeSampleButtonContainer = styled.div`
|
|
|
40
40
|
`;
|
|
41
41
|
|
|
42
42
|
const CopyCodeButton = styled.div`
|
|
43
|
-
padding:
|
|
44
|
-
border-radius:
|
|
45
|
-
|
|
43
|
+
padding: var(--code-block-controls-padding);
|
|
44
|
+
border-radius: var(--code-block-controls-border-radius);
|
|
45
|
+
font-size: var(--code-block-controls-font-size);
|
|
46
|
+
font-family: var(--code-block-controls-font-family);
|
|
46
47
|
&:hover {
|
|
47
48
|
cursor: pointer;
|
|
48
49
|
}
|
|
49
50
|
`;
|
|
50
51
|
|
|
51
52
|
const DoneIndicator = styled.div`
|
|
52
|
-
padding:
|
|
53
|
-
border-radius:
|
|
53
|
+
padding: var(--code-block-controls-padding);
|
|
54
|
+
border-radius: var(--code-block-controls-border-radius);
|
|
55
|
+
font-size: var(--code-block-controls-font-size);
|
|
56
|
+
font-family: var(--code-block-controls-font-family);
|
|
54
57
|
cursor: default;
|
|
55
58
|
`;
|
|
56
59
|
|
|
@@ -111,32 +114,30 @@ const Wrapper = styled.div`
|
|
|
111
114
|
|
|
112
115
|
${CopyCodeButton},
|
|
113
116
|
${DoneIndicator} {
|
|
114
|
-
color:
|
|
117
|
+
color: var(--code-block-controls-text-color);
|
|
118
|
+
background-color: var(--code-block-controls-background-color);
|
|
119
|
+
opacity: var(--code-block-controls-opacity);
|
|
115
120
|
}
|
|
116
121
|
${CopyCodeButton}:hover {
|
|
117
|
-
color:
|
|
118
|
-
background-color:
|
|
122
|
+
color: var(--code-block-controls-hover-text-color);
|
|
123
|
+
background-color: var(--code-block-controls-hover-background-color);
|
|
124
|
+
opacity: var(--code-block-controls-active-opacity);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
|
-
&:hover {
|
|
122
|
-
${CodeSampleButtonContainer} ${CopyCodeButton} {
|
|
123
|
-
display: block;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
127
|
pre {
|
|
127
128
|
white-space: var(--code-wrap);
|
|
128
129
|
color: white;
|
|
129
130
|
padding: 12px 14px 15px 14px;
|
|
130
131
|
overflow-x: auto;
|
|
131
132
|
line-height: normal;
|
|
132
|
-
border-radius:
|
|
133
|
+
border-radius: var(--code-block-border-radius);
|
|
133
134
|
font-family: var(--code-font-family);
|
|
134
|
-
background-color: var(--code-block-
|
|
135
|
+
background-color: var(--code-block-background-color);
|
|
135
136
|
code {
|
|
136
137
|
background-color: transparent;
|
|
137
138
|
border: 0;
|
|
138
139
|
padding: 0;
|
|
139
|
-
color:
|
|
140
|
+
color: var(--code-block-text-color);
|
|
140
141
|
&:before,
|
|
141
142
|
&:after {
|
|
142
143
|
content: none;
|
|
@@ -148,7 +149,7 @@ const Wrapper = styled.div`
|
|
|
148
149
|
margin: 0.5em 0;
|
|
149
150
|
overflow: auto;
|
|
150
151
|
border: 0;
|
|
151
|
-
border-radius: var(--
|
|
152
|
+
border-radius: var(--border-radius);
|
|
152
153
|
}
|
|
153
154
|
code[class='language-text'] {
|
|
154
155
|
line-height: 1.2em;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
'data-component-name': 'Markdown/
|
|
3
|
+
export const ContainerWrapper = styled.section.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Markdown/ContainerWrapper',
|
|
5
5
|
}))<{ withToc: boolean }>`
|
|
6
|
-
max-width: var(--
|
|
6
|
+
max-width: var(--md-container-max-width);
|
|
7
7
|
width: 90%;
|
|
8
8
|
margin: 0 auto;
|
|
9
9
|
|
|
10
|
-
padding: var(--
|
|
10
|
+
padding: var(--md-container-padding-vertical) var(--md-container-padding-horizontal);
|
|
11
11
|
|
|
12
12
|
& > article:first-child > h1:first-child {
|
|
13
13
|
// disable margin top for h1 on the title heading if there is no "Last updated at" block
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
type DetailsProps = {
|
|
5
|
+
summary: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function Details({ summary, children }: React.PropsWithChildren<DetailsProps>): JSX.Element {
|
|
9
|
+
return (
|
|
10
|
+
<StyledDetails>
|
|
11
|
+
<summary>{summary}</summary>
|
|
12
|
+
<StyledDetailsContent>{children}</StyledDetailsContent>
|
|
13
|
+
</StyledDetails>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const StyledDetails = styled.details``;
|
|
18
|
+
|
|
19
|
+
const StyledDetailsContent = styled.div``;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { PageWrapper } from '@theme/Markdown/PageWrapper';
|
|
4
|
-
import {
|
|
4
|
+
import { ContainerWrapper } from '@theme/Markdown/ContainerWrapper';
|
|
5
5
|
import { PageNavigation } from '@theme/PageNavigation/PageNavigation';
|
|
6
6
|
|
|
7
7
|
type MarkdownLayoutProps = {
|
|
8
8
|
tableOfContent: React.ReactNode;
|
|
9
9
|
markdownWrapper: React.ReactNode;
|
|
10
|
+
showPrevButton?: boolean;
|
|
11
|
+
showNextButton?: boolean;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export function MarkdownLayout({
|
|
13
15
|
tableOfContent,
|
|
14
16
|
markdownWrapper,
|
|
17
|
+
showPrevButton,
|
|
18
|
+
showNextButton,
|
|
15
19
|
}: MarkdownLayoutProps): JSX.Element {
|
|
16
20
|
return (
|
|
17
21
|
<PageWrapper data-component-name="Markdown/MarkdownLayout">
|
|
18
|
-
<
|
|
22
|
+
<ContainerWrapper withToc={true}>
|
|
19
23
|
{markdownWrapper}
|
|
20
|
-
<PageNavigation />
|
|
21
|
-
</
|
|
24
|
+
<PageNavigation showPrevButton={showPrevButton} showNextButton={showNextButton} />
|
|
25
|
+
</ContainerWrapper>
|
|
22
26
|
{tableOfContent}
|
|
23
27
|
</PageWrapper>
|
|
24
28
|
);
|