@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
@@ -13,7 +13,6 @@ const Tag_1 = require("../../../../components/Tag/Tag");
13
13
  const CatalogEntityRelationsTable_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable");
14
14
  const CatalogUserEntityCell_1 = require("../../../../components/Catalog/CatalogTableView/CatalogUserEntityCell");
15
15
  const CatalogEntityDefaultRelations_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations");
16
- const CatalogEntityRelationCell_1 = require("../../../../components/Catalog/CatalogTableView/CatalogEntityRelationCell");
17
16
  const teamColumns = [
18
17
  {
19
18
  key: 'entity',
@@ -32,11 +31,6 @@ const teamColumns = [
32
31
  render: (entity) => { var _a, _b; return (((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.role) ? react_1.default.createElement(Tag_1.Tag, null, (_b = entity.metadata) === null || _b === void 0 ? void 0 : _b.role) : null); },
33
32
  width: '2fr',
34
33
  },
35
- {
36
- key: 'relationType',
37
- title: 'Relations',
38
- render: (entity) => (react_1.default.createElement(CatalogEntityRelationCell_1.CatalogEntityRelationCell, { relationType: entity.relationType, relationRole: entity.relationRole })),
39
- },
40
34
  {
41
35
  key: 'description',
42
36
  title: 'Description',
@@ -50,10 +44,10 @@ function CatalogEntityTeamRelations({ entity, relations, query, searchQuery, set
50
44
  react_1.default.createElement(TabItem, { label: "Members", icon: react_1.default.createElement(PeopleIcon_1.PeopleIcon, null), onClick: () => setFilter('type:user') },
51
45
  react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { key: "members-table", entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, columns: teamColumns, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: "team" })),
52
46
  react_1.default.createElement(TabItem, { label: "Related entities", icon: react_1.default.createElement(EntityTypeIcon_1.EntityTypeIcon, null), onClick: () => setFilter('-type:user') },
53
- react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "related-entities-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, setFilter: setFilter, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false })))));
47
+ 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 })))));
54
48
  }
55
49
  const TabItem = styled_components_1.default.div `
56
- padding: 12px;
50
+ padding: var(--spacing-sm);
57
51
  `;
58
52
  const EntityDescription = styled_components_1.default.div `
59
53
  font-size: var(--catalog-table-entity-summary-font-size);
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
- import { BffCatalogEntity } from '../../../core/types';
2
+ import { BffCatalogEntity, BffCatalogRelatedEntity } from '../../../core/types';
3
3
  export type CatalogEntitySchemaProps = {
4
4
  entity: BffCatalogEntity;
5
+ relatedEntity: BffCatalogRelatedEntity | null;
6
+ RedocSchema: React.ComponentType<any>;
7
+ StoreProvider: React.ComponentType<any>;
8
+ GraphqlTypeRenderer?: React.ComponentType<{
9
+ sdl: string;
10
+ typeName: string;
11
+ }>;
5
12
  };
6
- export declare function CatalogEntitySchema({ entity }: CatalogEntitySchemaProps): React.JSX.Element | null;
13
+ export declare function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntitySchemaProps): React.JSX.Element;
@@ -1,14 +1,26 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
12
24
  };
13
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -17,39 +29,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
29
  exports.CatalogEntitySchema = CatalogEntitySchema;
18
30
  const react_1 = __importDefault(require("react"));
19
31
  const styled_components_1 = __importDefault(require("styled-components"));
32
+ const Sampler = __importStar(require("openapi-sampler"));
20
33
  const hooks_1 = require("../../../core/hooks");
34
+ const useCatalogEntitySchema_1 = require("../../../core/hooks/catalog/useCatalogEntitySchema");
21
35
  const JsonViewer_1 = require("../../../components/JsonViewer/JsonViewer");
22
- function CatalogEntitySchema({ entity }) {
36
+ const CopyButton_1 = require("../../../components/Buttons/CopyButton");
37
+ function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
38
+ var _a, _b;
23
39
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
24
40
  const { translate } = useTranslate();
25
- const _a = entity.metadata || {}, { schema } = _a, metadataToShow = __rest(_a, ["schema"]);
26
- const metadata = Object.entries(metadataToShow);
27
- if (!metadata.length) {
28
- return null;
29
- }
30
- let parsedSchema;
31
- try {
32
- parsedSchema = JSON.parse(schema);
33
- }
34
- catch (error) {
35
- return null;
36
- }
41
+ const { definition, parsedSchema, rawSchema } = (0, useCatalogEntitySchema_1.useCatalogEntitySchema)({ entity, relatedEntity });
42
+ const isGraphql = ((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.specType) === 'graphql';
43
+ const graphqlSDL = (_b = entity === null || entity === void 0 ? void 0 : entity.metadata) === null || _b === void 0 ? void 0 : _b.sdl;
37
44
  return (react_1.default.createElement(MetadataWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityMetadata" },
38
- react_1.default.createElement(Heading, null, translate('catalog.entity.metadata.title')),
39
- react_1.default.createElement(JsonViewer_1.JsonViewer, { data: parsedSchema, expandLevel: 3, title: "JSON" })));
45
+ react_1.default.createElement(HeaderWrapper, null,
46
+ react_1.default.createElement(Heading, null, translate('catalog.entity.schema.title')),
47
+ !isGraphql && (react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium" }))),
48
+ react_1.default.createElement(SplitViewWrapper, null,
49
+ react_1.default.createElement(SchemaContentWrapper, null, isGraphql && graphqlSDL && GraphqlTypeRenderer ? (react_1.default.createElement(GraphqlTypeRenderer, { sdl: graphqlSDL, typeName: entity.title })) : (react_1.default.createElement(StoreProvider, { definition: definition },
50
+ react_1.default.createElement(RedocSchema, { schema: parsedSchema })))),
51
+ !isGraphql && (react_1.default.createElement(SchemaSampleWrapper, null,
52
+ react_1.default.createElement(JsonViewer_1.JsonViewer, { data: Sampler.sample(Object.assign({}, parsedSchema)), expandLevel: 3, hideHeader: false }))))));
40
53
  }
41
54
  const MetadataWrapper = styled_components_1.default.div `
42
55
  display: flex;
43
56
  flex-direction: column;
44
- gap: var(--spacing-xs);
45
57
  border-radius: var(--border-radius);
46
58
  background-color: var(--catalog-metadata-bg-color);
47
- transition: all 0.2s ease-in-out;
48
- margin: var(--spacing-lg) 0;
59
+ margin-top: var(--spacing-base);
60
+ margin-bottom: var(--spacing-xs);
61
+ `;
62
+ const SchemaContentWrapper = styled_components_1.default.div `
63
+ flex: 1;
64
+ & > div > div {
65
+ padding-left: 0;
66
+ padding-top: 0;
67
+ }
68
+ `;
69
+ const HeaderWrapper = styled_components_1.default.div `
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: space-between;
73
+ gap: var(--spacing-sm);
49
74
  `;
50
75
  const Heading = styled_components_1.default.h2 `
51
- margin-bottom: var(--spacing-base);
52
- margin-top: 0;
53
76
  font-size: var(--catalog-metadata-heading-size);
54
77
  `;
78
+ const SplitViewWrapper = styled_components_1.default.div `
79
+ display: flex;
80
+ justify-content: space-between;
81
+ align-items: flex-start;
82
+ gap: var(--spacing-base);
83
+ `;
84
+ const SchemaSampleWrapper = styled_components_1.default.div `
85
+ flex: 1;
86
+ position: sticky;
87
+ top: calc(var(--navbar-height) + var(--spacing-md));
88
+ align-self: flex-start;
89
+ padding-top: var(--spacing-sm);
90
+ `;
55
91
  //# sourceMappingURL=CatalogEntitySchema.js.map
@@ -1,7 +1,9 @@
1
1
  import { JSX } from 'react';
2
+ import { UiAccessibleConfig } from '@redocly/config';
2
3
  export type CatalogEntityIconProps = {
3
4
  entityType: string;
4
5
  defaultColor?: boolean;
5
6
  forceColor?: string;
7
+ entitiesCatalogConfig?: UiAccessibleConfig['entitiesCatalog'];
6
8
  };
7
9
  export declare function CatalogEntityIcon({ entityType, defaultColor, forceColor, }: CatalogEntityIconProps): JSX.Element;
@@ -9,24 +9,41 @@ const CodeIcon_1 = require("../../icons/CodeIcon/CodeIcon");
9
9
  const GraphIcon_1 = require("../../icons/GraphIcon/GraphIcon");
10
10
  const PeopleIcon_1 = require("../../icons/PeopleIcon/PeopleIcon");
11
11
  const UserIcon_1 = require("../../icons/UserIcon/UserIcon");
12
- const NetworkIcon_1 = require("../../icons/NetworkIcon/NetworkIcon");
13
12
  const MoleculesIcon_1 = require("../../icons/MoleculesIcon/MoleculesIcon");
13
+ const HierarchyIcon_1 = require("../../icons/HierarchyIcon/HierarchyIcon");
14
+ const Image_1 = require("../../components/Image/Image");
15
+ const core_1 = require("../../core");
16
+ const NoteIcon_1 = require("../../icons/NoteIcon/NoteIcon");
14
17
  const getIconColor = (entityType) => `var(--catalog-entity-icon-color-${entityType})`;
15
- const getEntityIcon = ({ entityType, defaultColor, forceColor }) => {
16
- const iconColor = forceColor !== null && forceColor !== void 0 ? forceColor : (defaultColor ? `var(--catalog-entity-icon-color)` : getIconColor(entityType));
17
- const entityIconMap = {
18
- service: react_1.default.createElement(CodeIcon_1.CodeIcon, { color: iconColor }),
19
- domain: react_1.default.createElement(GraphIcon_1.GraphIcon, { color: iconColor }),
20
- team: react_1.default.createElement(PeopleIcon_1.PeopleIcon, { color: iconColor }),
21
- user: react_1.default.createElement(UserIcon_1.UserIcon, { color: iconColor }),
22
- 'api-description': react_1.default.createElement(CodeIcon_1.CodeIcon, { color: iconColor }),
23
- 'data-schema': react_1.default.createElement(NetworkIcon_1.NetworkIcon, { color: iconColor }),
24
- 'api-operation': react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, { color: iconColor }),
25
- };
26
- return entityIconMap[entityType];
18
+ const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogConfig, }) => {
19
+ var _a, _b;
20
+ if (core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)) {
21
+ const iconColor = forceColor !== null && forceColor !== void 0 ? forceColor : (defaultColor ? `var(--catalog-entity-icon-color)` : getIconColor(entityType));
22
+ const entityIconMap = {
23
+ service: react_1.default.createElement(CodeIcon_1.CodeIcon, { color: iconColor }),
24
+ domain: react_1.default.createElement(GraphIcon_1.GraphIcon, { color: iconColor }),
25
+ team: react_1.default.createElement(PeopleIcon_1.PeopleIcon, { color: iconColor }),
26
+ user: react_1.default.createElement(UserIcon_1.UserIcon, { color: iconColor }),
27
+ 'api-description': react_1.default.createElement(NoteIcon_1.NoteIcon, { color: iconColor }),
28
+ 'data-schema': react_1.default.createElement(HierarchyIcon_1.HierarchyIcon, { color: iconColor }),
29
+ 'api-operation': react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, { color: iconColor }),
30
+ };
31
+ return entityIconMap[entityType];
32
+ }
33
+ const iconConfig = (_b = (_a = entitiesCatalogConfig === null || entitiesCatalogConfig === void 0 ? void 0 : entitiesCatalogConfig.entityTypes) === null || _a === void 0 ? void 0 : _a[entityType]) === null || _b === void 0 ? void 0 : _b.icon;
34
+ if ((iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src) || (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet)) {
35
+ return (react_1.default.createElement(Image_1.Image, { src: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src, srcSet: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet, alt: `${entityType} icon`, width: "16", height: "16" }));
36
+ }
37
+ return react_1.default.createElement(CodeIcon_1.CodeIcon, { color: "var(--catalog-entity-icon-color)" }); // @TODO: add default icon
27
38
  };
28
39
  function CatalogEntityIcon({ entityType, defaultColor = false, forceColor, }) {
29
- const icon = getEntityIcon({ entityType, defaultColor, forceColor });
40
+ const themeConfig = (0, core_1.useThemeConfig)();
41
+ const icon = getEntityIcon({
42
+ entityType,
43
+ defaultColor,
44
+ forceColor,
45
+ entitiesCatalogConfig: themeConfig.entitiesCatalog,
46
+ });
30
47
  if (!icon) {
31
48
  throw new Error(`Unhandled entity type: ${entityType}`);
32
49
  }
@@ -7,6 +7,7 @@ exports.CatalogEntityTypeIcon = CatalogEntityTypeIcon;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const CatalogEntityIcon_1 = require("../../components/Catalog/CatalogEntityIcon");
10
+ const core_1 = require("../../core");
10
11
  function CatalogEntityTypeIcon({ entityType, defaultColor = false, }) {
11
12
  return (react_1.default.createElement(IconContainer, { "data-component-name": "Catalog/CatalogEntityTypeIcon", entityType: entityType, defaultColor: defaultColor },
12
13
  react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entityType, defaultColor: defaultColor })));
@@ -18,13 +19,25 @@ const IconContainer = styled_components_1.default.div `
18
19
  width: var(--catalog-table-icon-width);
19
20
  height: var(--catalog-table-icon-height);
20
21
  border-radius: var(--catalog-table-icon-border-radius);
21
- background-color: ${({ defaultColor, entityType }) => defaultColor
22
- ? 'var(--catalog-entity-bg-color)'
23
- : `var(--catalog-entity-bg-color-${entityType})`};
22
+ background-color: ${({ defaultColor, entityType }) => {
23
+ if (defaultColor) {
24
+ return 'var(--catalog-entity-bg-color)';
25
+ }
26
+ if (core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)) {
27
+ return `var(--catalog-entity-bg-color-${entityType})`;
28
+ }
29
+ return 'var(--catalog-entity-bg-color-custom)';
30
+ }};
24
31
  flex-shrink: 0;
25
32
  border: 1px solid
26
- ${({ defaultColor, entityType }) => defaultColor
27
- ? 'var(--catalog-entity-border-color)'
28
- : `var(--catalog-entity-border-color-${entityType})`};
33
+ ${({ defaultColor, entityType }) => {
34
+ if (defaultColor) {
35
+ return 'var(--catalog-entity-border-color)';
36
+ }
37
+ if (core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)) {
38
+ return `var(--catalog-entity-border-color-${entityType})`;
39
+ }
40
+ return 'var(--catalog-entity-border-color-custom)';
41
+ }};
29
42
  `;
30
43
  //# sourceMappingURL=CatalogEntityTypeIcon.js.map
@@ -9,6 +9,7 @@ const react_1 = __importDefault(require("react"));
9
9
  const styled_components_1 = __importDefault(require("styled-components"));
10
10
  const Tag_1 = require("../../components/Tag/Tag");
11
11
  const CatalogHighlight_1 = require("../../components/Catalog/CatalogHighlight");
12
+ const core_1 = require("../../core");
12
13
  const entityTagColorMap = {
13
14
  service: 'blue',
14
15
  domain: 'grass',
@@ -33,8 +34,13 @@ function CatalogEntityTypeTag({ entityType }) {
33
34
  const EntityTypeTagWrapper = (0, styled_components_1.default)(Tag_1.Tag) `
34
35
  font-size: var(--font-size-base);
35
36
  background-color: transparent;
36
- text-transform: lowercase;
37
- border: 1px solid ${({ entityType }) => `var(--catalog-entity-border-color-${entityType})`};
38
- color: ${({ entityType }) => `var(--catalog-entity-icon-color-${entityType})`};
37
+ text-transform: none;
38
+ border: 1px solid
39
+ ${({ entityType }) => !core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)
40
+ ? 'var(--catalog-entity-border-color-custom)'
41
+ : `var(--catalog-entity-border-color-${entityType})`};
42
+ color: ${({ entityType }) => !core_1.PREDEFINED_ENTITY_TYPES.includes(entityType)
43
+ ? 'var(--catalog-entity-icon-color-custom)'
44
+ : `var(--catalog-entity-icon-color-${entityType})`};
39
45
  `;
40
46
  //# sourceMappingURL=CatalogEntityTypeTag.js.map
@@ -1,6 +1,6 @@
1
1
  import { JSX } from 'react';
2
2
  import { Select } from '../../components/Select/Select';
3
- import { CatalogSwitcherItem, SortOption } from '../../core/types/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,3 +1,3 @@
1
1
  import type { BffCatalogRelatedEntity } from '../../../core/types';
2
2
  export type CatalogEntityRelationCellProps = Pick<BffCatalogRelatedEntity, 'relationType' | 'relationRole'>;
3
- export declare function CatalogEntityRelationCell({ relationType, relationRole, }: CatalogEntityRelationCellProps): "partOf" | "hasParts" | "creates" | "createdBy" | "owns" | "ownedBy" | "implements" | "implementedBy" | "dependsOn" | "dependencyOf" | "uses" | "usedBy" | "produces" | "consumes" | "linksTo" | "supersedes" | "supersededBy" | "compatibleWith" | "extends" | "extendedBy" | "relatesTo" | "hasMember" | "memberOf" | "triggers" | "triggeredBy";
3
+ export declare function CatalogEntityRelationCell({ relationType, relationRole, }: CatalogEntityRelationCellProps): string;
@@ -4,8 +4,8 @@ exports.CatalogEntityRelationCell = CatalogEntityRelationCell;
4
4
  const constants_1 = require("../../../core/constants");
5
5
  function CatalogEntityRelationCell({ relationType, relationRole, }) {
6
6
  if (relationRole === 'source') {
7
- return constants_1.reverseRelationMap[relationType];
7
+ return constants_1.relationTypeMap[constants_1.reverseRelationMap[relationType]];
8
8
  }
9
- return relationType;
9
+ return constants_1.relationTypeMap[relationType];
10
10
  }
11
11
  //# sourceMappingURL=CatalogEntityRelationCell.js.map
@@ -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;
@@ -15,7 +15,7 @@ exports.catalog = (0, styled_components_1.css) `
15
15
  --catalog-filter-padding-vertical-mobile: 0;
16
16
  --catalog-filter-padding-horizontal-mobile: var(--spacing-base);
17
17
 
18
- --catalog-heading-margin: 0 0 var(--spacing-xl) 0;
18
+ --catalog-heading-margin: 0 0 var(--spacing-sm) 0;
19
19
  --catalog-sidebar-width: 285px;
20
20
 
21
21
  /**
@@ -132,10 +132,14 @@ exports.catalog = (0, styled_components_1.css) `
132
132
  --catalog-entity-border-color-api-operation: var(--color-raspberry-3);
133
133
  --catalog-entity-bg-color-api-operation: var(--color-raspberry-1);
134
134
 
135
+ --catalog-entity-icon-color-custom: var(--color-persian-green-8);
136
+ --catalog-entity-border-color-custom: var(--color-persian-green-5);
137
+ --catalog-entity-bg-color-custom: var(--color-persian-green-1);
138
+
135
139
  /**
136
140
  * @tokens Catalog tags
137
141
  */
138
- --catalog-tags-wrapper-gap: 4px;
142
+ --catalog-tags-wrapper-gap: var(--spacing-xs) calc(var(--spacing-xs) - 5px);
139
143
  --catalog-tags-more-button-font-size: var(--font-size-base);
140
144
  --catalog-tags-more-button-margin-left: 4px;
141
145
  --catalog-tags-placeholder-bg-color: var(--bg-color);
@@ -195,7 +199,7 @@ exports.catalog = (0, styled_components_1.css) `
195
199
  */
196
200
  --catalog-card-height: 241px;
197
201
  --catalog-card-min-width: 400px;
198
- --catalog-card-padding-vertical: var(--spacing-md);
202
+ --catalog-card-padding-vertical: var(--spacing-base);
199
203
  --catalog-card-padding-horizontal: var(--spacing-md);
200
204
  --catalog-card-gap: var(--spacing-sm);
201
205
  --catalog-card-text-color: var(--text-color-secondary);
@@ -225,12 +229,11 @@ exports.catalog = (0, styled_components_1.css) `
225
229
  /**
226
230
  * @tokens Catalog metadata
227
231
  */
228
- --catalog-metadata-section-margin-top: var(--spacing-md);
229
- --catalog-metadata-section-gap: var(--spacing-lg);
232
+ --catalog-metadata-section-margin-top: var(--spacing-base);
233
+ --catalog-metadata-section-gap: var(--spacing-xs);
230
234
  --catalog-metadata-label-font-size: var(--font-size-base);
231
235
  --catalog-metadata-label-font-weight: var(--font-weight-medium);
232
236
  --catalog-metadata-label-color: var(--text-color-secondary);
233
- --catalog-metadata-label-margin-bottom: var(--spacing-unit);
234
237
  --catalog-metadata-column-half-gap: var(--spacing-sm);
235
238
  --catalog-metadata-heading-size: var(--font-size-md);
236
239
 
@@ -265,7 +268,7 @@ exports.catalog = (0, styled_components_1.css) `
265
268
  --catalog-card-description-line-height: var(--line-height-base);
266
269
  --catalog-card-description-font-weight: var(--font-weight-regular);
267
270
  --catalog-card-description-height: 62px;
268
- --catalog-card-description-margin-top: 2px;
271
+ --catalog-card-description-margin-top: 8px;
269
272
 
270
273
  --catalog-card-content-gap: var(--spacing-xs);
271
274
  --catalog-card-content-gap-vertical: var(--spacing-sm);
@@ -11,6 +11,7 @@ const utils_1 = require("../../core/utils");
11
11
  const hooks_1 = require("../../core/hooks");
12
12
  const H2_1 = require("../../components/Typography/H2");
13
13
  const FilterContent_1 = require("../../components/Filter/FilterContent");
14
+ const FilterInput_1 = require("../../components/Filter/FilterInput");
14
15
  const FilterPopover_1 = require("../../components/Filter/FilterPopover");
15
16
  const CatalogClassicHighlight_1 = require("../../components/CatalogClassic/CatalogClassicHighlight");
16
17
  const CatalogClassicActions_1 = require("../../components/CatalogClassic/CatalogClassicActions");
@@ -25,7 +26,7 @@ function CatalogClassic(props) {
25
26
  (0, hooks_1.useModalScrollLock)(filterPopoverVisible);
26
27
  return (react_1.default.createElement(CatalogClassicHighlight_1.HighlightContext.Provider, { value: [filterTerm] },
27
28
  react_1.default.createElement(exports.CatalogPageWrapper, { "data-component-name": "CatalogClassic/CatalogClassic", withoutFilters: !filters.length },
28
- react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) }),
29
+ Boolean(filters.length) && (react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) })),
29
30
  filterPopoverVisible && (react_1.default.createElement(FilterPopover_1.FilterPopover, { onClose: () => setFilterPopoverVisible(false), setFilterTerm: setFilterTerm, filterTerm: filterTerm, filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
30
31
  react_1.default.createElement(CatalogClassicActions_1.CatalogClassicActions, { onOpenFilter: () => setFilterPopoverVisible(true), filters: filters, filterTerm: filterTerm }),
31
32
  react_1.default.createElement(exports.CatalogPageContent, null,
@@ -37,7 +38,9 @@ function CatalogClassic(props) {
37
38
  catalogConfig.description ? (react_1.default.createElement(exports.CatalogDescription, { "data-translation-key": catalogConfig.descriptionTranslationKey },
38
39
  ' ',
39
40
  translate(catalogConfig.descriptionTranslationKey, catalogConfig.description),
40
- ' ')) : null),
41
+ ' ')) : null,
42
+ !filters.length && (react_1.default.createElement(CatalogSearchWrapper, null,
43
+ react_1.default.createElement(FilterInput_1.FilterInput, { value: filterTerm, onChange: (updatedTerm) => setFilterTerm(updatedTerm) })))),
41
44
  react_1.default.createElement(CatalogClassicVirtualizedGroups_1.CatalogClassicVirtualizedGroups, { groups: groups, filters: filters, filterTerm: filterTerm })))));
42
45
  }
43
46
  exports.CatalogPageContent = styled_components_1.default.main `
@@ -110,4 +113,8 @@ const FiltersSidebar = (0, styled_components_1.default)(Sidebar_1.Sidebar) `
110
113
  }
111
114
  --menu-container-padding-top: 0;
112
115
  `;
116
+ const CatalogSearchWrapper = styled_components_1.default.div `
117
+ margin-top: var(--spacing-base);
118
+ max-width: 300px;
119
+ `;
113
120
  //# sourceMappingURL=CatalogClassic.js.map
@@ -8,8 +8,8 @@ export type CodeBlockProps = {
8
8
  header?: CodeBlockControlsProps;
9
9
  dataTestId?: string;
10
10
  className?: string;
11
- tabs?: CodeBlockTabItems;
12
- dropdown?: CodeBlockDropdownItems;
11
+ tabs?: CodeBlockItems;
12
+ dropdown?: CodeBlockItems;
13
13
  withLineNumbers?: boolean;
14
14
  startLineNumber?: number;
15
15
  highlightedHtml?: string;
@@ -25,20 +25,13 @@ type UnstableExternalCodeSample = {
25
25
  label?: string;
26
26
  get: (source: ExternalSource) => string;
27
27
  };
28
- export type CodeBlockTabItems = {
28
+ export type CodeBlockItems = {
29
29
  items: {
30
30
  name: string;
31
31
  lang?: string;
32
+ id: string;
32
33
  }[];
33
- onChange: (name: string) => void;
34
- value: string;
35
- };
36
- export type CodeBlockDropdownItems = {
37
- items: {
38
- name: string;
39
- lang?: string;
40
- }[];
41
- onChange: (name: string | string[]) => void;
34
+ onChange: (id: string) => void;
42
35
  value: string;
43
36
  };
44
37
  type ExternalSource = {
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { JSX } from 'react';
3
- import type { CodeBlockDropdownItems, CodeBlockTabItems } from '../../components/CodeBlock/CodeBlock';
3
+ import type { CodeBlockItems } from '../../components/CodeBlock/CodeBlock';
4
4
  export type CodeBlockControlsProps = {
5
5
  children?: React.ReactNode;
6
6
  className?: string;
7
7
  title?: React.ReactNode | string;
8
8
  controls?: ControlItems | false;
9
- tabs?: CodeBlockTabItems;
10
- dropdown?: CodeBlockDropdownItems;
9
+ tabs?: CodeBlockItems;
10
+ dropdown?: CodeBlockItems;
11
11
  };
12
12
  type ControlItems = {
13
13
  copy?: CopyControlProps;
@@ -1,3 +1,3 @@
1
1
  import { type JSX } from 'react';
2
- import type { CodeBlockDropdownItems } from '../../components/CodeBlock/CodeBlock';
3
- export declare function CodeBlockDropdown({ items, onChange, value }: CodeBlockDropdownItems): JSX.Element;
2
+ import type { CodeBlockItems } from '../../components/CodeBlock/CodeBlock';
3
+ export declare function CodeBlockDropdown({ items, onChange, value }: CodeBlockItems): JSX.Element;
@@ -5,31 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CodeBlockDropdown = CodeBlockDropdown;
7
7
  const react_1 = __importDefault(require("react"));
8
- const styled_components_1 = __importDefault(require("styled-components"));
9
8
  const Dropdown_1 = require("../../components/Dropdown/Dropdown");
10
9
  const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
11
10
  const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
12
11
  const Button_1 = require("../../components/Button/Button");
13
- const ChevronSortIcon_1 = require("../../icons/ChevronSortIcon/ChevronSortIcon");
14
12
  const NoneIcon_1 = require("../../icons/NoneIcon/NoneIcon");
15
13
  const utils_1 = require("../../core/utils");
16
14
  function CodeBlockDropdown({ items, onChange, value }) {
17
- const activeItem = items.find((item) => item.name === value) || items[0];
15
+ const activeItem = items.find((item) => item.id === value) || items[0];
18
16
  const icon = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.lang) ? (0, utils_1.getFileIconByLanguage)(activeItem === null || activeItem === void 0 ? void 0 : activeItem.lang) : null;
19
- return (react_1.default.createElement(StyledDropdown, { alignment: "end", trigger: react_1.default.createElement(Button_1.Button, { icon: react_1.default.createElement(ChevronSortIcon_1.ChevronSortIcon, null), iconPosition: "right", variant: "text", size: "small" },
17
+ return (react_1.default.createElement(Dropdown_1.Dropdown, { withArrow: true, alignment: "end", trigger: react_1.default.createElement(Button_1.Button, { iconPosition: "right", variant: "ghost", size: "small" },
20
18
  icon,
21
19
  activeItem.name) },
22
20
  react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, items.map((item) => {
23
21
  const icon = (0, utils_1.getFileIconByLanguage)(item.lang || '');
24
- return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: item.lang, onAction: () => onChange(item.name), active: item.name === activeItem.name, prefix: item.lang ? icon : react_1.default.createElement(NoneIcon_1.NoneIcon, { size: "var(--icon-size)" }) }, item.name));
22
+ const isActive = item.id === value;
23
+ return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: item.id, onAction: () => onChange(item.id), active: isActive, prefix: item.lang ? icon : react_1.default.createElement(NoneIcon_1.NoneIcon, { size: "var(--icon-size)" }) }, item.name));
25
24
  }))));
26
25
  }
27
- const StyledDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
28
- margin-left: auto;
29
- --icon-size: 18px;
30
- --button-color: var(--text-color-secondary);
31
- button.button-size-small {
32
- --button-icon-size: 18px;
33
- }
34
- `;
35
26
  //# sourceMappingURL=CodeBlockDropdown.js.map
@@ -1,6 +1,6 @@
1
1
  import type { JSX } from 'react';
2
- import type { CodeBlockTabItems } from '../../components/CodeBlock/CodeBlock';
2
+ import type { CodeBlockItems } from '../../components/CodeBlock/CodeBlock';
3
3
  export type CodeBlockTabsProps = {
4
- tabs: CodeBlockTabItems;
4
+ tabs: CodeBlockItems;
5
5
  };
6
6
  export declare function CodeBlockTabs({ tabs }: CodeBlockTabsProps): JSX.Element;
@@ -40,15 +40,16 @@ function CodeBlockTabs({ tabs }) {
40
40
  tabRefs,
41
41
  });
42
42
  (0, react_1.useEffect)(() => {
43
- const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === tabs.value);
43
+ const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.id) === tabs.value);
44
44
  if (activeTab) {
45
45
  activeTab.scrollIntoView({ block: 'nearest', inline: 'center' });
46
46
  }
47
47
  }, [tabs.value]);
48
48
  return (react_1.default.createElement(CodeBlockTabsWrapper, { ref: containerRef, "data-component-name": "CodeBlock/CodeBlockTabs" },
49
49
  react_1.default.createElement(ShadowWrapper, null,
50
- react_1.default.createElement(Tabs, null, tabs.items.map(({ name, lang }, i) => {
50
+ react_1.default.createElement(Tabs, null, tabs.items.map((item, i) => {
51
51
  var _a;
52
+ const { name, lang, id } = item;
52
53
  const ext = (_a = name.match(/\.([^.]+)$/)) === null || _a === void 0 ? void 0 : _a[1];
53
54
  const fileIcon = lang
54
55
  ? (0, get_file_icon_1.getFileIconByLanguage)(lang)
@@ -57,7 +58,7 @@ function CodeBlockTabs({ tabs }) {
57
58
  : null;
58
59
  return (react_1.default.createElement(Tab, { ref: (el) => {
59
60
  tabRefs.current[i] = el;
60
- }, "data-name": name, active: name === tabs.value, key: name + i, onClick: () => tabs.onChange(name) },
61
+ }, "data-name": name, active: id === tabs.value, key: id, onClick: () => tabs.onChange(id) },
61
62
  fileIcon,
62
63
  name));
63
64
  }))),
@@ -5,7 +5,7 @@ export type FilterContentProps = {
5
5
  setFilterTerm: (value: string) => void;
6
6
  filters: ResolvedFilter[];
7
7
  filterTerm: string;
8
- filterValuesCasing?: NonNullable<RedoclyConfig['catalog']>[string]['filterValuesCasing'];
8
+ filterValuesCasing?: NonNullable<RedoclyConfig['catalog']>[string]['filterValuesCasing'] | ((str: string) => string);
9
9
  hideSearch?: boolean;
10
10
  showCounter?: boolean;
11
11
  };