@redocly/theme 0.58.0-next.4 → 0.58.0-next.6
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/Catalog.d.ts +2 -2
- package/lib/components/Catalog/Catalog.js +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +15 -14
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +1 -1
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntityIcon.js +31 -14
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +19 -6
- package/lib/components/Catalog/CatalogEntityTypeTag.js +9 -3
- package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +1 -1
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/variables.js +9 -6
- package/lib/components/Tooltip/Tooltip.js +7 -9
- package/lib/components/Tooltip/TooltipWrapper.js +1 -1
- package/lib/core/constants/catalog.d.ts +1 -1
- package/lib/core/constants/catalog.js +9 -27
- package/lib/core/hooks/use-control.js +17 -2
- package/lib/core/openapi/index.d.ts +1 -1
- package/lib/core/openapi/index.js +3 -3
- package/lib/core/styles/global.js +19 -0
- package/lib/core/types/catalog.d.ts +1 -1
- package/lib/core/types/hooks.d.ts +2 -2
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/icons/HierarchyIcon/HierarchyIcon.d.ts +9 -0
- package/lib/icons/HierarchyIcon/HierarchyIcon.js +23 -0
- package/lib/icons/NoteIcon/NoteIcon.d.ts +9 -0
- package/lib/icons/NoteIcon/NoteIcon.js +24 -0
- package/lib/icons/ShareIcon/ShareIcon.d.ts +9 -0
- package/lib/icons/ShareIcon/ShareIcon.js +22 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +3 -3
- package/src/components/Catalog/Catalog.tsx +15 -5
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +20 -19
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +1 -1
- package/src/components/Catalog/CatalogEntityIcon.tsx +53 -18
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +19 -8
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +11 -3
- package/src/components/Catalog/CatalogSelector.tsx +1 -1
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
- package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
- package/src/components/Catalog/variables.ts +9 -6
- package/src/components/Tooltip/Tooltip.tsx +6 -8
- package/src/components/Tooltip/TooltipWrapper.tsx +1 -1
- package/src/core/constants/catalog.ts +9 -27
- package/src/core/hooks/use-control.ts +21 -3
- package/src/core/openapi/index.ts +1 -1
- package/src/core/styles/global.ts +19 -0
- package/src/core/types/catalog.ts +1 -2
- package/src/core/types/hooks.ts +6 -1
- package/src/core/types/l10n.ts +3 -0
- package/src/icons/HierarchyIcon/HierarchyIcon.tsx +32 -0
- package/src/icons/NoteIcon/NoteIcon.tsx +35 -0
- package/src/icons/ShareIcon/ShareIcon.tsx +23 -0
- package/src/index.ts +2 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { CatalogEntityConfig } from '@redocly/config';
|
|
3
|
-
import { BffCatalogEntityList } from '../../core/types';
|
|
4
|
-
import { CatalogSwitcherItem } from '../../core/types/catalog';
|
|
3
|
+
import { BffCatalogEntityList, CatalogSwitcherItem, CatalogViewMode } from '../../core/types';
|
|
5
4
|
export type CatalogProps = {
|
|
6
5
|
catalogConfig: CatalogEntityConfig;
|
|
7
6
|
entitiesTypes: string[];
|
|
8
7
|
initialEntitiesList?: BffCatalogEntityList;
|
|
9
8
|
catalogSwitcherItems: CatalogSwitcherItem[];
|
|
9
|
+
initialViewMode?: CatalogViewMode;
|
|
10
10
|
};
|
|
11
11
|
export declare function Catalog(props: CatalogProps): JSX.Element;
|
|
@@ -27,15 +27,15 @@ const customCatalogOptionsCasing = (str) => {
|
|
|
27
27
|
if (index === 0 && word.toLowerCase() === 'api') {
|
|
28
28
|
return 'API';
|
|
29
29
|
}
|
|
30
|
-
return word[0].toUpperCase() + word.slice(1)
|
|
30
|
+
return word[0].toUpperCase() + word.slice(1);
|
|
31
31
|
})
|
|
32
32
|
.join(' ');
|
|
33
33
|
};
|
|
34
34
|
function Catalog(props) {
|
|
35
|
-
const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems } = props;
|
|
35
|
+
const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems, initialViewMode, } = props;
|
|
36
36
|
const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
|
|
37
37
|
const { translate } = useTranslate();
|
|
38
|
-
const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(catalogConfig, (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0);
|
|
38
|
+
const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(catalogConfig, (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0, initialViewMode);
|
|
39
39
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
40
40
|
react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/Catalog" },
|
|
41
41
|
react_1.default.createElement(FiltersSidebar, { collapsed: collapsedSidebar, header: collapsedSidebar ? null : (react_1.default.createElement(CatalogSelector_1.CatalogSelector, { catalogSwitcherItems: catalogSwitcherItems, setSearchQuery: setSearchQuery, setSortOption: setSortOption })), menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setSearchQuery, filters: filters, filterTerm: searchQuery, hideSearch: true, showCounter: false, filterValuesCasing: customCatalogOptionsCasing }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
|
|
@@ -14,7 +14,6 @@ const ArrowUpRightIcon_1 = require("../../../icons/ArrowUpRightIcon/ArrowUpRight
|
|
|
14
14
|
const CatalogTagsWithTooltip_1 = require("../../../components/Catalog/CatalogTagsWithTooltip");
|
|
15
15
|
const CatalogEntityIcon_1 = require("../../../components/Catalog/CatalogEntityIcon");
|
|
16
16
|
const utils_1 = require("../../../core/utils");
|
|
17
|
-
const Tooltip_1 = require("../../../components/Tooltip/Tooltip");
|
|
18
17
|
function CatalogCard({ entity, catalogConfig }) {
|
|
19
18
|
var _a, _b, _c;
|
|
20
19
|
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
@@ -26,15 +25,15 @@ function CatalogCard({ entity, catalogConfig }) {
|
|
|
26
25
|
} },
|
|
27
26
|
react_1.default.createElement(CardContent, null,
|
|
28
27
|
react_1.default.createElement(CardHeader, null,
|
|
29
|
-
react_1.default.createElement(
|
|
30
|
-
react_1.default.createElement(
|
|
31
|
-
|
|
32
|
-
react_1.default.createElement(CardTitle, null,
|
|
33
|
-
react_1.default.createElement(CatalogHighlight_1.CatalogHighlight, null, entity.title))),
|
|
28
|
+
react_1.default.createElement(HeaderIconWrapper, null,
|
|
29
|
+
react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entity.type })),
|
|
30
|
+
react_1.default.createElement(HeaderIconText, { entityType: entity.type }, entity.type)),
|
|
34
31
|
react_1.default.createElement(CardDescription, null,
|
|
32
|
+
react_1.default.createElement(CardTitle, null,
|
|
33
|
+
react_1.default.createElement(CatalogHighlight_1.CatalogHighlight, null, entity.title)),
|
|
35
34
|
react_1.default.createElement(CatalogHighlight_1.CatalogHighlight, null, (_a = entity.summary) !== null && _a !== void 0 ? _a : '')),
|
|
36
35
|
react_1.default.createElement(CardMetadataSection, null,
|
|
37
|
-
react_1.default.createElement(
|
|
36
|
+
react_1.default.createElement(MetadataRow, null,
|
|
38
37
|
react_1.default.createElement(MetadataLabel, null, "Domains:"),
|
|
39
38
|
react_1.default.createElement(CatalogTagsWithTooltip_1.CatalogTagsWithTooltip, { items: ((_b = entity.domains) === null || _b === void 0 ? void 0 : _b.map((domain) => domain.title)) || [], tagProps: {
|
|
40
39
|
style: {
|
|
@@ -44,7 +43,7 @@ function CatalogCard({ entity, catalogConfig }) {
|
|
|
44
43
|
icon: react_1.default.createElement(GraphIcon_1.GraphIcon, { color: "var(--color-green-8)" }),
|
|
45
44
|
textTransform: 'none',
|
|
46
45
|
} })),
|
|
47
|
-
react_1.default.createElement(
|
|
46
|
+
react_1.default.createElement(MetadataRow, null,
|
|
48
47
|
react_1.default.createElement(MetadataLabel, null, "Owners:"),
|
|
49
48
|
react_1.default.createElement(CatalogTagsWithTooltip_1.CatalogTagsWithTooltip, { items: ((_c = entity.owners) === null || _c === void 0 ? void 0 : _c.map((owner) => owner.key)) || [], tagProps: {
|
|
50
49
|
style: {
|
|
@@ -81,6 +80,9 @@ const HeaderIconWrapper = styled_components_1.default.div `
|
|
|
81
80
|
border: var(--catalog-card-icon-border-width) solid var(--catalog-card-icon-border-color);
|
|
82
81
|
margin-right: var(--catalog-card-icon-margin-right);
|
|
83
82
|
`;
|
|
83
|
+
const HeaderIconText = styled_components_1.default.div `
|
|
84
|
+
color: ${({ entityType }) => `var(--catalog-entity-icon-color-${entityType})`};
|
|
85
|
+
`;
|
|
84
86
|
const CardHeader = styled_components_1.default.div `
|
|
85
87
|
display: flex;
|
|
86
88
|
align-items: center;
|
|
@@ -89,20 +91,20 @@ const MetadataLabel = styled_components_1.default.div `
|
|
|
89
91
|
font-size: var(--catalog-metadata-label-font-size);
|
|
90
92
|
font-weight: var(--catalog-metadata-label-font-weight);
|
|
91
93
|
color: var(--catalog-metadata-label-color);
|
|
92
|
-
margin-bottom: var(--catalog-metadata-label-margin-bottom);
|
|
93
94
|
`;
|
|
94
95
|
const CardMetadataSection = styled_components_1.default.div `
|
|
95
96
|
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
96
98
|
justify-content: space-between;
|
|
97
99
|
margin-top: var(--catalog-metadata-section-margin-top);
|
|
98
100
|
gap: var(--catalog-metadata-section-gap);
|
|
99
101
|
width: 100%;
|
|
100
102
|
`;
|
|
101
|
-
const
|
|
103
|
+
const MetadataRow = styled_components_1.default.div `
|
|
102
104
|
display: flex;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
gap: var(--catalog-metadata-row-gap);
|
|
106
108
|
`;
|
|
107
109
|
const ArrowCircle = styled_components_1.default.div `
|
|
108
110
|
width: var(--catalog-arrow-circle-size);
|
|
@@ -136,7 +138,6 @@ const Divider = styled_components_1.default.div `
|
|
|
136
138
|
background-color: var(--catalog-card-divider-color);
|
|
137
139
|
`;
|
|
138
140
|
const CatalogCardWrapper = styled_components_1.default.div `
|
|
139
|
-
height: var(--catalog-card-height);
|
|
140
141
|
color: var(--catalog-card-text-color);
|
|
141
142
|
font-size: var(--catalog-card-font-size);
|
|
142
143
|
font-weight: var(--catalog-card-font-weight);
|
|
@@ -26,7 +26,6 @@ function CatalogEntityLinks({ entity }) {
|
|
|
26
26
|
const LinksWrapper = styled_components_1.default.div `
|
|
27
27
|
display: flex;
|
|
28
28
|
flex-direction: column;
|
|
29
|
-
gap: var(--spacing-xs);
|
|
30
29
|
border-radius: var(--border-radius);
|
|
31
30
|
background-color: var(--catalog-metadata-bg-color);
|
|
32
31
|
transition: all 0.2s ease-in-out;
|
|
@@ -82,7 +82,6 @@ const JsonViewerWrapper = (0, styled_components_1.default)(JsonViewer_1.JsonView
|
|
|
82
82
|
const MetadataWrapper = styled_components_1.default.div `
|
|
83
83
|
display: flex;
|
|
84
84
|
flex-direction: column;
|
|
85
|
-
gap: var(--spacing-xs);
|
|
86
85
|
border-radius: var(--border-radius);
|
|
87
86
|
background-color: var(--catalog-metadata-bg-color);
|
|
88
87
|
transition: all 0.2s ease-in-out;
|
|
@@ -31,7 +31,6 @@ const PathLabel = styled_components_1.default.label `
|
|
|
31
31
|
const LinksWrapper = styled_components_1.default.div `
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
|
-
gap: var(--spacing-xs);
|
|
35
34
|
border-radius: var(--border-radius);
|
|
36
35
|
background-color: var(--catalog-metadata-bg-color);
|
|
37
36
|
transition: all 0.2s ease-in-out;
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js
CHANGED
|
@@ -45,7 +45,7 @@ const CardHeader = styled_components_1.default.div `
|
|
|
45
45
|
const CardContent = styled_components_1.default.div `
|
|
46
46
|
flex: 1;
|
|
47
47
|
display: flex;
|
|
48
|
-
align-items:
|
|
48
|
+
align-items: flex-end;
|
|
49
49
|
gap: var(--catalog-card-content-gap);
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
color: var(--text-color-primary);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
+
import { UiAccessibleConfig } from '@redocly/config';
|
|
2
3
|
export type CatalogEntityIconProps = {
|
|
3
4
|
entityType: string;
|
|
4
5
|
defaultColor?: boolean;
|
|
5
6
|
forceColor?: string;
|
|
7
|
+
entitiesCatalogConfig?: UiAccessibleConfig['entitiesCatalog'];
|
|
6
8
|
};
|
|
7
9
|
export declare function CatalogEntityIcon({ entityType, defaultColor, forceColor, }: CatalogEntityIconProps): JSX.Element;
|
|
@@ -9,24 +9,41 @@ const CodeIcon_1 = require("../../icons/CodeIcon/CodeIcon");
|
|
|
9
9
|
const GraphIcon_1 = require("../../icons/GraphIcon/GraphIcon");
|
|
10
10
|
const PeopleIcon_1 = require("../../icons/PeopleIcon/PeopleIcon");
|
|
11
11
|
const UserIcon_1 = require("../../icons/UserIcon/UserIcon");
|
|
12
|
-
const NetworkIcon_1 = require("../../icons/NetworkIcon/NetworkIcon");
|
|
13
12
|
const MoleculesIcon_1 = require("../../icons/MoleculesIcon/MoleculesIcon");
|
|
13
|
+
const HierarchyIcon_1 = require("../../icons/HierarchyIcon/HierarchyIcon");
|
|
14
|
+
const Image_1 = require("../../components/Image/Image");
|
|
15
|
+
const core_1 = require("../../core");
|
|
16
|
+
const NoteIcon_1 = require("../../icons/NoteIcon/NoteIcon");
|
|
14
17
|
const getIconColor = (entityType) => `var(--catalog-entity-icon-color-${entityType})`;
|
|
15
|
-
const getEntityIcon = ({ entityType, defaultColor, forceColor }) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogConfig, }) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
if (core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)) {
|
|
21
|
+
const iconColor = forceColor !== null && forceColor !== void 0 ? forceColor : (defaultColor ? `var(--catalog-entity-icon-color)` : getIconColor(entityType));
|
|
22
|
+
const entityIconMap = {
|
|
23
|
+
service: react_1.default.createElement(CodeIcon_1.CodeIcon, { color: iconColor }),
|
|
24
|
+
domain: react_1.default.createElement(GraphIcon_1.GraphIcon, { color: iconColor }),
|
|
25
|
+
team: react_1.default.createElement(PeopleIcon_1.PeopleIcon, { color: iconColor }),
|
|
26
|
+
user: react_1.default.createElement(UserIcon_1.UserIcon, { color: iconColor }),
|
|
27
|
+
'api-description': react_1.default.createElement(NoteIcon_1.NoteIcon, { color: iconColor }),
|
|
28
|
+
'data-schema': react_1.default.createElement(HierarchyIcon_1.HierarchyIcon, { color: iconColor }),
|
|
29
|
+
'api-operation': react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, { color: iconColor }),
|
|
30
|
+
};
|
|
31
|
+
return entityIconMap[entityType];
|
|
32
|
+
}
|
|
33
|
+
const iconConfig = (_b = (_a = entitiesCatalogConfig === null || entitiesCatalogConfig === void 0 ? void 0 : entitiesCatalogConfig.entityTypes) === null || _a === void 0 ? void 0 : _a[entityType]) === null || _b === void 0 ? void 0 : _b.icon;
|
|
34
|
+
if ((iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src) || (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet)) {
|
|
35
|
+
return (react_1.default.createElement(Image_1.Image, { src: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src, srcSet: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet, alt: `${entityType} icon`, width: "16", height: "16" }));
|
|
36
|
+
}
|
|
37
|
+
return react_1.default.createElement(CodeIcon_1.CodeIcon, { color: "var(--catalog-entity-icon-color)" }); // @TODO: add default icon
|
|
27
38
|
};
|
|
28
39
|
function CatalogEntityIcon({ entityType, defaultColor = false, forceColor, }) {
|
|
29
|
-
const
|
|
40
|
+
const themeConfig = (0, core_1.useThemeConfig)();
|
|
41
|
+
const icon = getEntityIcon({
|
|
42
|
+
entityType,
|
|
43
|
+
defaultColor,
|
|
44
|
+
forceColor,
|
|
45
|
+
entitiesCatalogConfig: themeConfig.entitiesCatalog,
|
|
46
|
+
});
|
|
30
47
|
if (!icon) {
|
|
31
48
|
throw new Error(`Unhandled entity type: ${entityType}`);
|
|
32
49
|
}
|
|
@@ -7,6 +7,7 @@ exports.CatalogEntityTypeIcon = CatalogEntityTypeIcon;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const CatalogEntityIcon_1 = require("../../components/Catalog/CatalogEntityIcon");
|
|
10
|
+
const core_1 = require("../../core");
|
|
10
11
|
function CatalogEntityTypeIcon({ entityType, defaultColor = false, }) {
|
|
11
12
|
return (react_1.default.createElement(IconContainer, { "data-component-name": "Catalog/CatalogEntityTypeIcon", entityType: entityType, defaultColor: defaultColor },
|
|
12
13
|
react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entityType, defaultColor: defaultColor })));
|
|
@@ -18,13 +19,25 @@ const IconContainer = styled_components_1.default.div `
|
|
|
18
19
|
width: var(--catalog-table-icon-width);
|
|
19
20
|
height: var(--catalog-table-icon-height);
|
|
20
21
|
border-radius: var(--catalog-table-icon-border-radius);
|
|
21
|
-
background-color: ${({ defaultColor, entityType }) =>
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
background-color: ${({ defaultColor, entityType }) => {
|
|
23
|
+
if (defaultColor) {
|
|
24
|
+
return 'var(--catalog-entity-bg-color)';
|
|
25
|
+
}
|
|
26
|
+
if (core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)) {
|
|
27
|
+
return `var(--catalog-entity-bg-color-${entityType})`;
|
|
28
|
+
}
|
|
29
|
+
return 'var(--catalog-entity-bg-color-custom)';
|
|
30
|
+
}};
|
|
24
31
|
flex-shrink: 0;
|
|
25
32
|
border: 1px solid
|
|
26
|
-
${({ defaultColor, entityType }) =>
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
${({ defaultColor, entityType }) => {
|
|
34
|
+
if (defaultColor) {
|
|
35
|
+
return 'var(--catalog-entity-border-color)';
|
|
36
|
+
}
|
|
37
|
+
if (core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)) {
|
|
38
|
+
return `var(--catalog-entity-border-color-${entityType})`;
|
|
39
|
+
}
|
|
40
|
+
return 'var(--catalog-entity-border-color-custom)';
|
|
41
|
+
}};
|
|
29
42
|
`;
|
|
30
43
|
//# sourceMappingURL=CatalogEntityTypeIcon.js.map
|
|
@@ -9,6 +9,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
9
9
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
10
|
const Tag_1 = require("../../components/Tag/Tag");
|
|
11
11
|
const CatalogHighlight_1 = require("../../components/Catalog/CatalogHighlight");
|
|
12
|
+
const core_1 = require("../../core");
|
|
12
13
|
const entityTagColorMap = {
|
|
13
14
|
service: 'blue',
|
|
14
15
|
domain: 'grass',
|
|
@@ -33,8 +34,13 @@ function CatalogEntityTypeTag({ entityType }) {
|
|
|
33
34
|
const EntityTypeTagWrapper = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
34
35
|
font-size: var(--font-size-base);
|
|
35
36
|
background-color: transparent;
|
|
36
|
-
text-transform:
|
|
37
|
-
border: 1px solid
|
|
38
|
-
|
|
37
|
+
text-transform: none;
|
|
38
|
+
border: 1px solid
|
|
39
|
+
${({ entityType }) => !core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)
|
|
40
|
+
? 'var(--catalog-entity-border-color-custom)'
|
|
41
|
+
: `var(--catalog-entity-border-color-${entityType})`};
|
|
42
|
+
color: ${({ entityType }) => !core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)
|
|
43
|
+
? 'var(--catalog-entity-icon-color-custom)'
|
|
44
|
+
: `var(--catalog-entity-icon-color-${entityType})`};
|
|
39
45
|
`;
|
|
40
46
|
//# sourceMappingURL=CatalogEntityTypeTag.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { Select } from '../../components/Select/Select';
|
|
3
|
-
import { CatalogSwitcherItem, SortOption } from '../../core/types
|
|
3
|
+
import { CatalogSwitcherItem, SortOption } from '../../core/types';
|
|
4
4
|
export type CatalogSelectorProps = {
|
|
5
5
|
catalogSwitcherItems: CatalogSwitcherItem[];
|
|
6
6
|
setSearchQuery: (query: string) => void;
|
|
@@ -10,7 +10,7 @@ const CatalogHighlight_1 = require("../../../components/Catalog/CatalogHighlight
|
|
|
10
10
|
const CatalogEntityTypeIcon_1 = require("../../../components/Catalog/CatalogEntityTypeIcon");
|
|
11
11
|
function CatalogEntityCell({ entity }) {
|
|
12
12
|
return (react_1.default.createElement(EntityTitleCellWrapper, { "data-component-name": "Catalog/CatalogTableView/CatalogEntityCell" },
|
|
13
|
-
react_1.default.createElement(CatalogEntityTypeIcon_1.CatalogEntityTypeIcon, { entityType: entity.type
|
|
13
|
+
react_1.default.createElement(CatalogEntityTypeIcon_1.CatalogEntityTypeIcon, { entityType: entity.type }),
|
|
14
14
|
react_1.default.createElement(EntityTitleContent, null,
|
|
15
15
|
react_1.default.createElement(EntityTitle, { "data-component-name": "Catalog/CatalogTableView/CatalogEntityTitle" },
|
|
16
16
|
react_1.default.createElement(CatalogHighlight_1.CatalogHighlight, null, entity.title)),
|
|
@@ -132,10 +132,14 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
132
132
|
--catalog-entity-border-color-api-operation: var(--color-raspberry-3);
|
|
133
133
|
--catalog-entity-bg-color-api-operation: var(--color-raspberry-1);
|
|
134
134
|
|
|
135
|
+
--catalog-entity-icon-color-custom: var(--color-persian-green-8);
|
|
136
|
+
--catalog-entity-border-color-custom: var(--color-persian-green-5);
|
|
137
|
+
--catalog-entity-bg-color-custom: var(--color-persian-green-1);
|
|
138
|
+
|
|
135
139
|
/**
|
|
136
140
|
* @tokens Catalog tags
|
|
137
141
|
*/
|
|
138
|
-
--catalog-tags-wrapper-gap:
|
|
142
|
+
--catalog-tags-wrapper-gap: var(--spacing-xs) calc(var(--spacing-xs) - 5px);
|
|
139
143
|
--catalog-tags-more-button-font-size: var(--font-size-base);
|
|
140
144
|
--catalog-tags-more-button-margin-left: 4px;
|
|
141
145
|
--catalog-tags-placeholder-bg-color: var(--bg-color);
|
|
@@ -195,7 +199,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
195
199
|
*/
|
|
196
200
|
--catalog-card-height: 241px;
|
|
197
201
|
--catalog-card-min-width: 400px;
|
|
198
|
-
--catalog-card-padding-vertical: var(--spacing-
|
|
202
|
+
--catalog-card-padding-vertical: var(--spacing-base);
|
|
199
203
|
--catalog-card-padding-horizontal: var(--spacing-md);
|
|
200
204
|
--catalog-card-gap: var(--spacing-sm);
|
|
201
205
|
--catalog-card-text-color: var(--text-color-secondary);
|
|
@@ -225,12 +229,11 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
225
229
|
/**
|
|
226
230
|
* @tokens Catalog metadata
|
|
227
231
|
*/
|
|
228
|
-
--catalog-metadata-section-margin-top: var(--spacing-
|
|
229
|
-
--catalog-metadata-section-gap: var(--spacing-
|
|
232
|
+
--catalog-metadata-section-margin-top: var(--spacing-base);
|
|
233
|
+
--catalog-metadata-section-gap: var(--spacing-xs);
|
|
230
234
|
--catalog-metadata-label-font-size: var(--font-size-base);
|
|
231
235
|
--catalog-metadata-label-font-weight: var(--font-weight-medium);
|
|
232
236
|
--catalog-metadata-label-color: var(--text-color-secondary);
|
|
233
|
-
--catalog-metadata-label-margin-bottom: var(--spacing-unit);
|
|
234
237
|
--catalog-metadata-column-half-gap: var(--spacing-sm);
|
|
235
238
|
--catalog-metadata-heading-size: var(--font-size-md);
|
|
236
239
|
|
|
@@ -265,7 +268,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
265
268
|
--catalog-card-description-line-height: var(--line-height-base);
|
|
266
269
|
--catalog-card-description-font-weight: var(--font-weight-regular);
|
|
267
270
|
--catalog-card-description-height: 62px;
|
|
268
|
-
--catalog-card-description-margin-top:
|
|
271
|
+
--catalog-card-description-margin-top: 8px;
|
|
269
272
|
|
|
270
273
|
--catalog-card-content-gap: var(--spacing-xs);
|
|
271
274
|
--catalog-card-content-gap-vertical: var(--spacing-sm);
|
|
@@ -91,15 +91,13 @@ function TooltipComponent({ children, isOpen, tip, withArrow = true, placement =
|
|
|
91
91
|
}
|
|
92
92
|
}, [isOpened, placement, updateTooltipPosition]);
|
|
93
93
|
(0, react_1.useEffect)(() => {
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
handleClose();
|
|
100
|
-
}
|
|
94
|
+
if (isOpen && !disabled) {
|
|
95
|
+
handleOpen();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
handleClose();
|
|
101
99
|
}
|
|
102
|
-
}, [isOpen,
|
|
100
|
+
}, [isOpen, handleOpen, handleClose, disabled]);
|
|
103
101
|
const controllers = !isControlled &&
|
|
104
102
|
!disabled && {
|
|
105
103
|
onMouseEnter: handleOpen,
|
|
@@ -228,7 +226,7 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
228
226
|
display: inline-block;
|
|
229
227
|
|
|
230
228
|
padding: var(--tooltip-padding);
|
|
231
|
-
max-width: var(--tooltip-max-width);
|
|
229
|
+
max-width: ${({ width }) => width || 'var(--tooltip-max-width)'};
|
|
232
230
|
white-space: normal;
|
|
233
231
|
word-break: normal;
|
|
234
232
|
overflow-wrap: break-word;
|
|
@@ -9,7 +9,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
9
9
|
const hooks_1 = require("../../core/hooks");
|
|
10
10
|
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
11
11
|
function TooltipWrapper({ children, tip, placement = 'top', width = 'max-content', className = '', showOnHover = true, disabled = false, }) {
|
|
12
|
-
const tooltip = (0, hooks_1.useControl)();
|
|
12
|
+
const tooltip = (0, hooks_1.useControl)(false);
|
|
13
13
|
const handleMouseEnter = () => {
|
|
14
14
|
if (showOnHover && !disabled) {
|
|
15
15
|
tooltip.handleOpen();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EntityRelationType } from '../types/catalog';
|
|
2
2
|
export declare const CATALOG_TAG_MAX_LENGTH = 15;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const PREDEFINED_ENTITY_TYPES: string[];
|
|
4
4
|
export declare const reverseRelationMap: Record<EntityRelationType, EntityRelationType>;
|
|
5
5
|
export declare const relationTypeMap: Record<EntityRelationType, string>;
|
|
6
6
|
export declare enum GraphHandleType {
|
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GraphCustomEdgeType = exports.GraphCustomNodeType = exports.GraphHandleType = exports.relationTypeMap = exports.reverseRelationMap = exports.
|
|
3
|
+
exports.GraphCustomEdgeType = exports.GraphCustomNodeType = exports.GraphHandleType = exports.relationTypeMap = exports.reverseRelationMap = exports.PREDEFINED_ENTITY_TYPES = exports.CATALOG_TAG_MAX_LENGTH = void 0;
|
|
4
4
|
exports.CATALOG_TAG_MAX_LENGTH = 15;
|
|
5
|
-
exports.
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'implementedBy',
|
|
14
|
-
'dependsOn',
|
|
15
|
-
'dependencyOf',
|
|
16
|
-
'uses',
|
|
17
|
-
'usedBy',
|
|
18
|
-
'produces',
|
|
19
|
-
'consumes',
|
|
20
|
-
'linksTo',
|
|
21
|
-
'supersedes',
|
|
22
|
-
'supersededBy',
|
|
23
|
-
'compatibleWith',
|
|
24
|
-
'extends',
|
|
25
|
-
'extendedBy',
|
|
26
|
-
'relatesTo',
|
|
27
|
-
'hasMember',
|
|
28
|
-
'memberOf',
|
|
29
|
-
'triggers',
|
|
30
|
-
'triggeredBy',
|
|
5
|
+
exports.PREDEFINED_ENTITY_TYPES = [
|
|
6
|
+
'service',
|
|
7
|
+
'domain',
|
|
8
|
+
'team',
|
|
9
|
+
'user',
|
|
10
|
+
'api-description',
|
|
11
|
+
'data-schema',
|
|
12
|
+
'api-operation',
|
|
31
13
|
];
|
|
32
14
|
exports.reverseRelationMap = {
|
|
33
15
|
partOf: 'hasParts',
|
|
@@ -2,10 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useControl = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const DEFAULT_CONTROL_OPEN_DELAY = 300;
|
|
5
6
|
const useControl = (initialVal = false) => {
|
|
6
7
|
const [isOpened, setIsOpened] = (0, react_1.useState)(initialVal);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
8
|
+
const timeoutRef = (0, react_1.useRef)(null);
|
|
9
|
+
const clearOpenTimer = (0, react_1.useCallback)(() => {
|
|
10
|
+
if (timeoutRef.current) {
|
|
11
|
+
clearTimeout(timeoutRef.current);
|
|
12
|
+
}
|
|
13
|
+
}, []);
|
|
14
|
+
const handleOpen = (0, react_1.useCallback)(() => {
|
|
15
|
+
clearOpenTimer();
|
|
16
|
+
timeoutRef.current = setTimeout(() => {
|
|
17
|
+
setIsOpened(true);
|
|
18
|
+
}, DEFAULT_CONTROL_OPEN_DELAY);
|
|
19
|
+
}, [clearOpenTimer]);
|
|
20
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
21
|
+
clearOpenTimer();
|
|
22
|
+
setIsOpened(false);
|
|
23
|
+
}, [clearOpenTimer]);
|
|
9
24
|
return {
|
|
10
25
|
isOpened,
|
|
11
26
|
handleOpen,
|
|
@@ -9,6 +9,7 @@ export { useMount } from '../hooks/use-mount';
|
|
|
9
9
|
export { GlobalStyle } from '../styles/global';
|
|
10
10
|
export { breakpoints } from '../utils/media-css';
|
|
11
11
|
export { isPrimitive } from '../utils/args-typecheck';
|
|
12
|
+
export { ClipboardService } from '../utils/clipboard-service';
|
|
12
13
|
export { getUserAgent } from '../utils/get-user-agent';
|
|
13
14
|
export { useFocusTrap } from '../hooks/use-focus-trap';
|
|
14
15
|
export { useThemeHooks } from '../hooks/use-theme-hooks';
|
|
@@ -20,4 +21,3 @@ export { useDialogHotKeys } from '../hooks/use-dialog-hotkeys';
|
|
|
20
21
|
export { SecurityVariablesEnvSuffix } from '../constants/environments';
|
|
21
22
|
export { isUndefined, isString, isNotNull, isObject } from '../utils/type-guards';
|
|
22
23
|
export { ThemeDataContext, type ThemeDataTransferObject } from '../contexts/ThemeDataContext';
|
|
23
|
-
export { ENTITY_RELATION_TYPES } from '../constants/catalog';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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.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");
|
|
@@ -20,6 +20,8 @@ var media_css_1 = require("../utils/media-css");
|
|
|
20
20
|
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return media_css_1.breakpoints; } });
|
|
21
21
|
var args_typecheck_1 = require("../utils/args-typecheck");
|
|
22
22
|
Object.defineProperty(exports, "isPrimitive", { enumerable: true, get: function () { return args_typecheck_1.isPrimitive; } });
|
|
23
|
+
var clipboard_service_1 = require("../utils/clipboard-service");
|
|
24
|
+
Object.defineProperty(exports, "ClipboardService", { enumerable: true, get: function () { return clipboard_service_1.ClipboardService; } });
|
|
23
25
|
var get_user_agent_1 = require("../utils/get-user-agent");
|
|
24
26
|
Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return get_user_agent_1.getUserAgent; } });
|
|
25
27
|
var use_focus_trap_1 = require("../hooks/use-focus-trap");
|
|
@@ -45,6 +47,4 @@ Object.defineProperty(exports, "isNotNull", { enumerable: true, get: function ()
|
|
|
45
47
|
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return type_guards_1.isObject; } });
|
|
46
48
|
var ThemeDataContext_1 = require("../contexts/ThemeDataContext");
|
|
47
49
|
Object.defineProperty(exports, "ThemeDataContext", { enumerable: true, get: function () { return ThemeDataContext_1.ThemeDataContext; } });
|
|
48
|
-
var catalog_1 = require("../constants/catalog");
|
|
49
|
-
Object.defineProperty(exports, "ENTITY_RELATION_TYPES", { enumerable: true, get: function () { return catalog_1.ENTITY_RELATION_TYPES; } });
|
|
50
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -773,6 +773,25 @@ const apiReferenceDocs = (0, styled_components_1.css) `
|
|
|
773
773
|
--fab-icon-color: var(--navbar-text-color); // @presenter Color
|
|
774
774
|
|
|
775
775
|
// @tokens End
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* @tokens OpenAPI Schema Catalog Link
|
|
779
|
+
*/
|
|
780
|
+
|
|
781
|
+
--schema-catalog-link-margin-bottom: var(--spacing-lg);
|
|
782
|
+
--schema-catalog-link-padding: 2px;
|
|
783
|
+
--schema-catalog-link-border-radius: var(--border-radius-md);
|
|
784
|
+
--schema-catalog-link-background-color: var(--layer-color);
|
|
785
|
+
--schema-catalog-link-color: var(--color-purple-7);
|
|
786
|
+
|
|
787
|
+
--schema-catalog-link-share-icon-color: var(--color-purple-7);
|
|
788
|
+
--schema-catalog-link-share-icon-background-color: var(--color-purple-1);
|
|
789
|
+
--schema-catalog-link-share-icon-border-radius: var(--border-radius-md);
|
|
790
|
+
--schema-catalog-link-share-icon-wrapper-size: var(--spacing-xl);
|
|
791
|
+
|
|
792
|
+
--schema-catalog-link-text-color: var(--text-color-primary);
|
|
793
|
+
|
|
794
|
+
// @tokens End
|
|
776
795
|
`;
|
|
777
796
|
const badges = (0, styled_components_1.css) `
|
|
778
797
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { CatalogEntityConfig, LayoutVariant } from '@redocly/config';
|
|
3
|
+
import { ENTITY_RELATION_TYPES } from '@redocly/config';
|
|
3
4
|
import type { CatalogFilterConfig } from '../../config';
|
|
4
|
-
import { ENTITY_RELATION_TYPES } from '../constants/catalog';
|
|
5
5
|
export type SortOption = 'title' | '-title' | 'type' | '-type';
|
|
6
6
|
export type UseCatalogResponse = {
|
|
7
7
|
filters: ResolvedFilter[];
|
|
@@ -4,7 +4,7 @@ import type { ShikiTransformer } from '@shikijs/types';
|
|
|
4
4
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
5
5
|
import type { To, Location, NavigateFunction } from 'react-router-dom';
|
|
6
6
|
import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
7
|
-
import type { UseCatalogResponse, CatalogApiResults, CatalogApiParams, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse } from './catalog';
|
|
7
|
+
import type { UseCatalogResponse, CatalogApiResults, CatalogApiParams, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, CatalogViewMode } from './catalog';
|
|
8
8
|
import type { UserMenuData } from './user-menu';
|
|
9
9
|
import type { ItemState } from './sidebar';
|
|
10
10
|
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
|
|
@@ -112,7 +112,7 @@ export type ThemeHooks = {
|
|
|
112
112
|
prevPage?: ResolvedNavItemWithLink;
|
|
113
113
|
nextPage?: ResolvedNavItemWithLink;
|
|
114
114
|
} | undefined;
|
|
115
|
-
useCatalog: (config?: CatalogEntityConfig, entitiesCounterInitial?: number) => UseCatalogResponse;
|
|
115
|
+
useCatalog: (config?: CatalogEntityConfig, entitiesCounterInitial?: number, initialViewMode?: CatalogViewMode) => UseCatalogResponse;
|
|
116
116
|
useCatalogSort: () => UseCatalogSortResponse;
|
|
117
117
|
useCatalogSearch: () => UseCatalogSearchResponse;
|
|
118
118
|
useFetchCatalogEntities: (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity, BffCatalogEntityList>;
|