@redocly/theme 0.58.0-next.0 → 0.58.0-next.10

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 (163) hide show
  1. package/lib/components/Buttons/CopyButton.d.ts +1 -0
  2. package/lib/components/Buttons/CopyButton.js +3 -3
  3. package/lib/components/Catalog/Catalog.d.ts +2 -2
  4. package/lib/components/Catalog/Catalog.js +19 -5
  5. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +15 -14
  6. package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -1
  7. package/lib/components/Catalog/CatalogEntitiesEmptyState.js +32 -11
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +7 -7
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +13 -7
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +0 -1
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +6 -7
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +0 -1
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +6 -10
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +1 -1
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +5 -1
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +23 -0
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +27 -0
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +3 -2
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +2 -2
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +11 -2
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +2 -1
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +1 -1
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +2 -1
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +2 -8
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +9 -2
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +66 -30
  27. package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -0
  28. package/lib/components/Catalog/CatalogEntityIcon.js +31 -14
  29. package/lib/components/Catalog/CatalogEntityTypeIcon.js +19 -6
  30. package/lib/components/Catalog/CatalogEntityTypeTag.js +9 -3
  31. package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
  32. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +1 -1
  33. package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.d.ts +1 -1
  34. package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.js +2 -2
  35. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
  36. package/lib/components/Catalog/variables.js +10 -7
  37. package/lib/components/CatalogClassic/CatalogClassic.js +9 -2
  38. package/lib/components/CodeBlock/CodeBlock.d.ts +5 -12
  39. package/lib/components/CodeBlock/CodeBlockControls.d.ts +3 -3
  40. package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +2 -2
  41. package/lib/components/CodeBlock/CodeBlockDropdown.js +4 -13
  42. package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
  43. package/lib/components/CodeBlock/CodeBlockTabs.js +4 -3
  44. package/lib/components/Filter/FilterContent.d.ts +1 -1
  45. package/lib/components/Search/SearchDialog.js +12 -6
  46. package/lib/components/Search/SearchFilter.js +2 -1
  47. package/lib/components/Tooltip/Tooltip.js +7 -9
  48. package/lib/components/Tooltip/TooltipWrapper.js +1 -1
  49. package/lib/core/constants/catalog.d.ts +2 -1
  50. package/lib/core/constants/catalog.js +40 -27
  51. package/lib/core/contexts/CodeSnippetContext.d.ts +14 -6
  52. package/lib/core/contexts/CodeSnippetContext.js +57 -14
  53. package/lib/core/hooks/catalog/useCatalogEntitySchema.d.ts +11 -0
  54. package/lib/core/hooks/catalog/useCatalogEntitySchema.js +39 -0
  55. package/lib/core/hooks/catalog/useCatalogTableViewRow.js +1 -1
  56. package/lib/core/hooks/use-active-section-id.js +4 -0
  57. package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
  58. package/lib/core/hooks/use-control.js +17 -2
  59. package/lib/core/hooks/use-local-state.js +22 -18
  60. package/lib/core/hooks/use-telemetry-fallback.d.ts +5 -0
  61. package/lib/core/hooks/use-telemetry-fallback.js +5 -0
  62. package/lib/core/openapi/index.d.ts +8 -4
  63. package/lib/core/openapi/index.js +9 -9
  64. package/lib/core/styles/global.js +19 -0
  65. package/lib/core/types/catalog.d.ts +8 -1
  66. package/lib/core/types/filter.d.ts +1 -1
  67. package/lib/core/types/hooks.d.ts +2 -2
  68. package/lib/core/types/index.d.ts +1 -0
  69. package/lib/core/types/index.js +1 -0
  70. package/lib/core/types/l10n.d.ts +1 -1
  71. package/lib/core/types/open-api-info.d.ts +34 -0
  72. package/lib/core/types/open-api-info.js +3 -0
  73. package/lib/core/types/open-api-server.d.ts +1 -0
  74. package/lib/core/types/search.d.ts +2 -3
  75. package/lib/core/utils/change-text-casing.d.ts +1 -1
  76. package/lib/core/utils/change-text-casing.js +3 -0
  77. package/lib/core/utils/urls.js +1 -1
  78. package/lib/ext/configure.d.ts +1 -0
  79. package/lib/ext/configure.js +4 -1
  80. package/lib/ext/useConfigureReplay.d.ts +19 -0
  81. package/lib/ext/useConfigureReplay.js +64 -0
  82. package/lib/icons/HierarchyIcon/HierarchyIcon.d.ts +9 -0
  83. package/lib/icons/HierarchyIcon/HierarchyIcon.js +23 -0
  84. package/lib/icons/NoteIcon/NoteIcon.d.ts +9 -0
  85. package/lib/icons/NoteIcon/NoteIcon.js +24 -0
  86. package/lib/icons/ShareIcon/ShareIcon.d.ts +9 -0
  87. package/lib/icons/ShareIcon/ShareIcon.js +22 -0
  88. package/lib/index.d.ts +2 -0
  89. package/lib/index.js +2 -0
  90. package/lib/layouts/DocumentationLayout.js +1 -3
  91. package/lib/markdoc/components/CodeGroup/CodeGroup.js +49 -27
  92. package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
  93. package/lib/markdoc/components/Tabs/Tabs.js +3 -2
  94. package/package.json +5 -4
  95. package/src/components/Buttons/CopyButton.tsx +4 -1
  96. package/src/components/Catalog/Catalog.tsx +32 -7
  97. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +20 -19
  98. package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +39 -16
  99. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +53 -12
  100. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +0 -1
  101. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +8 -7
  102. package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +0 -1
  103. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +15 -14
  104. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +1 -1
  105. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +6 -1
  106. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +125 -0
  107. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +5 -1
  108. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +30 -3
  109. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +4 -3
  110. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +3 -1
  111. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -13
  112. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +84 -23
  113. package/src/components/Catalog/CatalogEntityIcon.tsx +53 -18
  114. package/src/components/Catalog/CatalogEntityTypeIcon.tsx +19 -8
  115. package/src/components/Catalog/CatalogEntityTypeTag.tsx +11 -3
  116. package/src/components/Catalog/CatalogSelector.tsx +1 -1
  117. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
  118. package/src/components/Catalog/CatalogTableView/CatalogEntityRelationCell.tsx +3 -3
  119. package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
  120. package/src/components/Catalog/variables.ts +10 -7
  121. package/src/components/CatalogClassic/CatalogClassic.tsx +26 -10
  122. package/src/components/CodeBlock/CodeBlock.tsx +5 -11
  123. package/src/components/CodeBlock/CodeBlockControls.tsx +3 -6
  124. package/src/components/CodeBlock/CodeBlockDropdown.tsx +11 -20
  125. package/src/components/CodeBlock/CodeBlockTabs.tsx +8 -8
  126. package/src/components/Filter/FilterContent.tsx +3 -1
  127. package/src/components/Search/SearchDialog.tsx +14 -5
  128. package/src/components/Search/SearchFilter.tsx +2 -1
  129. package/src/components/Tooltip/Tooltip.tsx +6 -8
  130. package/src/components/Tooltip/TooltipWrapper.tsx +1 -1
  131. package/src/core/constants/catalog.ts +41 -27
  132. package/src/core/contexts/CodeSnippetContext.tsx +54 -18
  133. package/src/core/hooks/catalog/useCatalogEntitySchema.ts +46 -0
  134. package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
  135. package/src/core/hooks/use-active-section-id.ts +6 -0
  136. package/src/core/hooks/use-codeblock-tabs-controls.ts +2 -2
  137. package/src/core/hooks/use-control.ts +21 -3
  138. package/src/core/hooks/use-local-state.ts +28 -19
  139. package/src/core/hooks/use-telemetry-fallback.ts +5 -0
  140. package/src/core/openapi/index.ts +8 -4
  141. package/src/core/styles/global.ts +19 -0
  142. package/src/core/types/catalog.ts +10 -2
  143. package/src/core/types/filter.ts +3 -1
  144. package/src/core/types/hooks.ts +6 -1
  145. package/src/core/types/index.ts +1 -0
  146. package/src/core/types/l10n.ts +3 -0
  147. package/src/core/types/open-api-info.ts +34 -0
  148. package/src/core/types/open-api-server.ts +1 -0
  149. package/src/core/types/search.ts +3 -3
  150. package/src/core/utils/change-text-casing.ts +8 -1
  151. package/src/core/utils/urls.ts +2 -1
  152. package/src/ext/configure.ts +5 -1
  153. package/src/ext/useConfigureReplay.ts +84 -0
  154. package/src/icons/HierarchyIcon/HierarchyIcon.tsx +32 -0
  155. package/src/icons/NoteIcon/NoteIcon.tsx +35 -0
  156. package/src/icons/ShareIcon/ShareIcon.tsx +23 -0
  157. package/src/index.ts +2 -0
  158. package/src/layouts/DocumentationLayout.tsx +3 -10
  159. package/src/markdoc/components/CodeGroup/CodeGroup.tsx +81 -52
  160. package/src/markdoc/components/Tabs/Tabs.tsx +10 -2
  161. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +0 -6
  162. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +0 -32
  163. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +0 -46
@@ -17,5 +17,6 @@ export type CopyButtonProps = {
17
17
  fullWidth?: ButtonProps['fullWidth'];
18
18
  tone?: ButtonProps['tone'];
19
19
  extraClass?: ButtonProps['extraClass'];
20
+ iconPosition?: ButtonProps['iconPosition'];
20
21
  };
21
22
  export declare const CopyButton: React.NamedExoticComponent<CopyButtonProps>;
@@ -30,7 +30,7 @@ const hooks_1 = require("../../core/hooks");
30
30
  const Button_1 = require("../../components/Button/Button");
31
31
  const CopyIcon_1 = require("../../icons/CopyIcon/CopyIcon");
32
32
  const Tooltip_1 = require("../../components/Tooltip/Tooltip");
33
- function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', toasterText, toasterDuration, buttonText, onCopyClick, dataTestId = 'copy-button', className, variant = 'text', size = 'small', disabled, fullWidth, tone, extraClass, }) {
33
+ function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', toasterText, toasterDuration, buttonText, onCopyClick, dataTestId = 'copy-button', className, variant = 'text', size = 'small', disabled, fullWidth, tone, extraClass, iconPosition, }) {
34
34
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
35
35
  const tooltip = (0, hooks_1.useControl)();
36
36
  const { translate } = useTranslate();
@@ -47,8 +47,8 @@ function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', to
47
47
  onCopyClick === null || onCopyClick === void 0 ? void 0 : onCopyClick(e);
48
48
  };
49
49
  return (react_1.default.createElement(Tooltip_1.Tooltip, { className: `copy-button ${className ? className : ''}`, tip: translate('codeSnippet.copy.buttonText', toasterText || 'Copied!'), isOpen: tooltip.isOpened, placement: toasterPlacement, width: "fit-content" },
50
- react_1.default.createElement(Button_1.Button, { "data-component-name": "Buttons/CopyButton", onClick: (e) => copy(e, toasterDuration), "data-testid": dataTestId, icon: type === 'icon' || type === 'compound' ? react_1.default.createElement(CopyIcon_1.CopyIcon, null) : undefined, size: size, variant: variant, disabled: disabled, fullWidth: fullWidth, tone: tone, extraClass: extraClass }, (type === 'text' || type === 'compound') &&
51
- translate('codeSnippet.copy.toasterText', buttonText || 'Copy'))));
50
+ react_1.default.createElement(Button_1.Button, { "data-component-name": "Buttons/CopyButton", onClick: (e) => copy(e, toasterDuration), "data-testid": dataTestId, icon: type === 'icon' || type === 'compound' ? react_1.default.createElement(CopyIcon_1.CopyIcon, null) : undefined, size: size, variant: variant, disabled: disabled, fullWidth: fullWidth, tone: tone, extraClass: extraClass, iconPosition: iconPosition }, (type === 'text' || type === 'compound') &&
51
+ (buttonText || translate('codeSnippet.copy.toasterText', 'Copy')))));
52
52
  }
53
53
  exports.CopyButton = (0, react_1.memo)(CopyButtonComponent);
54
54
  //# sourceMappingURL=CopyButton.js.map
@@ -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;
@@ -18,19 +18,34 @@ const FilterInput_1 = require("../../components/Filter/FilterInput");
18
18
  const CatalogViewModeToggle_1 = require("../../components/Catalog/CatalogViewModeToggle");
19
19
  const CatalogSortButton_1 = require("../../components/Catalog/CatalogSortButton");
20
20
  const CatalogEntities_1 = require("../../components/Catalog/CatalogEntities");
21
+ const customCatalogOptionsCasing = (str) => {
22
+ if (!str)
23
+ return str;
24
+ const words = str.split(/[\s-_]+/);
25
+ return words
26
+ .map((word, index) => {
27
+ if (index === 0 && word.toLowerCase() === 'api') {
28
+ return 'API';
29
+ }
30
+ return word[0].toUpperCase() + word.slice(1);
31
+ })
32
+ .join(' ');
33
+ };
21
34
  function Catalog(props) {
22
- const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems } = props;
35
+ const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems, initialViewMode, } = props;
23
36
  const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
24
37
  const { translate } = useTranslate();
25
- 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);
26
39
  return (react_1.default.createElement(react_1.default.Fragment, null,
27
40
  react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/Catalog" },
28
- 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: "sentence" }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
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 }) }),
29
42
  react_1.default.createElement(CatalogPageContent, null,
30
43
  react_1.default.createElement(CatalogPageDescription, null,
31
44
  react_1.default.createElement(CatalogTitleWrapper, null,
32
45
  react_1.default.createElement(CatalogTitle, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey },
33
- translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey),
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,
34
49
  ' '),
35
50
  react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, entitiesCounter)),
36
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))),
@@ -113,7 +128,6 @@ const CatalogPageWrapper = styled_components_1.default.div `
113
128
  }
114
129
  `;
115
130
  const CatalogPageDescription = styled_components_1.default.div `
116
- margin: var(--catalog-heading-margin);
117
131
  display: var(--catalog-page-description-display-mobile);
118
132
 
119
133
  @media screen and (min-width: ${utils_1.breakpoints.medium}) {
@@ -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);
@@ -1,6 +1,7 @@
1
1
  import { JSX } from 'react';
2
+ import type { ListType } from '../../core/types';
2
3
  interface CatalogEntitiesEmptyStateProps {
3
- listType?: 'default' | 'team';
4
+ listType?: ListType;
4
5
  }
5
6
  export declare function CatalogEntitiesEmptyState({ listType, }: CatalogEntitiesEmptyStateProps): JSX.Element;
6
7
  export {};
@@ -7,21 +7,42 @@ exports.CatalogEntitiesEmptyState = CatalogEntitiesEmptyState;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const HexagonIcon_1 = require("../../icons/HexagonIcon/HexagonIcon");
10
- function CatalogEntitiesEmptyState({ listType = 'default', }) {
11
- if (listType === 'team') {
12
- return (react_1.default.createElement(EmptyStateWrapper, { "data-component-name": "Catalog/CatalogEntitiesEmptyState" },
13
- react_1.default.createElement(EmptyStateIconWrapper, null,
14
- react_1.default.createElement(HexagonIcon_1.HexagonIcon, { size: "21px", color: "var(--color-warm-grey-7)" })),
15
- react_1.default.createElement(EmptyStateHeader, null, "No team members yet"),
16
- react_1.default.createElement(EmptyStateText, null, "Your team members will appear here"),
17
- react_1.default.createElement(EmptyStateText, null, "once they've been added to the team.")));
10
+ const getEmptyStateContent = (listType) => {
11
+ switch (listType) {
12
+ case 'team':
13
+ return {
14
+ header: 'No team members yet',
15
+ paragraph1: 'Your team members will appear here',
16
+ paragraph2: "once they've been added to the team.",
17
+ };
18
+ case 'api-operation':
19
+ return {
20
+ header: 'No operations yet',
21
+ paragraph1: 'Your operations will appear here',
22
+ paragraph2: "once they've been added to the API description.",
23
+ };
24
+ case 'data-schema':
25
+ return {
26
+ header: 'No schemas yet',
27
+ paragraph1: 'Your schemas will appear here',
28
+ paragraph2: "once they've been added to the API description.",
29
+ };
30
+ default:
31
+ return {
32
+ header: 'No entities found',
33
+ paragraph1: 'Try adjusting your search criteria or',
34
+ paragraph2: 'check back later for new additions.',
35
+ };
18
36
  }
37
+ };
38
+ function CatalogEntitiesEmptyState({ listType = 'default', }) {
39
+ const { header, paragraph1, paragraph2 } = getEmptyStateContent(listType);
19
40
  return (react_1.default.createElement(EmptyStateWrapper, { "data-component-name": "Catalog/CatalogEntitiesEmptyState" },
20
41
  react_1.default.createElement(EmptyStateIconWrapper, null,
21
42
  react_1.default.createElement(HexagonIcon_1.HexagonIcon, { size: "21px", color: "var(--color-warm-grey-7)" })),
22
- react_1.default.createElement(EmptyStateHeader, null, "No entities found"),
23
- react_1.default.createElement(EmptyStateText, null, "Try adjusting your search criteria or"),
24
- react_1.default.createElement(EmptyStateText, null, "check back later for new additions.")));
43
+ react_1.default.createElement(EmptyStateHeader, null, header),
44
+ react_1.default.createElement(EmptyStateText, null, paragraph1),
45
+ react_1.default.createElement(EmptyStateText, null, paragraph2)));
25
46
  }
26
47
  const EmptyStateWrapper = styled_components_1.default.div `
27
48
  display: flex;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
3
- import type { BffCatalogEntity, BffCatalogRelatedEntityList } from '../../../core/types';
4
2
  export type CatalogEntityProps = {
5
- entity: BffCatalogEntity;
6
- entitiesCatalogConfig: EntitiesCatalogConfig;
7
- catalogConfig: CatalogEntityConfig;
8
- initialRelations: BffCatalogRelatedEntityList;
3
+ RedocSchema: React.ComponentType<any>;
4
+ StoreProvider: React.ComponentType<any>;
5
+ GraphqlTypeRenderer?: React.ComponentType<{
6
+ sdl: string;
7
+ typeName: string;
8
+ }>;
9
9
  };
10
- export declare function CatalogEntity({ entity, entitiesCatalogConfig, catalogConfig, initialRelations, }: CatalogEntityProps): React.JSX.Element;
10
+ export declare function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntityProps): React.JSX.Element;
@@ -18,20 +18,25 @@ const hooks_1 = require("../../../core/hooks");
18
18
  const CatalogEntitySchema_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntitySchema");
19
19
  const CatalogEntityMethodAndPath_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityMethodAndPath");
20
20
  const CatalogEntityRelationsGraph_lazy_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy");
21
- const renderEntityContent = (entity) => {
21
+ const renderFirstColumnEntitySection = (entity) => {
22
22
  switch (entity.type) {
23
- case 'data-schema':
24
- return react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity });
25
23
  case 'api-operation':
26
24
  return react_1.default.createElement(CatalogEntityMethodAndPath_1.CatalogEntityMethodAndPath, { entity: entity });
27
25
  default:
28
26
  return react_1.default.createElement(CatalogEntityMetadata_1.CatalogEntityMetadata, { entity: entity });
29
27
  }
30
28
  };
31
- function CatalogEntity({ entity, entitiesCatalogConfig, catalogConfig, initialRelations, }) {
29
+ const renderDataSchemaSection = (entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer) => {
30
+ if (entity.type !== 'data-schema') {
31
+ return null;
32
+ }
33
+ return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, RedocSchema: RedocSchema, StoreProvider: StoreProvider, GraphqlTypeRenderer: GraphqlTypeRenderer }));
34
+ };
35
+ function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
32
36
  var _a;
33
- const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
37
+ const { useTranslate, useCatalog, usePageProps } = (0, hooks_1.useThemeHooks)();
34
38
  const { translate } = useTranslate();
39
+ const { entity, relations, catalogConfig, entitiesCatalogConfig, relatedEntity } = usePageProps();
35
40
  const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
36
41
  const linkToMainCatalogLabel = translate(catalogConfig.titleTranslationKey);
37
42
  const { searchQuery, setSearchQuery } = useCatalog();
@@ -47,10 +52,11 @@ function CatalogEntity({ entity, entitiesCatalogConfig, catalogConfig, initialRe
47
52
  react_1.default.createElement(react_router_dom_1.Route, { index: true, element: react_1.default.createElement(react_1.default.Fragment, null,
48
53
  react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
49
54
  react_1.default.createElement(CatalogEntityProperties_1.CatalogEntityProperties, { entity: entity }),
55
+ renderDataSchemaSection(entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer),
50
56
  react_1.default.createElement(CatalogTwoColumnsSection, null,
51
- renderEntityContent(entity),
57
+ renderFirstColumnEntitySection(entity),
52
58
  react_1.default.createElement(CatalogEntityLinks_1.CatalogEntityLinks, { entity: entity })),
53
- react_1.default.createElement(CatalogEntityRelations_1.CatalogEntityRelations, { entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, initialRelations: initialRelations, searchQuery: searchQuery, setSearchQuery: setSearchQuery })) }),
59
+ react_1.default.createElement(CatalogEntityRelations_1.CatalogEntityRelations, { entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, initialRelations: relations, searchQuery: searchQuery, setSearchQuery: setSearchQuery })) }),
54
60
  react_1.default.createElement(react_router_dom_1.Route, { path: "relations-graph", element: react_1.default.createElement(CatalogEntityRelationsGraph_lazy_1.CatalogEntityRelationsGraph, { entity: entity }) })))))));
55
61
  }
56
62
  const CatalogPageWrapper = styled_components_1.default.div `
@@ -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;
@@ -58,12 +58,12 @@ function renderMetadataValue(value) {
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, metadataToShow = __rest(_a, ["schema"]);
62
- const metadata = Object.entries(metadataToShow);
61
+ const _a = entity.metadata || {}, { schema, sdl } = _a, metadata = __rest(_a, ["schema", "sdl"]);
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
- const hasMoreItems = metadata.length > MAX_INITIAL_ITEMS;
65
- const visibleMetadata = isOn ? metadata : metadata.slice(0, MAX_INITIAL_ITEMS);
66
- if (!metadata.length) {
64
+ const hasMoreItems = metadataToShow.length > MAX_INITIAL_ITEMS;
65
+ const visibleMetadata = isOn ? metadataToShow : metadataToShow.slice(0, MAX_INITIAL_ITEMS);
66
+ if (!metadataToShow.length) {
67
67
  return null;
68
68
  }
69
69
  return (react_1.default.createElement(MetadataWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityMetadata" },
@@ -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;
@@ -101,7 +100,7 @@ const ArrayWrapper = styled_components_1.default.div `
101
100
  flex-direction: column;
102
101
  `;
103
102
  const Heading = styled_components_1.default.h2 `
104
- margin-bottom: var(--spacing-base);
103
+ margin-bottom: var(--spacing-sm);
105
104
  margin-top: 0;
106
105
  font-size: var(--catalog-metadata-heading-size);
107
106
  `;
@@ -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;
@@ -9,7 +9,6 @@ const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const EntityTypeProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty");
10
10
  const GitProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty");
11
11
  const TagsProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty");
12
- const ApiDescriptionProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty");
13
12
  const UserEmailProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty");
14
13
  const DomainsProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty");
15
14
  const OwnersProperty_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty");
@@ -41,11 +40,6 @@ const propertyRenderers = [
41
40
  condition: (entity) => { var _a; return !!((_a = entity.tags) === null || _a === void 0 ? void 0 : _a.length); },
42
41
  component: TagsProperty_1.TagsProperty,
43
42
  },
44
- {
45
- key: 'api-description',
46
- condition: (entity) => { var _a; return entity.type === 'api-description' && !!((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.descriptionFile); },
47
- component: ApiDescriptionProperty_1.ApiDescriptionProperty,
48
- },
49
43
  {
50
44
  key: 'user-email',
51
45
  condition: (entity) => { var _a; return entity.type === 'user' && !!((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.email); },
@@ -63,13 +57,15 @@ const propertyRenderers = [
63
57
  },
64
58
  ];
65
59
  function CatalogEntityProperties({ entity }) {
66
- return (react_1.default.createElement(CatalogEntityPropertiesGridWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties" }, propertyRenderers
67
- .filter((renderer) => renderer.condition(entity))
68
- .map((renderer) => (react_1.default.createElement(renderer.component, { key: renderer.key + entity.id, entity: entity })))));
60
+ const renderers = propertyRenderers.filter((renderer) => renderer.condition(entity));
61
+ const gridTemplateColumns = [1, 2, 4].includes(renderers.length)
62
+ ? 'repeat(2, 1fr)'
63
+ : 'repeat(3, 1fr)';
64
+ return (react_1.default.createElement(CatalogEntityPropertiesGridWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties", gridTemplateColumns: gridTemplateColumns }, renderers.map((renderer) => (react_1.default.createElement(renderer.component, { key: renderer.key + entity.id, entity: entity })))));
69
65
  }
70
66
  const CatalogEntityPropertiesGridWrapper = styled_components_1.default.div `
71
67
  display: grid;
72
- grid-template-columns: repeat(auto-fill, minmax(325px, 1fr));
68
+ grid-template-columns: ${({ gridTemplateColumns }) => gridTemplateColumns};
73
69
  gap: var(--spacing-base);
74
70
  `;
75
71
  //# sourceMappingURL=CatalogEntityProperties.js.map
@@ -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);
@@ -14,6 +14,10 @@ function ContactProperty({ entity }) {
14
14
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty" },
15
15
  react_1.default.createElement(CatalogEntityPropertyCard_1.CatalogEntityPropertyCard, { header: react_1.default.createElement(react_1.default.Fragment, null,
16
16
  react_1.default.createElement(SlackIcon_1.SlackIcon, null),
17
- "Slack channels"), content: react_1.default.createElement(react_1.default.Fragment, null, channels === null || channels === void 0 ? void 0 : channels.map((channel) => (react_1.default.createElement(Tag_1.Tag, { key: channel.name, textTransform: "none", style: { backgroundColor: 'var(--bg-color)' } }, channel.name)))) })));
17
+ "Slack channels"), content: react_1.default.createElement(react_1.default.Fragment, null, channels === null || channels === void 0 ? void 0 : channels.map((channel) => (react_1.default.createElement(Tag_1.Tag, { key: channel.name, textTransform: "none", style: { backgroundColor: 'var(--bg-color)', cursor: 'pointer' }, onClick: () => {
18
+ if (channel.url) {
19
+ window.open(channel.url, '_blank');
20
+ }
21
+ } }, channel.name)))) })));
18
22
  }
19
23
  //# sourceMappingURL=ContactProperty.js.map
@@ -0,0 +1,23 @@
1
+ import { JSX } from 'react';
2
+ import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
3
+ import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '../../../../core/types';
4
+ export type CatalogEntityApiDescriptionRelationsProps = {
5
+ entity: BffCatalogEntity;
6
+ catalogConfig: CatalogEntityConfig;
7
+ entitiesCatalogConfig: EntitiesCatalogConfig;
8
+ relations: BffCatalogRelatedEntity[];
9
+ query: {
10
+ fetchNextPage: () => void;
11
+ isFetchingNextPage: boolean;
12
+ hasNextPage: boolean;
13
+ };
14
+ searchQuery: string;
15
+ setSearchQuery: (query: string) => void;
16
+ setFilter: (filter?: string) => void;
17
+ sortOption: SortOption | null;
18
+ setSortOption: (sortOption: SortOption | null) => void;
19
+ handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
20
+ isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
21
+ shouldShowLoadMore: boolean;
22
+ };
23
+ export declare function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }: CatalogEntityApiDescriptionRelationsProps): JSX.Element;
@@ -0,0 +1,27 @@
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.CatalogEntityApiDescriptionRelations = CatalogEntityApiDescriptionRelations;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const Tabs_1 = require("../../../../markdoc/components/Tabs/Tabs");
10
+ const EntityTypeIcon_1 = require("../../../../icons/EntityTypeIcon/EntityTypeIcon");
11
+ const CatalogEntityDefaultRelations_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations");
12
+ const MoleculesIcon_1 = require("../../../../icons/MoleculesIcon/MoleculesIcon");
13
+ const NetworkIcon_1 = require("../../../../icons/NetworkIcon/NetworkIcon");
14
+ function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
15
+ return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
16
+ react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
17
+ react_1.default.createElement(TabItem, { label: "Operations", icon: react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, null), onClick: () => setFilter('type:api-operation') },
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
+ react_1.default.createElement(TabItem, { label: "Schemas", icon: react_1.default.createElement(NetworkIcon_1.NetworkIcon, null), onClick: () => setFilter('type:data-schema') },
20
+ react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "schemas-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: "data-schema" })),
21
+ react_1.default.createElement(TabItem, { label: "Related entities", icon: react_1.default.createElement(EntityTypeIcon_1.EntityTypeIcon, null), onClick: () => setFilter('-type:api-operation,data-schema') },
22
+ react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "related-entities-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 })))));
23
+ }
24
+ const TabItem = styled_components_1.default.div `
25
+ padding: var(--spacing-sm);
26
+ `;
27
+ //# sourceMappingURL=CatalogEntityApiDescriptionRelations.js.map
@@ -1,5 +1,6 @@
1
1
  import { JSX } from 'react';
2
2
  import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
3
+ import type { ListType } from '../../../../core/types';
3
4
  import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '../../../../core/types';
4
5
  export type CatalogEntityDefaultRelationsProps = {
5
6
  entity: BffCatalogEntity;
@@ -12,12 +13,12 @@ export type CatalogEntityDefaultRelationsProps = {
12
13
  };
13
14
  searchQuery: string;
14
15
  setSearchQuery: (query: string) => void;
15
- setFilter: (filter: string) => void;
16
16
  sortOption: SortOption | null;
17
17
  setSortOption: (sortOption: SortOption | null) => void;
18
18
  handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
19
19
  isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
20
20
  shouldShowLoadMore: boolean;
21
21
  shouldShowHeading?: boolean;
22
+ listType?: ListType;
22
23
  };
23
- export declare function CatalogEntityDefaultRelations({ entity, relations, query, searchQuery, setSearchQuery, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, shouldShowHeading, }: CatalogEntityDefaultRelationsProps): JSX.Element;
24
+ export declare function CatalogEntityDefaultRelations({ entity, relations, query, searchQuery, setSearchQuery, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, shouldShowHeading, listType, }: CatalogEntityDefaultRelationsProps): JSX.Element;
@@ -33,8 +33,8 @@ const columns = [
33
33
  width: '1fr',
34
34
  },
35
35
  ];
36
- function CatalogEntityDefaultRelations({ entity, relations, query, searchQuery, setSearchQuery, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, shouldShowHeading = true, }) {
36
+ function CatalogEntityDefaultRelations({ entity, relations, query, searchQuery, setSearchQuery, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, shouldShowHeading = true, listType, }) {
37
37
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations" },
38
- react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { entity: entity, catalogConfig: catalogConfig, entitiesCatalogConfig: entitiesCatalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, heading: shouldShowHeading ? 'Related entities' : undefined, columns: columns, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore })));
38
+ react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { entity: entity, catalogConfig: catalogConfig, entitiesCatalogConfig: entitiesCatalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, heading: shouldShowHeading ? 'Related entities' : undefined, columns: columns, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: listType })));
39
39
  }
40
40
  //# sourceMappingURL=CatalogEntityDefaultRelations.js.map
@@ -28,19 +28,25 @@ const react_1 = __importStar(require("react"));
28
28
  const hooks_1 = require("../../../../core/hooks");
29
29
  const CatalogEntityDefaultRelations_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations");
30
30
  const CatalogEntityTeamRelations_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations");
31
+ const CatalogEntityApiDescriptionRelations_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations");
31
32
  const LOAD_MORE_THRESHOLD = 10;
32
33
  const ENTITY_DEFAULT_FILTERS = {
33
34
  team: 'type:user',
35
+ 'api-description': 'type:api-operation',
34
36
  };
35
37
  function CatalogEntityRelations({ entity, entitiesCatalogConfig, initialRelations, catalogConfig, searchQuery, setSearchQuery, }) {
36
38
  const { useCatalogSort, useFetchCatalogEntitiesRelations } = (0, hooks_1.useThemeHooks)();
37
39
  const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
38
- const [filter, setFilter] = (0, react_1.useState)();
40
+ const [filter, setFilter] = (0, react_1.useState)(ENTITY_DEFAULT_FILTERS[entity.type]);
41
+ (0, react_1.useEffect)(() => {
42
+ setFilter(ENTITY_DEFAULT_FILTERS[entity.key]);
43
+ }, [entity.key]);
39
44
  const { items: relations, query } = useFetchCatalogEntitiesRelations({
40
45
  entityKey: entity.key,
41
46
  search: searchQuery,
42
47
  sort: sortOption !== null && sortOption !== void 0 ? sortOption : undefined,
43
48
  filter: filter !== null && filter !== void 0 ? filter : ENTITY_DEFAULT_FILTERS[entity.type],
49
+ limit: 10,
44
50
  }, initialRelations);
45
51
  const shouldShowLoadMore = query.hasNextPage ||
46
52
  (query.isPlaceholderData && relations && relations.length >= LOAD_MORE_THRESHOLD);
@@ -48,9 +54,12 @@ function CatalogEntityRelations({ entity, entitiesCatalogConfig, initialRelation
48
54
  case 'team':
49
55
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityTeamRelations" },
50
56
  react_1.default.createElement(CatalogEntityTeamRelations_1.CatalogEntityTeamRelations, { entity: entity, catalogConfig: catalogConfig, entitiesCatalogConfig: entitiesCatalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, setFilter: setFilter, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore })));
57
+ case 'api-description':
58
+ return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
59
+ react_1.default.createElement(CatalogEntityApiDescriptionRelations_1.CatalogEntityApiDescriptionRelations, { entity: entity, catalogConfig: catalogConfig, entitiesCatalogConfig: entitiesCatalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, setFilter: setFilter, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore })));
51
60
  default:
52
61
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityDefaultRelations" },
53
- react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { entity: entity, catalogConfig: catalogConfig, entitiesCatalogConfig: entitiesCatalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, setFilter: setFilter, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore })));
62
+ react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { entity: entity, catalogConfig: catalogConfig, entitiesCatalogConfig: entitiesCatalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore })));
54
63
  }
55
64
  }
56
65
  //# sourceMappingURL=CatalogEntityRelations.js.map
@@ -1,5 +1,6 @@
1
1
  import { JSX } from 'react';
2
2
  import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
3
+ import type { ListType } from '../../../../core/types';
3
4
  import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '../../../../core/types';
4
5
  import { CatalogColumn } from '../../../../components/Catalog/CatalogTableView/CatalogTableView';
5
6
  export type CatalogEntityRelationsTableProps = {
@@ -20,6 +21,6 @@ export type CatalogEntityRelationsTableProps = {
20
21
  handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
21
22
  isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
22
23
  shouldShowLoadMore: boolean;
23
- listType?: 'default' | 'team';
24
+ listType?: ListType;
24
25
  };
25
26
  export declare function CatalogEntityRelationsTable({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, setSearchQuery, heading, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }: CatalogEntityRelationsTableProps): JSX.Element;
@@ -7,7 +7,7 @@ exports.CatalogEntityRelationsTable = CatalogEntityRelationsTable;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const CatalogActionsRow_1 = require("../../../../components/Catalog/CatalogActionsRow");
10
- const CatalogEntityRelationsTableContent_1 = require("./CatalogEntityRelationsTableContent");
10
+ const CatalogEntityRelationsTableContent_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent");
11
11
  function CatalogEntityRelationsTable({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, setSearchQuery, heading, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }) {
12
12
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable" },
13
13
  heading && react_1.default.createElement(Heading, null, heading),
@@ -1,5 +1,6 @@
1
1
  import { JSX } from 'react';
2
2
  import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
3
+ import type { ListType } from '../../../../core/types';
3
4
  import { BffCatalogRelatedEntity, SortOption } from '../../../../core/types';
4
5
  import { CatalogColumn } from '../../../../components/Catalog/CatalogTableView/CatalogTableView';
5
6
  export type CatalogEntityRelationsTableContentProps = {
@@ -17,6 +18,6 @@ export type CatalogEntityRelationsTableContentProps = {
17
18
  handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
18
19
  isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
19
20
  shouldShowLoadMore: boolean;
20
- listType?: 'default' | 'team';
21
+ listType?: ListType;
21
22
  };
22
23
  export declare function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }: CatalogEntityRelationsTableContentProps): JSX.Element;