@redocly/theme 0.58.0-next.1 → 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 (120) hide show
  1. package/lib/components/Catalog/Catalog.d.ts +2 -2
  2. package/lib/components/Catalog/Catalog.js +6 -4
  3. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +15 -14
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +5 -1
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +4 -4
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +0 -1
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -2
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +0 -1
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +1 -1
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +5 -1
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +9 -7
  13. package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -0
  14. package/lib/components/Catalog/CatalogEntityIcon.js +31 -14
  15. package/lib/components/Catalog/CatalogEntityTypeIcon.js +19 -6
  16. package/lib/components/Catalog/CatalogEntityTypeTag.js +9 -3
  17. package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
  18. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +1 -1
  19. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
  20. package/lib/components/Catalog/variables.js +9 -6
  21. package/lib/components/CatalogClassic/CatalogClassic.js +9 -2
  22. package/lib/components/CodeBlock/CodeBlock.d.ts +5 -12
  23. package/lib/components/CodeBlock/CodeBlockControls.d.ts +3 -3
  24. package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +2 -2
  25. package/lib/components/CodeBlock/CodeBlockDropdown.js +4 -13
  26. package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
  27. package/lib/components/CodeBlock/CodeBlockTabs.js +4 -3
  28. package/lib/components/Search/SearchDialog.js +12 -6
  29. package/lib/components/Search/SearchFilter.js +2 -1
  30. package/lib/components/Tooltip/Tooltip.js +7 -9
  31. package/lib/components/Tooltip/TooltipWrapper.js +1 -1
  32. package/lib/core/constants/catalog.d.ts +1 -1
  33. package/lib/core/constants/catalog.js +13 -27
  34. package/lib/core/contexts/CodeSnippetContext.d.ts +14 -6
  35. package/lib/core/contexts/CodeSnippetContext.js +57 -14
  36. package/lib/core/hooks/catalog/useCatalogTableViewRow.js +1 -1
  37. package/lib/core/hooks/use-active-section-id.js +4 -0
  38. package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
  39. package/lib/core/hooks/use-control.js +17 -2
  40. package/lib/core/hooks/use-local-state.js +22 -18
  41. package/lib/core/hooks/use-telemetry-fallback.d.ts +5 -0
  42. package/lib/core/hooks/use-telemetry-fallback.js +5 -0
  43. package/lib/core/openapi/index.d.ts +8 -4
  44. package/lib/core/openapi/index.js +9 -9
  45. package/lib/core/styles/global.js +19 -0
  46. package/lib/core/types/catalog.d.ts +1 -1
  47. package/lib/core/types/hooks.d.ts +2 -2
  48. package/lib/core/types/index.d.ts +1 -0
  49. package/lib/core/types/index.js +1 -0
  50. package/lib/core/types/l10n.d.ts +1 -1
  51. package/lib/core/types/open-api-info.d.ts +34 -0
  52. package/lib/core/types/open-api-info.js +3 -0
  53. package/lib/core/types/open-api-server.d.ts +1 -0
  54. package/lib/core/types/search.d.ts +2 -3
  55. package/lib/core/utils/urls.js +1 -1
  56. package/lib/ext/useConfigureReplay.d.ts +2 -1
  57. package/lib/icons/HierarchyIcon/HierarchyIcon.d.ts +9 -0
  58. package/lib/icons/HierarchyIcon/HierarchyIcon.js +23 -0
  59. package/lib/icons/NoteIcon/NoteIcon.d.ts +9 -0
  60. package/lib/icons/NoteIcon/NoteIcon.js +24 -0
  61. package/lib/icons/ShareIcon/ShareIcon.d.ts +9 -0
  62. package/lib/icons/ShareIcon/ShareIcon.js +22 -0
  63. package/lib/index.d.ts +2 -0
  64. package/lib/index.js +2 -0
  65. package/lib/layouts/DocumentationLayout.js +1 -3
  66. package/lib/markdoc/components/CodeGroup/CodeGroup.js +49 -27
  67. package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
  68. package/lib/markdoc/components/Tabs/Tabs.js +3 -2
  69. package/package.json +4 -4
  70. package/src/components/Catalog/Catalog.tsx +18 -6
  71. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +20 -19
  72. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +15 -2
  73. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +0 -1
  74. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -2
  75. package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +0 -1
  76. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +1 -1
  77. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  78. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +31 -18
  79. package/src/components/Catalog/CatalogEntityIcon.tsx +53 -18
  80. package/src/components/Catalog/CatalogEntityTypeIcon.tsx +19 -8
  81. package/src/components/Catalog/CatalogEntityTypeTag.tsx +11 -3
  82. package/src/components/Catalog/CatalogSelector.tsx +1 -1
  83. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
  84. package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
  85. package/src/components/Catalog/variables.ts +9 -6
  86. package/src/components/CatalogClassic/CatalogClassic.tsx +26 -10
  87. package/src/components/CodeBlock/CodeBlock.tsx +5 -11
  88. package/src/components/CodeBlock/CodeBlockControls.tsx +3 -6
  89. package/src/components/CodeBlock/CodeBlockDropdown.tsx +11 -20
  90. package/src/components/CodeBlock/CodeBlockTabs.tsx +8 -8
  91. package/src/components/Search/SearchDialog.tsx +14 -5
  92. package/src/components/Search/SearchFilter.tsx +2 -1
  93. package/src/components/Tooltip/Tooltip.tsx +6 -8
  94. package/src/components/Tooltip/TooltipWrapper.tsx +1 -1
  95. package/src/core/constants/catalog.ts +13 -27
  96. package/src/core/contexts/CodeSnippetContext.tsx +54 -18
  97. package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
  98. package/src/core/hooks/use-active-section-id.ts +6 -0
  99. package/src/core/hooks/use-codeblock-tabs-controls.ts +2 -2
  100. package/src/core/hooks/use-control.ts +21 -3
  101. package/src/core/hooks/use-local-state.ts +28 -19
  102. package/src/core/hooks/use-telemetry-fallback.ts +5 -0
  103. package/src/core/openapi/index.ts +8 -4
  104. package/src/core/styles/global.ts +19 -0
  105. package/src/core/types/catalog.ts +1 -2
  106. package/src/core/types/hooks.ts +6 -1
  107. package/src/core/types/index.ts +1 -0
  108. package/src/core/types/l10n.ts +3 -0
  109. package/src/core/types/open-api-info.ts +34 -0
  110. package/src/core/types/open-api-server.ts +1 -0
  111. package/src/core/types/search.ts +3 -3
  112. package/src/core/utils/urls.ts +2 -1
  113. package/src/ext/useConfigureReplay.ts +2 -1
  114. package/src/icons/HierarchyIcon/HierarchyIcon.tsx +32 -0
  115. package/src/icons/NoteIcon/NoteIcon.tsx +35 -0
  116. package/src/icons/ShareIcon/ShareIcon.tsx +23 -0
  117. package/src/index.ts +2 -0
  118. package/src/layouts/DocumentationLayout.tsx +3 -10
  119. package/src/markdoc/components/CodeGroup/CodeGroup.tsx +81 -52
  120. package/src/markdoc/components/Tabs/Tabs.tsx +10 -2
@@ -1,11 +1,11 @@
1
1
  import { JSX } from 'react';
2
2
  import { CatalogEntityConfig } from '@redocly/config';
3
- import { BffCatalogEntityList } from '../../core/types';
4
- import { CatalogSwitcherItem } from '../../core/types/catalog';
3
+ import { BffCatalogEntityList, CatalogSwitcherItem, CatalogViewMode } from '../../core/types';
5
4
  export type CatalogProps = {
6
5
  catalogConfig: CatalogEntityConfig;
7
6
  entitiesTypes: string[];
8
7
  initialEntitiesList?: BffCatalogEntityList;
9
8
  catalogSwitcherItems: CatalogSwitcherItem[];
9
+ initialViewMode?: CatalogViewMode;
10
10
  };
11
11
  export declare function Catalog(props: CatalogProps): JSX.Element;
@@ -27,15 +27,15 @@ const customCatalogOptionsCasing = (str) => {
27
27
  if (index === 0 && word.toLowerCase() === 'api') {
28
28
  return 'API';
29
29
  }
30
- return word[0].toUpperCase() + word.slice(1).toLowerCase();
30
+ return word[0].toUpperCase() + word.slice(1);
31
31
  })
32
32
  .join(' ');
33
33
  };
34
34
  function Catalog(props) {
35
- const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems } = props;
35
+ const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems, initialViewMode, } = props;
36
36
  const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
37
37
  const { translate } = useTranslate();
38
- const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(catalogConfig, (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0);
38
+ const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(catalogConfig, (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0, initialViewMode);
39
39
  return (react_1.default.createElement(react_1.default.Fragment, null,
40
40
  react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/Catalog" },
41
41
  react_1.default.createElement(FiltersSidebar, { collapsed: collapsedSidebar, header: collapsedSidebar ? null : (react_1.default.createElement(CatalogSelector_1.CatalogSelector, { catalogSwitcherItems: catalogSwitcherItems, setSearchQuery: setSearchQuery, setSortOption: setSortOption })), menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setSearchQuery, filters: filters, filterTerm: searchQuery, hideSearch: true, showCounter: false, filterValuesCasing: customCatalogOptionsCasing }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
@@ -43,7 +43,9 @@ function Catalog(props) {
43
43
  react_1.default.createElement(CatalogPageDescription, null,
44
44
  react_1.default.createElement(CatalogTitleWrapper, null,
45
45
  react_1.default.createElement(CatalogTitle, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey },
46
- 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,
47
49
  ' '),
48
50
  react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, entitiesCounter)),
49
51
  react_1.default.createElement(CatalogDescription, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey }, translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey))),
@@ -14,7 +14,6 @@ const ArrowUpRightIcon_1 = require("../../../icons/ArrowUpRightIcon/ArrowUpRight
14
14
  const CatalogTagsWithTooltip_1 = require("../../../components/Catalog/CatalogTagsWithTooltip");
15
15
  const CatalogEntityIcon_1 = require("../../../components/Catalog/CatalogEntityIcon");
16
16
  const utils_1 = require("../../../core/utils");
17
- const Tooltip_1 = require("../../../components/Tooltip/Tooltip");
18
17
  function CatalogCard({ entity, catalogConfig }) {
19
18
  var _a, _b, _c;
20
19
  const { useTelemetry } = (0, hooks_1.useThemeHooks)();
@@ -26,15 +25,15 @@ function CatalogCard({ entity, catalogConfig }) {
26
25
  } },
27
26
  react_1.default.createElement(CardContent, null,
28
27
  react_1.default.createElement(CardHeader, null,
29
- react_1.default.createElement(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);
@@ -2,5 +2,9 @@ import React from 'react';
2
2
  export type CatalogEntityProps = {
3
3
  RedocSchema: React.ComponentType<any>;
4
4
  StoreProvider: React.ComponentType<any>;
5
+ GraphqlTypeRenderer?: React.ComponentType<{
6
+ sdl: string;
7
+ typeName: string;
8
+ }>;
5
9
  };
6
- export declare function CatalogEntity({ RedocSchema, StoreProvider }: CatalogEntityProps): React.JSX.Element;
10
+ export declare function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntityProps): React.JSX.Element;
@@ -26,13 +26,13 @@ const renderFirstColumnEntitySection = (entity) => {
26
26
  return react_1.default.createElement(CatalogEntityMetadata_1.CatalogEntityMetadata, { entity: entity });
27
27
  }
28
28
  };
29
- const renderDataSchemaSection = (entity, relatedEntity, RedocSchema, StoreProvider) => {
29
+ const renderDataSchemaSection = (entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer) => {
30
30
  if (entity.type !== 'data-schema') {
31
31
  return null;
32
32
  }
33
- return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, RedocSchema: RedocSchema, StoreProvider: StoreProvider }));
33
+ return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, RedocSchema: RedocSchema, StoreProvider: StoreProvider, GraphqlTypeRenderer: GraphqlTypeRenderer }));
34
34
  };
35
- function CatalogEntity({ RedocSchema, StoreProvider }) {
35
+ function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
36
36
  var _a;
37
37
  const { useTranslate, useCatalog, usePageProps } = (0, hooks_1.useThemeHooks)();
38
38
  const { translate } = useTranslate();
@@ -52,7 +52,7 @@ function CatalogEntity({ RedocSchema, StoreProvider }) {
52
52
  react_1.default.createElement(react_router_dom_1.Route, { index: true, element: react_1.default.createElement(react_1.default.Fragment, null,
53
53
  react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
54
54
  react_1.default.createElement(CatalogEntityProperties_1.CatalogEntityProperties, { entity: entity }),
55
- renderDataSchemaSection(entity, relatedEntity, RedocSchema, StoreProvider),
55
+ renderDataSchemaSection(entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer),
56
56
  react_1.default.createElement(CatalogTwoColumnsSection, null,
57
57
  renderFirstColumnEntitySection(entity),
58
58
  react_1.default.createElement(CatalogEntityLinks_1.CatalogEntityLinks, { entity: entity })),
@@ -26,7 +26,6 @@ function CatalogEntityLinks({ entity }) {
26
26
  const LinksWrapper = styled_components_1.default.div `
27
27
  display: flex;
28
28
  flex-direction: column;
29
- gap: var(--spacing-xs);
30
29
  border-radius: var(--border-radius);
31
30
  background-color: var(--catalog-metadata-bg-color);
32
31
  transition: all 0.2s ease-in-out;
@@ -58,7 +58,7 @@ 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, metadata = __rest(_a, ["schema"]);
61
+ const _a = entity.metadata || {}, { schema, sdl } = _a, metadata = __rest(_a, ["schema", "sdl"]);
62
62
  const metadataToShow = Object.entries(metadata).filter(([key]) => !(entity.type === 'api-description' && key === 'descriptionFile'));
63
63
  const [isOn, setIsOn] = (0, react_1.useState)(false);
64
64
  const hasMoreItems = metadataToShow.length > MAX_INITIAL_ITEMS;
@@ -82,7 +82,6 @@ const JsonViewerWrapper = (0, styled_components_1.default)(JsonViewer_1.JsonView
82
82
  const MetadataWrapper = styled_components_1.default.div `
83
83
  display: flex;
84
84
  flex-direction: column;
85
- gap: var(--spacing-xs);
86
85
  border-radius: var(--border-radius);
87
86
  background-color: var(--catalog-metadata-bg-color);
88
87
  transition: all 0.2s ease-in-out;
@@ -31,7 +31,6 @@ const PathLabel = styled_components_1.default.label `
31
31
  const LinksWrapper = styled_components_1.default.div `
32
32
  display: flex;
33
33
  flex-direction: column;
34
- gap: var(--spacing-xs);
35
34
  border-radius: var(--border-radius);
36
35
  background-color: var(--catalog-metadata-bg-color);
37
36
  transition: all 0.2s ease-in-out;
@@ -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);
@@ -13,7 +13,7 @@ const MoleculesIcon_1 = require("../../../../icons/MoleculesIcon/MoleculesIcon")
13
13
  const NetworkIcon_1 = require("../../../../icons/NetworkIcon/NetworkIcon");
14
14
  function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
15
15
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
16
- react_1.default.createElement(Tabs_1.Tabs, { forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
16
+ react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
17
17
  react_1.default.createElement(TabItem, { label: "Operations", icon: react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, null), onClick: () => setFilter('type:api-operation') },
18
18
  react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "operations-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false, listType: "api-operation" })),
19
19
  react_1.default.createElement(TabItem, { label: "Schemas", icon: react_1.default.createElement(NetworkIcon_1.NetworkIcon, null), onClick: () => setFilter('type:data-schema') },
@@ -5,5 +5,9 @@ export type CatalogEntitySchemaProps = {
5
5
  relatedEntity: BffCatalogRelatedEntity | null;
6
6
  RedocSchema: React.ComponentType<any>;
7
7
  StoreProvider: React.ComponentType<any>;
8
+ GraphqlTypeRenderer?: React.ComponentType<{
9
+ sdl: string;
10
+ typeName: string;
11
+ }>;
8
12
  };
9
- export declare function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, }: CatalogEntitySchemaProps): React.JSX.Element;
13
+ export declare function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntitySchemaProps): React.JSX.Element;
@@ -34,20 +34,22 @@ const hooks_1 = require("../../../core/hooks");
34
34
  const useCatalogEntitySchema_1 = require("../../../core/hooks/catalog/useCatalogEntitySchema");
35
35
  const JsonViewer_1 = require("../../../components/JsonViewer/JsonViewer");
36
36
  const CopyButton_1 = require("../../../components/Buttons/CopyButton");
37
- function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, }) {
37
+ function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
38
+ var _a, _b;
38
39
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
39
40
  const { translate } = useTranslate();
40
41
  const { definition, parsedSchema, rawSchema } = (0, useCatalogEntitySchema_1.useCatalogEntitySchema)({ entity, relatedEntity });
42
+ const isGraphql = ((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.specType) === 'graphql';
43
+ const graphqlSDL = (_b = entity === null || entity === void 0 ? void 0 : entity.metadata) === null || _b === void 0 ? void 0 : _b.sdl;
41
44
  return (react_1.default.createElement(MetadataWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityMetadata" },
42
45
  react_1.default.createElement(HeaderWrapper, null,
43
46
  react_1.default.createElement(Heading, null, translate('catalog.entity.schema.title')),
44
- react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium" })),
47
+ !isGraphql && (react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium" }))),
45
48
  react_1.default.createElement(SplitViewWrapper, null,
46
- react_1.default.createElement(SchemaContentWrapper, null,
47
- react_1.default.createElement(StoreProvider, { definition: definition },
48
- react_1.default.createElement(RedocSchema, { schema: parsedSchema }))),
49
- react_1.default.createElement(SchemaSampleWrapper, null,
50
- react_1.default.createElement(JsonViewer_1.JsonViewer, { data: Sampler.sample(Object.assign({}, parsedSchema)), expandLevel: 3, hideHeader: false })))));
49
+ react_1.default.createElement(SchemaContentWrapper, null, isGraphql && graphqlSDL && GraphqlTypeRenderer ? (react_1.default.createElement(GraphqlTypeRenderer, { sdl: graphqlSDL, typeName: entity.title })) : (react_1.default.createElement(StoreProvider, { definition: definition },
50
+ react_1.default.createElement(RedocSchema, { schema: parsedSchema })))),
51
+ !isGraphql && (react_1.default.createElement(SchemaSampleWrapper, null,
52
+ react_1.default.createElement(JsonViewer_1.JsonViewer, { data: Sampler.sample(Object.assign({}, parsedSchema)), expandLevel: 3, hideHeader: false }))))));
51
53
  }
52
54
  const MetadataWrapper = styled_components_1.default.div `
53
55
  display: flex;
@@ -1,7 +1,9 @@
1
1
  import { JSX } from 'react';
2
+ import { UiAccessibleConfig } from '@redocly/config';
2
3
  export type CatalogEntityIconProps = {
3
4
  entityType: string;
4
5
  defaultColor?: boolean;
5
6
  forceColor?: string;
7
+ entitiesCatalogConfig?: UiAccessibleConfig['entitiesCatalog'];
6
8
  };
7
9
  export declare function CatalogEntityIcon({ entityType, defaultColor, forceColor, }: CatalogEntityIconProps): JSX.Element;
@@ -9,24 +9,41 @@ const CodeIcon_1 = require("../../icons/CodeIcon/CodeIcon");
9
9
  const GraphIcon_1 = require("../../icons/GraphIcon/GraphIcon");
10
10
  const PeopleIcon_1 = require("../../icons/PeopleIcon/PeopleIcon");
11
11
  const UserIcon_1 = require("../../icons/UserIcon/UserIcon");
12
- const NetworkIcon_1 = require("../../icons/NetworkIcon/NetworkIcon");
13
12
  const MoleculesIcon_1 = require("../../icons/MoleculesIcon/MoleculesIcon");
13
+ const HierarchyIcon_1 = require("../../icons/HierarchyIcon/HierarchyIcon");
14
+ const Image_1 = require("../../components/Image/Image");
15
+ const core_1 = require("../../core");
16
+ const NoteIcon_1 = require("../../icons/NoteIcon/NoteIcon");
14
17
  const getIconColor = (entityType) => `var(--catalog-entity-icon-color-${entityType})`;
15
- const getEntityIcon = ({ entityType, defaultColor, forceColor }) => {
16
- 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,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;
@@ -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