@redocly/theme 0.24.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/CodeBlock/CodeBlockControls.js +1 -1
- package/lib/components/Feedback/Feedback.js +1 -1
- package/lib/components/Feedback/Mood.js +9 -5
- package/lib/components/Feedback/Rating.js +10 -6
- package/lib/components/Feedback/ReportDialog.js +16 -3
- package/lib/components/Feedback/Sentiment.js +9 -5
- package/lib/components/Feedback/types.d.ts +1 -1
- package/lib/components/Feedback/useReportDialog.js +3 -0
- package/lib/components/OpenApiDocs/ScorecardBadges.js +1 -3
- package/lib/components/Scorecard/Card.d.ts +2 -0
- package/lib/components/Scorecard/Card.js +26 -0
- package/lib/components/Scorecard/Gauge.d.ts +8 -0
- package/lib/components/Scorecard/Gauge.js +58 -0
- package/lib/components/Scorecard/StatusByLevelWidget.d.ts +11 -0
- package/lib/components/Scorecard/StatusByLevelWidget.js +80 -0
- package/lib/globalStyle.js +13 -8
- package/lib/types/portal/src/shared/types/feedback.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/CodeBlock/CodeBlockControls.tsx +0 -1
- package/src/components/Feedback/Feedback.tsx +2 -2
- package/src/components/Feedback/Mood.tsx +11 -5
- package/src/components/Feedback/Rating.tsx +11 -6
- package/src/components/Feedback/ReportDialog.tsx +6 -2
- package/src/components/Feedback/Sentiment.tsx +9 -5
- package/src/components/Feedback/types.ts +1 -1
- package/src/components/Feedback/useReportDialog.ts +3 -0
- package/src/components/OpenApiDocs/ScorecardBadges.tsx +1 -1
- package/src/components/Scorecard/Card.tsx +21 -0
- package/src/components/Scorecard/Gauge.tsx +44 -0
- package/src/components/Scorecard/StatusByLevelWidget.tsx +67 -0
- package/src/globalStyle.ts +24 -18
- package/src/types/portal/src/shared/types/feedback.ts +1 -0
|
@@ -29,7 +29,7 @@ function CodeBlockControls({ children, className, title, controls, }) {
|
|
|
29
29
|
collapse && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.collapse) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { "data-cy": "collapse-all", "data-testid": "collapse-all", asIcon: controlsType === 'icon', onClick: collapse === null || collapse === void 0 ? void 0 : collapse.onClick, title: (collapse === null || collapse === void 0 ? void 0 : collapse.tooltipText) || 'Collapse all' }, controlsType === 'icon' ? (react_1.default.createElement(icons_1.CollapseIcon, null)) : (collapse === null || collapse === void 0 ? void 0 : collapse.label) ? (collapse.label) : ('Collapse all'))) : null,
|
|
30
30
|
select ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { "data-cy": "select-all", "data-testid": "select-all", asIcon: controlsType === 'icon', onClick: select === null || select === void 0 ? void 0 : select.onClick, title: select === null || select === void 0 ? void 0 : select.tooltipText }, controlsType === 'icon' ? react_1.default.createElement(icons_1.SelectIcon, null) : (select === null || select === void 0 ? void 0 : select.label) ? select.label : 'Select all')) : null,
|
|
31
31
|
deselect ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { "data-cy": "clear-all", "data-testid": "clear-all", asIcon: controlsType === 'icon', onClick: deselect === null || deselect === void 0 ? void 0 : deselect.onClick, title: deselect === null || deselect === void 0 ? void 0 : deselect.tooltipText }, controlsType === 'icon' ? (react_1.default.createElement(icons_1.DeselectIcon, null)) : (deselect === null || deselect === void 0 ? void 0 : deselect.label) ? (deselect.label) : ('Clear all'))) : null,
|
|
32
|
-
report && ((_d = report === null || report === void 0 ? void 0 : report.props) === null || _d === void 0 ? void 0 : _d.visible) ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, Object.assign({ "data-cy": "report-button", "data-testid": "report-button", asIcon: controlsType === 'icon', title: report.tooltipText }, report.props
|
|
32
|
+
report && ((_d = report === null || report === void 0 ? void 0 : report.props) === null || _d === void 0 ? void 0 : _d.visible) ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, Object.assign({ "data-cy": "report-button", "data-testid": "report-button", asIcon: controlsType === 'icon', title: report.tooltipText }, report.props), controlsType === 'icon' ? react_1.default.createElement(icons_1.ReportIcon, null) : ((_e = report.props) === null || _e === void 0 ? void 0 : _e.buttonText) || 'Report')) : null))) : null;
|
|
33
33
|
return children || controls ? (react_1.default.createElement(ContainerWraper, { "data-component-name": "CodeBlock/CodeBlockControls", className: className }, children ? children : defaultControls)) : null;
|
|
34
34
|
}
|
|
35
35
|
exports.CodeBlockControls = CodeBlockControls;
|
|
@@ -40,6 +40,7 @@ const Feedback = (props) => {
|
|
|
40
40
|
const { feedback: themeFeedbackConf } = (0, hooks_1.useThemeConfig)();
|
|
41
41
|
const feedbackConf = Object.assign(Object.assign({}, themeFeedbackConf), props);
|
|
42
42
|
const renderFeedbackComponent = () => {
|
|
43
|
+
const { type, settings, path } = feedbackConf;
|
|
43
44
|
switch (type) {
|
|
44
45
|
case 'rating':
|
|
45
46
|
return (React.createElement(Wrapper, null,
|
|
@@ -70,7 +71,6 @@ const Feedback = (props) => {
|
|
|
70
71
|
break;
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
|
-
const { type, settings, path } = feedbackConf;
|
|
74
74
|
return React.createElement(React.Fragment, { key: pathname }, renderFeedbackComponent());
|
|
75
75
|
};
|
|
76
76
|
exports.Feedback = Feedback;
|
|
@@ -41,6 +41,7 @@ var MOOD_STATES;
|
|
|
41
41
|
const Mood = ({ settings, onSubmit, className }) => {
|
|
42
42
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
43
43
|
const [score, setScore] = React.useState('');
|
|
44
|
+
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
44
45
|
const [comment, setComment] = React.useState('');
|
|
45
46
|
const [reasons, setReasons] = React.useState([]);
|
|
46
47
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
@@ -72,11 +73,14 @@ const Mood = ({ settings, onSubmit, className }) => {
|
|
|
72
73
|
return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: renderCommentLabel(score) } }));
|
|
73
74
|
}
|
|
74
75
|
if (score) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
if (!isSubmitted) {
|
|
77
|
+
onSubmit({
|
|
78
|
+
score,
|
|
79
|
+
comment,
|
|
80
|
+
reasons,
|
|
81
|
+
});
|
|
82
|
+
setIsSubmitted(true);
|
|
83
|
+
}
|
|
80
84
|
return (React.createElement(Wrapper, null,
|
|
81
85
|
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for your feedback!'))));
|
|
82
86
|
}
|
|
@@ -33,6 +33,7 @@ const Feedback_1 = require("../../components/Feedback");
|
|
|
33
33
|
const hooks_1 = require("../../mocks/hooks");
|
|
34
34
|
const Rating = ({ settings, onSubmit, className }) => {
|
|
35
35
|
const { label, max, submitText, comment: commentSettings, reasons: reasonsSettings, } = settings || {};
|
|
36
|
+
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
36
37
|
const [score, setScore] = React.useState(0);
|
|
37
38
|
const [comment, setComment] = React.useState('');
|
|
38
39
|
const [reasons, setReasons] = React.useState([]);
|
|
@@ -51,12 +52,15 @@ const Rating = ({ settings, onSubmit, className }) => {
|
|
|
51
52
|
return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } }));
|
|
52
53
|
}
|
|
53
54
|
if (score) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
if (!isSubmitted) {
|
|
56
|
+
onSubmit({
|
|
57
|
+
score,
|
|
58
|
+
comment,
|
|
59
|
+
reasons,
|
|
60
|
+
max: maxRating,
|
|
61
|
+
});
|
|
62
|
+
setIsSubmitted(true);
|
|
63
|
+
}
|
|
60
64
|
return (React.createElement(Wrapper, null,
|
|
61
65
|
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
|
|
62
66
|
}
|
|
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
36
|
};
|
|
@@ -29,14 +38,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
38
|
exports.ReportDialog = void 0;
|
|
30
39
|
const React = __importStar(require("react"));
|
|
31
40
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
41
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
42
|
+
const telemetry_1 = require("../../mocks/telemetry");
|
|
32
43
|
const Comment_1 = require("../../components/Feedback/Comment");
|
|
33
44
|
const ReportDialog = ({ location, settings, onSubmit, onCancel, submitFeedback, }) => {
|
|
34
45
|
const { label } = settings;
|
|
46
|
+
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
35
47
|
return (React.createElement(Wrapper, { className: "modal" },
|
|
36
|
-
React.createElement(Comment_1.Comment, { settings: { label }, onSubmit: (value) => {
|
|
37
|
-
submitFeedback({ type: 'problem', values: value, path:
|
|
48
|
+
React.createElement(Comment_1.Comment, { settings: { label }, onSubmit: (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
yield submitFeedback({ type: 'problem', values: value, location, path: pathname });
|
|
50
|
+
telemetry_1.telemetry.send('code_snippet_reported', {});
|
|
38
51
|
onSubmit();
|
|
39
|
-
}, onCancel: onCancel })));
|
|
52
|
+
}), onCancel: onCancel })));
|
|
40
53
|
};
|
|
41
54
|
exports.ReportDialog = ReportDialog;
|
|
42
55
|
const Wrapper = styled_components_1.default.div `
|
|
@@ -34,6 +34,7 @@ const Thumbs_1 = require("../../components/Feedback/Thumbs");
|
|
|
34
34
|
const hooks_1 = require("../../mocks/hooks");
|
|
35
35
|
const Sentiment = ({ settings, onSubmit, className }) => {
|
|
36
36
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
37
|
+
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
37
38
|
const [score, setScore] = React.useState(0);
|
|
38
39
|
const [comment, setComment] = React.useState('');
|
|
39
40
|
const [reasons, setReasons] = React.useState([]);
|
|
@@ -56,11 +57,14 @@ const Sentiment = ({ settings, onSubmit, className }) => {
|
|
|
56
57
|
return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } }));
|
|
57
58
|
}
|
|
58
59
|
if (score) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
if (!isSubmitted) {
|
|
61
|
+
onSubmit({
|
|
62
|
+
score,
|
|
63
|
+
comment,
|
|
64
|
+
reasons,
|
|
65
|
+
});
|
|
66
|
+
setIsSubmitted(true);
|
|
67
|
+
}
|
|
64
68
|
return (React.createElement(Wrapper, null,
|
|
65
69
|
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
|
|
66
70
|
}
|
|
@@ -101,6 +101,6 @@ export type ReportDialogProps = {
|
|
|
101
101
|
settings: {
|
|
102
102
|
label?: string;
|
|
103
103
|
};
|
|
104
|
-
submitFeedback: ({ type, values, path }: SubmitFeedbackParams) => Promise<void>;
|
|
104
|
+
submitFeedback: ({ type, values, path, location }: SubmitFeedbackParams) => Promise<void>;
|
|
105
105
|
className?: string;
|
|
106
106
|
};
|
|
@@ -4,11 +4,13 @@ exports.useReportDialog = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const hooks_1 = require("../../mocks/hooks");
|
|
6
6
|
const hooks_2 = require("../../hooks");
|
|
7
|
+
const useSubmitFeedback_1 = require("../../mocks/Feedback/useSubmitFeedback");
|
|
7
8
|
function useReportDialog() {
|
|
8
9
|
const { codeSnippet: { report = {} } = {} } = (0, hooks_2.useThemeConfig)();
|
|
9
10
|
const [isReportDialogShown, setIsReportDialogShown] = (0, react_1.useState)(false);
|
|
10
11
|
const isReportButtonShown = (report === null || report === void 0 ? void 0 : report.hide) === false; // TODO: report temporary disabled by default
|
|
11
12
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
13
|
+
const { submitFeedback } = (0, useSubmitFeedback_1.useSubmitFeedback)();
|
|
12
14
|
const translationKeys = {
|
|
13
15
|
buttonText: 'theme.codeSnippet.report.buttonText',
|
|
14
16
|
tooltipText: 'theme.codeSnippet.report.tooltipText',
|
|
@@ -32,6 +34,7 @@ function useReportDialog() {
|
|
|
32
34
|
},
|
|
33
35
|
onSubmit: hideReportDialog,
|
|
34
36
|
onCancel: hideReportDialog,
|
|
37
|
+
submitFeedback,
|
|
35
38
|
};
|
|
36
39
|
return {
|
|
37
40
|
reportDialog: { visible: isReportDialogShown, props: reportDialogProps },
|
|
@@ -29,8 +29,6 @@ const ScorecardBadgesWrapper = styled_components_1.default.div `
|
|
|
29
29
|
function ComplianceTag(props) {
|
|
30
30
|
const { level, status, slug } = props;
|
|
31
31
|
return (react_1.default.createElement(Link_1.Link, { to: slug },
|
|
32
|
-
react_1.default.createElement(Tag_1.Tag, { color: (0, CatalogCard_1.statusToColor)(status), size: "large", onClick: () => telemetry_1.telemetry.send('scorecard_link_clicked', { action: 'click' }) },
|
|
33
|
-
level,
|
|
34
|
-
" oops")));
|
|
32
|
+
react_1.default.createElement(Tag_1.Tag, { color: (0, CatalogCard_1.statusToColor)(status), size: "large", onClick: () => telemetry_1.telemetry.send('scorecard_link_clicked', { action: 'click' }) }, level)));
|
|
35
33
|
}
|
|
36
34
|
//# sourceMappingURL=ScorecardBadges.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
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.ScorecardCardTitle = exports.ScorecardCard = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.ScorecardCard = styled_components_1.default.div `
|
|
9
|
+
color: var(--text-primary);
|
|
10
|
+
background-color: var(--thin-tile-background-color);
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
|
|
13
|
+
border: 1px solid var(--border-primary);
|
|
14
|
+
box-shadow: 0 0 10px 0 rgba(35, 35, 35, 0.05);
|
|
15
|
+
|
|
16
|
+
flex: 1;
|
|
17
|
+
min-width: 300px;
|
|
18
|
+
padding: 20px;
|
|
19
|
+
`;
|
|
20
|
+
exports.ScorecardCardTitle = styled_components_1.default.h3 `
|
|
21
|
+
font-size: 1.2rem;
|
|
22
|
+
font-weight: bold;
|
|
23
|
+
margin-bottom: 10px;
|
|
24
|
+
margin-top: 0;
|
|
25
|
+
`;
|
|
26
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
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.GaugeValue = exports.Gauge = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
function Gauge({ chunks, }) {
|
|
33
|
+
return (React.createElement(GaugeWrapper, null, chunks.map((chunk, i) => (React.createElement(GaugeChunk, Object.assign({ key: i }, chunk))))));
|
|
34
|
+
}
|
|
35
|
+
exports.Gauge = Gauge;
|
|
36
|
+
exports.GaugeValue = styled_components_1.default.span `
|
|
37
|
+
font-size: var(--font-size-lg);
|
|
38
|
+
line-height: var(line-height-regular);
|
|
39
|
+
|
|
40
|
+
margin-right: 5px;
|
|
41
|
+
vertical-align: middle;
|
|
42
|
+
display: inline-block;
|
|
43
|
+
margin-right: 0;
|
|
44
|
+
text-align: right;
|
|
45
|
+
width: 70px;
|
|
46
|
+
`;
|
|
47
|
+
const GaugeWrapper = styled_components_1.default.div `
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
height: 10px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
`;
|
|
53
|
+
const GaugeChunk = styled_components_1.default.div `
|
|
54
|
+
width: ${(props) => props.share}%;
|
|
55
|
+
background-color: ${(props) => props.color};
|
|
56
|
+
height: 10px;
|
|
57
|
+
`;
|
|
58
|
+
//# sourceMappingURL=Gauge.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface StatusByLevelWidgetProps {
|
|
3
|
+
title: string;
|
|
4
|
+
levels: {
|
|
5
|
+
name: string;
|
|
6
|
+
errors: number;
|
|
7
|
+
warnings: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export declare function StatusByLevelWidget(props: StatusByLevelWidgetProps): JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
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.StatusByLevelWidget = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const Gauge_1 = require("../../components/Scorecard/Gauge");
|
|
33
|
+
const Card_1 = require("../../components/Scorecard/Card");
|
|
34
|
+
function StatusByLevelWidget(props) {
|
|
35
|
+
const { levels, title } = props;
|
|
36
|
+
return (React.createElement(Card_1.ScorecardCard, null,
|
|
37
|
+
React.createElement(Card_1.ScorecardCardTitle, null, title),
|
|
38
|
+
React.createElement(CardBody, null, levels.map((level) => {
|
|
39
|
+
const success = level.total - level.errors - level.warnings;
|
|
40
|
+
return (React.createElement(CardRow, { key: level.name },
|
|
41
|
+
React.createElement("span", null, level.name),
|
|
42
|
+
React.createElement(Gauge_1.Gauge, { chunks: [
|
|
43
|
+
{
|
|
44
|
+
share: (success / level.total) * 100,
|
|
45
|
+
color: 'var(--scorecard-color-success)',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
share: (level.warnings / level.total) * 100,
|
|
49
|
+
color: 'var(--scorecard-color-warning)',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
share: (level.errors / level.total) * 100,
|
|
53
|
+
color: 'var(--scorecard-color-error)',
|
|
54
|
+
},
|
|
55
|
+
] }),
|
|
56
|
+
React.createElement(Gauge_1.GaugeValue, null,
|
|
57
|
+
success,
|
|
58
|
+
"/",
|
|
59
|
+
level.total)));
|
|
60
|
+
}))));
|
|
61
|
+
}
|
|
62
|
+
exports.StatusByLevelWidget = StatusByLevelWidget;
|
|
63
|
+
const CardBody = styled_components_1.default.div `
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
gap: 5px;
|
|
67
|
+
`;
|
|
68
|
+
const CardRow = styled_components_1.default.div `
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
gap: 10px;
|
|
72
|
+
|
|
73
|
+
align-items: center;
|
|
74
|
+
|
|
75
|
+
> span:first-child {
|
|
76
|
+
text-align: right;
|
|
77
|
+
width: 100px;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
//# sourceMappingURL=StatusByLevelWidget.js.map
|
package/lib/globalStyle.js
CHANGED
|
@@ -27,7 +27,7 @@ const Tooltip_1 = require("./components/Tooltip");
|
|
|
27
27
|
const LastUpdated_1 = require("./components/LastUpdated");
|
|
28
28
|
const NavbarLogo_1 = require("./components/NavbarLogo");
|
|
29
29
|
const themeColors = (0, styled_components_1.css) `
|
|
30
|
-
/* === Palette === */
|
|
30
|
+
/* === Palette === */
|
|
31
31
|
/**
|
|
32
32
|
* @tokens Base Colors
|
|
33
33
|
* @presenter Color
|
|
@@ -290,8 +290,8 @@ const typography = (0, styled_components_1.css) `
|
|
|
290
290
|
* @tokens Font Rendering
|
|
291
291
|
*/
|
|
292
292
|
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
--text-smoothing: antialiased; // text-smoothing
|
|
294
|
+
--text-rendering: optimizeSpeed; // text-rendering
|
|
295
295
|
|
|
296
296
|
// @tokens End
|
|
297
297
|
`;
|
|
@@ -385,7 +385,6 @@ const headingsTypography = (0, styled_components_1.css) `
|
|
|
385
385
|
--heading-anchor-color: var(--color-primary); // @presenter Color
|
|
386
386
|
--heading-anchor-icon: none;
|
|
387
387
|
|
|
388
|
-
|
|
389
388
|
/**
|
|
390
389
|
* @tokens Heading level 1
|
|
391
390
|
*/
|
|
@@ -702,7 +701,6 @@ const badges = (0, styled_components_1.css) `
|
|
|
702
701
|
--badge-deprecated-border: 1px solid var(--badge-deprecated-border-color); // @presenter Border
|
|
703
702
|
--badge-deprecated-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
704
703
|
|
|
705
|
-
|
|
706
704
|
// @tokens End
|
|
707
705
|
`;
|
|
708
706
|
const loadProgressBar = (0, styled_components_1.css) `
|
|
@@ -788,7 +786,8 @@ const docsDropdown = (0, styled_components_1.css) `
|
|
|
788
786
|
--docs-dropdown-padding-vertical: 6px;
|
|
789
787
|
--docs-dropdown-padding-left: 10px;
|
|
790
788
|
--docs-dropdown-padding-right: 26px;
|
|
791
|
-
--docs-dropdown-padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-right)
|
|
789
|
+
--docs-dropdown-padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-right)
|
|
790
|
+
var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-left);
|
|
792
791
|
--docs-dropdown-border: 1px solid var(--border-primary);
|
|
793
792
|
`;
|
|
794
793
|
const tile = (0, styled_components_1.css) `
|
|
@@ -839,11 +838,11 @@ const pages = (0, styled_components_1.css) `
|
|
|
839
838
|
--page-403-description-margin: 0; // @presenter Spacing
|
|
840
839
|
|
|
841
840
|
--page-403-button-margin: 4em; // @presenter Spacing
|
|
842
|
-
|
|
841
|
+
|
|
843
842
|
--page-403-oidc-description-font-size: var(--font-size-lg);
|
|
844
843
|
--page-403-oidc-description-margin: var(--spacing-md) var(--spacing-sm);
|
|
845
844
|
|
|
846
|
-
|
|
845
|
+
// @tokens End
|
|
847
846
|
`;
|
|
848
847
|
const error = (0, styled_components_1.css) `
|
|
849
848
|
--error-bubble-padding: var(--spacing-md);
|
|
@@ -914,6 +913,11 @@ const zIndexDepth = (0, styled_components_1.css) `
|
|
|
914
913
|
--z-index-popover: 200;
|
|
915
914
|
--z-index-overlay: 1000;
|
|
916
915
|
`;
|
|
916
|
+
const scorecardColors = (0, styled_components_1.css) `
|
|
917
|
+
--scorecard-color-error: var(--color-error);
|
|
918
|
+
--scorecard-color-warning: var(--color-warning);
|
|
919
|
+
--scorecard-color-success: var(--color-green-7);
|
|
920
|
+
`;
|
|
917
921
|
exports.styles = (0, styled_components_1.css) `
|
|
918
922
|
:root {
|
|
919
923
|
${Markdown_1.admonition}
|
|
@@ -961,6 +965,7 @@ exports.styles = (0, styled_components_1.css) `
|
|
|
961
965
|
${Profile_1.userProfileDropdown}
|
|
962
966
|
${Sidebar_1.versionPicker}
|
|
963
967
|
${zIndexDepth}
|
|
968
|
+
${scorecardColors}
|
|
964
969
|
|
|
965
970
|
--api-catalog-card-min-width: 250px;
|
|
966
971
|
|
package/package.json
CHANGED
|
@@ -142,7 +142,6 @@ export function CodeBlockControls({
|
|
|
142
142
|
asIcon={controlsType === 'icon'}
|
|
143
143
|
title={report.tooltipText}
|
|
144
144
|
{...report.props}
|
|
145
|
-
onClick={() => telemetry.send('code_snippet_reported', {})}
|
|
146
145
|
>
|
|
147
146
|
{controlsType === 'icon' ? <ReportIcon /> : report.props?.buttonText || 'Report'}
|
|
148
147
|
</CodeBlockControlButton>
|
|
@@ -15,6 +15,8 @@ export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
|
15
15
|
const feedbackConf = { ...themeFeedbackConf, ...props };
|
|
16
16
|
|
|
17
17
|
const renderFeedbackComponent = () => {
|
|
18
|
+
const { type, settings, path } = feedbackConf;
|
|
19
|
+
|
|
18
20
|
switch (type) {
|
|
19
21
|
case 'rating':
|
|
20
22
|
return (
|
|
@@ -70,8 +72,6 @@ export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
|
|
73
|
-
const { type, settings, path } = feedbackConf;
|
|
74
|
-
|
|
75
75
|
return <React.Fragment key={pathname}>{renderFeedbackComponent()}</React.Fragment>;
|
|
76
76
|
};
|
|
77
77
|
|
|
@@ -15,6 +15,7 @@ export enum MOOD_STATES {
|
|
|
15
15
|
export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element => {
|
|
16
16
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
17
17
|
const [score, setScore] = React.useState('');
|
|
18
|
+
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
18
19
|
const [comment, setComment] = React.useState('');
|
|
19
20
|
const [reasons, setReasons] = React.useState([] as ReasonsProps['settings']['items']);
|
|
20
21
|
const { translate } = useTranslate();
|
|
@@ -68,11 +69,16 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
if (score) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
if (!isSubmitted) {
|
|
73
|
+
onSubmit({
|
|
74
|
+
score,
|
|
75
|
+
comment,
|
|
76
|
+
reasons,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
setIsSubmitted(true);
|
|
80
|
+
}
|
|
81
|
+
|
|
76
82
|
return (
|
|
77
83
|
<Wrapper>
|
|
78
84
|
<Label data-translation-key={translationKeys.submitText}>
|
|
@@ -18,6 +18,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
18
18
|
comment: commentSettings,
|
|
19
19
|
reasons: reasonsSettings,
|
|
20
20
|
} = settings || {};
|
|
21
|
+
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
21
22
|
const [score, setScore] = React.useState(0);
|
|
22
23
|
const [comment, setComment] = React.useState('');
|
|
23
24
|
const [reasons, setReasons] = React.useState([] as ReasonsProps['settings']['items']);
|
|
@@ -49,12 +50,16 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
if (score) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if (!isSubmitted) {
|
|
54
|
+
onSubmit({
|
|
55
|
+
score,
|
|
56
|
+
comment,
|
|
57
|
+
reasons,
|
|
58
|
+
max: maxRating,
|
|
59
|
+
});
|
|
60
|
+
setIsSubmitted(true);
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
return (
|
|
59
64
|
<Wrapper>
|
|
60
65
|
<Label data-translation-key={translationKeys.submitText}>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
3
4
|
|
|
5
|
+
import { telemetry } from '@portal/telemetry';
|
|
4
6
|
import { Comment } from '@theme/components/Feedback/Comment';
|
|
5
7
|
import type { ReportDialogProps } from '@theme/components/Feedback';
|
|
6
8
|
|
|
@@ -12,13 +14,15 @@ export const ReportDialog = ({
|
|
|
12
14
|
submitFeedback,
|
|
13
15
|
}: ReportDialogProps): JSX.Element => {
|
|
14
16
|
const { label } = settings;
|
|
17
|
+
const { pathname } = useLocation();
|
|
15
18
|
|
|
16
19
|
return (
|
|
17
20
|
<Wrapper className="modal">
|
|
18
21
|
<Comment
|
|
19
22
|
settings={{ label }}
|
|
20
|
-
onSubmit={(value) => {
|
|
21
|
-
submitFeedback({ type: 'problem', values: value, path:
|
|
23
|
+
onSubmit={async (value) => {
|
|
24
|
+
await submitFeedback({ type: 'problem', values: value, location, path: pathname });
|
|
25
|
+
telemetry.send('code_snippet_reported', {});
|
|
22
26
|
onSubmit();
|
|
23
27
|
}}
|
|
24
28
|
onCancel={onCancel}
|
|
@@ -8,6 +8,7 @@ import { useTranslate } from '@portal/hooks';
|
|
|
8
8
|
|
|
9
9
|
export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JSX.Element => {
|
|
10
10
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
11
|
+
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
11
12
|
const [score, setScore] = React.useState(0);
|
|
12
13
|
const [comment, setComment] = React.useState('');
|
|
13
14
|
const [reasons, setReasons] = React.useState([] as ReasonsProps['settings']['items']);
|
|
@@ -47,11 +48,14 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
if (score) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (!isSubmitted) {
|
|
52
|
+
onSubmit({
|
|
53
|
+
score,
|
|
54
|
+
comment,
|
|
55
|
+
reasons,
|
|
56
|
+
});
|
|
57
|
+
setIsSubmitted(true);
|
|
58
|
+
}
|
|
55
59
|
return (
|
|
56
60
|
<Wrapper>
|
|
57
61
|
<Label data-translation-key={translationKeys.submitText}>
|
|
@@ -90,6 +90,6 @@ export type ReportDialogProps = {
|
|
|
90
90
|
settings: {
|
|
91
91
|
label?: string;
|
|
92
92
|
};
|
|
93
|
-
submitFeedback: ({ type, values, path }: SubmitFeedbackParams) => Promise<void>;
|
|
93
|
+
submitFeedback: ({ type, values, path, location }: SubmitFeedbackParams) => Promise<void>;
|
|
94
94
|
className?: string;
|
|
95
95
|
};
|
|
@@ -3,6 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import type { ReportDialogProps } from '@theme/components/Feedback/types';
|
|
4
4
|
import { useTranslate } from '@portal/hooks';
|
|
5
5
|
import { useThemeConfig } from '@theme/hooks';
|
|
6
|
+
import { useSubmitFeedback } from '@portal/Feedback/useSubmitFeedback';
|
|
6
7
|
|
|
7
8
|
export interface ReportButtonProps {
|
|
8
9
|
onClick: () => void;
|
|
@@ -20,6 +21,7 @@ export function useReportDialog(): Record<string, ReportComponentsProps> {
|
|
|
20
21
|
const [isReportDialogShown, setIsReportDialogShown] = useState(false);
|
|
21
22
|
const isReportButtonShown = report?.hide === false; // TODO: report temporary disabled by default
|
|
22
23
|
const { translate } = useTranslate();
|
|
24
|
+
const { submitFeedback } = useSubmitFeedback();
|
|
23
25
|
const translationKeys = {
|
|
24
26
|
buttonText: 'theme.codeSnippet.report.buttonText',
|
|
25
27
|
tooltipText: 'theme.codeSnippet.report.tooltipText',
|
|
@@ -44,6 +46,7 @@ export function useReportDialog(): Record<string, ReportComponentsProps> {
|
|
|
44
46
|
},
|
|
45
47
|
onSubmit: hideReportDialog,
|
|
46
48
|
onCancel: hideReportDialog,
|
|
49
|
+
submitFeedback,
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
return {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const ScorecardCard = styled.div`
|
|
4
|
+
color: var(--text-primary);
|
|
5
|
+
background-color: var(--thin-tile-background-color);
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
|
|
8
|
+
border: 1px solid var(--border-primary);
|
|
9
|
+
box-shadow: 0 0 10px 0 rgba(35, 35, 35, 0.05);
|
|
10
|
+
|
|
11
|
+
flex: 1;
|
|
12
|
+
min-width: 300px;
|
|
13
|
+
padding: 20px;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const ScorecardCardTitle = styled.h3`
|
|
17
|
+
font-size: 1.2rem;
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
margin-bottom: 10px;
|
|
20
|
+
margin-top: 0;
|
|
21
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export function Gauge({
|
|
5
|
+
chunks,
|
|
6
|
+
}: {
|
|
7
|
+
chunks: {
|
|
8
|
+
share: number;
|
|
9
|
+
color: string;
|
|
10
|
+
}[];
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<GaugeWrapper>
|
|
14
|
+
{chunks.map((chunk, i) => (
|
|
15
|
+
<GaugeChunk key={i} {...chunk} />
|
|
16
|
+
))}
|
|
17
|
+
</GaugeWrapper>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const GaugeValue = styled.span`
|
|
22
|
+
font-size: var(--font-size-lg);
|
|
23
|
+
line-height: var(line-height-regular);
|
|
24
|
+
|
|
25
|
+
margin-right: 5px;
|
|
26
|
+
vertical-align: middle;
|
|
27
|
+
display: inline-block;
|
|
28
|
+
margin-right: 0;
|
|
29
|
+
text-align: right;
|
|
30
|
+
width: 70px;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const GaugeWrapper = styled.div`
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
height: 10px;
|
|
37
|
+
width: 100%;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const GaugeChunk = styled.div<{ share: number; color: string }>`
|
|
41
|
+
width: ${(props) => props.share}%;
|
|
42
|
+
background-color: ${(props) => props.color};
|
|
43
|
+
height: 10px;
|
|
44
|
+
`;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Gauge, GaugeValue } from '@theme/components/Scorecard/Gauge';
|
|
5
|
+
import { ScorecardCard, ScorecardCardTitle } from '@theme/components/Scorecard/Card';
|
|
6
|
+
|
|
7
|
+
export interface StatusByLevelWidgetProps {
|
|
8
|
+
title: string;
|
|
9
|
+
levels: { name: string; errors: number; warnings: number; total: number }[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
|
|
13
|
+
const { levels, title } = props;
|
|
14
|
+
return (
|
|
15
|
+
<ScorecardCard>
|
|
16
|
+
<ScorecardCardTitle>{title}</ScorecardCardTitle>
|
|
17
|
+
<CardBody>
|
|
18
|
+
{levels.map((level) => {
|
|
19
|
+
const success = level.total - level.errors - level.warnings;
|
|
20
|
+
return (
|
|
21
|
+
<CardRow key={level.name}>
|
|
22
|
+
<span>{level.name}</span>
|
|
23
|
+
<Gauge
|
|
24
|
+
chunks={[
|
|
25
|
+
{
|
|
26
|
+
share: (success / level.total) * 100,
|
|
27
|
+
color: 'var(--scorecard-color-success)',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
share: (level.warnings / level.total) * 100,
|
|
31
|
+
color: 'var(--scorecard-color-warning)',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
share: (level.errors / level.total) * 100,
|
|
35
|
+
color: 'var(--scorecard-color-error)',
|
|
36
|
+
},
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
<GaugeValue>
|
|
40
|
+
{success}/{level.total}
|
|
41
|
+
</GaugeValue>
|
|
42
|
+
</CardRow>
|
|
43
|
+
);
|
|
44
|
+
})}
|
|
45
|
+
</CardBody>
|
|
46
|
+
</ScorecardCard>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const CardBody = styled.div`
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: 5px;
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const CardRow = styled.div`
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: row;
|
|
59
|
+
gap: 10px;
|
|
60
|
+
|
|
61
|
+
align-items: center;
|
|
62
|
+
|
|
63
|
+
> span:first-child {
|
|
64
|
+
text-align: right;
|
|
65
|
+
width: 100px;
|
|
66
|
+
}
|
|
67
|
+
`;
|
package/src/globalStyle.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { createGlobalStyle, css } from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { darkMode } from '@theme/ui/darkColors';
|
|
4
4
|
import { breakpoints } from '@portal/media-css';
|
|
5
|
-
import { footer } from
|
|
6
|
-
import { sidebar, versionPicker } from
|
|
7
|
-
import { breadcrumbs } from
|
|
5
|
+
import { footer } from '@theme/components/Footer';
|
|
6
|
+
import { sidebar, versionPicker } from '@theme/components/Sidebar';
|
|
7
|
+
import { breadcrumbs } from '@theme/components/Breadcrumbs';
|
|
8
8
|
import { button } from '@theme/components/Button';
|
|
9
9
|
import { tag } from '@theme/components/Tag';
|
|
10
10
|
import { toc } from '@theme/components/TableOfContent';
|
|
11
|
-
import { navbar } from
|
|
12
|
-
import { search } from
|
|
13
|
-
import { catalog } from
|
|
14
|
-
import { filter } from
|
|
15
|
-
import { menu, mobileMenu } from
|
|
11
|
+
import { navbar } from '@theme/components/Navbar';
|
|
12
|
+
import { search } from '@theme/components/Search';
|
|
13
|
+
import { catalog } from '@theme/components/Catalog';
|
|
14
|
+
import { filter } from '@theme/components/Filter';
|
|
15
|
+
import { menu, mobileMenu } from '@theme/components/Menu';
|
|
16
16
|
import { apiReferencePanels, responsePanelColors } from '@theme/components/Panel';
|
|
17
17
|
import { code } from '@theme/components/CodeBlock';
|
|
18
18
|
import { product, productPicker } from '@theme/components/Product';
|
|
@@ -26,7 +26,7 @@ import { lastUpdated } from '@theme/components/LastUpdated';
|
|
|
26
26
|
import { logo } from '@theme/components/NavbarLogo';
|
|
27
27
|
|
|
28
28
|
const themeColors = css`
|
|
29
|
-
/* === Palette === */
|
|
29
|
+
/* === Palette === */
|
|
30
30
|
/**
|
|
31
31
|
* @tokens Base Colors
|
|
32
32
|
* @presenter Color
|
|
@@ -290,8 +290,8 @@ const typography = css`
|
|
|
290
290
|
* @tokens Font Rendering
|
|
291
291
|
*/
|
|
292
292
|
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
--text-smoothing: antialiased; // text-smoothing
|
|
294
|
+
--text-rendering: optimizeSpeed; // text-rendering
|
|
295
295
|
|
|
296
296
|
// @tokens End
|
|
297
297
|
`;
|
|
@@ -363,7 +363,7 @@ const borders = css`
|
|
|
363
363
|
--border-radius-md: calc(var(--border-radius) * 1.5);
|
|
364
364
|
--border-radius-lg: calc(var(--border-radius) * 2);
|
|
365
365
|
--border-radius-xlg: calc(var(--border-radius) * 3);
|
|
366
|
-
|
|
366
|
+
`;
|
|
367
367
|
|
|
368
368
|
const headingsTypography = css`
|
|
369
369
|
* {
|
|
@@ -388,7 +388,6 @@ const headingsTypography = css`
|
|
|
388
388
|
--heading-anchor-color: var(--color-primary); // @presenter Color
|
|
389
389
|
--heading-anchor-icon: none;
|
|
390
390
|
|
|
391
|
-
|
|
392
391
|
/**
|
|
393
392
|
* @tokens Heading level 1
|
|
394
393
|
*/
|
|
@@ -708,7 +707,6 @@ const badges = css`
|
|
|
708
707
|
--badge-deprecated-border: 1px solid var(--badge-deprecated-border-color); // @presenter Border
|
|
709
708
|
--badge-deprecated-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
710
709
|
|
|
711
|
-
|
|
712
710
|
// @tokens End
|
|
713
711
|
`;
|
|
714
712
|
|
|
@@ -797,7 +795,8 @@ const docsDropdown = css`
|
|
|
797
795
|
--docs-dropdown-padding-vertical: 6px;
|
|
798
796
|
--docs-dropdown-padding-left: 10px;
|
|
799
797
|
--docs-dropdown-padding-right: 26px;
|
|
800
|
-
--docs-dropdown-padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-right)
|
|
798
|
+
--docs-dropdown-padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-right)
|
|
799
|
+
var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-left);
|
|
801
800
|
--docs-dropdown-border: 1px solid var(--border-primary);
|
|
802
801
|
`;
|
|
803
802
|
|
|
@@ -850,12 +849,12 @@ const pages = css`
|
|
|
850
849
|
--page-403-description-margin: 0; // @presenter Spacing
|
|
851
850
|
|
|
852
851
|
--page-403-button-margin: 4em; // @presenter Spacing
|
|
853
|
-
|
|
852
|
+
|
|
854
853
|
--page-403-oidc-description-font-size: var(--font-size-lg);
|
|
855
854
|
--page-403-oidc-description-margin: var(--spacing-md) var(--spacing-sm);
|
|
856
855
|
|
|
857
|
-
|
|
858
|
-
|
|
856
|
+
// @tokens End
|
|
857
|
+
`;
|
|
859
858
|
|
|
860
859
|
const error = css`
|
|
861
860
|
--error-bubble-padding: var(--spacing-md);
|
|
@@ -929,6 +928,12 @@ const zIndexDepth = css`
|
|
|
929
928
|
--z-index-overlay: 1000;
|
|
930
929
|
`;
|
|
931
930
|
|
|
931
|
+
const scorecardColors = css`
|
|
932
|
+
--scorecard-color-error: var(--color-error);
|
|
933
|
+
--scorecard-color-warning: var(--color-warning);
|
|
934
|
+
--scorecard-color-success: var(--color-green-7);
|
|
935
|
+
`;
|
|
936
|
+
|
|
932
937
|
export const styles = css`
|
|
933
938
|
:root {
|
|
934
939
|
${admonition}
|
|
@@ -976,6 +981,7 @@ export const styles = css`
|
|
|
976
981
|
${userProfileDropdown}
|
|
977
982
|
${versionPicker}
|
|
978
983
|
${zIndexDepth}
|
|
984
|
+
${scorecardColors}
|
|
979
985
|
|
|
980
986
|
--api-catalog-card-min-width: 250px;
|
|
981
987
|
|