@redocly/theme 0.58.0-next.1 → 0.58.0-next.11
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 +6 -4
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +15 -14
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +4 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +3 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +9 -7
- 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/CatalogClassic/CatalogClassic.js +9 -2
- package/lib/components/CodeBlock/CodeBlock.d.ts +5 -12
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +3 -3
- package/lib/components/CodeBlock/CodeBlockControls.js +1 -1
- package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockDropdown.js +4 -13
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockTabs.js +4 -3
- package/lib/components/JsonViewer/JsonViewer.d.ts +1 -1
- package/lib/components/JsonViewer/JsonViewer.js +9 -10
- package/lib/components/PageActions/PageActions.d.ts +4 -1
- package/lib/components/PageActions/PageActions.js +2 -2
- package/lib/components/Search/SearchDialog.js +12 -6
- package/lib/components/Search/SearchFilter.js +2 -1
- 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 +13 -27
- package/lib/core/contexts/CodeSnippetContext.d.ts +14 -6
- package/lib/core/contexts/CodeSnippetContext.js +57 -14
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +1 -1
- package/lib/core/hooks/use-active-section-id.js +4 -0
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
- package/lib/core/hooks/use-control.js +17 -2
- package/lib/core/hooks/use-local-state.js +22 -18
- package/lib/core/hooks/use-page-actions.d.ts +2 -1
- package/lib/core/hooks/use-page-actions.js +48 -6
- package/lib/core/hooks/use-telemetry-fallback.d.ts +5 -0
- package/lib/core/hooks/use-telemetry-fallback.js +5 -0
- package/lib/core/openapi/index.d.ts +9 -4
- package/lib/core/openapi/index.js +11 -9
- 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/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/open-api-info.d.ts +34 -0
- package/lib/core/types/open-api-info.js +3 -0
- package/lib/core/types/open-api-server.d.ts +1 -0
- package/lib/core/types/search.d.ts +2 -3
- package/lib/core/utils/urls.js +1 -1
- package/lib/ext/useConfigureReplay.d.ts +2 -1
- package/lib/icons/CursorIcon/CursorIcon.d.ts +9 -0
- package/lib/icons/CursorIcon/CursorIcon.js +22 -0
- 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/lib/layouts/DocumentationLayout.js +1 -3
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +49 -27
- package/lib/markdoc/components/Tabs/TabList.js +2 -0
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +3 -2
- package/package.json +4 -4
- package/src/components/Catalog/Catalog.tsx +18 -6
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +20 -19
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +15 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +3 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +27 -18
- 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/CatalogClassic/CatalogClassic.tsx +26 -10
- package/src/components/CodeBlock/CodeBlock.tsx +5 -11
- package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
- package/src/components/CodeBlock/CodeBlockDropdown.tsx +11 -20
- package/src/components/CodeBlock/CodeBlockTabs.tsx +8 -8
- package/src/components/JsonViewer/JsonViewer.tsx +16 -9
- package/src/components/PageActions/PageActions.tsx +6 -4
- package/src/components/Search/SearchDialog.tsx +14 -5
- package/src/components/Search/SearchFilter.tsx +2 -1
- package/src/components/Tooltip/Tooltip.tsx +6 -8
- package/src/components/Tooltip/TooltipWrapper.tsx +1 -1
- package/src/core/constants/catalog.ts +13 -27
- package/src/core/contexts/CodeSnippetContext.tsx +54 -18
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
- package/src/core/hooks/use-active-section-id.ts +6 -0
- package/src/core/hooks/use-codeblock-tabs-controls.ts +2 -2
- package/src/core/hooks/use-control.ts +21 -3
- package/src/core/hooks/use-local-state.ts +28 -19
- package/src/core/hooks/use-page-actions.ts +63 -6
- package/src/core/hooks/use-telemetry-fallback.ts +5 -0
- package/src/core/openapi/index.ts +9 -4
- 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/index.ts +1 -0
- package/src/core/types/l10n.ts +16 -0
- package/src/core/types/open-api-info.ts +34 -0
- package/src/core/types/open-api-server.ts +1 -0
- package/src/core/types/search.ts +3 -3
- package/src/core/utils/urls.ts +2 -1
- package/src/ext/useConfigureReplay.ts +2 -1
- package/src/icons/CursorIcon/CursorIcon.tsx +35 -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
- package/src/layouts/DocumentationLayout.tsx +3 -10
- package/src/markdoc/components/CodeGroup/CodeGroup.tsx +81 -52
- package/src/markdoc/components/Tabs/TabList.tsx +1 -0
- package/src/markdoc/components/Tabs/Tabs.tsx +10 -2
|
@@ -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 }) }),
|
|
@@ -43,7 +43,9 @@ function Catalog(props) {
|
|
|
43
43
|
react_1.default.createElement(CatalogPageDescription, null,
|
|
44
44
|
react_1.default.createElement(CatalogTitleWrapper, null,
|
|
45
45
|
react_1.default.createElement(CatalogTitle, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey },
|
|
46
|
-
|
|
46
|
+
(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey)
|
|
47
|
+
? translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey)
|
|
48
|
+
: catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.slug,
|
|
47
49
|
' '),
|
|
48
50
|
react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, entitiesCounter)),
|
|
49
51
|
react_1.default.createElement(CatalogDescription, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey }, translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey))),
|
|
@@ -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);
|
|
@@ -2,5 +2,9 @@ import React from 'react';
|
|
|
2
2
|
export type CatalogEntityProps = {
|
|
3
3
|
RedocSchema: React.ComponentType<any>;
|
|
4
4
|
StoreProvider: React.ComponentType<any>;
|
|
5
|
+
GraphqlTypeRenderer?: React.ComponentType<{
|
|
6
|
+
sdl: string;
|
|
7
|
+
typeName: string;
|
|
8
|
+
}>;
|
|
5
9
|
};
|
|
6
|
-
export declare function CatalogEntity({ RedocSchema, StoreProvider }: CatalogEntityProps): React.JSX.Element;
|
|
10
|
+
export declare function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntityProps): React.JSX.Element;
|
|
@@ -26,13 +26,13 @@ const renderFirstColumnEntitySection = (entity) => {
|
|
|
26
26
|
return react_1.default.createElement(CatalogEntityMetadata_1.CatalogEntityMetadata, { entity: entity });
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const renderDataSchemaSection = (entity, relatedEntity, RedocSchema, StoreProvider) => {
|
|
29
|
+
const renderDataSchemaSection = (entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer) => {
|
|
30
30
|
if (entity.type !== 'data-schema') {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, RedocSchema: RedocSchema, StoreProvider: StoreProvider }));
|
|
33
|
+
return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, RedocSchema: RedocSchema, StoreProvider: StoreProvider, GraphqlTypeRenderer: GraphqlTypeRenderer }));
|
|
34
34
|
};
|
|
35
|
-
function CatalogEntity({ RedocSchema, StoreProvider }) {
|
|
35
|
+
function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
36
36
|
var _a;
|
|
37
37
|
const { useTranslate, useCatalog, usePageProps } = (0, hooks_1.useThemeHooks)();
|
|
38
38
|
const { translate } = useTranslate();
|
|
@@ -52,7 +52,7 @@ function CatalogEntity({ RedocSchema, StoreProvider }) {
|
|
|
52
52
|
react_1.default.createElement(react_router_dom_1.Route, { index: true, element: react_1.default.createElement(react_1.default.Fragment, null,
|
|
53
53
|
react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
|
|
54
54
|
react_1.default.createElement(CatalogEntityProperties_1.CatalogEntityProperties, { entity: entity }),
|
|
55
|
-
renderDataSchemaSection(entity, relatedEntity, RedocSchema, StoreProvider),
|
|
55
|
+
renderDataSchemaSection(entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer),
|
|
56
56
|
react_1.default.createElement(CatalogTwoColumnsSection, null,
|
|
57
57
|
renderFirstColumnEntitySection(entity),
|
|
58
58
|
react_1.default.createElement(CatalogEntityLinks_1.CatalogEntityLinks, { entity: entity })),
|
|
@@ -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;
|
|
@@ -48,17 +48,17 @@ const CatalogEntityInfoBar_1 = require("../../../components/Catalog/CatalogEntit
|
|
|
48
48
|
const MAX_INITIAL_ITEMS = 4;
|
|
49
49
|
function renderMetadataValue(value) {
|
|
50
50
|
if ((0, utils_1.isPlainObject)(value)) {
|
|
51
|
-
return react_1.default.createElement(JsonViewerWrapper, { data: value, expandLevel: 3,
|
|
51
|
+
return react_1.default.createElement(JsonViewerWrapper, { data: value, expandLevel: 3, controls: false });
|
|
52
52
|
}
|
|
53
53
|
if (Array.isArray(value)) {
|
|
54
|
-
return (react_1.default.createElement(ArrayWrapper, null, value.map((item, index) => (react_1.default.createElement("div", { key: index }, (0, utils_1.isPlainObject)(item) ? (react_1.default.createElement(JsonViewerWrapper, { data: item, expandLevel: 3,
|
|
54
|
+
return (react_1.default.createElement(ArrayWrapper, null, value.map((item, index) => (react_1.default.createElement("div", { key: index }, (0, utils_1.isPlainObject)(item) ? (react_1.default.createElement(JsonViewerWrapper, { data: item, expandLevel: 3, controls: false })) : (react_1.default.createElement("span", null, String(item))))))));
|
|
55
55
|
}
|
|
56
56
|
return react_1.default.createElement("span", null, String(value));
|
|
57
57
|
}
|
|
58
58
|
function CatalogEntityMetadata({ entity }) {
|
|
59
59
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
60
60
|
const { translate } = useTranslate();
|
|
61
|
-
const _a = entity.metadata || {}, { schema } = _a, metadata = __rest(_a, ["schema"]);
|
|
61
|
+
const _a = entity.metadata || {}, { schema, sdl } = _a, metadata = __rest(_a, ["schema", "sdl"]);
|
|
62
62
|
const metadataToShow = Object.entries(metadata).filter(([key]) => !(entity.type === 'api-description' && key === 'descriptionFile'));
|
|
63
63
|
const [isOn, setIsOn] = (0, react_1.useState)(false);
|
|
64
64
|
const hasMoreItems = metadataToShow.length > MAX_INITIAL_ITEMS;
|
|
@@ -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);
|
|
@@ -13,7 +13,7 @@ const MoleculesIcon_1 = require("../../../../icons/MoleculesIcon/MoleculesIcon")
|
|
|
13
13
|
const NetworkIcon_1 = require("../../../../icons/NetworkIcon/NetworkIcon");
|
|
14
14
|
function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
|
|
15
15
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
|
|
16
|
-
react_1.default.createElement(Tabs_1.Tabs, { forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
|
|
16
|
+
react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
|
|
17
17
|
react_1.default.createElement(TabItem, { label: "Operations", icon: react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, null), onClick: () => setFilter('type:api-operation') },
|
|
18
18
|
react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "operations-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false, listType: "api-operation" })),
|
|
19
19
|
react_1.default.createElement(TabItem, { label: "Schemas", icon: react_1.default.createElement(NetworkIcon_1.NetworkIcon, null), onClick: () => setFilter('type:data-schema') },
|
|
@@ -5,5 +5,9 @@ export type CatalogEntitySchemaProps = {
|
|
|
5
5
|
relatedEntity: BffCatalogRelatedEntity | null;
|
|
6
6
|
RedocSchema: React.ComponentType<any>;
|
|
7
7
|
StoreProvider: React.ComponentType<any>;
|
|
8
|
+
GraphqlTypeRenderer?: React.ComponentType<{
|
|
9
|
+
sdl: string;
|
|
10
|
+
typeName: string;
|
|
11
|
+
}>;
|
|
8
12
|
};
|
|
9
|
-
export declare function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, }: CatalogEntitySchemaProps): React.JSX.Element;
|
|
13
|
+
export declare function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntitySchemaProps): React.JSX.Element;
|
|
@@ -34,20 +34,22 @@ const hooks_1 = require("../../../core/hooks");
|
|
|
34
34
|
const useCatalogEntitySchema_1 = require("../../../core/hooks/catalog/useCatalogEntitySchema");
|
|
35
35
|
const JsonViewer_1 = require("../../../components/JsonViewer/JsonViewer");
|
|
36
36
|
const CopyButton_1 = require("../../../components/Buttons/CopyButton");
|
|
37
|
-
function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, }) {
|
|
37
|
+
function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
38
|
+
var _a, _b;
|
|
38
39
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
39
40
|
const { translate } = useTranslate();
|
|
40
41
|
const { definition, parsedSchema, rawSchema } = (0, useCatalogEntitySchema_1.useCatalogEntitySchema)({ entity, relatedEntity });
|
|
42
|
+
const isGraphql = ((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.specType) === 'graphql';
|
|
43
|
+
const graphqlSDL = (_b = entity === null || entity === void 0 ? void 0 : entity.metadata) === null || _b === void 0 ? void 0 : _b.sdl;
|
|
41
44
|
return (react_1.default.createElement(MetadataWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityMetadata" },
|
|
42
45
|
react_1.default.createElement(HeaderWrapper, null,
|
|
43
46
|
react_1.default.createElement(Heading, null, translate('catalog.entity.schema.title')),
|
|
44
|
-
react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium" })),
|
|
47
|
+
!isGraphql && (react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium" }))),
|
|
45
48
|
react_1.default.createElement(SplitViewWrapper, null,
|
|
46
|
-
react_1.default.createElement(SchemaContentWrapper, null,
|
|
47
|
-
react_1.default.createElement(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
react_1.default.createElement(JsonViewer_1.JsonViewer, { data: Sampler.sample(Object.assign({}, parsedSchema)), expandLevel: 3, hideHeader: false })))));
|
|
49
|
+
react_1.default.createElement(SchemaContentWrapper, null, isGraphql && graphqlSDL && GraphqlTypeRenderer ? (react_1.default.createElement(GraphqlTypeRenderer, { sdl: graphqlSDL, typeName: entity.title })) : (react_1.default.createElement(StoreProvider, { definition: definition },
|
|
50
|
+
react_1.default.createElement(RedocSchema, { schema: parsedSchema })))),
|
|
51
|
+
!isGraphql && (react_1.default.createElement(SchemaSampleWrapper, null,
|
|
52
|
+
react_1.default.createElement(JsonViewer_1.JsonViewer, { data: Sampler.sample(Object.assign({}, parsedSchema)), expandLevel: 3 }))))));
|
|
51
53
|
}
|
|
52
54
|
const MetadataWrapper = styled_components_1.default.div `
|
|
53
55
|
display: flex;
|
|
@@ -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);
|
|
@@ -11,6 +11,7 @@ const utils_1 = require("../../core/utils");
|
|
|
11
11
|
const hooks_1 = require("../../core/hooks");
|
|
12
12
|
const H2_1 = require("../../components/Typography/H2");
|
|
13
13
|
const FilterContent_1 = require("../../components/Filter/FilterContent");
|
|
14
|
+
const FilterInput_1 = require("../../components/Filter/FilterInput");
|
|
14
15
|
const FilterPopover_1 = require("../../components/Filter/FilterPopover");
|
|
15
16
|
const CatalogClassicHighlight_1 = require("../../components/CatalogClassic/CatalogClassicHighlight");
|
|
16
17
|
const CatalogClassicActions_1 = require("../../components/CatalogClassic/CatalogClassicActions");
|
|
@@ -25,7 +26,7 @@ function CatalogClassic(props) {
|
|
|
25
26
|
(0, hooks_1.useModalScrollLock)(filterPopoverVisible);
|
|
26
27
|
return (react_1.default.createElement(CatalogClassicHighlight_1.HighlightContext.Provider, { value: [filterTerm] },
|
|
27
28
|
react_1.default.createElement(exports.CatalogPageWrapper, { "data-component-name": "CatalogClassic/CatalogClassic", withoutFilters: !filters.length },
|
|
28
|
-
react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) }),
|
|
29
|
+
Boolean(filters.length) && (react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) })),
|
|
29
30
|
filterPopoverVisible && (react_1.default.createElement(FilterPopover_1.FilterPopover, { onClose: () => setFilterPopoverVisible(false), setFilterTerm: setFilterTerm, filterTerm: filterTerm, filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
|
|
30
31
|
react_1.default.createElement(CatalogClassicActions_1.CatalogClassicActions, { onOpenFilter: () => setFilterPopoverVisible(true), filters: filters, filterTerm: filterTerm }),
|
|
31
32
|
react_1.default.createElement(exports.CatalogPageContent, null,
|
|
@@ -37,7 +38,9 @@ function CatalogClassic(props) {
|
|
|
37
38
|
catalogConfig.description ? (react_1.default.createElement(exports.CatalogDescription, { "data-translation-key": catalogConfig.descriptionTranslationKey },
|
|
38
39
|
' ',
|
|
39
40
|
translate(catalogConfig.descriptionTranslationKey, catalogConfig.description),
|
|
40
|
-
' ')) : null
|
|
41
|
+
' ')) : null,
|
|
42
|
+
!filters.length && (react_1.default.createElement(CatalogSearchWrapper, null,
|
|
43
|
+
react_1.default.createElement(FilterInput_1.FilterInput, { value: filterTerm, onChange: (updatedTerm) => setFilterTerm(updatedTerm) })))),
|
|
41
44
|
react_1.default.createElement(CatalogClassicVirtualizedGroups_1.CatalogClassicVirtualizedGroups, { groups: groups, filters: filters, filterTerm: filterTerm })))));
|
|
42
45
|
}
|
|
43
46
|
exports.CatalogPageContent = styled_components_1.default.main `
|
|
@@ -110,4 +113,8 @@ const FiltersSidebar = (0, styled_components_1.default)(Sidebar_1.Sidebar) `
|
|
|
110
113
|
}
|
|
111
114
|
--menu-container-padding-top: 0;
|
|
112
115
|
`;
|
|
116
|
+
const CatalogSearchWrapper = styled_components_1.default.div `
|
|
117
|
+
margin-top: var(--spacing-base);
|
|
118
|
+
max-width: 300px;
|
|
119
|
+
`;
|
|
113
120
|
//# sourceMappingURL=CatalogClassic.js.map
|
|
@@ -8,8 +8,8 @@ export type CodeBlockProps = {
|
|
|
8
8
|
header?: CodeBlockControlsProps;
|
|
9
9
|
dataTestId?: string;
|
|
10
10
|
className?: string;
|
|
11
|
-
tabs?:
|
|
12
|
-
dropdown?:
|
|
11
|
+
tabs?: CodeBlockItems;
|
|
12
|
+
dropdown?: CodeBlockItems;
|
|
13
13
|
withLineNumbers?: boolean;
|
|
14
14
|
startLineNumber?: number;
|
|
15
15
|
highlightedHtml?: string;
|
|
@@ -25,20 +25,13 @@ type UnstableExternalCodeSample = {
|
|
|
25
25
|
label?: string;
|
|
26
26
|
get: (source: ExternalSource) => string;
|
|
27
27
|
};
|
|
28
|
-
export type
|
|
28
|
+
export type CodeBlockItems = {
|
|
29
29
|
items: {
|
|
30
30
|
name: string;
|
|
31
31
|
lang?: string;
|
|
32
|
+
id: string;
|
|
32
33
|
}[];
|
|
33
|
-
onChange: (
|
|
34
|
-
value: string;
|
|
35
|
-
};
|
|
36
|
-
export type CodeBlockDropdownItems = {
|
|
37
|
-
items: {
|
|
38
|
-
name: string;
|
|
39
|
-
lang?: string;
|
|
40
|
-
}[];
|
|
41
|
-
onChange: (name: string | string[]) => void;
|
|
34
|
+
onChange: (id: string) => void;
|
|
42
35
|
value: string;
|
|
43
36
|
};
|
|
44
37
|
type ExternalSource = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CodeBlockItems } from '../../components/CodeBlock/CodeBlock';
|
|
4
4
|
export type CodeBlockControlsProps = {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
title?: React.ReactNode | string;
|
|
8
8
|
controls?: ControlItems | false;
|
|
9
|
-
tabs?:
|
|
10
|
-
dropdown?:
|
|
9
|
+
tabs?: CodeBlockItems;
|
|
10
|
+
dropdown?: CodeBlockItems;
|
|
11
11
|
};
|
|
12
12
|
type ControlItems = {
|
|
13
13
|
copy?: CopyControlProps;
|
|
@@ -38,7 +38,7 @@ function CodeBlockControls({ children, className, title, controls, tabs, dropdow
|
|
|
38
38
|
tabs && react_1.default.createElement(CodeBlockTabs_1.CodeBlockTabs, { tabs: tabs }),
|
|
39
39
|
react_1.default.createElement(ControlsWrapper, null,
|
|
40
40
|
dropdown && react_1.default.createElement(CodeBlockDropdown_1.CodeBlockDropdown, Object.assign({}, dropdown)),
|
|
41
|
-
report && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.report.tooltipText', 'Report a problem'), placement: "top" },
|
|
41
|
+
report && !report.hidden && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.report.tooltipText', 'Report a problem'), placement: "top" },
|
|
42
42
|
react_1.default.createElement(ControlButton, Object.assign({ variant: "text", size: "small", "data-testid": "report-button", icon: controlsType === 'icon' ? react_1.default.createElement(WarningSquareIcon_1.WarningSquareIcon, { size: "18px" }) : undefined }, report.props), controlsType != 'icon' && (((_b = report.props) === null || _b === void 0 ? void 0 : _b.buttonText) || 'Report')))) : null,
|
|
43
43
|
expand && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.expand) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.expand.tooltipText', 'Expand all'), placement: "top" },
|
|
44
44
|
react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "expand-all", icon: controlsType === 'icon' ? react_1.default.createElement(MaximizeIcon_1.MaximizeIcon, null) : undefined, onClick: expand === null || expand === void 0 ? void 0 : expand.onClick }, controlsType !== 'icon' && ((expand === null || expand === void 0 ? void 0 : expand.label) || 'Expand all')))) : null,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function CodeBlockDropdown({ items, onChange, value }:
|
|
2
|
+
import type { CodeBlockItems } from '../../components/CodeBlock/CodeBlock';
|
|
3
|
+
export declare function CodeBlockDropdown({ items, onChange, value }: CodeBlockItems): JSX.Element;
|