@redocly/theme 0.60.0-next.2 → 0.60.0-next.3
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/Menu/MenuItem.js +5 -1
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +7 -1
- package/lib/components/Search/SearchItem.js +5 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Tag/variables.dark.js +6 -0
- package/lib/components/Tag/variables.js +6 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/request-methods.d.ts +1 -0
- package/lib/core/constants/request-methods.js +14 -0
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/openapi/index.js +3 -1
- package/lib/core/types/search.d.ts +1 -0
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/utils/get-operation-color.d.ts +7 -0
- package/lib/core/utils/get-operation-color.js +13 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/package.json +2 -2
- package/src/components/Menu/MenuItem.tsx +6 -2
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +7 -1
- package/src/components/Search/SearchItem.tsx +7 -2
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/Tag/variables.dark.ts +6 -0
- package/src/components/Tag/variables.ts +6 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/request-methods.ts +10 -0
- package/src/core/openapi/index.ts +1 -0
- package/src/core/types/search.ts +1 -0
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/utils/get-operation-color.ts +18 -0
- package/src/core/utils/index.ts +1 -0
|
@@ -80,7 +80,11 @@ function MenuItem(props) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
const chevron = hasChevron ? (isExpanded ? (react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" })) : (react_1.default.createElement(ChevronRightIcon_1.ChevronRightIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" }))) : null;
|
|
83
|
-
const httpColor =
|
|
83
|
+
const httpColor = (0, utils_1.getOperationColor)({
|
|
84
|
+
isAdditionalOperation: item.isAdditionalOperation,
|
|
85
|
+
deprecated: item.deprecated,
|
|
86
|
+
httpVerb: item.httpVerb || '',
|
|
87
|
+
});
|
|
84
88
|
const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, deprecated: item.deprecated, depth: depth, withChevron: hasChevron, isSeparator: isSeparator, onClick: handleOnClick, onKeyDown: handleExpandOnEnter, ref: labelRef, role: item.link ? 'none' : 'link', tabIndex: !item.link ? 0 : undefined, "data-testid": "menu-item-label", "data-active": item.active },
|
|
85
89
|
hasChevron ? react_1.default.createElement(ChevronWrapper, null, chevron) : null,
|
|
86
90
|
react_1.default.createElement(MenuItemIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
@@ -7,6 +7,8 @@ exports.SearchFilterFieldTags = SearchFilterFieldTags;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Tag_1 = require("../../../components/Tag/Tag");
|
|
10
|
+
const utils_1 = require("../../../core/utils");
|
|
11
|
+
const constants_1 = require("../../../core/constants");
|
|
10
12
|
function SearchFilterFieldTags({ className, facet, selectedValues, onChange, }) {
|
|
11
13
|
return (react_1.default.createElement(FilterTagsWrapper, { "data-component-name": "Search/FilterFields/SearchFilterFieldTags", className: className }, facet.values.map((facetCount, index) => {
|
|
12
14
|
const { value, count, isCounterVisible } = facetCount;
|
|
@@ -17,7 +19,11 @@ function SearchFilterFieldTags({ className, facet, selectedValues, onChange, })
|
|
|
17
19
|
: [...selectedValues, value];
|
|
18
20
|
onChange(values);
|
|
19
21
|
};
|
|
20
|
-
|
|
22
|
+
const color = (0, utils_1.getOperationColor)({
|
|
23
|
+
httpVerb: value,
|
|
24
|
+
isAdditionalOperation: !constants_1.REQUEST_METHODS.includes(value.toUpperCase()),
|
|
25
|
+
});
|
|
26
|
+
return (react_1.default.createElement(FilterTagWrapper, { key: `${count}-${index}`, tabIndex: 0, color: color, onClick: () => {
|
|
21
27
|
updateSelectedValues();
|
|
22
28
|
}, onKeyDown: (e) => {
|
|
23
29
|
if (e.key === 'Enter') {
|
|
@@ -61,6 +61,10 @@ function SearchItem({ onClick, item, className, product, innerRef, }) {
|
|
|
61
61
|
const { document, highlight } = item;
|
|
62
62
|
const parameter = highlight.parameters && highlight.parameters.length ? highlight.parameters[0] : null;
|
|
63
63
|
const shouldShowPath = document.path && ((_a = document.path) === null || _a === void 0 ? void 0 : _a.length) > 1;
|
|
64
|
+
const httpColor = (0, utils_1.getOperationColor)({
|
|
65
|
+
isAdditionalOperation: document.isAdditionalOperation,
|
|
66
|
+
httpVerb: document.httpMethod || '',
|
|
67
|
+
});
|
|
64
68
|
return (react_1.default.createElement(SearchItemWrapper, { className: className, to: document.url, onClick: onClick, tabIndex: 0, innerRef: (el) => {
|
|
65
69
|
ref.current = el;
|
|
66
70
|
if (!innerRef)
|
|
@@ -78,7 +82,7 @@ function SearchItem({ onClick, item, className, product, innerRef, }) {
|
|
|
78
82
|
react_1.default.createElement(Image_1.Image, { src: product.icon }),
|
|
79
83
|
product.name)),
|
|
80
84
|
document.httpMethod ? (react_1.default.createElement(SearchItemOperation, null,
|
|
81
|
-
react_1.default.createElement(SearchItemOperationTag, { color:
|
|
85
|
+
react_1.default.createElement(SearchItemOperationTag, { color: httpColor }, document.httpMethod.toUpperCase()),
|
|
82
86
|
highlight.httpPath ? (0, SearchHighlight_1.searchHighlight)(highlight.httpPath) : document.httpPath)) : null,
|
|
83
87
|
react_1.default.createElement(SearchItemTitleWrapper, null,
|
|
84
88
|
react_1.default.createElement(SearchItemTitle, null, highlight.title ? (0, SearchHighlight_1.searchHighlight)(highlight.title) : document.title),
|
|
@@ -6,7 +6,7 @@ type SubjectStatusColor = 'active' | 'draft' | 'deprecated' | 'product';
|
|
|
6
6
|
type HttpColor = 'get' | 'post' | 'put' | 'delete' | 'option' | 'patch' | 'head' | 'hook' | 'link';
|
|
7
7
|
type ActionColor = 'receive' | 'send';
|
|
8
8
|
type ChannelColor = 'channel';
|
|
9
|
-
type HttpStatusColor = 'http-deprecated';
|
|
9
|
+
type HttpStatusColor = 'http-deprecated' | 'http-additional-operation';
|
|
10
10
|
type StatusColor = DefaultStatusColor | ActionStatusColor | SubjectStatusColor | HttpColor | ActionColor | ChannelColor | HttpStatusColor;
|
|
11
11
|
type Color = 'red' | 'green' | 'blue' | 'grey' | 'turquoise' | 'magenta' | 'purple' | 'carrot' | 'raspberry' | 'orange' | 'grass' | 'persian-green' | 'sky' | 'blueberry';
|
|
12
12
|
export type TagProps = {
|
|
@@ -232,6 +232,12 @@ exports.tagDarkMode = (0, styled_components_1.css) `
|
|
|
232
232
|
--tag-bg-color-hover: #373776; // @presenter Color
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
.tag-http-additional-operation {
|
|
236
|
+
--tag-color: #FCAB69; // @presenter Color
|
|
237
|
+
--tag-bg-color: #523926; // @presenter Color
|
|
238
|
+
--tag-bg-color-hover: #694830; // @presenter Color
|
|
239
|
+
}
|
|
240
|
+
|
|
235
241
|
.tag-receive {
|
|
236
242
|
--tag-color: #88CF82; // @presenter Color
|
|
237
243
|
--tag-bg-color: #23421F; // @presenter Color
|
|
@@ -313,6 +313,12 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
313
313
|
--tag-color: var(--text-color-disabled); // @presenter Color
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
.tag-http-additional-operation {
|
|
317
|
+
--tag-color: #F97316; // @presenter Color
|
|
318
|
+
--tag-bg-color: #faede3; // @presenter Color
|
|
319
|
+
--tag-bg-color-hover: #fae2cf; // @presenter Color
|
|
320
|
+
}
|
|
321
|
+
|
|
316
322
|
.tag-send {
|
|
317
323
|
--tag-color: #4144F6; // @presenter Color
|
|
318
324
|
--tag-bg-color: #ECECFE; // @presenter Color
|
|
@@ -20,5 +20,6 @@ __exportStar(require("./code-walkthrough"), exports);
|
|
|
20
20
|
__exportStar(require("./search"), exports);
|
|
21
21
|
__exportStar(require("./catalog"), exports);
|
|
22
22
|
__exportStar(require("./breadcrumb"), exports);
|
|
23
|
+
__exportStar(require("./request-methods"), exports);
|
|
23
24
|
__exportStar(require("./mcp"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const REQUEST_METHODS: string[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUEST_METHODS = void 0;
|
|
4
|
+
exports.REQUEST_METHODS = [
|
|
5
|
+
'GET',
|
|
6
|
+
'POST',
|
|
7
|
+
'PUT',
|
|
8
|
+
'DELETE',
|
|
9
|
+
'PATCH',
|
|
10
|
+
'OPTIONS',
|
|
11
|
+
'HEAD',
|
|
12
|
+
'TRACE',
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=request-methods.js.map
|
|
@@ -11,6 +11,7 @@ export { useMount } from '../hooks/use-mount';
|
|
|
11
11
|
export { GlobalStyle } from '../styles/global';
|
|
12
12
|
export { breakpoints } from '../utils/media-css';
|
|
13
13
|
export { isPrimitive } from '../utils/args-typecheck';
|
|
14
|
+
export { getOperationColor } from '../utils/get-operation-color';
|
|
14
15
|
export { ClipboardService } from '../utils/clipboard-service';
|
|
15
16
|
export { getUserAgent } from '../utils/get-user-agent';
|
|
16
17
|
export { useFocusTrap } from '../hooks/use-focus-trap';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.ClipboardService = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.capitalize = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
3
|
+
exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.ClipboardService = exports.getOperationColor = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.capitalize = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
4
4
|
var dom_1 = require("../utils/dom");
|
|
5
5
|
Object.defineProperty(exports, "IS_BROWSER", { enumerable: true, get: function () { return dom_1.IS_BROWSER; } });
|
|
6
6
|
var urls_1 = require("../utils/urls");
|
|
@@ -22,6 +22,8 @@ var media_css_1 = require("../utils/media-css");
|
|
|
22
22
|
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return media_css_1.breakpoints; } });
|
|
23
23
|
var args_typecheck_1 = require("../utils/args-typecheck");
|
|
24
24
|
Object.defineProperty(exports, "isPrimitive", { enumerable: true, get: function () { return args_typecheck_1.isPrimitive; } });
|
|
25
|
+
var get_operation_color_1 = require("../utils/get-operation-color");
|
|
26
|
+
Object.defineProperty(exports, "getOperationColor", { enumerable: true, get: function () { return get_operation_color_1.getOperationColor; } });
|
|
25
27
|
var clipboard_service_1 = require("../utils/clipboard-service");
|
|
26
28
|
Object.defineProperty(exports, "ClipboardService", { enumerable: true, get: function () { return clipboard_service_1.ClipboardService; } });
|
|
27
29
|
var get_user_agent_1 = require("../utils/get-user-agent");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOperationColor = getOperationColor;
|
|
4
|
+
function getOperationColor({ deprecated, isAdditionalOperation, httpVerb, }) {
|
|
5
|
+
if (deprecated) {
|
|
6
|
+
return 'http-deprecated';
|
|
7
|
+
}
|
|
8
|
+
else if (isAdditionalOperation) {
|
|
9
|
+
return 'http-additional-operation';
|
|
10
|
+
}
|
|
11
|
+
return httpVerb;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=get-operation-color.js.map
|
package/lib/core/utils/index.js
CHANGED
|
@@ -55,5 +55,6 @@ __exportStar(require("./enhanced-smoothstep"), exports);
|
|
|
55
55
|
__exportStar(require("./icon-resolver"), exports);
|
|
56
56
|
__exportStar(require("./Dynamic"), exports);
|
|
57
57
|
__exportStar(require("./tabs"), exports);
|
|
58
|
+
__exportStar(require("./get-operation-color"), exports);
|
|
58
59
|
__exportStar(require("./frontmatter-translate"), exports);
|
|
59
60
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.60.0-next.
|
|
3
|
+
"version": "0.60.0-next.3",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"openapi-sampler": "1.6.2",
|
|
88
88
|
"react-calendar": "5.1.0",
|
|
89
89
|
"react-date-picker": "11.0.0",
|
|
90
|
-
"@redocly/config": "0.
|
|
90
|
+
"@redocly/config": "0.39.0",
|
|
91
91
|
"@redocly/realm-asyncapi-sdk": "0.6.0-next.0"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
@@ -11,7 +11,7 @@ import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDow
|
|
|
11
11
|
import { ChevronRightIcon } from '@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon';
|
|
12
12
|
import { HttpTag } from '@redocly/theme/components/Tags/HttpTag';
|
|
13
13
|
import { MenuItemType } from '@redocly/theme/core/constants';
|
|
14
|
-
import { getMenuItemType } from '@redocly/theme/core/utils';
|
|
14
|
+
import { getMenuItemType, getOperationColor } from '@redocly/theme/core/utils';
|
|
15
15
|
import { ArrowRightIcon } from '@redocly/theme/icons/ArrowRightIcon/ArrowRightIcon';
|
|
16
16
|
import { Badge } from '@redocly/theme/components/Badge/Badge';
|
|
17
17
|
import { GenericIcon } from '@redocly/theme/icons/GenericIcon/GenericIcon';
|
|
@@ -67,7 +67,11 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
|
|
|
67
67
|
)
|
|
68
68
|
) : null;
|
|
69
69
|
|
|
70
|
-
const httpColor =
|
|
70
|
+
const httpColor = getOperationColor({
|
|
71
|
+
isAdditionalOperation: item.isAdditionalOperation,
|
|
72
|
+
deprecated: item.deprecated,
|
|
73
|
+
httpVerb: item.httpVerb || '',
|
|
74
|
+
});
|
|
71
75
|
|
|
72
76
|
const label = item.label && (
|
|
73
77
|
<MenuItemLabelWrapper
|
|
@@ -4,6 +4,8 @@ import styled from 'styled-components';
|
|
|
4
4
|
import type { SearchFacet, SearchFacetCount } from '@redocly/theme/core/types';
|
|
5
5
|
|
|
6
6
|
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
7
|
+
import { getOperationColor } from '@redocly/theme/core/utils';
|
|
8
|
+
import { REQUEST_METHODS } from '@redocly/theme/core/constants';
|
|
7
9
|
|
|
8
10
|
type SearchFilterFieldTagsProps = {
|
|
9
11
|
className?: string;
|
|
@@ -32,11 +34,15 @@ export function SearchFilterFieldTags({
|
|
|
32
34
|
: [...selectedValues, value];
|
|
33
35
|
onChange(values);
|
|
34
36
|
};
|
|
37
|
+
const color = getOperationColor({
|
|
38
|
+
httpVerb: value,
|
|
39
|
+
isAdditionalOperation: !REQUEST_METHODS.includes(value.toUpperCase()),
|
|
40
|
+
});
|
|
35
41
|
return (
|
|
36
42
|
<FilterTagWrapper
|
|
37
43
|
key={`${count}-${index}`}
|
|
38
44
|
tabIndex={0}
|
|
39
|
-
color={
|
|
45
|
+
color={color}
|
|
40
46
|
onClick={() => {
|
|
41
47
|
updateSelectedValues();
|
|
42
48
|
}}
|
|
@@ -9,7 +9,7 @@ import { Link } from '@redocly/theme/components/Link/Link';
|
|
|
9
9
|
import { Image } from '@redocly/theme/components/Image/Image';
|
|
10
10
|
import { searchHighlight } from '@redocly/theme/components/Search/SearchHighlight';
|
|
11
11
|
import { Badge } from '@redocly/theme/components/Badge/Badge';
|
|
12
|
-
import { trimText } from '@redocly/theme/core/utils';
|
|
12
|
+
import { trimText, getOperationColor } from '@redocly/theme/core/utils';
|
|
13
13
|
import { ReturnKeyIcon } from '@redocly/theme/icons/ReturnKeyIcon/ReturnKeyIcon';
|
|
14
14
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
15
15
|
|
|
@@ -48,6 +48,11 @@ export function SearchItem({
|
|
|
48
48
|
highlight.parameters && highlight.parameters.length ? highlight.parameters[0] : null;
|
|
49
49
|
const shouldShowPath = document.path && document.path?.length > 1;
|
|
50
50
|
|
|
51
|
+
const httpColor = getOperationColor({
|
|
52
|
+
isAdditionalOperation: document.isAdditionalOperation,
|
|
53
|
+
httpVerb: document.httpMethod || '',
|
|
54
|
+
});
|
|
55
|
+
|
|
51
56
|
return (
|
|
52
57
|
<SearchItemWrapper
|
|
53
58
|
className={className}
|
|
@@ -77,7 +82,7 @@ export function SearchItem({
|
|
|
77
82
|
)}
|
|
78
83
|
{document.httpMethod ? (
|
|
79
84
|
<SearchItemOperation>
|
|
80
|
-
<SearchItemOperationTag color={
|
|
85
|
+
<SearchItemOperationTag color={httpColor}>
|
|
81
86
|
{document.httpMethod.toUpperCase()}
|
|
82
87
|
</SearchItemOperationTag>
|
|
83
88
|
{highlight.httpPath ? searchHighlight(highlight.httpPath) : document.httpPath}
|
|
@@ -12,7 +12,7 @@ type SubjectStatusColor = 'active' | 'draft' | 'deprecated' | 'product';
|
|
|
12
12
|
type HttpColor = 'get' | 'post' | 'put' | 'delete' | 'option' | 'patch' | 'head' | 'hook' | 'link';
|
|
13
13
|
type ActionColor = 'receive' | 'send';
|
|
14
14
|
type ChannelColor = 'channel';
|
|
15
|
-
type HttpStatusColor = 'http-deprecated';
|
|
15
|
+
type HttpStatusColor = 'http-deprecated' | 'http-additional-operation';
|
|
16
16
|
type StatusColor =
|
|
17
17
|
| DefaultStatusColor
|
|
18
18
|
| ActionStatusColor
|
|
@@ -230,6 +230,12 @@ export const tagDarkMode = css`
|
|
|
230
230
|
--tag-bg-color-hover: #373776; // @presenter Color
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
.tag-http-additional-operation {
|
|
234
|
+
--tag-color: #FCAB69; // @presenter Color
|
|
235
|
+
--tag-bg-color: #523926; // @presenter Color
|
|
236
|
+
--tag-bg-color-hover: #694830; // @presenter Color
|
|
237
|
+
}
|
|
238
|
+
|
|
233
239
|
.tag-receive {
|
|
234
240
|
--tag-color: #88CF82; // @presenter Color
|
|
235
241
|
--tag-bg-color: #23421F; // @presenter Color
|
|
@@ -311,6 +311,12 @@ export const tag = css`
|
|
|
311
311
|
--tag-color: var(--text-color-disabled); // @presenter Color
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
.tag-http-additional-operation {
|
|
315
|
+
--tag-color: #F97316; // @presenter Color
|
|
316
|
+
--tag-bg-color: #faede3; // @presenter Color
|
|
317
|
+
--tag-bg-color-hover: #fae2cf; // @presenter Color
|
|
318
|
+
}
|
|
319
|
+
|
|
314
320
|
.tag-send {
|
|
315
321
|
--tag-color: #4144F6; // @presenter Color
|
|
316
322
|
--tag-bg-color: #ECECFE; // @presenter Color
|
|
@@ -24,6 +24,7 @@ export { useMount } from '../hooks/use-mount';
|
|
|
24
24
|
export { GlobalStyle } from '../styles/global';
|
|
25
25
|
export { breakpoints } from '../utils/media-css';
|
|
26
26
|
export { isPrimitive } from '../utils/args-typecheck';
|
|
27
|
+
export { getOperationColor } from '../utils/get-operation-color';
|
|
27
28
|
export { ClipboardService } from '../utils/clipboard-service';
|
|
28
29
|
export { getUserAgent } from '../utils/get-user-agent';
|
|
29
30
|
export { useFocusTrap } from '../hooks/use-focus-trap';
|
package/src/core/types/search.ts
CHANGED
|
@@ -51,6 +51,7 @@ export type ItemState = Omit<SidebarNavItem, 'items'> & {
|
|
|
51
51
|
languageInsensitive?: boolean;
|
|
52
52
|
modified?: boolean; //item from openapi-docs sidebar
|
|
53
53
|
deprecated?: boolean; //item from openapi-docs sidebar
|
|
54
|
+
isAdditionalOperation?: boolean; //item from openapi-docs sidebar
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
export type DrilldownMenuItemDetails = {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type OperationColorProps = {
|
|
2
|
+
deprecated?: boolean;
|
|
3
|
+
isAdditionalOperation?: boolean;
|
|
4
|
+
httpVerb: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function getOperationColor({
|
|
8
|
+
deprecated,
|
|
9
|
+
isAdditionalOperation,
|
|
10
|
+
httpVerb,
|
|
11
|
+
}: OperationColorProps): string {
|
|
12
|
+
if (deprecated) {
|
|
13
|
+
return 'http-deprecated';
|
|
14
|
+
} else if (isAdditionalOperation) {
|
|
15
|
+
return 'http-additional-operation';
|
|
16
|
+
}
|
|
17
|
+
return httpVerb;
|
|
18
|
+
}
|