@redocly/theme 0.6.3 → 0.6.5
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/Button/Button.d.ts +3 -3
- package/lib/Feedback/Rating.d.ts +3 -0
- package/lib/Feedback/Rating.js +69 -0
- package/lib/Feedback/Sentiment.d.ts +3 -0
- package/lib/Feedback/Sentiment.js +55 -0
- package/lib/Feedback/Thumbs.d.ts +7 -0
- package/lib/Feedback/Thumbs.js +79 -0
- package/lib/Feedback/index.d.ts +3 -0
- package/lib/Feedback/index.js +23 -0
- package/lib/Feedback/types.d.ts +26 -0
- package/lib/Feedback/types.js +3 -0
- package/lib/Markdown/CodeSample/CodeSample.d.ts +1 -1
- package/lib/Markdown/Details.d.ts +1 -1
- package/lib/Markdown/MarkdownLayout.d.ts +3 -2
- package/lib/Markdown/MarkdownLayout.js +8 -2
- package/lib/Markdown/Mermaid.d.ts +1 -1
- package/lib/Markdown/Tabs/Tab.d.ts +1 -1
- package/lib/Markdown/Tabs/Tabs.d.ts +1 -1
- package/lib/Navbar/MobileNavbarMenu.d.ts +3 -2
- package/lib/Navbar/MobileNavbarMenu.js +16 -4
- package/lib/Navbar/Navbar.js +6 -3
- package/lib/NavbarLogo/NavbarLogo.d.ts +1 -1
- package/lib/Profile/LoginLink.d.ts +5 -0
- package/lib/Profile/LoginLink.js +30 -0
- package/lib/Profile/Profile.js +8 -1
- package/lib/Profile/UserProfile.d.ts +13 -0
- package/lib/Profile/UserProfile.js +82 -0
- package/lib/Profile/index.d.ts +4 -0
- package/lib/Profile/index.js +5 -1
- package/lib/Search/Autocomplete.js +1 -0
- package/lib/Search/Popover.js +9 -1
- package/lib/Search/Search.js +37 -4
- package/lib/Sidebar/ArrowBack.js +2 -2
- package/lib/Sidebar/SidebarLayout.d.ts +1 -5
- package/lib/Sidebar/SidebarLayout.js +1 -26
- package/lib/SourceCode/SourceCode.d.ts +1 -1
- package/lib/config.d.ts +55 -2
- package/lib/config.js +18 -0
- package/lib/globalStyle.js +6 -2
- package/lib/hooks/useActiveHeading.d.ts +1 -1
- package/lib/hooks/useActiveSectionId.d.ts +1 -1
- package/lib/hooks/useActiveSectionId.js +0 -3
- package/lib/hooks/useControl.d.ts +1 -1
- package/lib/hooks/useNavbarHeight.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mocks/hooks/index.js +6 -0
- package/lib/mocks/types/index.d.ts +1 -1
- package/lib/mocks/types.d.ts +3 -3
- package/lib/types/config.d.ts +1 -1
- package/lib/ui/Box.d.ts +2 -2
- package/lib/ui/Box.js +1 -0
- package/lib/ui/Burger.js +3 -2
- package/lib/ui/Dropdown.d.ts +1 -1
- package/lib/ui/Tiles/ThinTile.d.ts +1 -1
- package/lib/utils/jsonToHtml.d.ts +1 -1
- package/lib/utils/media-css.d.ts +1 -1
- package/package.json +7 -4
- package/src/Feedback/Rating.tsx +79 -0
- package/src/Feedback/Sentiment.tsx +36 -0
- package/src/Feedback/Thumbs.tsx +116 -0
- package/src/Feedback/index.ts +3 -0
- package/src/Feedback/types.ts +29 -0
- package/src/Markdown/MarkdownLayout.tsx +10 -1
- package/src/Navbar/MobileNavbarMenu.tsx +14 -0
- package/src/Navbar/Navbar.tsx +12 -3
- package/src/Profile/LoginLink.tsx +29 -0
- package/src/Profile/Profile.tsx +8 -1
- package/src/Profile/UserProfile.tsx +101 -0
- package/src/Profile/index.ts +4 -0
- package/src/Search/Autocomplete.tsx +1 -0
- package/src/Search/Popover.tsx +9 -1
- package/src/Search/Search.tsx +25 -15
- package/src/Sidebar/ArrowBack.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +1 -38
- package/src/config.ts +19 -0
- package/src/globalStyle.ts +7 -2
- package/src/hooks/useActiveSectionId.ts +0 -2
- package/src/index.ts +1 -0
- package/src/mocks/hooks/index.ts +6 -0
- package/src/settings.yaml +2 -0
- package/src/types/portal/index.d.ts +1 -1
- package/src/ui/Box.tsx +5 -2
- package/src/ui/Burger.tsx +3 -2
package/lib/Profile/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { Profile } from './Profile';
|
|
2
2
|
export type { ProfileProps } from './Profile';
|
|
3
|
+
export { LoginLink } from './LoginLink';
|
|
4
|
+
export type { LoginLinkProps } from './LoginLink';
|
|
5
|
+
export { UserProfile } from './UserProfile';
|
|
6
|
+
export type { UserProfileProps } from './UserProfile';
|
package/lib/Profile/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Profile = void 0;
|
|
3
|
+
exports.UserProfile = exports.LoginLink = exports.Profile = void 0;
|
|
4
4
|
var Profile_1 = require("./Profile");
|
|
5
5
|
Object.defineProperty(exports, "Profile", { enumerable: true, get: function () { return Profile_1.Profile; } });
|
|
6
|
+
var LoginLink_1 = require("./LoginLink");
|
|
7
|
+
Object.defineProperty(exports, "LoginLink", { enumerable: true, get: function () { return LoginLink_1.LoginLink; } });
|
|
8
|
+
var UserProfile_1 = require("./UserProfile");
|
|
9
|
+
Object.defineProperty(exports, "UserProfile", { enumerable: true, get: function () { return UserProfile_1.UserProfile; } });
|
|
6
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -48,6 +48,7 @@ function Autocomplete({ placeholder, value, items, change, select, renderItem, c
|
|
|
48
48
|
const stopPropagation = (event) => event.stopPropagation();
|
|
49
49
|
const onChange = (event) => {
|
|
50
50
|
setActiveIdx(-1);
|
|
51
|
+
setIsOpen(true);
|
|
51
52
|
change(event.target.value);
|
|
52
53
|
};
|
|
53
54
|
const onKeydown = (event) => {
|
package/lib/Search/Popover.js
CHANGED
|
@@ -13,7 +13,6 @@ exports.Popover = styled_components_1.default.div.attrs(() => ({
|
|
|
13
13
|
right: 0;
|
|
14
14
|
z-index: 100;
|
|
15
15
|
min-width: 100%;
|
|
16
|
-
width: 550px;
|
|
17
16
|
max-width: 90vw;
|
|
18
17
|
max-height: 400px;
|
|
19
18
|
overflow-y: auto;
|
|
@@ -22,5 +21,14 @@ exports.Popover = styled_components_1.default.div.attrs(() => ({
|
|
|
22
21
|
list-style: none;
|
|
23
22
|
border-radius: var(--search-popover-border-radius);
|
|
24
23
|
border: var(--search-popover-border);
|
|
24
|
+
width: 100%;
|
|
25
|
+
|
|
26
|
+
${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.small; }} {
|
|
27
|
+
width: 400px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.medium; }} {
|
|
31
|
+
width: 550px;
|
|
32
|
+
}
|
|
25
33
|
`;
|
|
26
34
|
//# sourceMappingURL=Popover.js.map
|
package/lib/Search/Search.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.Search = void 0;
|
|
7
|
-
const
|
|
30
|
+
const React = __importStar(require("react"));
|
|
8
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
32
|
const usePreloadHistory_1 = require("../mocks/usePreloadHistory");
|
|
10
33
|
const search_1 = require("../mocks/search");
|
|
@@ -17,11 +40,21 @@ function Search() {
|
|
|
17
40
|
const { query, setQuery, items } = (0, search_1.useFuseSearch)();
|
|
18
41
|
// TODO: ask somebody about typings
|
|
19
42
|
const navigate = (item) => history.push(item.url);
|
|
20
|
-
|
|
21
|
-
|
|
43
|
+
const renderAutocomplete = () => (React.createElement(Autocomplete_1.Autocomplete, { items: items, value: query, change: setQuery, select: navigate, placeholder: "Search the docs", renderItem: (item) => React.createElement(SearchItem_1.SearchItem, { key: item.id, item: item }) }, (isOpen, reset) => (isOpen ? React.createElement(ClearIcon_1.ClearIcon, { onClick: reset }) : React.createElement(SearchIcon_1.SearchIcon, null))));
|
|
44
|
+
return React.createElement(Wrapper, { "data-component-name": "Search/Search" }, renderAutocomplete());
|
|
22
45
|
}
|
|
23
46
|
exports.Search = Search;
|
|
24
47
|
const Wrapper = styled_components_1.default.div `
|
|
25
|
-
margin:
|
|
48
|
+
margin-left: auto;
|
|
49
|
+
|
|
50
|
+
display: none;
|
|
51
|
+
|
|
52
|
+
${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.small; }} {
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.medium; }} {
|
|
57
|
+
margin: 0 auto;
|
|
58
|
+
}
|
|
26
59
|
`;
|
|
27
60
|
//# sourceMappingURL=Search.js.map
|
package/lib/Sidebar/ArrowBack.js
CHANGED
|
@@ -7,12 +7,12 @@ exports.ArrowBack = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Arrow = ({ className }) => (react_1.default.createElement("span", { "data-component-name": "Sidebar/ArrowBack" },
|
|
10
|
-
react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 10", width: "
|
|
10
|
+
react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 10", width: "12px", height: "10px", className: className },
|
|
11
11
|
react_1.default.createElement("path", { d: "M2.414 5l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L2.414 5z" }),
|
|
12
12
|
react_1.default.createElement("path", { d: "M2 5a1 1 0 011-1h8a1 1 0 110 2H3a1 1 0 01-1-1z" }))));
|
|
13
13
|
exports.ArrowBack = (0, styled_components_1.default)(Arrow) `
|
|
14
14
|
fill: var(--sidebar-back-button-icon-color);
|
|
15
|
-
margin-right: calc(var(--sidebar-spacing-unit));
|
|
15
|
+
margin-right: calc(var(--sidebar-spacing-unit) * 1.5);
|
|
16
16
|
|
|
17
17
|
background-image: var(--sidebar-back-button-icon);
|
|
18
18
|
background-repeat: no-repeat;
|
|
@@ -2,10 +2,6 @@ import React from 'react';
|
|
|
2
2
|
interface SidebarLayoutProps {
|
|
3
3
|
versions: React.ReactNode;
|
|
4
4
|
menu: React.ReactNode;
|
|
5
|
-
backLink?: {
|
|
6
|
-
label: string;
|
|
7
|
-
slug: string;
|
|
8
|
-
};
|
|
9
5
|
}
|
|
10
|
-
export declare function SidebarLayout({ versions, menu
|
|
6
|
+
export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null;
|
|
11
7
|
export {};
|
|
@@ -12,9 +12,7 @@ const MobileSidebarButton_1 = require("../Sidebar/MobileSidebarButton");
|
|
|
12
12
|
const MenuContainer_1 = require("../Sidebar/MenuContainer");
|
|
13
13
|
const SidebarSearch_1 = require("../Search/SidebarSearch");
|
|
14
14
|
const useThemeConfig_1 = require("../hooks/useThemeConfig");
|
|
15
|
-
|
|
16
|
-
const Link_1 = require("../mocks/Link");
|
|
17
|
-
function SidebarLayout({ versions, menu, backLink, }) {
|
|
15
|
+
function SidebarLayout({ versions, menu }) {
|
|
18
16
|
const [isOpen, setIsOpen] = (0, useMobileMenu_1.useMobileMenu)();
|
|
19
17
|
const toggleMenu = () => setIsOpen(!isOpen);
|
|
20
18
|
const { search, sidebar } = (0, useThemeConfig_1.useThemeConfig)();
|
|
@@ -25,32 +23,9 @@ function SidebarLayout({ versions, menu, backLink, }) {
|
|
|
25
23
|
react_1.default.createElement(MobileSidebarButton_1.MobileSidebarButton, { opened: isOpen, onClick: toggleMenu }),
|
|
26
24
|
!(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,
|
|
27
25
|
react_1.default.createElement(Sidebar_1.Sidebar, { animate: true, opened: isOpen },
|
|
28
|
-
(backLink && (react_1.default.createElement(BackLinkWrapper, null,
|
|
29
|
-
react_1.default.createElement(Link_1.Link, { to: backLink.slug },
|
|
30
|
-
react_1.default.createElement(ArrowBack_1.ArrowBack, null),
|
|
31
|
-
"Back to ",
|
|
32
|
-
backLink.label)))) ||
|
|
33
|
-
null,
|
|
34
26
|
versions,
|
|
35
27
|
react_1.default.createElement(MenuContainer_1.MenuContainer, null, menu))));
|
|
36
28
|
}
|
|
37
29
|
exports.SidebarLayout = SidebarLayout;
|
|
38
|
-
const BackLinkWrapper = styled_components_1.default.div `
|
|
39
|
-
padding: var(--sidebar-offset-top) var(--sidebar-item-padding-horizontal)
|
|
40
|
-
var(--sidebar-item-padding-horizontal)
|
|
41
|
-
calc(var(--sidebar-offset-left) + var(--sidebar-item-padding-horizontal));
|
|
42
|
-
|
|
43
|
-
a {
|
|
44
|
-
color: var(--sidebar-back-button-text-color);
|
|
45
|
-
font-size: var(--sidebar-back-button-font-size);
|
|
46
|
-
font-family: var(--sidebar-back-button-font-family);
|
|
47
|
-
text-decoration: none;
|
|
48
|
-
&:hover {
|
|
49
|
-
color: var(--sidebar-back-button-hover-text-color);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
border-bottom: 1px solid var(--sidebar-border-color);
|
|
54
|
-
`;
|
|
55
30
|
const Wrapper = styled_components_1.default.div ``;
|
|
56
31
|
//# sourceMappingURL=SidebarLayout.js.map
|
|
@@ -17,7 +17,7 @@ export interface Sample {
|
|
|
17
17
|
lang: string;
|
|
18
18
|
label?: string;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type UnstableExternalCodeSample = Sample & {
|
|
21
21
|
get: (source: ExternalSource) => string;
|
|
22
22
|
};
|
|
23
23
|
export interface ExternalSource {
|
package/lib/config.d.ts
CHANGED
|
@@ -228,6 +228,20 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
228
228
|
title?: string | undefined;
|
|
229
229
|
href: string;
|
|
230
230
|
}>, "many">>;
|
|
231
|
+
feedback: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
|
|
232
|
+
type: z.ZodDefault<z.ZodString>;
|
|
233
|
+
settings: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, {
|
|
235
|
+
hide: z.ZodOptional<z.ZodBoolean>;
|
|
236
|
+
}>, "strict", z.ZodTypeAny, {
|
|
237
|
+
hide?: boolean | undefined;
|
|
238
|
+
settings?: string | undefined;
|
|
239
|
+
type: string;
|
|
240
|
+
}, {
|
|
241
|
+
type?: string | undefined;
|
|
242
|
+
hide?: boolean | undefined;
|
|
243
|
+
settings?: string | undefined;
|
|
244
|
+
}>>>;
|
|
231
245
|
search: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
|
|
232
246
|
placement: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
233
247
|
}, {
|
|
@@ -415,6 +429,23 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
415
429
|
}>>>;
|
|
416
430
|
openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
417
431
|
graphql: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
432
|
+
userProfile: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
|
|
433
|
+
loginLabel: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
434
|
+
logoutLabel: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
435
|
+
logoutRedirect: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
436
|
+
}, {
|
|
437
|
+
hide: z.ZodOptional<z.ZodBoolean>;
|
|
438
|
+
}>, "strip", z.ZodTypeAny, {
|
|
439
|
+
hide?: boolean | undefined;
|
|
440
|
+
loginLabel?: string | undefined;
|
|
441
|
+
logoutLabel?: string | undefined;
|
|
442
|
+
logoutRedirect?: string | undefined;
|
|
443
|
+
}, {
|
|
444
|
+
hide?: boolean | undefined;
|
|
445
|
+
loginLabel?: string | undefined;
|
|
446
|
+
logoutLabel?: string | undefined;
|
|
447
|
+
logoutRedirect?: string | undefined;
|
|
448
|
+
}>>>;
|
|
418
449
|
}, "passthrough", z.ZodTypeAny, {
|
|
419
450
|
imports?: string[] | undefined;
|
|
420
451
|
logo?: {
|
|
@@ -480,6 +511,11 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
480
511
|
title?: string | undefined;
|
|
481
512
|
href: string;
|
|
482
513
|
}[] | undefined;
|
|
514
|
+
feedback?: {
|
|
515
|
+
hide?: boolean | undefined;
|
|
516
|
+
settings?: string | undefined;
|
|
517
|
+
type: string;
|
|
518
|
+
} | undefined;
|
|
483
519
|
search?: {
|
|
484
520
|
hide?: boolean | undefined;
|
|
485
521
|
placement?: string | undefined;
|
|
@@ -527,6 +563,12 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
527
563
|
text: string;
|
|
528
564
|
};
|
|
529
565
|
};
|
|
566
|
+
userProfile: {
|
|
567
|
+
hide?: boolean | undefined;
|
|
568
|
+
loginLabel?: string | undefined;
|
|
569
|
+
logoutLabel?: string | undefined;
|
|
570
|
+
logoutRedirect?: string | undefined;
|
|
571
|
+
};
|
|
530
572
|
}, {
|
|
531
573
|
imports?: string[] | undefined;
|
|
532
574
|
logo?: {
|
|
@@ -592,6 +634,11 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
592
634
|
title?: string | undefined;
|
|
593
635
|
href: string;
|
|
594
636
|
}[] | undefined;
|
|
637
|
+
feedback?: {
|
|
638
|
+
type?: string | undefined;
|
|
639
|
+
hide?: boolean | undefined;
|
|
640
|
+
settings?: string | undefined;
|
|
641
|
+
} | undefined;
|
|
595
642
|
search?: {
|
|
596
643
|
hide?: boolean | undefined;
|
|
597
644
|
placement?: string | undefined;
|
|
@@ -639,9 +686,15 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
639
686
|
} | undefined;
|
|
640
687
|
openapi?: {} | undefined;
|
|
641
688
|
graphql?: {} | undefined;
|
|
689
|
+
userProfile?: {
|
|
690
|
+
hide?: boolean | undefined;
|
|
691
|
+
loginLabel?: string | undefined;
|
|
692
|
+
logoutLabel?: string | undefined;
|
|
693
|
+
logoutRedirect?: string | undefined;
|
|
694
|
+
} | undefined;
|
|
642
695
|
}>>;
|
|
643
|
-
export
|
|
644
|
-
export
|
|
696
|
+
export type ThemeConfig = z.infer<typeof ThemeConfig>;
|
|
697
|
+
export type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 'scripts'> & {
|
|
645
698
|
navbar?: any;
|
|
646
699
|
footer?: any;
|
|
647
700
|
auth?: {
|
package/lib/config.js
CHANGED
|
@@ -74,6 +74,15 @@ exports.ThemeConfig = zod_1.z
|
|
|
74
74
|
})
|
|
75
75
|
.optional(),
|
|
76
76
|
links: zod_1.z.array(LinksConfig).optional(),
|
|
77
|
+
feedback: zod_1.z
|
|
78
|
+
.object({
|
|
79
|
+
type: zod_1.z.string().default('sentiment'),
|
|
80
|
+
settings: zod_1.z.string().optional(),
|
|
81
|
+
})
|
|
82
|
+
.extend(HideConfig.shape)
|
|
83
|
+
.strict()
|
|
84
|
+
.default({})
|
|
85
|
+
.optional(),
|
|
77
86
|
search: zod_1.z
|
|
78
87
|
.object({
|
|
79
88
|
placement: zod_1.z.string().default('navbar').optional(),
|
|
@@ -151,6 +160,15 @@ exports.ThemeConfig = zod_1.z
|
|
|
151
160
|
.optional(),
|
|
152
161
|
openapi: zod_1.z.object({}).passthrough().optional(),
|
|
153
162
|
graphql: zod_1.z.object({}).passthrough().optional(),
|
|
163
|
+
userProfile: zod_1.z
|
|
164
|
+
.object({
|
|
165
|
+
loginLabel: zod_1.z.string().default('Login').optional(),
|
|
166
|
+
logoutLabel: zod_1.z.string().default('Logout').optional(),
|
|
167
|
+
logoutRedirect: zod_1.z.string().default('/').optional(),
|
|
168
|
+
})
|
|
169
|
+
.extend(HideConfig.shape)
|
|
170
|
+
.optional()
|
|
171
|
+
.default({}),
|
|
154
172
|
})
|
|
155
173
|
.passthrough()
|
|
156
174
|
.default({});
|
package/lib/globalStyle.js
CHANGED
|
@@ -202,7 +202,7 @@ const headingsTypography = (0, styled_components_1.css) `
|
|
|
202
202
|
--h2-font-weight: var(--heading-font-weight); // @presenter FontWeight
|
|
203
203
|
--h2-font-size: 28px; // @presenter FontSize
|
|
204
204
|
--h2-line-height: 28px; // @presenter LineHeight
|
|
205
|
-
--h2-margin-top:
|
|
205
|
+
--h2-margin-top: 0; // @presenter Spacing
|
|
206
206
|
--h2-margin-bottom: var(--heading-margin-bottom); // @presenter Spacing
|
|
207
207
|
--h2-text-color: var(--heading-text-color); // @presenter Color
|
|
208
208
|
|
|
@@ -512,7 +512,7 @@ const sidebar = (0, styled_components_1.css) `
|
|
|
512
512
|
--sidebar-back-button-font-family: var(--sidebar-item-font-family);
|
|
513
513
|
--sidebar-back-button-font-size: var(--sidebar-item-font-size);
|
|
514
514
|
--sidebar-back-button-transform: inherit;
|
|
515
|
-
--sidebar-back-button-text-color: var(--
|
|
515
|
+
--sidebar-back-button-text-color: var(--sidebar-item-text-color);
|
|
516
516
|
--sidebar-back-button-background-color: transparent;
|
|
517
517
|
--sidebar-back-button-hover-text-color: var(--sidebar-item-active-color);
|
|
518
518
|
--sidebar-back-button-hover-background-color: transparent;
|
|
@@ -1878,6 +1878,9 @@ const tile = (0, styled_components_1.css) `
|
|
|
1878
1878
|
--wide-tile-background-color: var(--color-secondary-50);
|
|
1879
1879
|
--thin-tile-background-color: var(--color-secondary-50);
|
|
1880
1880
|
`;
|
|
1881
|
+
const apiLogsTable = (0, styled_components_1.css) `
|
|
1882
|
+
--api-logs-row-hover-background-color: var(--color-secondary-300)
|
|
1883
|
+
`;
|
|
1881
1884
|
exports.styles = (0, styled_components_1.css) `
|
|
1882
1885
|
:root {
|
|
1883
1886
|
${baseColors}
|
|
@@ -1906,6 +1909,7 @@ exports.styles = (0, styled_components_1.css) `
|
|
|
1906
1909
|
${lastUpdated}
|
|
1907
1910
|
${tile}
|
|
1908
1911
|
${loadProgressBar}
|
|
1912
|
+
${apiLogsTable}
|
|
1909
1913
|
}
|
|
1910
1914
|
|
|
1911
1915
|
:root.dark {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type UseActiveHeadingReturnType = string | undefined;
|
|
2
2
|
export declare function useActiveHeading(contentElement: HTMLDivElement | null, displayedHeaders: Array<string | undefined>): UseActiveHeadingReturnType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Location } from 'history';
|
|
2
|
-
export
|
|
2
|
+
export type UseActiveSectionIdReturnType = string;
|
|
3
3
|
export declare function useActiveSectionId(location: Location, hasOverviewPage?: boolean): UseActiveSectionIdReturnType;
|
|
@@ -28,9 +28,6 @@ function useActiveSectionId(location, hasOverviewPage = false) {
|
|
|
28
28
|
if (hasOverviewPage) {
|
|
29
29
|
setItemId('');
|
|
30
30
|
}
|
|
31
|
-
else {
|
|
32
|
-
setItemId((sections[0] && sections[0].getAttribute('data-section-id')) || '');
|
|
33
|
-
}
|
|
34
31
|
}, 150), [navbarHeight, hasOverviewPage]);
|
|
35
32
|
(0, react_1.useEffect)(() => {
|
|
36
33
|
window.addEventListener('scroll', scrollListener, { capture: false });
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./Tooltip"), exports);
|
|
|
26
26
|
__exportStar(require("./SourceCode"), exports);
|
|
27
27
|
__exportStar(require("./Panel"), exports);
|
|
28
28
|
__exportStar(require("./icons"), exports);
|
|
29
|
+
__exportStar(require("./Feedback"), exports);
|
|
29
30
|
__exportStar(require("./hooks"), exports);
|
|
30
31
|
__exportStar(require("./utils"), exports);
|
|
31
32
|
__exportStar(require("./globalStyle"), exports);
|
package/lib/mocks/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ResolvedNavLinkItem = any;
|
package/lib/mocks/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type ActiveItem<T> = T;
|
|
2
|
+
export type SearchDocument = any;
|
|
3
|
+
export type OperationParameter = any;
|
package/lib/types/config.d.ts
CHANGED
package/lib/ui/Box.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpaceProps, LayoutProps, TextAlignProps, ColorProps, PositionProps, FlexProps, BordersProps } from 'styled-system';
|
|
2
|
-
export interface BoxProps extends SpaceProps, LayoutProps, PositionProps, FlexProps, TextAlignProps, ColorProps, BordersProps {
|
|
1
|
+
import type { SpaceProps, LayoutProps, TextAlignProps, ColorProps, PositionProps, FlexProps, BordersProps, GridProps } from 'styled-system';
|
|
2
|
+
export interface BoxProps extends SpaceProps, LayoutProps, PositionProps, FlexProps, TextAlignProps, ColorProps, BordersProps, GridProps {
|
|
3
3
|
}
|
|
4
4
|
export declare const Box: import("styled-components").StyledComponent<"div", any, {
|
|
5
5
|
'data-component-name': string;
|
package/lib/ui/Box.js
CHANGED
package/lib/ui/Burger.js
CHANGED
|
@@ -14,7 +14,8 @@ function BurgerComponent({ onClick, className }) {
|
|
|
14
14
|
}
|
|
15
15
|
const Button = styled_components_1.default.button `
|
|
16
16
|
all: unset;
|
|
17
|
-
max-width:
|
|
17
|
+
max-width: 20px;
|
|
18
|
+
min-width: 20px;
|
|
18
19
|
width: 100%;
|
|
19
20
|
min-width: 10px;
|
|
20
21
|
display: block;
|
|
@@ -24,7 +25,7 @@ const Line = styled_components_1.default.div `
|
|
|
24
25
|
margin: 4px 0;
|
|
25
26
|
width: 100%;
|
|
26
27
|
height: 2px;
|
|
27
|
-
background:
|
|
28
|
+
background: var(--text-color);
|
|
28
29
|
border-radius: 1px;
|
|
29
30
|
`;
|
|
30
31
|
exports.Burger = (0, styled_components_1.default)(BurgerComponent) ``;
|
package/lib/ui/Dropdown.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
|
-
|
|
3
|
+
type TextAlign = 'left' | 'right' | 'center' | 'justify';
|
|
4
4
|
export interface TileProps {
|
|
5
5
|
header?: string;
|
|
6
6
|
icon?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type JsonValue = JSON | Record<string, unknown>;
|
|
2
2
|
export declare function jsonToHTML(json: JsonValue, maxExpandLevel: number, startLine?: number): string;
|
|
3
3
|
export declare function getLines(json: JsonValue, maxExpandLevel: number): string;
|
|
4
4
|
export {};
|
package/lib/utils/media-css.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "Shared UI components",
|
|
3
|
+
"version": "0.6.5",
|
|
4
|
+
"description": "Shared UI components lib",
|
|
5
5
|
"author": "team@redocly.com",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./config": "./lib/config.js",
|
|
13
13
|
".": "./lib/index.js",
|
|
14
14
|
"./Sidebar/*": "./lib/Sidebar/*.js",
|
|
15
|
-
"./*": "./lib
|
|
15
|
+
"./*": "./lib/index.js",
|
|
16
16
|
"./src/": "./src/"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
@@ -115,7 +115,10 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"test": {
|
|
118
|
-
"outputs": [
|
|
118
|
+
"outputs": [
|
|
119
|
+
"{projectRoot}/coverage",
|
|
120
|
+
"{projectRoot}/report.json"
|
|
121
|
+
]
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { RatingProps } from '@theme/Feedback';
|
|
5
|
+
|
|
6
|
+
type StarsProps = {
|
|
7
|
+
onSubmit: RatingProps['onSubmit'];
|
|
8
|
+
max: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Rating = ({ settings, onSubmit }: RatingProps): JSX.Element => {
|
|
12
|
+
const { label, max, submitText } = settings || {};
|
|
13
|
+
const [submitValue, setSubmitValue] = React.useState(0);
|
|
14
|
+
|
|
15
|
+
if (submitValue) {
|
|
16
|
+
return (
|
|
17
|
+
<RatingWidget>
|
|
18
|
+
<Label>{submitText || 'Thank you for helping improve our documentation!'}</Label>
|
|
19
|
+
</RatingWidget>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<RatingWidget>
|
|
25
|
+
<Label>{label || 'How helpful was this page?'}</Label>
|
|
26
|
+
<Stars
|
|
27
|
+
max={max || 5}
|
|
28
|
+
onSubmit={(value: number) => {
|
|
29
|
+
setSubmitValue(value);
|
|
30
|
+
onSubmit(value);
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</RatingWidget>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const Stars = ({ max, onSubmit }: StarsProps): JSX.Element => {
|
|
38
|
+
const [hovered, setHovered] = React.useState(0);
|
|
39
|
+
const stars: JSX.Element[] = [];
|
|
40
|
+
|
|
41
|
+
for (let index = 1; index <= max; index++) {
|
|
42
|
+
stars.push(
|
|
43
|
+
<Star
|
|
44
|
+
key={index}
|
|
45
|
+
onClick={() => onSubmit(index)}
|
|
46
|
+
onMouseOver={() => setHovered(index)}
|
|
47
|
+
onMouseLeave={() => setHovered(0)}
|
|
48
|
+
>
|
|
49
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
50
|
+
{hovered < index ? (
|
|
51
|
+
<g fill="#e8c002">
|
|
52
|
+
<path d="M20 7h-7L10 .5 7 7H0l5.46 5.47-1.64 7 6.18-3.7 6.18 3.73-1.63-7zm-10 6.9-3.76 2.27 1-4.28L3.5 8.5h4.61L10 4.6l1.9 3.9h4.6l-3.73 3.4 1 4.28z" />
|
|
53
|
+
</g>
|
|
54
|
+
) : (
|
|
55
|
+
<g fill="#e8c002">
|
|
56
|
+
<path d="M20 7h-7L10 .5 7 7H0l5.46 5.47-1.64 7 6.18-3.7 6.18 3.73-1.63-7z" />
|
|
57
|
+
</g>
|
|
58
|
+
)}
|
|
59
|
+
</svg>
|
|
60
|
+
</Star>,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return <>{stars}</>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const RatingWidget = styled.div`
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
const Star = styled.span`
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
const Label = styled.h3`
|
|
77
|
+
margin-right: 15px;
|
|
78
|
+
font-family: var(--font-family-base);
|
|
79
|
+
`;
|