@redocly/theme 0.58.0-next.5 → 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.
Files changed (29) hide show
  1. package/lib/components/Catalog/Catalog.d.ts +2 -2
  2. package/lib/components/Catalog/Catalog.js +2 -2
  3. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +15 -14
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +0 -1
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +0 -1
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +0 -1
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +1 -1
  8. package/lib/components/Catalog/CatalogEntityIcon.js +2 -2
  9. package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
  10. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +1 -1
  11. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
  12. package/lib/components/Catalog/variables.js +5 -6
  13. package/lib/core/types/hooks.d.ts +2 -2
  14. package/lib/icons/HierarchyIcon/HierarchyIcon.d.ts +9 -0
  15. package/lib/icons/HierarchyIcon/HierarchyIcon.js +23 -0
  16. package/package.json +3 -3
  17. package/src/components/Catalog/Catalog.tsx +14 -4
  18. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +20 -19
  19. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +0 -1
  20. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +0 -1
  21. package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +0 -1
  22. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +1 -1
  23. package/src/components/Catalog/CatalogEntityIcon.tsx +2 -2
  24. package/src/components/Catalog/CatalogSelector.tsx +1 -1
  25. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
  26. package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
  27. package/src/components/Catalog/variables.ts +5 -6
  28. package/src/core/types/hooks.ts +6 -1
  29. package/src/icons/HierarchyIcon/HierarchyIcon.tsx +32 -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;
@@ -32,10 +32,10 @@ const customCatalogOptionsCasing = (str) => {
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(Tooltip_1.TooltipComponent, { tip: entity.type, placement: "bottom", className: "catalog" },
30
- react_1.default.createElement(HeaderIconWrapper, null,
31
- react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entity.type, defaultColor: true }))),
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(MetadataColumn, null,
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(MetadataColumn, null,
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 MetadataColumn = styled_components_1.default.div `
103
+ const MetadataRow = styled_components_1.default.div `
102
104
  display: flex;
103
- flex-direction: column;
104
- flex: 1;
105
- width: calc(50% - var(--catalog-metadata-column-half-gap)); /* 50% minus half the gap */
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;
@@ -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: center;
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);
@@ -9,8 +9,8 @@ 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
14
  const Image_1 = require("../../components/Image/Image");
15
15
  const core_1 = require("../../core");
16
16
  const NoteIcon_1 = require("../../icons/NoteIcon/NoteIcon");
@@ -25,7 +25,7 @@ const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogCo
25
25
  team: react_1.default.createElement(PeopleIcon_1.PeopleIcon, { color: iconColor }),
26
26
  user: react_1.default.createElement(UserIcon_1.UserIcon, { color: iconColor }),
27
27
  'api-description': react_1.default.createElement(NoteIcon_1.NoteIcon, { color: iconColor }),
28
- 'data-schema': react_1.default.createElement(NetworkIcon_1.NetworkIcon, { color: iconColor }),
28
+ 'data-schema': react_1.default.createElement(HierarchyIcon_1.HierarchyIcon, { color: iconColor }),
29
29
  'api-operation': react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, { color: iconColor }),
30
30
  };
31
31
  return entityIconMap[entityType];
@@ -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/catalog';
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, defaultColor: true }),
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)),
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CatalogViewMode } from '../../core/types/catalog';
2
+ import { CatalogViewMode } from '../../core/types';
3
3
  export type CatalogViewModeToggleProps = {
4
4
  viewMode: CatalogViewMode;
5
5
  onViewModeChange: (mode: CatalogViewMode) => void;
@@ -139,7 +139,7 @@ exports.catalog = (0, styled_components_1.css) `
139
139
  /**
140
140
  * @tokens Catalog tags
141
141
  */
142
- --catalog-tags-wrapper-gap: 4px;
142
+ --catalog-tags-wrapper-gap: var(--spacing-xs) calc(var(--spacing-xs) - 5px);
143
143
  --catalog-tags-more-button-font-size: var(--font-size-base);
144
144
  --catalog-tags-more-button-margin-left: 4px;
145
145
  --catalog-tags-placeholder-bg-color: var(--bg-color);
@@ -199,7 +199,7 @@ exports.catalog = (0, styled_components_1.css) `
199
199
  */
200
200
  --catalog-card-height: 241px;
201
201
  --catalog-card-min-width: 400px;
202
- --catalog-card-padding-vertical: var(--spacing-md);
202
+ --catalog-card-padding-vertical: var(--spacing-base);
203
203
  --catalog-card-padding-horizontal: var(--spacing-md);
204
204
  --catalog-card-gap: var(--spacing-sm);
205
205
  --catalog-card-text-color: var(--text-color-secondary);
@@ -229,12 +229,11 @@ exports.catalog = (0, styled_components_1.css) `
229
229
  /**
230
230
  * @tokens Catalog metadata
231
231
  */
232
- --catalog-metadata-section-margin-top: var(--spacing-md);
233
- --catalog-metadata-section-gap: var(--spacing-lg);
232
+ --catalog-metadata-section-margin-top: var(--spacing-base);
233
+ --catalog-metadata-section-gap: var(--spacing-xs);
234
234
  --catalog-metadata-label-font-size: var(--font-size-base);
235
235
  --catalog-metadata-label-font-weight: var(--font-weight-medium);
236
236
  --catalog-metadata-label-color: var(--text-color-secondary);
237
- --catalog-metadata-label-margin-bottom: var(--spacing-unit);
238
237
  --catalog-metadata-column-half-gap: var(--spacing-sm);
239
238
  --catalog-metadata-heading-size: var(--font-size-md);
240
239
 
@@ -269,7 +268,7 @@ exports.catalog = (0, styled_components_1.css) `
269
268
  --catalog-card-description-line-height: var(--line-height-base);
270
269
  --catalog-card-description-font-weight: var(--font-weight-regular);
271
270
  --catalog-card-description-height: 62px;
272
- --catalog-card-description-margin-top: 2px;
271
+ --catalog-card-description-margin-top: 8px;
273
272
 
274
273
  --catalog-card-content-gap: var(--spacing-xs);
275
274
  --catalog-card-content-gap-vertical: var(--spacing-sm);
@@ -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>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const HierarchyIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
4
+ 'data-component-name': string;
5
+ } & {
6
+ color?: string;
7
+ size?: string;
8
+ className?: string;
9
+ } & React.SVGProps<SVGSVGElement>, "data-component-name">;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HierarchyIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const utils_1 = require("../../core/utils");
10
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18" }, props),
11
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.0625 7.3125H15.1875C15.4858 7.31216 15.7717 7.19352 15.9826 6.98262C16.1935 6.77171 16.3122 6.48576 16.3125 6.1875V2.8125C16.3122 2.51424 16.1935 2.22829 15.9826 2.01738C15.7717 1.80648 15.4858 1.68784 15.1875 1.6875H2.8125C2.51424 1.68784 2.22829 1.80648 2.01738 2.01738C1.80648 2.22829 1.68784 2.51424 1.6875 2.8125V6.1875C1.68784 6.48576 1.80648 6.77171 2.01738 6.98262C2.22829 7.19352 2.51424 7.31216 2.8125 7.3125H3.9375H5.0625ZM15.1875 2.8125H2.8125V6.1875H15.1875V2.8125Z" }),
12
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.1875 10.6875H9.5625C9.26424 10.6878 8.97829 10.8065 8.76738 11.0174C8.55648 11.2283 8.43784 11.5142 8.4375 11.8125V12.9375H5.0625V10.4546V9.5625V7.3125H3.9375V10.4546V12.9375C3.93784 13.2358 4.05648 13.5217 4.26738 13.7326C4.47829 13.9435 4.76424 14.0622 5.0625 14.0625H8.4375V15.1875C8.43784 15.4858 8.55648 15.7717 8.76738 15.9826C8.97829 16.1935 9.26424 16.3122 9.5625 16.3125H15.1875C15.4858 16.3122 15.7717 16.1935 15.9826 15.9826C16.1935 15.7717 16.3122 15.4858 16.3125 15.1875V11.8125C16.3122 11.5142 16.1935 11.2283 15.9826 11.0174C15.7717 10.8065 15.4858 10.6878 15.1875 10.6875ZM9.5625 11.8125V15.1875H15.1875V11.8125H9.5625Z" })));
13
+ exports.HierarchyIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
14
+ 'data-component-name': 'icons/HierarchyIcon/HierarchyIcon',
15
+ })) `
16
+ path {
17
+ fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
18
+ }
19
+
20
+ height: ${({ size }) => size || '16px'};
21
+ width: ${({ size }) => size || '16px'};
22
+ `;
23
+ //# sourceMappingURL=HierarchyIcon.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.58.0-next.5",
3
+ "version": "0.58.0-next.6",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -87,8 +87,8 @@
87
87
  "openapi-sampler": "1.6.1",
88
88
  "react-calendar": "5.1.0",
89
89
  "react-date-picker": "11.0.0",
90
- "@redocly/config": "0.33.0",
91
- "@redocly/realm-asyncapi-sdk": "0.4.0-next.1"
90
+ "@redocly/config": "0.34.0",
91
+ "@redocly/realm-asyncapi-sdk": "0.4.0-next.2"
92
92
  },
93
93
  "scripts": {
94
94
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -2,13 +2,16 @@ import React, { JSX } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { CatalogEntityConfig } from '@redocly/config';
4
4
 
5
- import { BffCatalogEntityList } from '@redocly/theme/core/types';
5
+ import {
6
+ BffCatalogEntityList,
7
+ CatalogSwitcherItem,
8
+ CatalogViewMode,
9
+ } from '@redocly/theme/core/types';
6
10
  import { breakpoints } from '@redocly/theme/core/utils';
7
11
  import { useThemeHooks } from '@redocly/theme/core/hooks';
8
12
  import { H3 } from '@redocly/theme/components/Typography/H3';
9
13
  import { FilterContent } from '@redocly/theme/components/Filter/FilterContent';
10
14
  import { Sidebar, SidebarHeader } from '@redocly/theme/components/Sidebar/Sidebar';
11
- import { CatalogSwitcherItem } from '@redocly/theme/core/types/catalog';
12
15
  import { CatalogSelector } from '@redocly/theme/components/Catalog/CatalogSelector';
13
16
  import { SidebarActions } from '@redocly/theme/components/SidebarActions/SidebarActions';
14
17
  import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
@@ -22,6 +25,7 @@ export type CatalogProps = {
22
25
  entitiesTypes: string[];
23
26
  initialEntitiesList?: BffCatalogEntityList;
24
27
  catalogSwitcherItems: CatalogSwitcherItem[];
28
+ initialViewMode?: CatalogViewMode;
25
29
  };
26
30
 
27
31
  const customCatalogOptionsCasing = (str: string): string => {
@@ -39,7 +43,13 @@ const customCatalogOptionsCasing = (str: string): string => {
39
43
  };
40
44
 
41
45
  export function Catalog(props: CatalogProps): JSX.Element {
42
- const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems } = props;
46
+ const {
47
+ catalogConfig,
48
+ entitiesTypes,
49
+ initialEntitiesList,
50
+ catalogSwitcherItems,
51
+ initialViewMode,
52
+ } = props;
43
53
 
44
54
  const { useTranslate, useCatalog } = useThemeHooks();
45
55
 
@@ -62,7 +72,7 @@ export function Catalog(props: CatalogProps): JSX.Element {
62
72
  onChangeCollapseSidebarClick,
63
73
  layout,
64
74
  collapsedSidebar,
65
- } = useCatalog(catalogConfig, initialEntitiesList?.page.total || 0);
75
+ } = useCatalog(catalogConfig, initialEntitiesList?.page.total || 0, initialViewMode);
66
76
 
67
77
  return (
68
78
  <>
@@ -11,7 +11,6 @@ import { ArrowUpRightIcon } from '@redocly/theme/icons/ArrowUpRightIcon/ArrowUpR
11
11
  import { CatalogTagsWithTooltip } from '@redocly/theme/components/Catalog/CatalogTagsWithTooltip';
12
12
  import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
13
13
  import { getPathPrefix } from '@redocly/theme/core/utils';
14
- import { TooltipComponent } from '@redocly/theme/components/Tooltip/Tooltip';
15
14
 
16
15
  export type CatalogCardProps = {
17
16
  entity: BffCatalogEntity;
@@ -35,22 +34,21 @@ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.El
35
34
  >
36
35
  <CardContent>
37
36
  <CardHeader>
38
- <TooltipComponent tip={entity.type} placement="bottom" className="catalog">
39
- <HeaderIconWrapper>
40
- <CatalogEntityIcon entityType={entity.type} defaultColor={true} />
41
- </HeaderIconWrapper>
42
- </TooltipComponent>
43
- <CardTitle>
44
- <CatalogHighlight>{entity.title}</CatalogHighlight>
45
- </CardTitle>
37
+ <HeaderIconWrapper>
38
+ <CatalogEntityIcon entityType={entity.type} />
39
+ </HeaderIconWrapper>
40
+ <HeaderIconText entityType={entity.type}>{entity.type}</HeaderIconText>
46
41
  </CardHeader>
47
42
 
48
43
  <CardDescription>
44
+ <CardTitle>
45
+ <CatalogHighlight>{entity.title}</CatalogHighlight>
46
+ </CardTitle>
49
47
  <CatalogHighlight>{entity.summary ?? ''}</CatalogHighlight>
50
48
  </CardDescription>
51
49
 
52
50
  <CardMetadataSection>
53
- <MetadataColumn>
51
+ <MetadataRow>
54
52
  <MetadataLabel>Domains:</MetadataLabel>
55
53
  <CatalogTagsWithTooltip
56
54
  items={entity.domains?.map((domain) => domain.title) || []}
@@ -63,9 +61,9 @@ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.El
63
61
  textTransform: 'none',
64
62
  }}
65
63
  />
66
- </MetadataColumn>
64
+ </MetadataRow>
67
65
 
68
- <MetadataColumn>
66
+ <MetadataRow>
69
67
  <MetadataLabel>Owners:</MetadataLabel>
70
68
  <CatalogTagsWithTooltip
71
69
  items={entity.owners?.map((owner) => owner.key) || []}
@@ -78,7 +76,7 @@ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.El
78
76
  textTransform: 'none',
79
77
  }}
80
78
  />
81
- </MetadataColumn>
79
+ </MetadataRow>
82
80
  </CardMetadataSection>
83
81
  </CardContent>
84
82
 
@@ -121,6 +119,10 @@ const HeaderIconWrapper = styled.div`
121
119
  margin-right: var(--catalog-card-icon-margin-right);
122
120
  `;
123
121
 
122
+ const HeaderIconText = styled.div<{ entityType: string }>`
123
+ color: ${({ entityType }) => `var(--catalog-entity-icon-color-${entityType})`};
124
+ `;
125
+
124
126
  const CardHeader = styled.div`
125
127
  display: flex;
126
128
  align-items: center;
@@ -130,22 +132,22 @@ const MetadataLabel = styled.div`
130
132
  font-size: var(--catalog-metadata-label-font-size);
131
133
  font-weight: var(--catalog-metadata-label-font-weight);
132
134
  color: var(--catalog-metadata-label-color);
133
- margin-bottom: var(--catalog-metadata-label-margin-bottom);
134
135
  `;
135
136
 
136
137
  const CardMetadataSection = styled.div`
137
138
  display: flex;
139
+ flex-direction: column;
138
140
  justify-content: space-between;
139
141
  margin-top: var(--catalog-metadata-section-margin-top);
140
142
  gap: var(--catalog-metadata-section-gap);
141
143
  width: 100%;
142
144
  `;
143
145
 
144
- const MetadataColumn = styled.div`
146
+ const MetadataRow = styled.div`
145
147
  display: flex;
146
- flex-direction: column;
147
- flex: 1;
148
- width: calc(50% - var(--catalog-metadata-column-half-gap)); /* 50% minus half the gap */
148
+ align-items: center;
149
+ justify-content: space-between;
150
+ gap: var(--catalog-metadata-row-gap);
149
151
  `;
150
152
 
151
153
  const ArrowCircle = styled.div`
@@ -184,7 +186,6 @@ const Divider = styled.div`
184
186
  `;
185
187
 
186
188
  const CatalogCardWrapper = styled.div`
187
- height: var(--catalog-card-height);
188
189
  color: var(--catalog-card-text-color);
189
190
  font-size: var(--catalog-card-font-size);
190
191
  font-weight: var(--catalog-card-font-weight);
@@ -41,7 +41,6 @@ export function CatalogEntityLinks({ entity }: CatalogEntityLinksProps) {
41
41
  const LinksWrapper = styled.div`
42
42
  display: flex;
43
43
  flex-direction: column;
44
- gap: var(--spacing-xs);
45
44
  border-radius: var(--border-radius);
46
45
  background-color: var(--catalog-metadata-bg-color);
47
46
  transition: all 0.2s ease-in-out;
@@ -81,7 +81,6 @@ const JsonViewerWrapper = styled(JsonViewer)`
81
81
  const MetadataWrapper = styled.div`
82
82
  display: flex;
83
83
  flex-direction: column;
84
- gap: var(--spacing-xs);
85
84
  border-radius: var(--border-radius);
86
85
  background-color: var(--catalog-metadata-bg-color);
87
86
  transition: all 0.2s ease-in-out;
@@ -45,7 +45,6 @@ const PathLabel = styled.label`
45
45
  const LinksWrapper = styled.div`
46
46
  display: flex;
47
47
  flex-direction: column;
48
- gap: var(--spacing-xs);
49
48
  border-radius: var(--border-radius);
50
49
  background-color: var(--catalog-metadata-bg-color);
51
50
  transition: all 0.2s ease-in-out;
@@ -64,7 +64,7 @@ const CardHeader = styled.div`
64
64
  const CardContent = styled.div`
65
65
  flex: 1;
66
66
  display: flex;
67
- align-items: center;
67
+ align-items: flex-end;
68
68
  gap: var(--catalog-card-content-gap);
69
69
  flex-wrap: wrap;
70
70
  color: var(--text-color-primary);
@@ -6,8 +6,8 @@ import { CodeIcon } from '@redocly/theme/icons/CodeIcon/CodeIcon';
6
6
  import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
7
7
  import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
8
8
  import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
9
- import { NetworkIcon } from '@redocly/theme/icons/NetworkIcon/NetworkIcon';
10
9
  import { MoleculesIcon } from '@redocly/theme/icons/MoleculesIcon/MoleculesIcon';
10
+ import { HierarchyIcon } from '@redocly/theme/icons/HierarchyIcon/HierarchyIcon';
11
11
  import { Image } from '@redocly/theme/components/Image/Image';
12
12
  import { PREDEFINED_ENTITY_TYPES, useThemeConfig } from '@redocly/theme/core';
13
13
  import { NoteIcon } from '@redocly/theme/icons/NoteIcon/NoteIcon';
@@ -38,7 +38,7 @@ const getEntityIcon = ({
38
38
  team: <PeopleIcon color={iconColor} />,
39
39
  user: <UserIcon color={iconColor} />,
40
40
  'api-description': <NoteIcon color={iconColor} />,
41
- 'data-schema': <NetworkIcon color={iconColor} />,
41
+ 'data-schema': <HierarchyIcon color={iconColor} />,
42
42
  'api-operation': <MoleculesIcon color={iconColor} />,
43
43
  };
44
44
 
@@ -3,7 +3,7 @@ import styled from 'styled-components';
3
3
  import { useNavigate } from 'react-router-dom';
4
4
 
5
5
  import { Select } from '@redocly/theme/components/Select/Select';
6
- import { CatalogSwitcherItem, SortOption } from '@redocly/theme/core/types/catalog';
6
+ import { CatalogSwitcherItem, SortOption } from '@redocly/theme/core/types';
7
7
  import { getPathPrefix } from '@redocly/theme/core/utils';
8
8
  import { useThemeHooks } from '@redocly/theme/core/hooks';
9
9
  import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
@@ -13,7 +13,7 @@ export type CatalogEntityCellProps<T extends Entity> = {
13
13
  export function CatalogEntityCell<T extends Entity>({ entity }: CatalogEntityCellProps<T>) {
14
14
  return (
15
15
  <EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
16
- <CatalogEntityTypeIcon entityType={entity.type} defaultColor={true} />
16
+ <CatalogEntityTypeIcon entityType={entity.type} />
17
17
  <EntityTitleContent>
18
18
  <EntityTitle data-component-name="Catalog/CatalogTableView/CatalogEntityTitle">
19
19
  <CatalogHighlight>{entity.title}</CatalogHighlight>
@@ -3,7 +3,7 @@ import styled from 'styled-components';
3
3
 
4
4
  import { TableIcon } from '@redocly/theme/icons/TableIcon/TableIcon';
5
5
  import { CardsIcon } from '@redocly/theme/icons/CardsIcon/CardsIcon';
6
- import { CatalogViewMode } from '@redocly/theme/core/types/catalog';
6
+ import { CatalogViewMode } from '@redocly/theme/core/types';
7
7
 
8
8
  function useViewMode(initialViewMode: CatalogViewMode) {
9
9
  const [viewMode, setViewMode] = useState<CatalogViewMode | null>(null);
@@ -137,7 +137,7 @@ export const catalog = css`
137
137
  /**
138
138
  * @tokens Catalog tags
139
139
  */
140
- --catalog-tags-wrapper-gap: 4px;
140
+ --catalog-tags-wrapper-gap: var(--spacing-xs) calc(var(--spacing-xs) - 5px);
141
141
  --catalog-tags-more-button-font-size: var(--font-size-base);
142
142
  --catalog-tags-more-button-margin-left: 4px;
143
143
  --catalog-tags-placeholder-bg-color: var(--bg-color);
@@ -197,7 +197,7 @@ export const catalog = css`
197
197
  */
198
198
  --catalog-card-height: 241px;
199
199
  --catalog-card-min-width: 400px;
200
- --catalog-card-padding-vertical: var(--spacing-md);
200
+ --catalog-card-padding-vertical: var(--spacing-base);
201
201
  --catalog-card-padding-horizontal: var(--spacing-md);
202
202
  --catalog-card-gap: var(--spacing-sm);
203
203
  --catalog-card-text-color: var(--text-color-secondary);
@@ -227,12 +227,11 @@ export const catalog = css`
227
227
  /**
228
228
  * @tokens Catalog metadata
229
229
  */
230
- --catalog-metadata-section-margin-top: var(--spacing-md);
231
- --catalog-metadata-section-gap: var(--spacing-lg);
230
+ --catalog-metadata-section-margin-top: var(--spacing-base);
231
+ --catalog-metadata-section-gap: var(--spacing-xs);
232
232
  --catalog-metadata-label-font-size: var(--font-size-base);
233
233
  --catalog-metadata-label-font-weight: var(--font-weight-medium);
234
234
  --catalog-metadata-label-color: var(--text-color-secondary);
235
- --catalog-metadata-label-margin-bottom: var(--spacing-unit);
236
235
  --catalog-metadata-column-half-gap: var(--spacing-sm);
237
236
  --catalog-metadata-heading-size: var(--font-size-md);
238
237
 
@@ -267,7 +266,7 @@ export const catalog = css`
267
266
  --catalog-card-description-line-height: var(--line-height-base);
268
267
  --catalog-card-description-font-weight: var(--font-weight-regular);
269
268
  --catalog-card-description-height: 62px;
270
- --catalog-card-description-margin-top: 2px;
269
+ --catalog-card-description-margin-top: 8px;
271
270
 
272
271
  --catalog-card-content-gap: var(--spacing-xs);
273
272
  --catalog-card-content-gap-vertical: var(--spacing-sm);
@@ -17,6 +17,7 @@ import type {
17
17
  FilteredCatalog,
18
18
  UseCatalogSortResponse,
19
19
  UseCatalogSearchResponse,
20
+ CatalogViewMode,
20
21
  } from './catalog';
21
22
  import type { UserMenuData } from './user-menu';
22
23
  import type { ItemState } from './sidebar';
@@ -139,7 +140,11 @@ export type ThemeHooks = {
139
140
  nextPage?: ResolvedNavItemWithLink;
140
141
  }
141
142
  | undefined;
142
- useCatalog: (config?: CatalogEntityConfig, entitiesCounterInitial?: number) => UseCatalogResponse;
143
+ useCatalog: (
144
+ config?: CatalogEntityConfig,
145
+ entitiesCounterInitial?: number,
146
+ initialViewMode?: CatalogViewMode,
147
+ ) => UseCatalogResponse;
143
148
  useCatalogSort: () => UseCatalogSortResponse;
144
149
  useCatalogSearch: () => UseCatalogSearchResponse;
145
150
  useFetchCatalogEntities: (
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { IconProps } from '@redocly/theme/icons/types';
5
+
6
+ import { getCssColorVariable } from '@redocly/theme/core/utils';
7
+
8
+ const Icon = (props: IconProps) => (
9
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" {...props}>
10
+ <path
11
+ fillRule="evenodd"
12
+ clipRule="evenodd"
13
+ d="M5.0625 7.3125H15.1875C15.4858 7.31216 15.7717 7.19352 15.9826 6.98262C16.1935 6.77171 16.3122 6.48576 16.3125 6.1875V2.8125C16.3122 2.51424 16.1935 2.22829 15.9826 2.01738C15.7717 1.80648 15.4858 1.68784 15.1875 1.6875H2.8125C2.51424 1.68784 2.22829 1.80648 2.01738 2.01738C1.80648 2.22829 1.68784 2.51424 1.6875 2.8125V6.1875C1.68784 6.48576 1.80648 6.77171 2.01738 6.98262C2.22829 7.19352 2.51424 7.31216 2.8125 7.3125H3.9375H5.0625ZM15.1875 2.8125H2.8125V6.1875H15.1875V2.8125Z"
14
+ />
15
+ <path
16
+ fillRule="evenodd"
17
+ clipRule="evenodd"
18
+ d="M15.1875 10.6875H9.5625C9.26424 10.6878 8.97829 10.8065 8.76738 11.0174C8.55648 11.2283 8.43784 11.5142 8.4375 11.8125V12.9375H5.0625V10.4546V9.5625V7.3125H3.9375V10.4546V12.9375C3.93784 13.2358 4.05648 13.5217 4.26738 13.7326C4.47829 13.9435 4.76424 14.0622 5.0625 14.0625H8.4375V15.1875C8.43784 15.4858 8.55648 15.7717 8.76738 15.9826C8.97829 16.1935 9.26424 16.3122 9.5625 16.3125H15.1875C15.4858 16.3122 15.7717 16.1935 15.9826 15.9826C16.1935 15.7717 16.3122 15.4858 16.3125 15.1875V11.8125C16.3122 11.5142 16.1935 11.2283 15.9826 11.0174C15.7717 10.8065 15.4858 10.6878 15.1875 10.6875ZM9.5625 11.8125V15.1875H15.1875V11.8125H9.5625Z"
19
+ />
20
+ </svg>
21
+ );
22
+
23
+ export const HierarchyIcon = styled(Icon).attrs(() => ({
24
+ 'data-component-name': 'icons/HierarchyIcon/HierarchyIcon',
25
+ }))<IconProps>`
26
+ path {
27
+ fill: ${({ color }) => getCssColorVariable(color)};
28
+ }
29
+
30
+ height: ${({ size }) => size || '16px'};
31
+ width: ${({ size }) => size || '16px'};
32
+ `;