@redocly/theme 0.30.3-beta.1 → 0.30.4
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/useCatalog.js +3 -4
- package/lib/components/Feedback/Mood.js +4 -4
- package/lib/components/Feedback/Rating.js +2 -2
- package/lib/components/Feedback/Scale.js +2 -2
- package/lib/components/Feedback/Sentiment.js +2 -2
- package/lib/components/Feedback/types.d.ts +8 -8
- package/lib/components/Filter/Filter.js +5 -1
- package/lib/components/Menu/constants.js +1 -1
- package/lib/components/Navbar/Navbar.js +2 -4
- package/lib/components/Scorecard/Card.d.ts +1 -3
- package/lib/components/Scorecard/Card.js +2 -4
- package/lib/components/Scorecard/Gauge.d.ts +2 -5
- package/lib/components/Scorecard/Gauge.js +2 -6
- package/lib/components/Scorecard/StatusByLevelWidget.d.ts +0 -1
- package/lib/components/Scorecard/StatusByLevelWidget.js +2 -5
- package/lib/components/Sidebar/types.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +1 -1
- package/lib/components/Tabs/Tabs.js +4 -2
- package/lib/config.d.ts +4 -10
- package/lib/config.js +9 -4
- package/lib/mocks/Sidebar/types.js +1 -1
- package/lib/types/portal/src/shared/constants.js +3 -3
- package/lib/types/portal/src/shared/types/nav.js +1 -1
- package/package.json +14 -14
- package/src/components/Catalog/useCatalog.ts +3 -6
- package/src/components/Feedback/Mood.tsx +3 -3
- package/src/components/Feedback/Rating.tsx +2 -2
- package/src/components/Feedback/Scale.tsx +2 -2
- package/src/components/Feedback/Sentiment.tsx +2 -2
- package/src/components/Feedback/types.ts +8 -8
- package/src/components/Filter/Filter.tsx +6 -1
- package/src/components/Scorecard/Card.tsx +2 -4
- package/src/components/Scorecard/Gauge.tsx +7 -16
- package/src/components/Scorecard/StatusByLevelWidget.tsx +2 -6
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/config.ts +8 -3
|
@@ -256,10 +256,9 @@ function collectFilterOptions(items, filters) {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
const options = Object.entries(usedOptions)
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
259
|
+
const options = Object.entries(usedOptions)
|
|
260
|
+
.map(([value, count]) => ({ value, count }))
|
|
261
|
+
.sort((a, b) => b.value.localeCompare(a.value));
|
|
263
262
|
if (othersCount) {
|
|
264
263
|
options.push({
|
|
265
264
|
value: filter.missingCategoryNameTranslationKey || filter.missingCategoryName || 'Others',
|
|
@@ -41,7 +41,7 @@ var MOOD_STATES;
|
|
|
41
41
|
MOOD_STATES["SATISFIED"] = "satisfied";
|
|
42
42
|
MOOD_STATES["NEUTRAL"] = "neutral";
|
|
43
43
|
MOOD_STATES["DISSATISFIED"] = "dissatisfied";
|
|
44
|
-
})(MOOD_STATES
|
|
44
|
+
})(MOOD_STATES || (exports.MOOD_STATES = MOOD_STATES = {}));
|
|
45
45
|
const Mood = ({ settings, onSubmit, className }) => {
|
|
46
46
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
47
47
|
const [score, setScore] = React.useState('');
|
|
@@ -50,7 +50,7 @@ const Mood = ({ settings, onSubmit, className }) => {
|
|
|
50
50
|
const [reasons, setReasons] = React.useState([]);
|
|
51
51
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
52
52
|
const renderCommentLabel = (score) => {
|
|
53
|
-
if (!(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.
|
|
53
|
+
if (!commentSettings || (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide) === true)
|
|
54
54
|
return '';
|
|
55
55
|
switch (score) {
|
|
56
56
|
case MOOD_STATES.SATISFIED:
|
|
@@ -66,8 +66,8 @@ const Mood = ({ settings, onSubmit, className }) => {
|
|
|
66
66
|
return translate('theme.feedback.settings.comment.satisfiedLabel', 'What can we improve?');
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
const displayReasons = !!score &&
|
|
70
|
-
const displayComment = !!score &&
|
|
69
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
70
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
71
71
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
72
72
|
const onSubmitMoodForm = () => {
|
|
73
73
|
onSubmit({
|
|
@@ -53,8 +53,8 @@ const Rating = ({ settings, onSubmit, className }) => {
|
|
|
53
53
|
});
|
|
54
54
|
setIsSubmitted(true);
|
|
55
55
|
};
|
|
56
|
-
const displayReasons = !!score &&
|
|
57
|
-
const displayComment = !!score &&
|
|
56
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
57
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
58
58
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
59
59
|
(0, react_1.useEffect)(() => {
|
|
60
60
|
if (score && !displayComment && !displayReasons) {
|
|
@@ -47,8 +47,8 @@ const Scale = ({ settings, onSubmit, className }) => {
|
|
|
47
47
|
for (let i = 1; i <= exports.MAX_SCALE; i++) {
|
|
48
48
|
scaleOptions.push(React.createElement(ScaleOption, { id: `scale-option-${i}`, key: `scale-option-${i}`, onClick: () => setScore(i), className: `${score === i ? 'active' : ''}` }, i));
|
|
49
49
|
}
|
|
50
|
-
const displayReasons = !!score &&
|
|
51
|
-
const displayComment = !!score &&
|
|
50
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
51
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
52
52
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
53
53
|
const onSubmitScaleForm = () => {
|
|
54
54
|
onSubmit({
|
|
@@ -43,8 +43,8 @@ const Sentiment = ({ settings, onSubmit, className }) => {
|
|
|
43
43
|
const [comment, setComment] = React.useState('');
|
|
44
44
|
const [reasons, setReasons] = React.useState([]);
|
|
45
45
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
46
|
-
const displayReasons = !!score &&
|
|
47
|
-
const displayComment = !!score &&
|
|
46
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
47
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
48
48
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
49
49
|
const commentLabel = score === 1
|
|
50
50
|
? (commentSettings && commentSettings.likeLabel) ||
|
|
@@ -10,11 +10,11 @@ export type RatingProps = {
|
|
|
10
10
|
label?: string;
|
|
11
11
|
submitText?: string;
|
|
12
12
|
comment?: {
|
|
13
|
-
|
|
13
|
+
hide?: boolean;
|
|
14
14
|
label?: string;
|
|
15
15
|
};
|
|
16
16
|
reasons?: {
|
|
17
|
-
|
|
17
|
+
hide?: boolean;
|
|
18
18
|
label?: string;
|
|
19
19
|
component?: string;
|
|
20
20
|
items: string[];
|
|
@@ -35,11 +35,11 @@ export type ScaleProps = {
|
|
|
35
35
|
leftScaleLabel?: string;
|
|
36
36
|
rightScaleLabel?: string;
|
|
37
37
|
comment?: {
|
|
38
|
-
|
|
38
|
+
hide?: boolean;
|
|
39
39
|
label?: string;
|
|
40
40
|
};
|
|
41
41
|
reasons?: {
|
|
42
|
-
|
|
42
|
+
hide?: boolean;
|
|
43
43
|
label?: string;
|
|
44
44
|
component?: string;
|
|
45
45
|
items: string[];
|
|
@@ -57,13 +57,13 @@ export type MoodProps = {
|
|
|
57
57
|
label?: string;
|
|
58
58
|
submitText?: string;
|
|
59
59
|
comment?: {
|
|
60
|
-
|
|
60
|
+
hide?: boolean;
|
|
61
61
|
satisfiedLabel?: string;
|
|
62
62
|
neutralLabel?: string;
|
|
63
63
|
dissatisfiedLabel?: string;
|
|
64
64
|
};
|
|
65
65
|
reasons?: {
|
|
66
|
-
|
|
66
|
+
hide?: boolean;
|
|
67
67
|
label?: string;
|
|
68
68
|
component?: string;
|
|
69
69
|
items: string[];
|
|
@@ -81,12 +81,12 @@ export type SentimentProps = {
|
|
|
81
81
|
label?: string;
|
|
82
82
|
submitText?: string;
|
|
83
83
|
comment?: {
|
|
84
|
-
|
|
84
|
+
hide?: boolean;
|
|
85
85
|
likeLabel?: string;
|
|
86
86
|
dislikeLabel?: string;
|
|
87
87
|
};
|
|
88
88
|
reasons?: {
|
|
89
|
-
|
|
89
|
+
hide?: boolean;
|
|
90
90
|
label?: string;
|
|
91
91
|
component?: string;
|
|
92
92
|
items: string[];
|
|
@@ -52,7 +52,7 @@ function Filter({ filter, filterValuesCasing, }) {
|
|
|
52
52
|
return;
|
|
53
53
|
filter.selectOption(Object.assign(Object.assign({}, filter.selectedOptions), { to: formatDateWithNoTimeZone(to) }));
|
|
54
54
|
} })))) : (filter.filteredOptions.map((value) => {
|
|
55
|
-
const id = 'filter--' + filter.property + '--' + value.value;
|
|
55
|
+
const id = 'filter--' + filter.property + '--' + slug(value.value);
|
|
56
56
|
return (react_1.default.createElement(FilterOption, { key: id, role: "link", onClick: () => filter.toggleOption(value.value) },
|
|
57
57
|
react_1.default.createElement(icons_1.CheckboxIcon, { checked: filter.selectedOptions.has(value.value) }),
|
|
58
58
|
react_1.default.createElement(FilterOptionLabel, null, changeCasing(translate(value.value), filterValuesCasing)),
|
|
@@ -133,6 +133,10 @@ const StyledSelect = (0, styled_components_1.default)(Select_1.Select) `
|
|
|
133
133
|
margin: var(--filter-select-option-margin);
|
|
134
134
|
}
|
|
135
135
|
`;
|
|
136
|
+
// TODO: import from portal
|
|
137
|
+
function slug(str) {
|
|
138
|
+
return str.replace(/\s/g, '-').toLowerCase();
|
|
139
|
+
}
|
|
136
140
|
const DatePickerWrapper = styled_components_1.default.div `
|
|
137
141
|
color: var(--filter-date-picker-color);
|
|
138
142
|
display: flex;
|
|
@@ -6,5 +6,5 @@ var MenuType;
|
|
|
6
6
|
MenuType["MAIN_MENU"] = "MAIN_MENU";
|
|
7
7
|
MenuType["PRODUCT"] = "PRODUCT";
|
|
8
8
|
MenuType["PAGE"] = "PAGE";
|
|
9
|
-
})(MenuType
|
|
9
|
+
})(MenuType || (exports.MenuType = MenuType = {}));
|
|
10
10
|
//# sourceMappingURL=constants.js.map
|
|
@@ -64,15 +64,13 @@ function Navbar() {
|
|
|
64
64
|
if (!menu && !logo) {
|
|
65
65
|
return react_1.default.createElement(EmptyNavbarHack, null);
|
|
66
66
|
}
|
|
67
|
-
return (react_1.default.createElement(NavbarPresentational,
|
|
68
|
-
closeMobileMenu,
|
|
67
|
+
return (react_1.default.createElement(NavbarPresentational, { closeMobileMenu,
|
|
69
68
|
openMobileMenu,
|
|
70
69
|
isOpen,
|
|
71
70
|
hideSearch: Boolean(hideSearch),
|
|
72
71
|
logo: logo,
|
|
73
72
|
hideUserProfile,
|
|
74
|
-
changeLanguage
|
|
75
|
-
})));
|
|
73
|
+
changeLanguage }));
|
|
76
74
|
}
|
|
77
75
|
exports.Navbar = Navbar;
|
|
78
76
|
function NavbarPresentational(props) {
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export declare const ScorecardCard: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
-
'data-component-name': string;
|
|
3
|
-
}, "data-component-name">;
|
|
1
|
+
export declare const ScorecardCard: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
2
|
export declare const ScorecardCardTitle: import("styled-components").StyledComponent<"h3", any, {}, never>;
|
|
@@ -5,11 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ScorecardCardTitle = exports.ScorecardCard = void 0;
|
|
7
7
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
exports.ScorecardCard = styled_components_1.default.div
|
|
9
|
-
'data-component-name': 'Scorecard/ScorecardCard',
|
|
10
|
-
}) `
|
|
8
|
+
exports.ScorecardCard = styled_components_1.default.div `
|
|
11
9
|
color: var(--text-primary);
|
|
12
|
-
background-color: var(--
|
|
10
|
+
background-color: var(--thin-tile-background-color);
|
|
13
11
|
border-radius: 4px;
|
|
14
12
|
|
|
15
13
|
border: 1px solid var(--border-primary);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export declare function Gauge({ chunks, }: {
|
|
3
3
|
chunks: {
|
|
4
4
|
share: number;
|
|
5
5
|
color: string;
|
|
6
|
-
title?: string;
|
|
7
6
|
}[];
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export declare function Gauge({ chunks, className }: GaugeProps): JSX.Element;
|
|
7
|
+
}): JSX.Element;
|
|
11
8
|
export declare const GaugeValue: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -29,12 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.GaugeValue = exports.Gauge = void 0;
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
-
function Gauge({ chunks,
|
|
33
|
-
|
|
34
|
-
.map((chunk) => chunk.title)
|
|
35
|
-
.filter(Boolean)
|
|
36
|
-
.join(', ');
|
|
37
|
-
return (React.createElement(GaugeWrapper, { "data-component-name": "Scorecard/StatusByLevelWidget", className: className, title: title }, chunks.map((chunk, i) => (React.createElement(GaugeChunk, { key: i, share: chunk.share, color: chunk.color })))));
|
|
32
|
+
function Gauge({ chunks, }) {
|
|
33
|
+
return (React.createElement(GaugeWrapper, null, chunks.map((chunk, i) => (React.createElement(GaugeChunk, Object.assign({ key: i }, chunk))))));
|
|
38
34
|
}
|
|
39
35
|
exports.Gauge = Gauge;
|
|
40
36
|
exports.GaugeValue = styled_components_1.default.span `
|
|
@@ -32,8 +32,8 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
32
32
|
const Gauge_1 = require("../../components/Scorecard/Gauge");
|
|
33
33
|
const Card_1 = require("../../components/Scorecard/Card");
|
|
34
34
|
function StatusByLevelWidget(props) {
|
|
35
|
-
const { levels, title
|
|
36
|
-
return (React.createElement(Card_1.ScorecardCard,
|
|
35
|
+
const { levels, title } = props;
|
|
36
|
+
return (React.createElement(Card_1.ScorecardCard, null,
|
|
37
37
|
React.createElement(Card_1.ScorecardCardTitle, null, title),
|
|
38
38
|
React.createElement(CardBody, null, levels.map((level) => {
|
|
39
39
|
const success = level.total - level.errors - level.warnings;
|
|
@@ -43,17 +43,14 @@ function StatusByLevelWidget(props) {
|
|
|
43
43
|
{
|
|
44
44
|
share: (success / level.total) * 100,
|
|
45
45
|
color: 'var(--scorecard-color-success)',
|
|
46
|
-
title: `${success} passed`,
|
|
47
46
|
},
|
|
48
47
|
{
|
|
49
48
|
share: (level.warnings / level.total) * 100,
|
|
50
49
|
color: 'var(--scorecard-color-warning)',
|
|
51
|
-
title: `${level.warnings} ${level.warnings === 1 ? 'warning' : 'warnings'}`,
|
|
52
50
|
},
|
|
53
51
|
{
|
|
54
52
|
share: (level.errors / level.total) * 100,
|
|
55
53
|
color: 'var(--scorecard-color-error)',
|
|
56
|
-
title: `${level.errors} ${level.errors === 1 ? 'error' : 'errors'}`,
|
|
57
54
|
},
|
|
58
55
|
] }),
|
|
59
56
|
React.createElement(Gauge_1.GaugeValue, null,
|
|
@@ -14,7 +14,7 @@ var LayoutVariant;
|
|
|
14
14
|
(function (LayoutVariant) {
|
|
15
15
|
LayoutVariant["STACKED"] = "stacked";
|
|
16
16
|
LayoutVariant["THREE_PANEL"] = "three-panel";
|
|
17
|
-
})(LayoutVariant
|
|
17
|
+
})(LayoutVariant || (exports.LayoutVariant = LayoutVariant = {}));
|
|
18
18
|
const SidebarActions = ({ showChangeLayoutButton, showRightPanelToggle, layout, initialShowRightPanelToggle, hideCollapseSidebarButton = false, collapsedSidebar, isOpenapiDocs, onChangeRightPanelViewClick, onChangeViewClick, onChangeCollapseSidebarClick, requestAccessButton, className, }) => {
|
|
19
19
|
return (react_1.default.createElement(styled_1.ControlsWrap, { className: className, isOpenapiDocs: isOpenapiDocs, isCollapsed: collapsedSidebar, "data-component-name": "Sidebar/Actions" },
|
|
20
20
|
isOpenapiDocs && (react_1.default.createElement(styled_1.ControlsWrapChangeLayoutButtons, { isCollapsed: collapsedSidebar },
|
|
@@ -40,10 +40,12 @@ function Tabs(props) {
|
|
|
40
40
|
const { label, key } = child.props;
|
|
41
41
|
return (react_1.default.createElement(Tabs_1.Tab, { activeTab: activeTab, key: `${key || label}-${idx}`, label: label, onClick: onTabSelect }));
|
|
42
42
|
})),
|
|
43
|
-
react_1.default.createElement(TabContent, null, children.map((child) => {
|
|
43
|
+
react_1.default.createElement(TabContent, null, children.map((child, idx) => {
|
|
44
44
|
if (child.props.label !== activeTab)
|
|
45
45
|
return undefined;
|
|
46
|
-
return
|
|
46
|
+
return react_1.default.createElement(react_1.default.Fragment, { key: idx },
|
|
47
|
+
" ",
|
|
48
|
+
child.props.children);
|
|
47
49
|
}))));
|
|
48
50
|
}
|
|
49
51
|
exports.Tabs = Tabs;
|
package/lib/config.d.ts
CHANGED
|
@@ -308,9 +308,6 @@ declare const scorecardConfigSchema: {
|
|
|
308
308
|
readonly name: {
|
|
309
309
|
readonly type: "string";
|
|
310
310
|
};
|
|
311
|
-
readonly color: {
|
|
312
|
-
readonly type: "string";
|
|
313
|
-
};
|
|
314
311
|
readonly extends: {
|
|
315
312
|
readonly type: "array";
|
|
316
313
|
readonly items: {
|
|
@@ -1068,9 +1065,9 @@ export declare const themeConfigSchema: {
|
|
|
1068
1065
|
readonly reasons: {
|
|
1069
1066
|
readonly type: "object";
|
|
1070
1067
|
readonly properties: {
|
|
1071
|
-
readonly
|
|
1068
|
+
readonly hide: {
|
|
1072
1069
|
readonly type: "boolean";
|
|
1073
|
-
readonly default:
|
|
1070
|
+
readonly default: false;
|
|
1074
1071
|
};
|
|
1075
1072
|
readonly component: {
|
|
1076
1073
|
readonly type: "string";
|
|
@@ -1092,9 +1089,9 @@ export declare const themeConfigSchema: {
|
|
|
1092
1089
|
readonly comment: {
|
|
1093
1090
|
readonly type: "object";
|
|
1094
1091
|
readonly properties: {
|
|
1095
|
-
readonly
|
|
1092
|
+
readonly hide: {
|
|
1096
1093
|
readonly type: "boolean";
|
|
1097
|
-
readonly default:
|
|
1094
|
+
readonly default: false;
|
|
1098
1095
|
};
|
|
1099
1096
|
readonly label: {
|
|
1100
1097
|
readonly type: "string";
|
|
@@ -1871,9 +1868,6 @@ export declare const themeConfigSchema: {
|
|
|
1871
1868
|
readonly name: {
|
|
1872
1869
|
readonly type: "string";
|
|
1873
1870
|
};
|
|
1874
|
-
readonly color: {
|
|
1875
|
-
readonly type: "string";
|
|
1876
|
-
};
|
|
1877
1871
|
readonly extends: {
|
|
1878
1872
|
readonly type: "array";
|
|
1879
1873
|
readonly items: {
|
package/lib/config.js
CHANGED
|
@@ -280,7 +280,6 @@ const scorecardConfigSchema = {
|
|
|
280
280
|
required: ['name'],
|
|
281
281
|
properties: {
|
|
282
282
|
name: { type: 'string' },
|
|
283
|
-
color: { type: 'string' },
|
|
284
283
|
extends: { type: 'array', items: { type: 'string' } },
|
|
285
284
|
rules: {
|
|
286
285
|
type: 'object',
|
|
@@ -408,7 +407,10 @@ exports.themeConfigSchema = {
|
|
|
408
407
|
reasons: {
|
|
409
408
|
type: 'object',
|
|
410
409
|
properties: {
|
|
411
|
-
|
|
410
|
+
hide: {
|
|
411
|
+
type: 'boolean',
|
|
412
|
+
default: false,
|
|
413
|
+
},
|
|
412
414
|
component: {
|
|
413
415
|
type: 'string',
|
|
414
416
|
enum: ['radio', 'checkbox'],
|
|
@@ -422,7 +424,10 @@ exports.themeConfigSchema = {
|
|
|
422
424
|
comment: {
|
|
423
425
|
type: 'object',
|
|
424
426
|
properties: {
|
|
425
|
-
|
|
427
|
+
hide: {
|
|
428
|
+
type: 'boolean',
|
|
429
|
+
default: false,
|
|
430
|
+
},
|
|
426
431
|
label: { type: 'string' },
|
|
427
432
|
likeLabel: { type: 'string' },
|
|
428
433
|
dislikeLabel: { type: 'string' },
|
|
@@ -604,5 +609,5 @@ var ScorecardStatus;
|
|
|
604
609
|
ScorecardStatus["BelowMinimum"] = "Below minimum";
|
|
605
610
|
ScorecardStatus["Highest"] = "Highest";
|
|
606
611
|
ScorecardStatus["Minimum"] = "Minimum";
|
|
607
|
-
})(ScorecardStatus
|
|
612
|
+
})(ScorecardStatus || (exports.ScorecardStatus = ScorecardStatus = {}));
|
|
608
613
|
//# sourceMappingURL=config.js.map
|
|
@@ -7,5 +7,5 @@ var MenuType;
|
|
|
7
7
|
MenuType["DrillDown"] = "drilldown";
|
|
8
8
|
MenuType["Group"] = "group";
|
|
9
9
|
MenuType["Operation"] = "operation";
|
|
10
|
-
})(MenuType
|
|
10
|
+
})(MenuType || (exports.MenuType = MenuType = {}));
|
|
11
11
|
//# sourceMappingURL=types.js.map
|
|
@@ -12,14 +12,14 @@ var FEEDBACK_TYPES;
|
|
|
12
12
|
FEEDBACK_TYPES["MOOD"] = "mood";
|
|
13
13
|
FEEDBACK_TYPES["PROBLEM"] = "problem";
|
|
14
14
|
FEEDBACK_TYPES["SCALE"] = "scale";
|
|
15
|
-
})(FEEDBACK_TYPES
|
|
15
|
+
})(FEEDBACK_TYPES || (exports.FEEDBACK_TYPES = FEEDBACK_TYPES = {}));
|
|
16
16
|
exports.DEV_LOGIN_SLUG = '/login/';
|
|
17
17
|
var ExternalRoutes;
|
|
18
18
|
(function (ExternalRoutes) {
|
|
19
19
|
ExternalRoutes["AUTH0_PASS"] = "/auth/auth0-pass";
|
|
20
|
-
})(ExternalRoutes
|
|
20
|
+
})(ExternalRoutes || (exports.ExternalRoutes = ExternalRoutes = {}));
|
|
21
21
|
var FsErrors;
|
|
22
22
|
(function (FsErrors) {
|
|
23
23
|
FsErrors["NotExist"] = "ENOENT";
|
|
24
|
-
})(FsErrors
|
|
24
|
+
})(FsErrors || (exports.FsErrors = FsErrors = {}));
|
|
25
25
|
//# sourceMappingURL=constants.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.4",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"styled-system": "^5.1.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@storybook/addon-actions": "^7.
|
|
32
|
-
"@storybook/addon-essentials": "^7.
|
|
33
|
-
"@storybook/addon-interactions": "^7.
|
|
34
|
-
"@storybook/addon-links": "^7.
|
|
35
|
-
"@storybook/addon-viewport": "^7.
|
|
36
|
-
"@storybook/addons": "^7.
|
|
37
|
-
"@storybook/core-common": "^7.
|
|
38
|
-
"@storybook/node-logger": "^7.
|
|
39
|
-
"@storybook/react": "^7.
|
|
40
|
-
"@storybook/react-webpack5": "^7.
|
|
31
|
+
"@storybook/addon-actions": "^7.5.0",
|
|
32
|
+
"@storybook/addon-essentials": "^7.5.0",
|
|
33
|
+
"@storybook/addon-interactions": "^7.5.0",
|
|
34
|
+
"@storybook/addon-links": "^7.5.0",
|
|
35
|
+
"@storybook/addon-viewport": "^7.5.0",
|
|
36
|
+
"@storybook/addons": "^7.5.0",
|
|
37
|
+
"@storybook/core-common": "^7.5.0",
|
|
38
|
+
"@storybook/node-logger": "^7.5.0",
|
|
39
|
+
"@storybook/react": "^7.5.0",
|
|
40
|
+
"@storybook/react-webpack5": "^7.5.0",
|
|
41
41
|
"@storybook/testing-library": "^0.2.2",
|
|
42
|
-
"@storybook/theming": "^7.
|
|
42
|
+
"@storybook/theming": "^7.5.0",
|
|
43
43
|
"@testing-library/jest-dom": "^5.16.5",
|
|
44
44
|
"@testing-library/react": "^12.1.4",
|
|
45
45
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"npm-run-all": "^4.1.5",
|
|
69
69
|
"react-refresh": "^0.14.0",
|
|
70
70
|
"react-router-dom": "^6.10.0",
|
|
71
|
-
"storybook": "^7.
|
|
71
|
+
"storybook": "^7.5.0",
|
|
72
72
|
"storybook-addon-pseudo-states": "^2.1.2",
|
|
73
73
|
"storybook-design-token": "3.0.0-beta.6",
|
|
74
74
|
"styled-components": "^5.3.7",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"tsc-alias": "^1.8.2",
|
|
80
80
|
"tsconfig-paths": "^4.2.0",
|
|
81
81
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
82
|
-
"typescript": "^
|
|
82
|
+
"typescript": "^5.2.2",
|
|
83
83
|
"webpack": "^5.72.0",
|
|
84
84
|
"@redocly/portal-types": "1.2.0"
|
|
85
85
|
},
|
|
@@ -299,12 +299,9 @@ function collectFilterOptions(
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
const options = Object.entries(usedOptions)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
options.sort((a, b) => b.value.localeCompare(a.value));
|
|
306
|
-
}
|
|
307
|
-
|
|
302
|
+
const options = Object.entries(usedOptions)
|
|
303
|
+
.map(([value, count]) => ({ value, count }))
|
|
304
|
+
.sort((a, b) => b.value.localeCompare(a.value));
|
|
308
305
|
if (othersCount) {
|
|
309
306
|
options.push({
|
|
310
307
|
value: filter.missingCategoryNameTranslationKey || filter.missingCategoryName || 'Others',
|
|
@@ -25,7 +25,7 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
25
25
|
const { translate } = useTranslate();
|
|
26
26
|
|
|
27
27
|
const renderCommentLabel = (score: string) => {
|
|
28
|
-
if (!commentSettings?.
|
|
28
|
+
if (!commentSettings || commentSettings?.hide === true) return '';
|
|
29
29
|
|
|
30
30
|
switch (score) {
|
|
31
31
|
case MOOD_STATES.SATISFIED:
|
|
@@ -48,8 +48,8 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
const displayReasons = !!score && reasonsSettings
|
|
52
|
-
const displayComment = !!score && commentSettings
|
|
51
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
52
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
53
53
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
54
54
|
|
|
55
55
|
const onSubmitMoodForm = () => {
|
|
@@ -31,8 +31,8 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
31
31
|
setIsSubmitted(true);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const displayReasons = !!score && reasonsSettings
|
|
35
|
-
const displayComment = !!score && commentSettings
|
|
34
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
35
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
36
36
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
37
37
|
|
|
38
38
|
useEffect(() => {
|
|
@@ -41,8 +41,8 @@ export const Scale = ({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const displayReasons = !!score && reasonsSettings
|
|
45
|
-
const displayComment = !!score && commentSettings
|
|
44
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
45
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
46
46
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
47
47
|
|
|
48
48
|
const onSubmitScaleForm = () => {
|
|
@@ -18,8 +18,8 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
18
18
|
const [reasons, setReasons] = React.useState([] as ReasonsProps['settings']['items']);
|
|
19
19
|
const { translate } = useTranslate();
|
|
20
20
|
|
|
21
|
-
const displayReasons = !!score && reasonsSettings
|
|
22
|
-
const displayComment = !!score && commentSettings
|
|
21
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
22
|
+
const displayComment = !!score && commentSettings && !commentSettings.hide;
|
|
23
23
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
24
24
|
|
|
25
25
|
const commentLabel =
|
|
@@ -6,11 +6,11 @@ export type RatingProps = {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
submitText?: string;
|
|
8
8
|
comment?: {
|
|
9
|
-
|
|
9
|
+
hide?: boolean;
|
|
10
10
|
label?: string;
|
|
11
11
|
};
|
|
12
12
|
reasons?: {
|
|
13
|
-
|
|
13
|
+
hide?: boolean;
|
|
14
14
|
label?: string;
|
|
15
15
|
component?: string;
|
|
16
16
|
items: string[];
|
|
@@ -27,11 +27,11 @@ export type ScaleProps = {
|
|
|
27
27
|
leftScaleLabel?: string;
|
|
28
28
|
rightScaleLabel?: string;
|
|
29
29
|
comment?: {
|
|
30
|
-
|
|
30
|
+
hide?: boolean;
|
|
31
31
|
label?: string;
|
|
32
32
|
};
|
|
33
33
|
reasons?: {
|
|
34
|
-
|
|
34
|
+
hide?: boolean;
|
|
35
35
|
label?: string;
|
|
36
36
|
component?: string;
|
|
37
37
|
items: string[];
|
|
@@ -46,13 +46,13 @@ export type MoodProps = {
|
|
|
46
46
|
label?: string;
|
|
47
47
|
submitText?: string;
|
|
48
48
|
comment?: {
|
|
49
|
-
|
|
49
|
+
hide?: boolean;
|
|
50
50
|
satisfiedLabel?: string;
|
|
51
51
|
neutralLabel?: string;
|
|
52
52
|
dissatisfiedLabel?: string;
|
|
53
53
|
};
|
|
54
54
|
reasons?: {
|
|
55
|
-
|
|
55
|
+
hide?: boolean;
|
|
56
56
|
label?: string;
|
|
57
57
|
component?: string;
|
|
58
58
|
items: string[];
|
|
@@ -67,12 +67,12 @@ export type SentimentProps = {
|
|
|
67
67
|
label?: string;
|
|
68
68
|
submitText?: string;
|
|
69
69
|
comment?: {
|
|
70
|
-
|
|
70
|
+
hide?: boolean;
|
|
71
71
|
likeLabel?: string;
|
|
72
72
|
dislikeLabel?: string;
|
|
73
73
|
};
|
|
74
74
|
reasons?: {
|
|
75
|
-
|
|
75
|
+
hide?: boolean;
|
|
76
76
|
label?: string;
|
|
77
77
|
component?: string;
|
|
78
78
|
items: string[];
|
|
@@ -109,7 +109,7 @@ export function Filter({
|
|
|
109
109
|
</>
|
|
110
110
|
) : (
|
|
111
111
|
filter.filteredOptions.map((value: any) => {
|
|
112
|
-
const id = 'filter--' + filter.property + '--' + value.value;
|
|
112
|
+
const id = 'filter--' + filter.property + '--' + slug(value.value);
|
|
113
113
|
return (
|
|
114
114
|
<FilterOption key={id} role="link" onClick={() => filter.toggleOption(value.value)}>
|
|
115
115
|
<CheckboxIcon checked={filter.selectedOptions.has(value.value)} />
|
|
@@ -210,6 +210,11 @@ const StyledSelect = styled(Select)`
|
|
|
210
210
|
}
|
|
211
211
|
`;
|
|
212
212
|
|
|
213
|
+
// TODO: import from portal
|
|
214
|
+
function slug(str: string): string {
|
|
215
|
+
return str.replace(/\s/g, '-').toLowerCase();
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
const DatePickerWrapper = styled.div`
|
|
214
219
|
color: var(--filter-date-picker-color);
|
|
215
220
|
display: flex;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const ScorecardCard = styled.div
|
|
4
|
-
'data-component-name': 'Scorecard/ScorecardCard',
|
|
5
|
-
})`
|
|
3
|
+
export const ScorecardCard = styled.div`
|
|
6
4
|
color: var(--text-primary);
|
|
7
|
-
background-color: var(--
|
|
5
|
+
background-color: var(--thin-tile-background-color);
|
|
8
6
|
border-radius: 4px;
|
|
9
7
|
|
|
10
8
|
border: 1px solid var(--border-primary);
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export function Gauge({
|
|
5
|
+
chunks,
|
|
6
|
+
}: {
|
|
4
7
|
chunks: {
|
|
5
8
|
share: number;
|
|
6
9
|
color: string;
|
|
7
|
-
title?: string;
|
|
8
10
|
}[];
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function Gauge({ chunks, className }: GaugeProps) {
|
|
13
|
-
const title = chunks
|
|
14
|
-
.map((chunk) => chunk.title)
|
|
15
|
-
.filter(Boolean)
|
|
16
|
-
.join(', ');
|
|
11
|
+
}) {
|
|
17
12
|
return (
|
|
18
|
-
<GaugeWrapper
|
|
19
|
-
data-component-name="Scorecard/StatusByLevelWidget"
|
|
20
|
-
className={className}
|
|
21
|
-
title={title}
|
|
22
|
-
>
|
|
13
|
+
<GaugeWrapper>
|
|
23
14
|
{chunks.map((chunk, i) => (
|
|
24
|
-
<GaugeChunk key={i}
|
|
15
|
+
<GaugeChunk key={i} {...chunk} />
|
|
25
16
|
))}
|
|
26
17
|
</GaugeWrapper>
|
|
27
18
|
);
|
|
@@ -7,13 +7,12 @@ import { ScorecardCard, ScorecardCardTitle } from '@theme/components/Scorecard/C
|
|
|
7
7
|
export interface StatusByLevelWidgetProps {
|
|
8
8
|
title: string;
|
|
9
9
|
levels: { name: string; errors: number; warnings: number; total: number }[];
|
|
10
|
-
className?: string;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
|
|
14
|
-
const { levels, title
|
|
13
|
+
const { levels, title } = props;
|
|
15
14
|
return (
|
|
16
|
-
<ScorecardCard
|
|
15
|
+
<ScorecardCard>
|
|
17
16
|
<ScorecardCardTitle>{title}</ScorecardCardTitle>
|
|
18
17
|
<CardBody>
|
|
19
18
|
{levels.map((level) => {
|
|
@@ -26,17 +25,14 @@ export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
|
|
|
26
25
|
{
|
|
27
26
|
share: (success / level.total) * 100,
|
|
28
27
|
color: 'var(--scorecard-color-success)',
|
|
29
|
-
title: `${success} passed`,
|
|
30
28
|
},
|
|
31
29
|
{
|
|
32
30
|
share: (level.warnings / level.total) * 100,
|
|
33
31
|
color: 'var(--scorecard-color-warning)',
|
|
34
|
-
title: `${level.warnings} ${level.warnings === 1 ? 'warning' : 'warnings'}`,
|
|
35
32
|
},
|
|
36
33
|
{
|
|
37
34
|
share: (level.errors / level.total) * 100,
|
|
38
35
|
color: 'var(--scorecard-color-error)',
|
|
39
|
-
title: `${level.errors} ${level.errors === 1 ? 'error' : 'errors'}`,
|
|
40
36
|
},
|
|
41
37
|
]}
|
|
42
38
|
/>
|
|
@@ -29,9 +29,9 @@ export function Tabs(props: TabsProps): JSX.Element {
|
|
|
29
29
|
})}
|
|
30
30
|
</TabList>
|
|
31
31
|
<TabContent>
|
|
32
|
-
{children.map((child) => {
|
|
32
|
+
{children.map((child, idx) => {
|
|
33
33
|
if (child.props.label !== activeTab) return undefined;
|
|
34
|
-
return child.props.children
|
|
34
|
+
return <React.Fragment key={idx}> {child.props.children}</React.Fragment>;
|
|
35
35
|
})}
|
|
36
36
|
</TabContent>
|
|
37
37
|
</TabsContainer>
|
package/src/config.ts
CHANGED
|
@@ -319,7 +319,6 @@ const scorecardConfigSchema = {
|
|
|
319
319
|
required: ['name'],
|
|
320
320
|
properties: {
|
|
321
321
|
name: { type: 'string' },
|
|
322
|
-
color: { type: 'string' },
|
|
323
322
|
extends: { type: 'array', items: { type: 'string' } },
|
|
324
323
|
rules: {
|
|
325
324
|
type: 'object',
|
|
@@ -464,7 +463,10 @@ export const themeConfigSchema = {
|
|
|
464
463
|
reasons: {
|
|
465
464
|
type: 'object',
|
|
466
465
|
properties: {
|
|
467
|
-
|
|
466
|
+
hide: {
|
|
467
|
+
type: 'boolean',
|
|
468
|
+
default: false,
|
|
469
|
+
},
|
|
468
470
|
component: {
|
|
469
471
|
type: 'string',
|
|
470
472
|
enum: ['radio', 'checkbox'],
|
|
@@ -478,7 +480,10 @@ export const themeConfigSchema = {
|
|
|
478
480
|
comment: {
|
|
479
481
|
type: 'object',
|
|
480
482
|
properties: {
|
|
481
|
-
|
|
483
|
+
hide: {
|
|
484
|
+
type: 'boolean',
|
|
485
|
+
default: false,
|
|
486
|
+
},
|
|
482
487
|
label: { type: 'string' },
|
|
483
488
|
likeLabel: { type: 'string' },
|
|
484
489
|
dislikeLabel: { type: 'string' },
|