@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.
Files changed (84) hide show
  1. package/lib/Button/Button.d.ts +3 -3
  2. package/lib/Feedback/Rating.d.ts +3 -0
  3. package/lib/Feedback/Rating.js +69 -0
  4. package/lib/Feedback/Sentiment.d.ts +3 -0
  5. package/lib/Feedback/Sentiment.js +55 -0
  6. package/lib/Feedback/Thumbs.d.ts +7 -0
  7. package/lib/Feedback/Thumbs.js +79 -0
  8. package/lib/Feedback/index.d.ts +3 -0
  9. package/lib/Feedback/index.js +23 -0
  10. package/lib/Feedback/types.d.ts +26 -0
  11. package/lib/Feedback/types.js +3 -0
  12. package/lib/Markdown/CodeSample/CodeSample.d.ts +1 -1
  13. package/lib/Markdown/Details.d.ts +1 -1
  14. package/lib/Markdown/MarkdownLayout.d.ts +3 -2
  15. package/lib/Markdown/MarkdownLayout.js +8 -2
  16. package/lib/Markdown/Mermaid.d.ts +1 -1
  17. package/lib/Markdown/Tabs/Tab.d.ts +1 -1
  18. package/lib/Markdown/Tabs/Tabs.d.ts +1 -1
  19. package/lib/Navbar/MobileNavbarMenu.d.ts +3 -2
  20. package/lib/Navbar/MobileNavbarMenu.js +16 -4
  21. package/lib/Navbar/Navbar.js +6 -3
  22. package/lib/NavbarLogo/NavbarLogo.d.ts +1 -1
  23. package/lib/Profile/LoginLink.d.ts +5 -0
  24. package/lib/Profile/LoginLink.js +30 -0
  25. package/lib/Profile/Profile.js +8 -1
  26. package/lib/Profile/UserProfile.d.ts +13 -0
  27. package/lib/Profile/UserProfile.js +82 -0
  28. package/lib/Profile/index.d.ts +4 -0
  29. package/lib/Profile/index.js +5 -1
  30. package/lib/Search/Autocomplete.js +1 -0
  31. package/lib/Search/Popover.js +9 -1
  32. package/lib/Search/Search.js +37 -4
  33. package/lib/Sidebar/ArrowBack.js +2 -2
  34. package/lib/Sidebar/SidebarLayout.d.ts +1 -5
  35. package/lib/Sidebar/SidebarLayout.js +1 -26
  36. package/lib/SourceCode/SourceCode.d.ts +1 -1
  37. package/lib/config.d.ts +55 -2
  38. package/lib/config.js +18 -0
  39. package/lib/globalStyle.js +6 -2
  40. package/lib/hooks/useActiveHeading.d.ts +1 -1
  41. package/lib/hooks/useActiveSectionId.d.ts +1 -1
  42. package/lib/hooks/useActiveSectionId.js +0 -3
  43. package/lib/hooks/useControl.d.ts +1 -1
  44. package/lib/hooks/useNavbarHeight.d.ts +1 -1
  45. package/lib/index.d.ts +1 -0
  46. package/lib/index.js +1 -0
  47. package/lib/mocks/hooks/index.js +6 -0
  48. package/lib/mocks/types/index.d.ts +1 -1
  49. package/lib/mocks/types.d.ts +3 -3
  50. package/lib/types/config.d.ts +1 -1
  51. package/lib/ui/Box.d.ts +2 -2
  52. package/lib/ui/Box.js +1 -0
  53. package/lib/ui/Burger.js +3 -2
  54. package/lib/ui/Dropdown.d.ts +1 -1
  55. package/lib/ui/Tiles/ThinTile.d.ts +1 -1
  56. package/lib/utils/jsonToHtml.d.ts +1 -1
  57. package/lib/utils/media-css.d.ts +1 -1
  58. package/package.json +7 -4
  59. package/src/Feedback/Rating.tsx +79 -0
  60. package/src/Feedback/Sentiment.tsx +36 -0
  61. package/src/Feedback/Thumbs.tsx +116 -0
  62. package/src/Feedback/index.ts +3 -0
  63. package/src/Feedback/types.ts +29 -0
  64. package/src/Markdown/MarkdownLayout.tsx +10 -1
  65. package/src/Navbar/MobileNavbarMenu.tsx +14 -0
  66. package/src/Navbar/Navbar.tsx +12 -3
  67. package/src/Profile/LoginLink.tsx +29 -0
  68. package/src/Profile/Profile.tsx +8 -1
  69. package/src/Profile/UserProfile.tsx +101 -0
  70. package/src/Profile/index.ts +4 -0
  71. package/src/Search/Autocomplete.tsx +1 -0
  72. package/src/Search/Popover.tsx +9 -1
  73. package/src/Search/Search.tsx +25 -15
  74. package/src/Sidebar/ArrowBack.tsx +2 -2
  75. package/src/Sidebar/SidebarLayout.tsx +1 -38
  76. package/src/config.ts +19 -0
  77. package/src/globalStyle.ts +7 -2
  78. package/src/hooks/useActiveSectionId.ts +0 -2
  79. package/src/index.ts +1 -0
  80. package/src/mocks/hooks/index.ts +6 -0
  81. package/src/settings.yaml +2 -0
  82. package/src/types/portal/index.d.ts +1 -1
  83. package/src/ui/Box.tsx +5 -2
  84. package/src/ui/Burger.tsx +3 -2
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { FlattenSimpleInterpolation } from 'styled-components';
3
- export declare type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge' | string;
4
- export declare type ButtonColor = 'primary' | 'secondary' | 'default' | string;
5
- export declare type ButtonVariant = 'outlined' | 'contained';
3
+ export type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge' | string;
4
+ export type ButtonColor = 'primary' | 'secondary' | 'default' | string;
5
+ export type ButtonVariant = 'outlined' | 'contained';
6
6
  export interface ButtonProps {
7
7
  color?: ButtonColor;
8
8
  disabled?: boolean;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { RatingProps } from '../Feedback';
3
+ export declare const Rating: ({ settings, onSubmit }: RatingProps) => JSX.Element;
@@ -0,0 +1,69 @@
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
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Rating = void 0;
30
+ const React = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const Rating = ({ settings, onSubmit }) => {
33
+ const { label, max, submitText } = settings || {};
34
+ const [submitValue, setSubmitValue] = React.useState(0);
35
+ if (submitValue) {
36
+ return (React.createElement(RatingWidget, null,
37
+ React.createElement(Label, null, submitText || 'Thank you for helping improve our documentation!')));
38
+ }
39
+ return (React.createElement(RatingWidget, null,
40
+ React.createElement(Label, null, label || 'How helpful was this page?'),
41
+ React.createElement(Stars, { max: max || 5, onSubmit: (value) => {
42
+ setSubmitValue(value);
43
+ onSubmit(value);
44
+ } })));
45
+ };
46
+ exports.Rating = Rating;
47
+ const Stars = ({ max, onSubmit }) => {
48
+ const [hovered, setHovered] = React.useState(0);
49
+ const stars = [];
50
+ for (let index = 1; index <= max; index++) {
51
+ stars.push(React.createElement(Star, { key: index, onClick: () => onSubmit(index), onMouseOver: () => setHovered(index), onMouseLeave: () => setHovered(0) },
52
+ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20" }, hovered < index ? (React.createElement("g", { fill: "#e8c002" },
53
+ React.createElement("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" }))) : (React.createElement("g", { fill: "#e8c002" },
54
+ React.createElement("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" }))))));
55
+ }
56
+ return React.createElement(React.Fragment, null, stars);
57
+ };
58
+ const RatingWidget = styled_components_1.default.div `
59
+ display: flex;
60
+ align-items: center;
61
+ `;
62
+ const Star = styled_components_1.default.span `
63
+ cursor: pointer;
64
+ `;
65
+ const Label = styled_components_1.default.h3 `
66
+ margin-right: 15px;
67
+ font-family: var(--font-family-base);
68
+ `;
69
+ //# sourceMappingURL=Rating.js.map
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { SentimentProps } from '../Feedback';
3
+ export declare const Sentiment: ({ settings, onSubmit }: SentimentProps) => JSX.Element;
@@ -0,0 +1,55 @@
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
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Sentiment = void 0;
30
+ const React = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const Thumbs_1 = require("./Thumbs");
33
+ const Sentiment = ({ settings, onSubmit }) => {
34
+ const { label } = settings || {};
35
+ return (React.createElement(Wrapper, null,
36
+ React.createElement(Label, null, label || 'Was this page helpful?'),
37
+ React.createElement(Vote, { onClick: () => onSubmit(1) },
38
+ React.createElement(Thumbs_1.ThumbUp, { text: "Yes" })),
39
+ React.createElement(Vote, { onClick: () => onSubmit(-1) },
40
+ React.createElement(Thumbs_1.ThumbDown, null))));
41
+ };
42
+ exports.Sentiment = Sentiment;
43
+ const Wrapper = styled_components_1.default.div `
44
+ font-family: var(--font-family-base);
45
+ display: flex;
46
+ align-items: center;
47
+ `;
48
+ const Label = styled_components_1.default.h3 `
49
+ margin-right: 15px;
50
+ `;
51
+ const Vote = styled_components_1.default.div `
52
+ cursor: pointer;
53
+ margin: 0 10px;
54
+ `;
55
+ //# sourceMappingURL=Sentiment.js.map
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const ThumbUp: ({ text }: {
3
+ text?: string | undefined;
4
+ }) => JSX.Element;
5
+ export declare const ThumbDown: ({ text }: {
6
+ text?: string | undefined;
7
+ }) => JSX.Element;
@@ -0,0 +1,79 @@
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
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ThumbDown = exports.ThumbUp = void 0;
30
+ const React = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const ThumbUp = ({ text }) => (React.createElement(Wrapper, { style: { alignItems: 'normal' } },
33
+ React.createElement(Icon, null,
34
+ React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 512 512" },
35
+ React.createElement("g", null,
36
+ React.createElement("g", null,
37
+ React.createElement("g", null,
38
+ React.createElement("path", { d: "M495.736,290.773C509.397,282.317,512,269.397,512,260.796c0-22.4-18.253-47.462-42.667-47.462H349.918\n c-4.284-0.051-25.651-1.51-25.651-25.6c0-4.71-3.814-8.533-8.533-8.533s-8.533,3.823-8.533,8.533\n c0,33.749,27.913,42.667,42.667,42.667h119.467c14.182,0,25.6,16.631,25.6,30.396c0,4.437,0,17.946-26.53,20.855\n c-4.506,0.495-7.834,4.42-7.586,8.951c0.239,4.523,3.985,8.064,8.516,8.064c14.114,0,25.6,11.486,25.6,25.6\n s-11.486,25.6-25.6,25.6h-17.067c-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c14.114,0,25.6,11.486,25.6,25.6\n s-11.486,25.6-25.6,25.6h-25.6c-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c8.934,0,17.067,8.132,17.067,17.067\n c0,8.61-8.448,17.067-17.067,17.067h-128c-35.627,0-48.444-7.074-63.292-15.258c-12.553-6.921-26.786-14.763-54.963-18.79\n c-4.668-0.674-8.994,2.577-9.66,7.236c-0.666,4.668,2.569,8.994,7.236,9.66c25.105,3.584,37.325,10.325,49.152,16.845\n c15.497,8.542,31.505,17.374,71.526,17.374h128c17.869,0,34.133-16.273,34.133-34.133c0-6.229-1.775-12.134-4.83-17.229\n c21.794-1.877,38.963-20.224,38.963-42.505c0-10.829-4.062-20.736-10.735-28.271C500.42,358.212,512,342.571,512,324.267\n C512,310.699,505.634,298.59,495.736,290.773z" }),
39
+ React.createElement("path", { d: "M76.8,443.733c9.412,0,17.067-7.654,17.067-17.067S86.212,409.6,76.8,409.6c-9.412,0-17.067,7.654-17.067,17.067\n S67.388,443.733,76.8,443.733z" }),
40
+ React.createElement("path", { d: "M179.2,247.467c25.353,0,57.429-28.297,74.3-45.167c36.634-36.634,36.634-82.167,36.634-151.1\n c0-5.342,3.191-8.533,8.533-8.533c29.508,0,42.667,13.158,42.667,42.667v102.4c0,4.71,3.814,8.533,8.533,8.533\n s8.533-3.823,8.533-8.533v-102.4c0-39.083-20.659-59.733-59.733-59.733c-14.831,0-25.6,10.769-25.6,25.6\n c0,66.978,0,107.401-31.633,139.034C216.661,215.006,192.811,230.4,179.2,230.4c-4.719,0-8.533,3.823-8.533,8.533\n S174.481,247.467,179.2,247.467z" }),
41
+ React.createElement("path", { d: "M145.067,213.333H8.533c-4.719,0-8.533,3.823-8.533,8.533v256c0,4.71,3.814,8.533,8.533,8.533h136.533\n c4.719,0,8.533-3.823,8.533-8.533v-256C153.6,217.156,149.786,213.333,145.067,213.333z M136.533,469.333H17.067V230.4h119.467\n V469.333z" })))))),
42
+ React.createElement("span", null, text || 'Yes')));
43
+ exports.ThumbUp = ThumbUp;
44
+ const ThumbDown = ({ text }) => (React.createElement(Wrapper, { style: { alignItems: 'end' } },
45
+ React.createElement(Icon, null,
46
+ React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 512 512" },
47
+ React.createElement("g", null,
48
+ React.createElement("g", null,
49
+ React.createElement("g", null,
50
+ React.createElement("path", { d: "M76.8,247.467c9.412,0,17.067-7.654,17.067-17.067c0-9.412-7.654-17.067-17.067-17.067\n\t\t\t\tc-9.412,0-17.067,7.654-17.067,17.067C59.733,239.812,67.388,247.467,76.8,247.467z" }),
51
+ React.createElement("path", { d: "M495.736,221.227C505.634,213.41,512,201.301,512,187.733c0-18.295-11.58-33.946-27.802-39.996\n\t\t\t\tc6.673-7.535,10.735-17.434,10.735-28.271c0-22.281-17.169-40.627-38.963-42.505c3.055-5.094,4.83-10.999,4.83-17.229\n\t\t\t\tc0-17.86-16.265-34.133-34.133-34.133h-128c-40.021,0-56.03,8.832-71.526,17.374c-11.827,6.519-24.047,13.261-49.152,16.845\n\t\t\t\tc-4.668,0.666-7.902,4.992-7.236,9.66c0.666,4.659,4.949,7.885,9.66,7.236c28.177-4.028,42.411-11.87,54.963-18.79\n\t\t\t\tc14.848-8.183,27.665-15.258,63.292-15.258h128c8.619,0,17.067,8.456,17.067,17.067c0,8.934-8.132,17.067-17.067,17.067\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533h25.6c14.114,0,25.6,11.486,25.6,25.6s-11.486,25.6-25.6,25.6\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533c0,4.71,3.814,8.533,8.533,8.533h17.067c14.114,0,25.6,11.486,25.6,25.6\n\t\t\t\ts-11.486,25.6-25.6,25.6c-4.531,0-8.277,3.541-8.516,8.064c-0.247,4.531,3.081,8.457,7.586,8.951\n\t\t\t\tc26.53,2.91,26.53,16.418,26.53,20.847c0,13.773-11.418,30.404-25.6,30.404H349.867c-14.763,0-42.667,8.917-42.667,42.667\n\t\t\t\tc0,4.71,3.814,8.533,8.533,8.533s8.533-3.823,8.533-8.533c0-24.09,21.367-25.549,25.6-25.6h119.467\n\t\t\t\tc24.414,0,42.667-25.054,42.667-47.471C512,242.603,509.397,229.683,495.736,221.227z" }),
52
+ React.createElement("path", { d: "M349.867,315.733c-4.719,0-8.533,3.823-8.533,8.533v102.4c0,29.508-13.158,42.667-42.667,42.667\n\t\t\t\tc-5.342,0-8.533-3.192-8.533-8.533c0-68.932,0-114.466-36.634-151.1c-16.87-16.87-48.947-45.167-74.3-45.167\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c13.611,0,37.461,15.394,62.234,40.166\n\t\t\t\tc31.633,31.633,31.633,72.055,31.633,139.034c0,14.831,10.769,25.6,25.6,25.6c39.074,0,59.733-20.651,59.733-59.733v-102.4\n\t\t\t\tC358.4,319.556,354.586,315.733,349.867,315.733z" }),
53
+ React.createElement("path", { d: "M145.067,25.6H8.533C3.814,25.6,0,29.423,0,34.133v256c0,4.71,3.814,8.533,8.533,8.533h136.533\n\t\t\t\tc4.719,0,8.533-3.823,8.533-8.533v-256C153.6,29.423,149.786,25.6,145.067,25.6z M136.533,281.6H17.067V42.667h119.467V281.6z" })))))),
54
+ React.createElement("span", null, text || 'No')));
55
+ exports.ThumbDown = ThumbDown;
56
+ const Wrapper = styled_components_1.default.div `
57
+ font-family: var(--font-family-base);
58
+ display: flex;
59
+ color: var(--color-primary-500);
60
+ &:hover {
61
+ color: var(--color-primary-600);
62
+ svg {
63
+ > g {
64
+ fill: var(--color-primary-600);
65
+ }
66
+ }
67
+ }
68
+ `;
69
+ const Icon = styled_components_1.default.div `
70
+ width: 18px;
71
+ height: 18px;
72
+ margin-right: 5px;
73
+ > svg {
74
+ > g {
75
+ fill: var(--color-primary-500);
76
+ }
77
+ }
78
+ `;
79
+ //# sourceMappingURL=Thumbs.js.map
@@ -0,0 +1,3 @@
1
+ export { Rating } from './Rating';
2
+ export { Sentiment } from './Sentiment';
3
+ export * from './types';
@@ -0,0 +1,23 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Sentiment = exports.Rating = void 0;
18
+ var Rating_1 = require("./Rating");
19
+ Object.defineProperty(exports, "Rating", { enumerable: true, get: function () { return Rating_1.Rating; } });
20
+ var Sentiment_1 = require("./Sentiment");
21
+ Object.defineProperty(exports, "Sentiment", { enumerable: true, get: function () { return Sentiment_1.Sentiment; } });
22
+ __exportStar(require("./types"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,26 @@
1
+ export type RatingProps = {
2
+ onSubmit: (value: number) => void;
3
+ settings?: {
4
+ label?: string;
5
+ max?: number;
6
+ submitText?: string;
7
+ };
8
+ };
9
+ export type SentimentProps = {
10
+ onSubmit: (value: -1 | 1) => void;
11
+ settings?: {
12
+ label?: string;
13
+ };
14
+ };
15
+ export type CommentProps = {
16
+ onSubmit: (value: string) => void;
17
+ settings?: {
18
+ label?: string;
19
+ };
20
+ };
21
+ export type ProblemProps = {
22
+ onSubmit: (value: string, location: string) => void;
23
+ settings?: {
24
+ label?: string;
25
+ };
26
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare type CodeSampleProps = {
2
+ export type CodeSampleProps = {
3
3
  language: string;
4
4
  highlighted: string;
5
5
  rawContent: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type DetailsProps = {
2
+ type DetailsProps = {
3
3
  summary: string;
4
4
  };
5
5
  export declare function Details({ summary, children }: React.PropsWithChildren<DetailsProps>): JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- declare type MarkdownLayoutProps = {
2
+ type MarkdownLayoutProps = {
3
3
  tableOfContent: React.ReactNode;
4
4
  markdownWrapper: React.ReactNode;
5
+ feedback: React.ReactNode;
5
6
  editPage?: {
6
7
  to: string;
7
8
  text: string;
@@ -10,5 +11,5 @@ declare type MarkdownLayoutProps = {
10
11
  /** String in ISO format */
11
12
  lastModified?: string | null;
12
13
  };
13
- export declare function MarkdownLayout({ tableOfContent, markdownWrapper, editPage, lastModified, }: MarkdownLayoutProps): JSX.Element;
14
+ export declare function MarkdownLayout({ tableOfContent, markdownWrapper, feedback, editPage, lastModified, }: MarkdownLayoutProps): JSX.Element;
14
15
  export {};
@@ -12,16 +12,17 @@ const PageNavigation_1 = require("../PageNavigation/PageNavigation");
12
12
  const EditPageButton_1 = require("../EditPageButton");
13
13
  const LastUpdated_1 = require("../LastUpdated/LastUpdated");
14
14
  const hooks_1 = require("../hooks");
15
- function MarkdownLayout({ tableOfContent, markdownWrapper, editPage, lastModified, }) {
15
+ function MarkdownLayout({ tableOfContent, markdownWrapper, feedback, editPage, lastModified, }) {
16
16
  const { markdown } = (0, hooks_1.useThemeConfig)();
17
17
  const { editPage: themeEditPage } = markdown || {};
18
- const mergedConf = editPage ? Object.assign(Object.assign({}, editPage), themeEditPage) : undefined;
18
+ const mergedConf = editPage ? Object.assign(Object.assign({}, themeEditPage), editPage) : undefined;
19
19
  return (react_1.default.createElement(PageWrapper_1.PageWrapper, { "data-component-name": "Markdown/MarkdownLayout" },
20
20
  react_1.default.createElement(ContainerWrapper_1.ContainerWrapper, { withToc: true },
21
21
  react_1.default.createElement(LayoutTop, null,
22
22
  lastModified && react_1.default.createElement(LastUpdated_1.LastUpdated, { lastModified: new Date(lastModified) }),
23
23
  mergedConf && (react_1.default.createElement(EditPageButton_1.EditPageButton, { text: mergedConf.text, to: mergedConf.to, icon: mergedConf.icon }))),
24
24
  markdownWrapper,
25
+ react_1.default.createElement(LayoutBottom, null, feedback),
25
26
  react_1.default.createElement(PageNavigation_1.PageNavigation, null)),
26
27
  tableOfContent));
27
28
  }
@@ -31,4 +32,9 @@ const LayoutTop = styled_components_1.default.div `
31
32
  justify-content: space-between;
32
33
  flex-flow: row nowrap;
33
34
  `;
35
+ const LayoutBottom = (0, styled_components_1.default)(LayoutTop) `
36
+ > * {
37
+ margin: 25px 5px;
38
+ }
39
+ `;
34
40
  //# sourceMappingURL=MarkdownLayout.js.map
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type MermaidProps = {
2
+ type MermaidProps = {
3
3
  diagramHtml: string;
4
4
  };
5
5
  export declare function Mermaid({ diagramHtml }: MermaidProps): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type TabProps = {
2
+ type TabProps = {
3
3
  activeTab: string;
4
4
  label: string;
5
5
  onClick: (e: string) => void;
@@ -1,5 +1,5 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- declare type TabsProps = PropsWithChildren<{
2
+ type TabsProps = PropsWithChildren<{
3
3
  children: {
4
4
  props: {
5
5
  label: string;
@@ -1,6 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { ResolvedConfigLinks } from '@theme/types/portal';
3
- export declare function MobileNavbarMenu({ menuItems, closeMenu, }: {
3
+ export declare function MobileNavbarMenu({ menuItems, closeMenu, search, }: {
4
4
  menuItems: ResolvedConfigLinks;
5
+ search: React.ReactNode | undefined;
5
6
  closeMenu: () => void;
6
7
  }): JSX.Element | null;
@@ -10,14 +10,16 @@ const NavbarItem_1 = require("../Navbar/NavbarItem");
10
10
  const MobileNavbarItem_1 = require("../Navbar/MobileNavbarItem");
11
11
  const NavbarDropdown_1 = require("../Navbar/NavbarDropdown");
12
12
  const utils_1 = require("../utils");
13
- function MobileNavbarMenu({ menuItems, closeMenu, }) {
13
+ function MobileNavbarMenu({ menuItems, closeMenu, search, }) {
14
14
  if ((0, utils_1.isPrimitive)(menuItems) || (0, utils_1.isEmptyArray)(menuItems)) {
15
15
  return null;
16
16
  }
17
17
  return (react_1.default.createElement(NavbarItemsWrapper, { "data-component-name": "Navbar/MobileNavbarMenu" },
18
- react_1.default.createElement(NavbarItemsContainer, null, menuItems.map((navItem, index) => {
19
- return (react_1.default.createElement(MobileNavbarItem_1.MobileNavbarItem, { key: `${navItem.label}_${index}`, "data-cy": navItem.label, navItem: navItem }));
20
- })),
18
+ react_1.default.createElement(NavbarItemsContainer, null,
19
+ react_1.default.createElement(MobileSearchWrapper, null, search || null),
20
+ menuItems.map((navItem, index) => {
21
+ return (react_1.default.createElement(MobileNavbarItem_1.MobileNavbarItem, { key: `${navItem.label}_${index}`, "data-cy": navItem.label, navItem: navItem }));
22
+ })),
21
23
  react_1.default.createElement(NavbarItemsClosableArea, { onClick: closeMenu })));
22
24
  }
23
25
  exports.MobileNavbarMenu = MobileNavbarMenu;
@@ -89,4 +91,14 @@ const NavbarItemsContainer = styled_components_1.default.ul `
89
91
  position: relative;
90
92
  }
91
93
  `;
94
+ const MobileSearchWrapper = styled_components_1.default.div `
95
+ padding: var(--navbar-item-padding-horizontal);
96
+ > div {
97
+ display: block;
98
+ width: 100%;
99
+ }
100
+ input {
101
+ width: 100%;
102
+ }
103
+ `;
92
104
  //# sourceMappingURL=MobileNavbarMenu.js.map
@@ -14,8 +14,9 @@ const ColorModeSwitcher_1 = require("../ColorModeSwitcher/ColorModeSwitcher");
14
14
  const useThemeConfig_1 = require("../hooks/useThemeConfig");
15
15
  function Navbar({ menu, logo, search, profile }) {
16
16
  const [isOpen, setIsOpen] = (0, useMobileMenu_1.useMobileMenu)(false);
17
- const { search: searchSettings, navbar } = (0, useThemeConfig_1.useThemeConfig)();
17
+ const { search: searchSettings, navbar, userProfile: userProfileSettings } = (0, useThemeConfig_1.useThemeConfig)();
18
18
  const hideSearch = (searchSettings === null || searchSettings === void 0 ? void 0 : searchSettings.hide) || ((searchSettings === null || searchSettings === void 0 ? void 0 : searchSettings.placement) && (searchSettings === null || searchSettings === void 0 ? void 0 : searchSettings.placement) !== 'navbar');
19
+ const hideUserProfile = userProfileSettings === null || userProfileSettings === void 0 ? void 0 : userProfileSettings.hide;
19
20
  if (navbar === null || navbar === void 0 ? void 0 : navbar.hide) {
20
21
  return null;
21
22
  }
@@ -23,16 +24,18 @@ function Navbar({ menu, logo, search, profile }) {
23
24
  const closeMobileMenu = () => setIsOpen(false);
24
25
  return (react_1.default.createElement(exports.NavbarContainer, { "data-component-name": "Navbar/Navbar" },
25
26
  react_1.default.createElement(MobileNavbarMenuButton_1.MobileNavbarMenuButton, { onClick: openMobileMenu }),
26
- isOpen && react_1.default.createElement(MobileNavbarMenu_1.MobileNavbarMenu, { closeMenu: closeMobileMenu, menuItems: menu }),
27
+ isOpen && (react_1.default.createElement(MobileNavbarMenu_1.MobileNavbarMenu, { closeMenu: closeMobileMenu, menuItems: menu, search: hideSearch ? null : search })),
27
28
  react_1.default.createElement(exports.NavbarRow, null,
28
29
  logo,
29
30
  react_1.default.createElement(Navbar_1.NavbarMenu, { menuItems: menu }),
30
31
  hideSearch ? null : search,
31
- profile,
32
+ hideUserProfile ? null : profile,
32
33
  react_1.default.createElement(ColorModeSwitcher_1.ColorModeSwitcher, null))));
33
34
  }
34
35
  exports.Navbar = Navbar;
35
36
  exports.NavbarContainer = styled_components_1.default.nav `
37
+ --text-color: var(--navbar-text-color);
38
+
36
39
  height: var(--navbar-height);
37
40
  box-sizing: border-box;
38
41
  display: flex;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { LogoConfig } from '@theme/types/portal';
3
- export declare type NavbarLogoProps = {
3
+ export type NavbarLogoProps = {
4
4
  logo: Pick<LogoConfig, 'image' | 'link' | 'altText'>;
5
5
  };
6
6
  export declare function NavbarLogo({ logo }: NavbarLogoProps): JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface LoginLinkProps {
3
+ href: string;
4
+ }
5
+ export declare function LoginLink({ href }: LoginLinkProps): JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LoginLink = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const useThemeConfig_1 = require("../hooks/useThemeConfig");
10
+ function LoginLink({ href }) {
11
+ const { userProfile } = (0, useThemeConfig_1.useThemeConfig)();
12
+ return react_1.default.createElement(StyledLink, { href: href }, (userProfile === null || userProfile === void 0 ? void 0 : userProfile.loginLabel) || 'Login');
13
+ }
14
+ exports.LoginLink = LoginLink;
15
+ const StyledLink = styled_components_1.default.a.attrs(() => ({
16
+ 'data-component-name': 'Profile/LoginLink',
17
+ })) `
18
+ display: inline-block;
19
+ color: var(--navbar-text-color);
20
+ text-decoration: none;
21
+ padding: 0 var(--navbar-item-padding-horizontal);
22
+ text-align: center;
23
+ line-height: 1;
24
+ font-size: var(--navbar-item-font-size);
25
+ font-weight: var(--navbar-item-font-weight);
26
+ &:hover {
27
+ color: var(--navbar-item-hover-text-color);
28
+ }
29
+ `;
30
+ //# sourceMappingURL=LoginLink.js.map
@@ -42,7 +42,9 @@ function ProfileComponent({ name, imageUrl, onClick, color }) {
42
42
  react_1.default.createElement("span", null, avatarLetters))));
43
43
  }
44
44
  exports.Profile = (0, react_1.memo)(ProfileComponent);
45
- const ProfileWrapper = styled_components_1.default.div `
45
+ const ProfileWrapper = styled_components_1.default.div.attrs(() => ({
46
+ 'data-component-name': 'Profile/Profile',
47
+ })) `
46
48
  display: flex;
47
49
  align-items: center;
48
50
  cursor: pointer;
@@ -51,6 +53,11 @@ const ProfileWrapper = styled_components_1.default.div `
51
53
  `;
52
54
  const StyledUserName = styled_components_1.default.span `
53
55
  color: ${({ color }) => color || 'var(--navbar-text-color)'};
56
+ display: none;
57
+
58
+ ${({ theme }) => { var _a; return (_a = theme.mediaQueries) === null || _a === void 0 ? void 0 : _a.medium; }} {
59
+ display: block;
60
+ }
54
61
  `;
55
62
  const AvatarWrapper = styled_components_1.default.div `
56
63
  width: 40px;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface UserProfileProps {
3
+ userInfo: {
4
+ isAuthenticated: boolean;
5
+ name: string;
6
+ picture: string;
7
+ logoutDisabled?: boolean;
8
+ };
9
+ handleLogout: (logoutRedirect?: string) => void;
10
+ hasDeveloperOnboarding?: boolean;
11
+ hasApiLogs?: boolean;
12
+ }
13
+ export declare function UserProfile({ userInfo, handleLogout, hasDeveloperOnboarding, hasApiLogs, }: UserProfileProps): JSX.Element;
@@ -0,0 +1,82 @@
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
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.UserProfile = void 0;
30
+ const react_1 = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const Link_1 = require("../mocks/Link");
33
+ const Profile_1 = require("../Profile/Profile");
34
+ const Tooltip_1 = require("../Tooltip/Tooltip");
35
+ const useThemeConfig_1 = require("../hooks/useThemeConfig");
36
+ function UserProfile({ userInfo, handleLogout, hasDeveloperOnboarding = false, hasApiLogs = false, }) {
37
+ const [isOpened, setIsOpened] = (0, react_1.useState)(false);
38
+ const { userProfile: userProfileSettings } = (0, useThemeConfig_1.useThemeConfig)();
39
+ const logoutRedirect = (userProfileSettings === null || userProfileSettings === void 0 ? void 0 : userProfileSettings.logoutRedirect) || '/';
40
+ return (react_1.default.createElement(StyledTooltip, { isOpen: isOpened, withArrow: false, className: "copy-button", placement: "bottom", width: "100%", tip: react_1.default.createElement(StyledUl, null,
41
+ hasDeveloperOnboarding ? (react_1.default.createElement(Link_1.Link, { to: "/apps" },
42
+ react_1.default.createElement(StyledLi, null, "My Apps"))) : null,
43
+ hasApiLogs ? (react_1.default.createElement(Link_1.Link, { to: "/api-logs" },
44
+ react_1.default.createElement(StyledLi, null, "API logs"))) : null,
45
+ react_1.default.createElement(StyledLi, { onClick: () => handleLogout(logoutRedirect) }, (userProfileSettings === null || userProfileSettings === void 0 ? void 0 : userProfileSettings.logoutLabel) || 'Log out')) },
46
+ react_1.default.createElement(Profile_1.Profile, { name: userInfo.name, imageUrl: userInfo.picture, onClick: userInfo.logoutDisabled ? undefined : () => setIsOpened(!isOpened) })));
47
+ }
48
+ exports.UserProfile = UserProfile;
49
+ const StyledTooltip = (0, styled_components_1.default)(Tooltip_1.Tooltip) `
50
+ > span {
51
+ padding: 0;
52
+ }
53
+ `;
54
+ const StyledUl = styled_components_1.default.ul `
55
+ margin: 0;
56
+ padding: 0;
57
+ list-style: none;
58
+ text-align: left;
59
+ background-color: var(--search-modal-background);
60
+ color: var(--search-modal-text-color);
61
+ min-width: 100px;
62
+ a {
63
+ text-decoration: none;
64
+ &:hover {
65
+ color: inherit;
66
+ }
67
+ &:visited {
68
+ color: inherit;
69
+ }
70
+ }
71
+ `;
72
+ const StyledLi = styled_components_1.default.li `
73
+ cursor: pointer;
74
+ font-size: 16px;
75
+ list-style: none;
76
+ padding: 15px 20px;
77
+ transition: background-color 0.25s ease 0s;
78
+ &:hover {
79
+ background-color: rgba(0, 0, 0, 0.1);
80
+ }
81
+ `;
82
+ //# sourceMappingURL=UserProfile.js.map