@redocly/theme 0.21.2 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Catalog/CatalogCard.d.ts +1 -0
- package/lib/components/Catalog/CatalogCard.js +2 -1
- package/lib/components/Feedback/Emotions.d.ts +4 -0
- package/lib/components/Feedback/Emotions.js +74 -0
- package/lib/components/Feedback/Feedback.js +6 -0
- package/lib/components/Feedback/Mood.d.ts +8 -0
- package/lib/components/Feedback/Mood.js +116 -0
- package/lib/components/Feedback/index.d.ts +1 -0
- package/lib/components/Feedback/index.js +3 -1
- package/lib/components/Feedback/types.d.ts +24 -0
- package/lib/components/OpenApiDocs/ScorecardBadges.d.ts +10 -0
- package/lib/components/OpenApiDocs/ScorecardBadges.js +36 -0
- package/lib/components/OpenApiDocs/index.d.ts +1 -0
- package/lib/components/OpenApiDocs/index.js +1 -0
- package/lib/config.d.ts +10 -1
- package/lib/config.js +4 -1
- package/lib/globalStyle.js +3 -0
- package/lib/icons/DissatisfiedIcon/DissatisfiedIcon.d.ts +4 -0
- package/lib/icons/DissatisfiedIcon/DissatisfiedIcon.js +18 -0
- package/lib/icons/DissatisfiedIcon/index.d.ts +1 -0
- package/lib/icons/DissatisfiedIcon/index.js +18 -0
- package/lib/icons/NeutralIcon/NeutralIcon.d.ts +4 -0
- package/lib/icons/NeutralIcon/NeutralIcon.js +18 -0
- package/lib/icons/NeutralIcon/index.d.ts +1 -0
- package/lib/icons/NeutralIcon/index.js +18 -0
- package/lib/icons/SatisfiedIcon/SatisfiedIcon.d.ts +4 -0
- package/lib/icons/SatisfiedIcon/SatisfiedIcon.js +18 -0
- package/lib/icons/SatisfiedIcon/index.d.ts +1 -0
- package/lib/icons/SatisfiedIcon/index.js +18 -0
- package/lib/icons/index.d.ts +3 -0
- package/lib/icons/index.js +3 -0
- package/lib/layouts/OIDCForbidden.d.ts +2 -0
- package/lib/layouts/OIDCForbidden.js +95 -0
- package/lib/layouts/index.d.ts +1 -0
- package/lib/layouts/index.js +1 -0
- package/lib/types/portal/src/shared/constants.d.ts +2 -1
- package/lib/types/portal/src/shared/constants.js +1 -0
- package/lib/types/portal/src/shared/types/feedback.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/Catalog/CatalogCard.tsx +1 -1
- package/src/components/Feedback/Emotions.tsx +59 -0
- package/src/components/Feedback/Feedback.tsx +13 -1
- package/src/components/Feedback/Mood.tsx +133 -0
- package/src/components/Feedback/index.ts +1 -0
- package/src/components/Feedback/types.ts +21 -0
- package/src/components/OpenApiDocs/ScorecardBadges.tsx +55 -0
- package/src/components/OpenApiDocs/index.ts +1 -0
- package/src/config.ts +4 -1
- package/src/globalStyle.ts +3 -0
- package/src/icons/DissatisfiedIcon/DissatisfiedIcon.tsx +38 -0
- package/src/icons/DissatisfiedIcon/index.ts +1 -0
- package/src/icons/NeutralIcon/NeutralIcon.tsx +34 -0
- package/src/icons/NeutralIcon/index.ts +1 -0
- package/src/icons/SatisfiedIcon/SatisfiedIcon.tsx +45 -0
- package/src/icons/SatisfiedIcon/index.ts +1 -0
- package/src/icons/index.ts +3 -0
- package/src/layouts/OIDCForbidden.tsx +89 -0
- package/src/layouts/index.ts +1 -0
- package/src/types/portal/src/shared/constants.ts +1 -0
- package/src/types/portal/src/shared/types/feedback.ts +2 -2
|
@@ -0,0 +1,95 @@
|
|
|
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.OIDCForbidden = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
33
|
+
const hooks_1 = require("../mocks/hooks");
|
|
34
|
+
function OIDCForbidden() {
|
|
35
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
36
|
+
const [searchParams, setSearchParams] = (0, react_router_dom_1.useSearchParams)();
|
|
37
|
+
const [errorDescription, setErrorDescription] = (0, react_1.useState)('');
|
|
38
|
+
const translationKeys = {
|
|
39
|
+
title: 'theme.page.forbidden.title',
|
|
40
|
+
};
|
|
41
|
+
// use whatever you want here
|
|
42
|
+
const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
|
43
|
+
const renderText = (text) => text.split(' ').map((part) => URL_REGEX.test(part) ? (react_1.default.createElement(ErrorDescriptionLink, { key: part, href: part },
|
|
44
|
+
part,
|
|
45
|
+
' ')) : (part + ' '));
|
|
46
|
+
(0, react_1.useEffect)(() => {
|
|
47
|
+
if (Array.from(searchParams).length) {
|
|
48
|
+
setErrorDescription(searchParams.get('error_description') || searchParams.get('error') || '');
|
|
49
|
+
setSearchParams({});
|
|
50
|
+
}
|
|
51
|
+
}, [searchParams, setSearchParams]);
|
|
52
|
+
return (react_1.default.createElement(Wrapper, { "data-component-name": "Pages/OIDCForbidden" },
|
|
53
|
+
react_1.default.createElement(Header, null, "403"),
|
|
54
|
+
react_1.default.createElement(Description, { "data-translation-key": translationKeys.title }, translate(translationKeys.title, 'Access forbidden')),
|
|
55
|
+
errorDescription && react_1.default.createElement(ErrorDescription, null, renderText(errorDescription))));
|
|
56
|
+
}
|
|
57
|
+
exports.OIDCForbidden = OIDCForbidden;
|
|
58
|
+
const Wrapper = styled_components_1.default.div `
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
margin: 25px auto;
|
|
64
|
+
font-family: var(--page-403-font-family);
|
|
65
|
+
text-align: center;
|
|
66
|
+
`;
|
|
67
|
+
const Header = styled_components_1.default.div `
|
|
68
|
+
color: var(--page-403-header-text-color);
|
|
69
|
+
margin: var(--page-403-header-margin);
|
|
70
|
+
font-size: var(--page-403-header-font-size);
|
|
71
|
+
line-height: var(--page-403-header-line-height);
|
|
72
|
+
font-weight: var(--page-403-header-font-weight);
|
|
73
|
+
`;
|
|
74
|
+
const Description = styled_components_1.default.div `
|
|
75
|
+
color: var(--page-403-description-text-color);
|
|
76
|
+
margin: var(--page-403-description-margin);
|
|
77
|
+
font-size: var(--page-403-description-font-size);
|
|
78
|
+
line-height: var(--page-403-description-line-height);
|
|
79
|
+
font-weight: var(--page-403-description-font-weight);
|
|
80
|
+
`;
|
|
81
|
+
const ErrorDescription = styled_components_1.default.div `
|
|
82
|
+
margin: var(--page-403-oidc-description-margin);
|
|
83
|
+
font-size: var(--page-403-oidc-description-font-size);
|
|
84
|
+
color: var(--page-403-description-text-color);
|
|
85
|
+
line-height: var(--page-403-description-line-height);
|
|
86
|
+
font-weight: var(--page-403-description-font-weight);
|
|
87
|
+
`;
|
|
88
|
+
const ErrorDescriptionLink = styled_components_1.default.a `
|
|
89
|
+
color: var(--link-text-color);
|
|
90
|
+
|
|
91
|
+
&:hover {
|
|
92
|
+
color: var(--link-hover-text-color);
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
//# sourceMappingURL=OIDCForbidden.js.map
|
package/lib/layouts/index.d.ts
CHANGED
package/lib/layouts/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("../layouts/RootLayout"), exports);
|
|
|
18
18
|
__exportStar(require("../layouts/PageLayout"), exports);
|
|
19
19
|
__exportStar(require("../layouts/NotFound"), exports);
|
|
20
20
|
__exportStar(require("../layouts/Forbidden"), exports);
|
|
21
|
+
__exportStar(require("../layouts/OIDCForbidden"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,8 @@ export type DEFAULT_COOKIE_EXPIRATION = number;
|
|
|
6
6
|
export declare enum FEEDBACK_TYPES {
|
|
7
7
|
RATING = "rating",
|
|
8
8
|
SENTIMENT = "sentiment",
|
|
9
|
-
COMMENT = "comment"
|
|
9
|
+
COMMENT = "comment",
|
|
10
|
+
MOOD = "mood"
|
|
10
11
|
}
|
|
11
12
|
export declare const DEV_LOGIN_SLUG = "/login/";
|
|
12
13
|
export declare enum ExternalRoutes {
|
|
@@ -9,6 +9,7 @@ var FEEDBACK_TYPES;
|
|
|
9
9
|
FEEDBACK_TYPES["RATING"] = "rating";
|
|
10
10
|
FEEDBACK_TYPES["SENTIMENT"] = "sentiment";
|
|
11
11
|
FEEDBACK_TYPES["COMMENT"] = "comment";
|
|
12
|
+
FEEDBACK_TYPES["MOOD"] = "mood";
|
|
12
13
|
})(FEEDBACK_TYPES = exports.FEEDBACK_TYPES || (exports.FEEDBACK_TYPES = {}));
|
|
13
14
|
exports.DEV_LOGIN_SLUG = '/login/';
|
|
14
15
|
var ExternalRoutes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FEEDBACK_TYPES } from '../constants';
|
|
2
|
-
import type { RatingProps, SentimentProps, CommentProps } from '../../../../../components/Feedback';
|
|
2
|
+
import type { RatingProps, SentimentProps, CommentProps, MoodProps } from '../../../../../components/Feedback';
|
|
3
3
|
export type SubmitFeedbackParams = {
|
|
4
4
|
type: string;
|
|
5
5
|
values: Record<string, unknown>;
|
|
@@ -7,5 +7,5 @@ export type SubmitFeedbackParams = {
|
|
|
7
7
|
};
|
|
8
8
|
export type FeedbackProps = {
|
|
9
9
|
type: FEEDBACK_TYPES;
|
|
10
|
-
settings: (RatingProps | SentimentProps | CommentProps)['settings'];
|
|
10
|
+
settings: (RatingProps | SentimentProps | CommentProps | MoodProps)['settings'];
|
|
11
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
82
82
|
"typescript": "^4.8.4",
|
|
83
83
|
"webpack": "^5.72.0",
|
|
84
|
-
"@redocly/portal-types": "1.0
|
|
84
|
+
"@redocly/portal-types": "1.1.0"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@redocly/ajv": "^8.11.0",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { SatisfiedIcon, DissatisfiedIcon, NeutralIcon } from '@theme/icons';
|
|
5
|
+
|
|
6
|
+
export const Satisfied = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Wrapper>
|
|
9
|
+
<Icon>
|
|
10
|
+
<SatisfiedIcon />
|
|
11
|
+
</Icon>
|
|
12
|
+
</Wrapper>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Dissatisfied = () => {
|
|
17
|
+
return (
|
|
18
|
+
<Wrapper>
|
|
19
|
+
<Icon>
|
|
20
|
+
<DissatisfiedIcon />
|
|
21
|
+
</Icon>
|
|
22
|
+
</Wrapper>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Neutral = () => {
|
|
27
|
+
return (
|
|
28
|
+
<Wrapper>
|
|
29
|
+
<Icon>
|
|
30
|
+
<NeutralIcon />
|
|
31
|
+
</Icon>
|
|
32
|
+
</Wrapper>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const Wrapper = styled.div`
|
|
37
|
+
font-family: var(--font-family-base);
|
|
38
|
+
display: flex;
|
|
39
|
+
color: var(--color-info-text);
|
|
40
|
+
&:hover {
|
|
41
|
+
color: var(--color-info-text-active);
|
|
42
|
+
svg {
|
|
43
|
+
> g {
|
|
44
|
+
fill: var(--color-info-text-active);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const Icon = styled.div`
|
|
51
|
+
width: 16px;
|
|
52
|
+
height: 16px;
|
|
53
|
+
margin-right: 5px;
|
|
54
|
+
> svg {
|
|
55
|
+
> g {
|
|
56
|
+
fill: var(--color-info-text);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
@@ -3,7 +3,7 @@ import { useLocation } from 'react-router-dom';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { FeedbackProps } from '@theme/types/portal/src/shared/types/feedback';
|
|
6
|
-
import { Rating, Sentiment, Comment } from '@theme/components/Feedback';
|
|
6
|
+
import { Rating, Sentiment, Comment, Mood } from '@theme/components/Feedback';
|
|
7
7
|
import { useThemeConfig } from '@theme/hooks';
|
|
8
8
|
import { useSubmitFeedback } from '@portal/Feedback/useSubmitFeedback';
|
|
9
9
|
import { telemetry } from '@portal/telemetry';
|
|
@@ -40,6 +40,18 @@ export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
|
40
40
|
/>
|
|
41
41
|
</Wrapper>
|
|
42
42
|
);
|
|
43
|
+
case 'mood':
|
|
44
|
+
return (
|
|
45
|
+
<Wrapper>
|
|
46
|
+
<Mood
|
|
47
|
+
settings={settings}
|
|
48
|
+
onSubmit={(values) => {
|
|
49
|
+
submitFeedback({ type: 'mood', values, path });
|
|
50
|
+
telemetry.send('feedback_sent', { type: 'mood' });
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
</Wrapper>
|
|
54
|
+
);
|
|
43
55
|
case 'comment':
|
|
44
56
|
return (
|
|
45
57
|
<Wrapper>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { MoodProps, ReasonsProps } from '@theme/components/';
|
|
5
|
+
import { useTranslate } from '@portal/hooks';
|
|
6
|
+
import { Dissatisfied, Neutral, Satisfied } from '@theme/components/Feedback/Emotions';
|
|
7
|
+
import { Comment, Reasons } from '@theme/components/Feedback';
|
|
8
|
+
|
|
9
|
+
export enum MOOD_STATES {
|
|
10
|
+
SATISFIED = 'satisfied',
|
|
11
|
+
NEUTRAL = 'neutral',
|
|
12
|
+
DISSATISFIED = 'dissatisfied',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element => {
|
|
16
|
+
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
17
|
+
const [score, setScore] = React.useState('');
|
|
18
|
+
const [comment, setComment] = React.useState('');
|
|
19
|
+
const [reasons, setReasons] = React.useState([] as ReasonsProps['settings']['items']);
|
|
20
|
+
const { translate } = useTranslate();
|
|
21
|
+
const translationKeys = {
|
|
22
|
+
submitText: 'theme.feedback.settings.submitText',
|
|
23
|
+
label: 'theme.feedback.settings.label',
|
|
24
|
+
satisfiedLabel: 'theme.feedback.settings.comment.satisfiedLabel',
|
|
25
|
+
neutralLabel: 'theme.feedback.settings.comment.neutralLabel',
|
|
26
|
+
dissatisfiedLabel: 'theme.feedback.settings.comment.dissatisfiedLabel',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (score && reasonsSettings?.enable && !reasons.length) {
|
|
30
|
+
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
31
|
+
const buttonText = commentSettings?.enable ? 'Next' : 'Send';
|
|
32
|
+
return (
|
|
33
|
+
<Reasons
|
|
34
|
+
onSubmit={({ reasons }) => setReasons(reasons)}
|
|
35
|
+
settings={{ label: reasonsLabel, items, multi, buttonText }}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (score && commentSettings?.enable && !comment) {
|
|
41
|
+
const renderCommentLabel = (score: string) => {
|
|
42
|
+
switch (score) {
|
|
43
|
+
case MOOD_STATES.SATISFIED:
|
|
44
|
+
return translate(
|
|
45
|
+
translationKeys.satisfiedLabel,
|
|
46
|
+
commentSettings.satisfiedLabel || 'What was most helpful?',
|
|
47
|
+
);
|
|
48
|
+
case MOOD_STATES.NEUTRAL:
|
|
49
|
+
return translate(
|
|
50
|
+
translationKeys.neutralLabel,
|
|
51
|
+
commentSettings.neutralLabel || 'What can we improve?',
|
|
52
|
+
);
|
|
53
|
+
case MOOD_STATES.DISSATISFIED:
|
|
54
|
+
return translate(
|
|
55
|
+
translationKeys.dissatisfiedLabel,
|
|
56
|
+
commentSettings.dissatisfiedLabel || 'What can we improve?',
|
|
57
|
+
);
|
|
58
|
+
default:
|
|
59
|
+
return translate(translationKeys.satisfiedLabel, 'What can we improve?');
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return (
|
|
63
|
+
<Comment
|
|
64
|
+
onSubmit={({ comment }) => setComment(comment)}
|
|
65
|
+
settings={{ label: renderCommentLabel(score) }}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (score) {
|
|
71
|
+
onSubmit({
|
|
72
|
+
score,
|
|
73
|
+
comment,
|
|
74
|
+
reasons,
|
|
75
|
+
});
|
|
76
|
+
return (
|
|
77
|
+
<Wrapper>
|
|
78
|
+
<Label data-translation-key={translationKeys.submitText}>
|
|
79
|
+
{translate(translationKeys.submitText, submitText || 'Thank you for your feedback!')}
|
|
80
|
+
</Label>
|
|
81
|
+
</Wrapper>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Wrapper data-component-name="Feedback/Mood" className={className}>
|
|
87
|
+
<Label data-translation-key={translationKeys.label}>
|
|
88
|
+
{translate(translationKeys.label, label || 'Was this page helpful?')}
|
|
89
|
+
</Label>
|
|
90
|
+
<Vote
|
|
91
|
+
onClick={() => {
|
|
92
|
+
setScore(MOOD_STATES.DISSATISFIED);
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
<Dissatisfied />
|
|
96
|
+
</Vote>
|
|
97
|
+
<Vote
|
|
98
|
+
onClick={() => {
|
|
99
|
+
setScore(MOOD_STATES.NEUTRAL);
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
<Neutral />
|
|
103
|
+
</Vote>
|
|
104
|
+
<Vote
|
|
105
|
+
onClick={() => {
|
|
106
|
+
setScore(MOOD_STATES.SATISFIED);
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<Satisfied />
|
|
110
|
+
</Vote>
|
|
111
|
+
</Wrapper>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const Wrapper = styled.div`
|
|
116
|
+
font-family: var(--font-family-base);
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
const Label = styled.h3`
|
|
122
|
+
font-family: var(--h3-font-family);
|
|
123
|
+
font-weight: var(--h3-font-weight);
|
|
124
|
+
font-size: var(--h3-font-size);
|
|
125
|
+
line-height: var(--h3-line-height);
|
|
126
|
+
color: var(--h3-text-color);
|
|
127
|
+
margin-right: 15px;
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
const Vote = styled.div`
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
margin: 0 10px;
|
|
133
|
+
`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Feedback } from '@theme/components/Feedback/Feedback';
|
|
2
2
|
export { Rating } from '@theme/components/Feedback/Rating';
|
|
3
3
|
export { Sentiment } from '@theme/components/Feedback/Sentiment';
|
|
4
|
+
export { Mood } from '@theme/components/Feedback/Mood';
|
|
4
5
|
export { Comment } from '@theme/components/Feedback/Comment';
|
|
5
6
|
export { Reasons } from '@theme/components/Feedback/Reasons';
|
|
6
7
|
export { ReportDialog } from '@theme/components/Feedback/ReportDialog';
|
|
@@ -20,6 +20,27 @@ export type RatingProps = {
|
|
|
20
20
|
className?: string;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
export type MoodProps = {
|
|
24
|
+
onSubmit: (value: { score: string; comment?: string; reasons?: string[] }) => void;
|
|
25
|
+
settings?: {
|
|
26
|
+
label?: string;
|
|
27
|
+
submitText?: string;
|
|
28
|
+
comment?: {
|
|
29
|
+
enable: boolean;
|
|
30
|
+
satisfiedLabel?: string;
|
|
31
|
+
neutralLabel?: string;
|
|
32
|
+
dissatisfiedLabel?: string;
|
|
33
|
+
};
|
|
34
|
+
reasons?: {
|
|
35
|
+
enable: boolean;
|
|
36
|
+
label?: string;
|
|
37
|
+
multi?: boolean;
|
|
38
|
+
items: string[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
className?: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
23
44
|
export type SentimentProps = {
|
|
24
45
|
onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
|
|
25
46
|
settings?: {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Tag } from '@theme/components/Tag';
|
|
5
|
+
import { Link } from '@portal/Link';
|
|
6
|
+
import { telemetry } from '@portal/telemetry';
|
|
7
|
+
import { statusToColor } from '@theme/components/Catalog/CatalogCard';
|
|
8
|
+
|
|
9
|
+
interface ScorecardBadgesProps {
|
|
10
|
+
metadata?: {
|
|
11
|
+
scorecardLevel?: string;
|
|
12
|
+
scorecardStatus?: string;
|
|
13
|
+
scoreCardSlug?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function ScorecardBadges(props: ScorecardBadgesProps) {
|
|
18
|
+
return (
|
|
19
|
+
(props.metadata?.scorecardLevel && (
|
|
20
|
+
<ScorecardBadgesWrapper data-component-name="OpenApiDocs/ScorecardBadges">
|
|
21
|
+
<ComplianceTag
|
|
22
|
+
level={props.metadata.scorecardLevel as string}
|
|
23
|
+
status={props.metadata?.scorecardStatus as string}
|
|
24
|
+
slug={props.metadata?.scoreCardSlug as string}
|
|
25
|
+
/>
|
|
26
|
+
</ScorecardBadgesWrapper>
|
|
27
|
+
)) ||
|
|
28
|
+
null
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ScorecardBadgesWrapper = styled.div`
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
|
|
36
|
+
margin-top: var(--panel-gap-vertical);
|
|
37
|
+
position: absolute;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
right: var(--panel-gap-horizontal);
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
function ComplianceTag(props: { level: string; status: string; slug: string }) {
|
|
43
|
+
const { level, status, slug } = props;
|
|
44
|
+
return (
|
|
45
|
+
<Link to={slug}>
|
|
46
|
+
<Tag
|
|
47
|
+
color={statusToColor(status)}
|
|
48
|
+
size="large"
|
|
49
|
+
onClick={() => telemetry.send('scorecard_link_clicked', { action: 'click' })}
|
|
50
|
+
>
|
|
51
|
+
{level} oops
|
|
52
|
+
</Tag>
|
|
53
|
+
</Link>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -7,3 +7,4 @@ export * from '@theme/components/OpenApiDocs/hooks/AfterOpenApiOperation';
|
|
|
7
7
|
export * from '@theme/components/OpenApiDocs/hooks/AfterOpenApiOperationSummary';
|
|
8
8
|
export * from '@theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation';
|
|
9
9
|
export * from '@theme/components/OpenApiDocs/hooks/BeforeOpenApiOperationSummary';
|
|
10
|
+
export * from '@theme/components/OpenApiDocs/ScorecardBadges';
|
package/src/config.ts
CHANGED
|
@@ -448,7 +448,7 @@ export const themeConfigSchema = {
|
|
|
448
448
|
},
|
|
449
449
|
type: {
|
|
450
450
|
type: 'string',
|
|
451
|
-
enum: ['rating', 'sentiment', 'comment', 'reasons'],
|
|
451
|
+
enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood'],
|
|
452
452
|
default: 'sentiment',
|
|
453
453
|
},
|
|
454
454
|
settings: {
|
|
@@ -477,6 +477,9 @@ export const themeConfigSchema = {
|
|
|
477
477
|
label: { type: 'string' },
|
|
478
478
|
likeLabel: { type: 'string' },
|
|
479
479
|
dislikeLabel: { type: 'string' },
|
|
480
|
+
satisfiedLabel: { type: 'string' },
|
|
481
|
+
neutralLabel: { type: 'string' },
|
|
482
|
+
dissatisfiedLabel: { type: 'string' },
|
|
480
483
|
},
|
|
481
484
|
additionalProperties: false,
|
|
482
485
|
},
|
package/src/globalStyle.ts
CHANGED
|
@@ -850,6 +850,9 @@ const pages = css`
|
|
|
850
850
|
--page-403-description-margin: 0; // @presenter Spacing
|
|
851
851
|
|
|
852
852
|
--page-403-button-margin: 4em; // @presenter Spacing
|
|
853
|
+
|
|
854
|
+
--page-403-oidc-description-font-size: var(--font-size-lg);
|
|
855
|
+
--page-403-oidc-description-margin: var(--spacing-md) var(--spacing-sm);
|
|
853
856
|
|
|
854
857
|
// @tokens End
|
|
855
858
|
`
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Icon = () => (
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewBox="0 0 16 17" fill="none">
|
|
6
|
+
<rect
|
|
7
|
+
width="16"
|
|
8
|
+
height="16"
|
|
9
|
+
transform="translate(0 0.511719)"
|
|
10
|
+
fill="white"
|
|
11
|
+
style={{ mixBlendMode: 'multiply' }}
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
d="M8 1.51172C6.61553 1.51172 5.26216 1.92226 4.11101 2.69143C2.95987 3.4606 2.06266 4.55385 1.53285 5.83293C1.00303 7.11202 0.86441 8.51948 1.13451 9.87735C1.4046 11.2352 2.07129 12.4825 3.05026 13.4615C4.02922 14.4404 5.2765 15.1071 6.63437 15.3772C7.99224 15.6473 9.3997 15.5087 10.6788 14.9789C11.9579 14.4491 13.0511 13.5519 13.8203 12.4007C14.5895 11.2496 15 9.89619 15 8.51172C15 6.6552 14.2625 4.87473 12.9497 3.56197C11.637 2.24922 9.85652 1.51172 8 1.51172ZM8 14.5117C6.81332 14.5117 5.65328 14.1598 4.66658 13.5005C3.67989 12.8412 2.91085 11.9042 2.45673 10.8078C2.0026 9.71146 1.88378 8.50506 2.11529 7.34118C2.3468 6.17729 2.91825 5.10819 3.75736 4.26908C4.59648 3.42996 5.66558 2.85852 6.82946 2.62701C7.99335 2.3955 9.19975 2.51432 10.2961 2.96844C11.3925 3.42257 12.3295 4.1916 12.9888 5.1783C13.6481 6.16499 14 7.32503 14 8.51172C14 10.103 13.3679 11.6291 12.2426 12.7544C11.1174 13.8796 9.5913 14.5117 8 14.5117Z"
|
|
15
|
+
fill="black"
|
|
16
|
+
fillOpacity="0.45"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M5.75 6.01172C5.50278 6.01172 5.2611 6.08503 5.05554 6.22238C4.84998 6.35973 4.68976 6.55496 4.59515 6.78336C4.50054 7.01177 4.47579 7.26311 4.52402 7.50558C4.57225 7.74806 4.6913 7.97079 4.86612 8.1456C5.04094 8.32042 5.26366 8.43947 5.50614 8.4877C5.74862 8.53593 5.99995 8.51118 6.22836 8.41657C6.45677 8.32196 6.65199 8.16174 6.78934 7.95618C6.92669 7.75062 7 7.50895 7 7.26172C7 6.9302 6.86831 6.61226 6.63389 6.37784C6.39947 6.14341 6.08152 6.01172 5.75 6.01172Z"
|
|
20
|
+
fill="black"
|
|
21
|
+
fillOpacity="0.45"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M10.25 6.01172C10.0028 6.01172 9.7611 6.08503 9.55554 6.22238C9.34998 6.35973 9.18976 6.55496 9.09515 6.78336C9.00054 7.01177 8.97579 7.26311 9.02402 7.50558C9.07225 7.74806 9.1913 7.97079 9.36612 8.1456C9.54093 8.32042 9.76366 8.43947 10.0061 8.4877C10.2486 8.53593 10.4999 8.51118 10.7284 8.41657C10.9568 8.32196 11.152 8.16174 11.2893 7.95618C11.4267 7.75062 11.5 7.50895 11.5 7.26172C11.5 6.9302 11.3683 6.61226 11.1339 6.37784C10.8995 6.14341 10.5815 6.01172 10.25 6.01172Z"
|
|
25
|
+
fill="black"
|
|
26
|
+
fillOpacity="0.45"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
d="M8 10.0117C7.30982 10.0129 6.63168 10.1926 6.03151 10.5334C5.43135 10.8743 4.92958 11.3646 4.575 11.9567L5.43 12.4567C5.69683 12.0136 6.07369 11.647 6.524 11.3925C6.97431 11.1381 7.48276 11.0043 8 11.0043C8.51724 11.0043 9.0257 11.1381 9.47601 11.3925C9.92631 11.647 10.3032 12.0136 10.57 12.4567L11.425 11.9567C11.0704 11.3646 10.5687 10.8743 9.96849 10.5334C9.36833 10.1926 8.69019 10.0129 8 10.0117Z"
|
|
30
|
+
fill="black"
|
|
31
|
+
fillOpacity="0.45"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const DissatisfiedIcon = styled(Icon).attrs(() => ({
|
|
37
|
+
'data-component-name': 'icons/DissatisfiedIcon/DissatisfiedIcon',
|
|
38
|
+
}))``;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@theme/icons/DissatisfiedIcon/DissatisfiedIcon';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Icon = () => (
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewBox="0 0 16 17" fill="none">
|
|
6
|
+
<rect
|
|
7
|
+
width="16"
|
|
8
|
+
height="16"
|
|
9
|
+
transform="translate(0 0.511719)"
|
|
10
|
+
fill="white"
|
|
11
|
+
style={{ mixBlendMode: 'multiply' }}
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
d="M8 1.51172C6.61553 1.51172 5.26216 1.92226 4.11101 2.69143C2.95987 3.4606 2.06266 4.55385 1.53285 5.83293C1.00303 7.11202 0.86441 8.51948 1.13451 9.87735C1.4046 11.2352 2.07129 12.4825 3.05026 13.4615C4.02922 14.4404 5.2765 15.1071 6.63437 15.3772C7.99224 15.6473 9.3997 15.5087 10.6788 14.9789C11.9579 14.4491 13.0511 13.5519 13.8203 12.4007C14.5895 11.2496 15 9.89619 15 8.51172C15 6.6552 14.2625 4.87473 12.9497 3.56197C11.637 2.24922 9.85652 1.51172 8 1.51172ZM8 14.5117C6.81332 14.5117 5.65328 14.1598 4.66658 13.5005C3.67989 12.8412 2.91085 11.9042 2.45673 10.8078C2.0026 9.71146 1.88378 8.50506 2.11529 7.34118C2.3468 6.17729 2.91825 5.10819 3.75736 4.26908C4.59648 3.42996 5.66558 2.85852 6.82946 2.62701C7.99335 2.3955 9.19975 2.51432 10.2961 2.96844C11.3925 3.42257 12.3295 4.1916 12.9888 5.1783C13.6481 6.16499 14 7.32503 14 8.51172C14 10.103 13.3679 11.6291 12.2426 12.7544C11.1174 13.8796 9.5913 14.5117 8 14.5117Z"
|
|
15
|
+
fill="black"
|
|
16
|
+
fillOpacity="0.45"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M5.75 6.01172C5.50278 6.01172 5.2611 6.08503 5.05554 6.22238C4.84998 6.35973 4.68976 6.55496 4.59515 6.78336C4.50054 7.01177 4.47579 7.26311 4.52402 7.50558C4.57225 7.74806 4.6913 7.97079 4.86612 8.1456C5.04094 8.32042 5.26366 8.43947 5.50614 8.4877C5.74862 8.53593 5.99995 8.51118 6.22836 8.41657C6.45677 8.32196 6.65199 8.16174 6.78934 7.95618C6.92669 7.75062 7 7.50895 7 7.26172C7 6.9302 6.86831 6.61226 6.63389 6.37784C6.39947 6.14341 6.08152 6.01172 5.75 6.01172Z"
|
|
20
|
+
fill="black"
|
|
21
|
+
fillOpacity="0.45"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M10.25 6.01172C10.0028 6.01172 9.7611 6.08503 9.55554 6.22238C9.34998 6.35973 9.18976 6.55496 9.09515 6.78336C9.00054 7.01177 8.97579 7.26311 9.02402 7.50558C9.07225 7.74806 9.1913 7.97079 9.36612 8.1456C9.54093 8.32042 9.76366 8.43947 10.0061 8.4877C10.2486 8.53593 10.4999 8.51118 10.7284 8.41657C10.9568 8.32196 11.152 8.16174 11.2893 7.95618C11.4267 7.75062 11.5 7.50895 11.5 7.26172C11.5 6.9302 11.3683 6.61226 11.1339 6.37784C10.8995 6.14341 10.5815 6.01172 10.25 6.01172Z"
|
|
25
|
+
fill="black"
|
|
26
|
+
fillOpacity="0.45"
|
|
27
|
+
/>
|
|
28
|
+
<path d="M11 10.5117H5V11.5117H11V10.5117Z" fill="black" fillOpacity="0.45" />
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const NeutralIcon = styled(Icon).attrs(() => ({
|
|
33
|
+
'data-component-name': 'icons/NeutralIcon/NeutralIcon',
|
|
34
|
+
}))``;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@theme/icons/NeutralIcon/NeutralIcon';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Icon = () => (
|
|
5
|
+
<svg
|
|
6
|
+
version="1.1"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
width="16"
|
|
9
|
+
height="17"
|
|
10
|
+
viewBox="0 0 16 17"
|
|
11
|
+
fill="none"
|
|
12
|
+
>
|
|
13
|
+
<rect
|
|
14
|
+
width="16"
|
|
15
|
+
height="16"
|
|
16
|
+
transform="translate(0 0.511719)"
|
|
17
|
+
fill="white"
|
|
18
|
+
style={{ mixBlendMode: 'multiply' }}
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
d="M8 1.51172C6.61553 1.51172 5.26216 1.92226 4.11101 2.69143C2.95987 3.4606 2.06266 4.55385 1.53285 5.83293C1.00303 7.11202 0.86441 8.51948 1.13451 9.87735C1.4046 11.2352 2.07129 12.4825 3.05026 13.4615C4.02922 14.4404 5.2765 15.1071 6.63437 15.3772C7.99224 15.6473 9.3997 15.5087 10.6788 14.9789C11.9579 14.4491 13.0511 13.5519 13.8203 12.4007C14.5895 11.2496 15 9.89619 15 8.51172C15 6.6552 14.2625 4.87473 12.9497 3.56197C11.637 2.24922 9.85652 1.51172 8 1.51172ZM8 14.5117C6.81332 14.5117 5.65328 14.1598 4.66658 13.5005C3.67989 12.8412 2.91085 11.9042 2.45673 10.8078C2.0026 9.71146 1.88378 8.50506 2.11529 7.34118C2.3468 6.17729 2.91825 5.10819 3.75736 4.26908C4.59648 3.42996 5.66558 2.85852 6.82946 2.62701C7.99335 2.3955 9.19975 2.51432 10.2961 2.96844C11.3925 3.42257 12.3295 4.1916 12.9888 5.1783C13.6481 6.16499 14 7.32503 14 8.51172C14 10.103 13.3679 11.6291 12.2426 12.7544C11.1174 13.8796 9.5913 14.5117 8 14.5117Z"
|
|
22
|
+
fill="black"
|
|
23
|
+
fillOpacity="0.45"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
d="M5.75 6.01172C5.50278 6.01172 5.2611 6.08503 5.05554 6.22238C4.84998 6.35973 4.68976 6.55496 4.59515 6.78336C4.50054 7.01177 4.47579 7.26311 4.52402 7.50558C4.57225 7.74806 4.6913 7.97079 4.86612 8.1456C5.04094 8.32042 5.26366 8.43947 5.50614 8.4877C5.74862 8.53593 5.99995 8.51118 6.22836 8.41657C6.45677 8.32196 6.65199 8.16174 6.78934 7.95618C6.92669 7.75062 7 7.50895 7 7.26172C7.00134 7.0972 6.96991 6.93405 6.90757 6.78179C6.84522 6.62953 6.7532 6.49121 6.63686 6.37487C6.52052 6.25853 6.38219 6.1665 6.22993 6.10416C6.07767 6.04181 5.91453 6.01039 5.75 6.01172Z"
|
|
27
|
+
fill="black"
|
|
28
|
+
fillOpacity="0.45"
|
|
29
|
+
/>
|
|
30
|
+
<path
|
|
31
|
+
d="M10.25 6.01172C10.0028 6.01172 9.7611 6.08503 9.55554 6.22238C9.34998 6.35973 9.18976 6.55496 9.09515 6.78336C9.00054 7.01177 8.97579 7.26311 9.02402 7.50558C9.07225 7.74806 9.1913 7.97079 9.36612 8.1456C9.54093 8.32042 9.76366 8.43947 10.0061 8.4877C10.2486 8.53593 10.4999 8.51118 10.7284 8.41657C10.9568 8.32196 11.152 8.16174 11.2893 7.95618C11.4267 7.75062 11.5 7.50895 11.5 7.26172C11.5013 7.0972 11.4699 6.93405 11.4076 6.78179C11.3452 6.62953 11.2532 6.49121 11.1369 6.37487C11.0205 6.25853 10.8822 6.1665 10.7299 6.10416C10.5777 6.04181 10.4145 6.01039 10.25 6.01172Z"
|
|
32
|
+
fill="black"
|
|
33
|
+
fillOpacity="0.45"
|
|
34
|
+
/>
|
|
35
|
+
<path
|
|
36
|
+
d="M8 12.5117C8.69019 12.5106 9.36833 12.3308 9.96849 11.99C10.5687 11.6492 11.0704 11.1589 11.425 10.5667L10.57 10.0667C10.3032 10.5098 9.92631 10.8764 9.47601 11.1309C9.0257 11.3854 8.51724 11.5191 8 11.5191C7.48276 11.5191 6.97431 11.3854 6.524 11.1309C6.07369 10.8764 5.69683 10.5098 5.43 10.0667L4.575 10.5667C4.92958 11.1589 5.43135 11.6492 6.03151 11.99C6.63168 12.3308 7.30982 12.5106 8 12.5117Z"
|
|
37
|
+
fill="black"
|
|
38
|
+
fillOpacity="0.45"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const SatisfiedIcon = styled(Icon).attrs(() => ({
|
|
44
|
+
'data-component-name': 'icons/SatisfiedIcon/SatisfiedIcon',
|
|
45
|
+
}))``;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@theme/icons/SatisfiedIcon/SatisfiedIcon';
|
package/src/icons/index.ts
CHANGED
|
@@ -21,3 +21,6 @@ export * from '@theme/icons/CheckboxIcon';
|
|
|
21
21
|
export * from '@theme/icons/ErrorIcon';
|
|
22
22
|
export * from '@theme/icons/EditIcon';
|
|
23
23
|
export * from '@theme/icons/RocketIcon';
|
|
24
|
+
export * from '@theme/icons/SatisfiedIcon';
|
|
25
|
+
export * from '@theme/icons/DissatisfiedIcon';
|
|
26
|
+
export * from '@theme/icons/NeutralIcon';
|