@redocly/theme 0.63.0-next.4 → 0.63.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/lib/components/Accordion/variables.js +2 -2
  2. package/lib/components/Buttons/DownloadButton.d.ts +6 -0
  3. package/lib/components/Buttons/DownloadButton.js +20 -0
  4. package/lib/components/Buttons/EmailButton.js +6 -1
  5. package/lib/components/Buttons/NewTabButton.js +6 -1
  6. package/lib/components/Catalog/Catalog.js +114 -50
  7. package/lib/components/Catalog/CatalogAvatar.d.ts +5 -0
  8. package/lib/components/Catalog/CatalogAvatar.js +92 -0
  9. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +26 -7
  10. package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +10 -2
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +17 -17
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js +4 -20
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.d.ts +7 -0
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.js +53 -0
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js +3 -17
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +30 -9
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +16 -3
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +8 -4
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +11 -5
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +1 -1
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +1 -1
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +4 -1
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +7 -2
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
  27. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +1 -1
  28. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +4 -2
  29. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +25 -8
  30. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.d.ts +7 -0
  31. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +24 -0
  32. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.d.ts +6 -0
  33. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.js +26 -0
  34. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.d.ts +7 -0
  35. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +30 -0
  36. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +13 -0
  37. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.js +30 -0
  38. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +11 -0
  39. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.js +21 -0
  40. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.d.ts +7 -0
  41. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.js +25 -0
  42. package/lib/components/Catalog/CatalogPageDescription.js +0 -6
  43. package/lib/components/Catalog/CatalogSelector.d.ts +0 -1
  44. package/lib/components/Catalog/CatalogSelector.js +50 -16
  45. package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +2 -1
  46. package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +20 -5
  47. package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +2 -23
  48. package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +2 -1
  49. package/lib/components/Catalog/CatalogTagsWithTooltip.js +14 -6
  50. package/lib/components/Catalog/variables.js +78 -36
  51. package/lib/components/Filter/variables.js +1 -1
  52. package/lib/components/LoadMore/LoadMore.js +1 -0
  53. package/lib/components/Menu/MenuItem.js +1 -1
  54. package/lib/components/PageActions/PageActions.js +1 -2
  55. package/lib/components/Search/SearchDialog.js +1 -1
  56. package/lib/components/SidebarActions/SidebarActions.js +1 -1
  57. package/lib/components/Tooltip/AnchorTooltip.js +5 -2
  58. package/lib/components/Tooltip/JsTooltip.js +5 -2
  59. package/lib/components/UserMenu/UserMenu.js +1 -3
  60. package/lib/core/hooks/index.d.ts +1 -0
  61. package/lib/core/hooks/index.js +1 -0
  62. package/lib/core/hooks/use-is-truncated.d.ts +1 -0
  63. package/lib/core/hooks/use-is-truncated.js +19 -0
  64. package/lib/core/hooks/use-tabs.d.ts +1 -1
  65. package/lib/core/hooks/use-tabs.js +30 -17
  66. package/lib/core/types/hooks.d.ts +1 -0
  67. package/lib/core/types/l10n.d.ts +1 -1
  68. package/lib/core/types/tooltip.d.ts +1 -0
  69. package/lib/core/utils/custom-catalog-options-casing.d.ts +15 -0
  70. package/lib/core/utils/custom-catalog-options-casing.js +32 -0
  71. package/lib/core/utils/index.d.ts +1 -0
  72. package/lib/core/utils/index.js +1 -0
  73. package/lib/index.d.ts +1 -0
  74. package/lib/index.js +1 -0
  75. package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +2 -2
  76. package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -2
  77. package/lib/markdoc/components/Tabs/Tabs.js +9 -22
  78. package/package.json +4 -4
  79. package/src/components/Accordion/variables.ts +2 -2
  80. package/src/components/Buttons/DownloadButton.tsx +41 -0
  81. package/src/components/Buttons/EmailButton.tsx +18 -8
  82. package/src/components/Buttons/NewTabButton.tsx +19 -8
  83. package/src/components/Catalog/Catalog.tsx +157 -95
  84. package/src/components/Catalog/CatalogAvatar.tsx +68 -0
  85. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +29 -5
  86. package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +10 -2
  87. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +17 -17
  88. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.tsx +4 -21
  89. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.tsx +82 -0
  90. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.tsx +4 -22
  91. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +39 -10
  92. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +19 -3
  93. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +8 -4
  94. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +12 -10
  95. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +5 -1
  96. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +1 -0
  97. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  98. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +6 -2
  99. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +10 -2
  100. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
  101. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
  102. package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +1 -1
  103. package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +30 -6
  104. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +31 -0
  105. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.tsx +34 -0
  106. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +40 -0
  107. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +54 -0
  108. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +34 -0
  109. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.tsx +39 -0
  110. package/src/components/Catalog/CatalogPageDescription.tsx +0 -6
  111. package/src/components/Catalog/CatalogSelector.tsx +23 -21
  112. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +37 -6
  113. package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +2 -26
  114. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +24 -9
  115. package/src/components/Catalog/variables.ts +78 -36
  116. package/src/components/Filter/variables.ts +1 -1
  117. package/src/components/LoadMore/LoadMore.tsx +1 -0
  118. package/src/components/Menu/MenuItem.tsx +1 -0
  119. package/src/components/PageActions/PageActions.tsx +1 -2
  120. package/src/components/Search/SearchDialog.tsx +1 -1
  121. package/src/components/SidebarActions/SidebarActions.tsx +1 -0
  122. package/src/components/Tooltip/AnchorTooltip.tsx +5 -1
  123. package/src/components/Tooltip/JsTooltip.tsx +5 -1
  124. package/src/components/UserMenu/UserMenu.tsx +1 -3
  125. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +1 -1
  126. package/src/core/hooks/index.ts +1 -0
  127. package/src/core/hooks/use-is-truncated.ts +20 -0
  128. package/src/core/hooks/use-tabs.ts +40 -21
  129. package/src/core/types/hooks.ts +1 -1
  130. package/src/core/types/l10n.ts +7 -0
  131. package/src/core/types/tooltip.ts +1 -0
  132. package/src/core/utils/custom-catalog-options-casing.ts +29 -0
  133. package/src/core/utils/index.ts +1 -0
  134. package/src/index.ts +1 -0
  135. package/src/markdoc/components/MarkdocExample/MarkdocExample.tsx +2 -6
  136. package/src/markdoc/components/Tabs/Tabs.tsx +4 -37
@@ -0,0 +1,34 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { Button } from '@redocly/theme/components/Button/Button';
5
+ import { useThemeHooks } from '@redocly/theme/core';
6
+
7
+ type CatalogMobileFiltersPanelHeaderProps = {
8
+ setMobileFiltersPanelOpen: (open: boolean) => void;
9
+ };
10
+
11
+ export function CatalogMobileFiltersPanelHeader({
12
+ setMobileFiltersPanelOpen,
13
+ }: CatalogMobileFiltersPanelHeaderProps): JSX.Element {
14
+ const { useTranslate } = useThemeHooks();
15
+ const { translate } = useTranslate();
16
+
17
+ return (
18
+ <CatalogMobileFiltersPanelHeaderWrapper>
19
+ <span />
20
+ <Button variant="ghost" size="medium" onClick={() => setMobileFiltersPanelOpen(false)}>
21
+ {translate('catalog.filters.close', 'Close')}
22
+ </Button>
23
+ </CatalogMobileFiltersPanelHeaderWrapper>
24
+ );
25
+ }
26
+
27
+ const CatalogMobileFiltersPanelHeaderWrapper = styled.div`
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: space-between;
31
+ padding: var(--catalog-filter-content-header-padding);
32
+ border-bottom: 1px solid var(--border-color-secondary);
33
+ flex-shrink: 0;
34
+ `;
@@ -0,0 +1,40 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { breakpoints } from '@redocly/theme/core';
5
+ import { CatalogMobileFiltersPanel } from '@redocly/theme/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel';
6
+
7
+ type CatalogMobileFiltersPanelOverlayProps = {
8
+ setMobileFiltersPanelOpen: (open: boolean) => void;
9
+ filterContent: React.ReactNode;
10
+ };
11
+
12
+ export function CatalogMobileFiltersPanelOverlay({
13
+ setMobileFiltersPanelOpen,
14
+ filterContent,
15
+ }: CatalogMobileFiltersPanelOverlayProps): JSX.Element {
16
+ return (
17
+ <CatalogMobileFiltersPanelOverlayWrapper>
18
+ <CatalogMobileFiltersPanel
19
+ setMobileFiltersPanelOpen={setMobileFiltersPanelOpen}
20
+ filterContent={filterContent}
21
+ />
22
+ </CatalogMobileFiltersPanelOverlayWrapper>
23
+ );
24
+ }
25
+
26
+ const CatalogMobileFiltersPanelOverlayWrapper = styled.div`
27
+ display: none;
28
+ position: fixed;
29
+ top: calc(var(--navbar-height) + var(--banner-height));
30
+ left: 0;
31
+ width: 100%;
32
+ height: calc(100vh - var(--navbar-height) - var(--banner-height));
33
+ z-index: 3;
34
+ background: var(--bg-color);
35
+ flex-direction: column;
36
+
37
+ @media screen and (max-width: ${breakpoints.medium}) {
38
+ display: flex;
39
+ }
40
+ `;
@@ -0,0 +1,54 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { CatalogMobileTopBarFiltersButton } from '@redocly/theme/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton';
5
+ import { CatalogMobileTopBarControls } from '@redocly/theme/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls';
6
+ import { breakpoints, SortOption } from '@redocly/theme/core';
7
+ import { CatalogViewMode } from '@redocly/theme/core';
8
+
9
+ type CatalogMobileTopBarProps = {
10
+ setMobileFiltersPanelOpen: (open: boolean) => void;
11
+ activeFiltersCount: number;
12
+ setSortOption: (sortOption: SortOption | null) => void;
13
+ sortOption: SortOption | null;
14
+ viewMode: CatalogViewMode;
15
+ setViewMode: (viewMode: CatalogViewMode) => void;
16
+ };
17
+
18
+ export function CatalogMobileTopBar({
19
+ setMobileFiltersPanelOpen,
20
+ activeFiltersCount,
21
+ setSortOption,
22
+ sortOption,
23
+ viewMode,
24
+ setViewMode,
25
+ }: CatalogMobileTopBarProps): JSX.Element {
26
+ return (
27
+ <CatalogMobileTopBarWrapper>
28
+ <CatalogMobileTopBarFiltersButton
29
+ setMobileFiltersPanelOpen={setMobileFiltersPanelOpen}
30
+ activeFiltersCount={activeFiltersCount}
31
+ />
32
+ <CatalogMobileTopBarControls
33
+ setSortOption={setSortOption}
34
+ sortOption={sortOption}
35
+ viewMode={viewMode}
36
+ setViewMode={setViewMode}
37
+ />
38
+ </CatalogMobileTopBarWrapper>
39
+ );
40
+ }
41
+
42
+ const CatalogMobileTopBarWrapper = styled.div`
43
+ display: none;
44
+ align-items: center;
45
+ justify-content: space-between;
46
+ padding: var(--spacing-sm) var(--catalog-page-padding-horizontal);
47
+ border-bottom: 1px solid var(--border-color-secondary);
48
+ background: var(--bg-color);
49
+ flex-shrink: 0;
50
+
51
+ @media screen and (max-width: ${breakpoints.medium}) {
52
+ display: flex;
53
+ }
54
+ `;
@@ -0,0 +1,34 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
5
+ import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/CatalogViewModeToggle';
6
+ import { SortOption } from '@redocly/theme/core';
7
+ import { CatalogViewMode } from '@redocly/theme/core';
8
+
9
+ type CatalogMobileTopBarControlsProps = {
10
+ setSortOption: (sortOption: SortOption | null) => void;
11
+ sortOption: SortOption | null;
12
+ viewMode: CatalogViewMode;
13
+ setViewMode: (viewMode: CatalogViewMode) => void;
14
+ };
15
+
16
+ export function CatalogMobileTopBarControls({
17
+ setSortOption,
18
+ sortOption,
19
+ viewMode,
20
+ setViewMode,
21
+ }: CatalogMobileTopBarControlsProps): JSX.Element {
22
+ return (
23
+ <CatalogMobileTopBarControlsWrapper>
24
+ <CatalogSortButton onSortChange={setSortOption} currentSort={sortOption} />
25
+ <CatalogViewModeToggle viewMode={viewMode} onViewModeChange={setViewMode} />
26
+ </CatalogMobileTopBarControlsWrapper>
27
+ );
28
+ }
29
+
30
+ const CatalogMobileTopBarControlsWrapper = styled.div`
31
+ display: flex;
32
+ align-items: center;
33
+ gap: var(--catalog-controls-wrapper-gap);
34
+ `;
@@ -0,0 +1,39 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { FilterIcon } from '@redocly/theme/icons/FilterIcon/FilterIcon';
5
+ import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
6
+ import { useThemeHooks } from '@redocly/theme/core';
7
+ import { Button } from '@redocly/theme/components/Button/Button';
8
+
9
+ type CatalogMobileTopBarFiltersButtonProps = {
10
+ setMobileFiltersPanelOpen: (open: boolean) => void;
11
+ activeFiltersCount: number;
12
+ };
13
+
14
+ export function CatalogMobileTopBarFiltersButton({
15
+ setMobileFiltersPanelOpen,
16
+ activeFiltersCount,
17
+ }: CatalogMobileTopBarFiltersButtonProps): JSX.Element {
18
+ const { useTranslate } = useThemeHooks();
19
+ const { translate } = useTranslate();
20
+
21
+ return (
22
+ <CatalogMobileTopBarFiltersButtonWrapper
23
+ icon={<FilterIcon size="16px" />}
24
+ variant="ghost"
25
+ iconPosition="left"
26
+ size="medium"
27
+ onClick={() => setMobileFiltersPanelOpen(true)}
28
+ >
29
+ {translate('catalog.filters.title', 'Filters')}
30
+ {activeFiltersCount > 0 ? <CounterTag borderless>{activeFiltersCount}</CounterTag> : null}
31
+ </CatalogMobileTopBarFiltersButtonWrapper>
32
+ );
33
+ }
34
+
35
+ const CatalogMobileTopBarFiltersButtonWrapper = styled(Button)`
36
+ display: inline-flex;
37
+ align-items: center;
38
+ gap: var(--spacing-xs);
39
+ `;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
- import { breakpoints } from '@redocly/theme/core/utils';
5
4
  import { H3 } from '@redocly/theme/components/Typography/H3';
6
5
  import { Tag } from '@redocly/theme/components/Tag/Tag';
7
6
 
@@ -37,11 +36,6 @@ export function CatalogPageDescription({
37
36
 
38
37
  const CatalogPageDescriptionWrapper = styled.div`
39
38
  margin: var(--catalog-heading-margin);
40
- display: var(--catalog-page-description-display-mobile);
41
-
42
- @media screen and (min-width: ${breakpoints.medium}) {
43
- display: var(--catalog-page-description-display-desktop);
44
- }
45
39
  `;
46
40
 
47
41
  const CatalogTitleWrapper = styled.div`
@@ -1,7 +1,8 @@
1
- import React, { JSX } from 'react';
1
+ import React, { useState, JSX } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { useNavigate } from 'react-router-dom';
4
4
 
5
+ import { Accordion } from '@redocly/theme/components/Accordion/Accordion';
5
6
  import { Select } from '@redocly/theme/components/Select/Select';
6
7
  import { CatalogSwitcherItem } from '@redocly/theme/core/types';
7
8
  import { getPathPrefix } from '@redocly/theme/core/utils';
@@ -19,6 +20,7 @@ export function CatalogSelector({
19
20
  }: CatalogSelectorProps): JSX.Element {
20
21
  const { useTranslate } = useThemeHooks();
21
22
  const { translate } = useTranslate();
23
+ const [isExpanded, setIsExpanded] = useState(true);
22
24
 
23
25
  const navigate = useNavigate();
24
26
  const pathPrefix = getPathPrefix();
@@ -31,35 +33,35 @@ export function CatalogSelector({
31
33
 
32
34
  const selectedCatalogItem = catalogSwitcherItems.find((item) => item.selected);
33
35
 
36
+ const headerLabel = translate('catalog.catalogs.label', 'Catalogs');
37
+
34
38
  return (
35
39
  <CatalogSelectWrapper data-component-name="Catalog/CatalogSelector">
36
- <CatalogSelectLabel>{translate('catalog.catalogs.label', 'Catalogs')}</CatalogSelectLabel>
37
- <CatalogSelect
38
- value={selectedCatalogItem?.slug}
39
- options={options}
40
- onChange={(value) => {
41
- navigate(`${pathPrefix}/catalogs/${value}`);
42
- onChange();
43
- }}
44
- icon={<ChevronDownIcon color="var(--catalog-select-icon-color)" />}
45
- />
40
+ <Accordion expanded={isExpanded} header={headerLabel} onToggle={setIsExpanded}>
41
+ <CatalogSelect
42
+ value={selectedCatalogItem?.slug}
43
+ options={options}
44
+ onChange={(value) => {
45
+ navigate(`${pathPrefix}/catalogs/${value}`);
46
+ onChange();
47
+ }}
48
+ icon={<ChevronDownIcon color="var(--catalog-select-icon-color)" />}
49
+ />
50
+ </Accordion>
46
51
  </CatalogSelectWrapper>
47
52
  );
48
53
  }
49
54
 
50
55
  export const CatalogSelectWrapper = styled.div`
51
- margin-top: var(--catalog-select-wrapper-margin-top);
52
- `;
53
-
54
- export const CatalogSelectLabel = styled.label`
55
- display: block;
56
- margin-bottom: var(--catalog-select-label-margin-bottom);
57
- font-weight: var(--catalog-select-label-font-weight);
58
- font-size: var(--catalog-select-label-font-size);
59
- line-height: var(--catalog-select-label-line-height);
56
+ display: flex;
57
+ flex-direction: column;
58
+ gap: var(--filter-group-gap);
59
+ --accordion-body-padding: var(--catalog-select-accordion-body-padding);
60
+ --accordion-header-padding: var(--catalog-select-accordion-header-padding);
61
+ --select-line-height: var(--catalog-select-select-line-height);
62
+ --select-input-padding: var(--catalog-select-select-input-padding);
60
63
  `;
61
64
 
62
65
  export const CatalogSelect = styled(Select)`
63
66
  border-radius: var(--catalog-select-border-radius);
64
- --select-input-padding: var(--catalog-select-input-padding);
65
67
  `;
@@ -11,6 +11,7 @@ import { CatalogTableHeaderCell } from '@redocly/theme/components/Catalog/Catalo
11
11
  import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
12
12
  import { CatalogTableViewRow } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableViewRow';
13
13
  import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
14
+ import { breakpoints } from '@redocly/theme/core';
14
15
 
15
16
  export type BaseEntity = {
16
17
  id: string;
@@ -31,6 +32,7 @@ export type CatalogTableViewProps<T extends BaseEntity> = {
31
32
  handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
32
33
  isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
33
34
  style?: React.CSSProperties;
35
+ contentMinWidth?: number;
34
36
  };
35
37
 
36
38
  export type CatalogColumn<T> = {
@@ -100,9 +102,10 @@ export const CatalogTableView = <T extends BaseEntity>({
100
102
  handleSortClick,
101
103
  isColumnSorted,
102
104
  style,
105
+ contentMinWidth,
103
106
  }: CatalogTableViewProps<T>) => {
104
- return (
105
- <CatalogTableWrapper data-component-name="Catalog/CatalogTableView" style={style}>
107
+ const tableContent = (
108
+ <>
106
109
  <CatalogTableHeader
107
110
  columnsWidths={columns.map((column) => column.width || '1fr')}
108
111
  columnsMinWidths={columns.map((column) => column.minWidth || 'auto')}
@@ -118,7 +121,7 @@ export const CatalogTableView = <T extends BaseEntity>({
118
121
  />
119
122
  ))}
120
123
  </CatalogTableHeader>
121
- <div>
124
+ <CatalogTableBody>
122
125
  {entities.map((entity) => (
123
126
  <CatalogTableViewRow
124
127
  key={entity.id}
@@ -129,7 +132,19 @@ export const CatalogTableView = <T extends BaseEntity>({
129
132
  onRowClick={onRowClick}
130
133
  />
131
134
  ))}
132
- </div>
135
+ </CatalogTableBody>
136
+ </>
137
+ );
138
+
139
+ return (
140
+ <CatalogTableWrapper data-component-name="Catalog/CatalogTableView" style={style}>
141
+ {contentMinWidth != null ? (
142
+ <CatalogTableContentInner $contentMinWidth={contentMinWidth}>
143
+ {tableContent}
144
+ </CatalogTableContentInner>
145
+ ) : (
146
+ <CatalogTableScrollContent>{tableContent}</CatalogTableScrollContent>
147
+ )}
133
148
  </CatalogTableWrapper>
134
149
  );
135
150
  };
@@ -137,8 +152,19 @@ export const CatalogTableView = <T extends BaseEntity>({
137
152
  const CatalogTableWrapper = styled.div`
138
153
  width: 100%;
139
154
  border-bottom: 1px solid var(--catalog-table-border-color);
140
- margin-bottom: var(--spacing-xl);
141
- margin-top: var(--spacing-xl);
155
+ overflow-x: auto;
156
+
157
+ @media screen and (max-width: ${breakpoints.medium}) {
158
+ margin-top: 0;
159
+ }
160
+ `;
161
+
162
+ const CatalogTableScrollContent = styled.div`
163
+ min-width: min-content;
164
+ `;
165
+
166
+ const CatalogTableContentInner = styled.div<{ $contentMinWidth: number }>`
167
+ min-width: ${({ $contentMinWidth }) => $contentMinWidth}px;
142
168
  `;
143
169
 
144
170
  const CatalogTableHeader = styled.div<{ columnsWidths: string[]; columnsMinWidths: string[] }>`
@@ -151,4 +177,9 @@ const CatalogTableHeader = styled.div<{ columnsWidths: string[]; columnsMinWidth
151
177
  .join(' ')};
152
178
  background: var(--catalog-table-header-bg-color);
153
179
  font-weight: var(--catalog-table-header-font-weight);
180
+ border-radius: var(--border-radius) var(--border-radius) 0 0;
181
+ `;
182
+
183
+ const CatalogTableBody = styled.div`
184
+ min-width: min-content;
154
185
  `;
@@ -2,28 +2,17 @@ import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
5
+ import { CatalogAvatar } from '@redocly/theme/components/Catalog/CatalogAvatar';
5
6
 
6
7
  export type CatalogUserEntityCellProps = {
7
8
  name: string;
8
9
  email: string;
9
10
  };
10
11
 
11
- const extractInitials = (name: string) => {
12
- const trimmedName = name?.trim();
13
- if (!trimmedName) return '';
14
-
15
- const initials = trimmedName.split(' ').map((n) => n[0]);
16
- if (initials.length === 1) {
17
- return initials[0];
18
- }
19
-
20
- return initials[0] + initials[initials.length - 1];
21
- };
22
-
23
12
  export function CatalogUserEntityCell({ name, email }: CatalogUserEntityCellProps) {
24
13
  return (
25
14
  <EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogUserEntityCell">
26
- <Avatar>{extractInitials(name)}</Avatar>
15
+ <CatalogAvatar value={name} size="medium" />
27
16
  <EntityTitleContent>
28
17
  <EntityTitle>
29
18
  <CatalogHighlight>{name}</CatalogHighlight>
@@ -43,19 +32,6 @@ const EntityTitleCellWrapper = styled.div`
43
32
  max-width: 100%;
44
33
  `;
45
34
 
46
- const Avatar = styled.div`
47
- display: flex;
48
- align-items: center;
49
- justify-content: center;
50
- width: 32px;
51
- height: 32px;
52
- border-radius: 50%;
53
- background-color: var(--catalog-avatar-bg-color);
54
- flex-shrink: 0;
55
- font-size: 14px;
56
- font-weight: 400;
57
- `;
58
-
59
35
  const EntityTitleContent = styled.div`
60
36
  display: flex;
61
37
  flex-direction: column;
@@ -6,18 +6,21 @@ import { Tag, TagProps } from '@redocly/theme/components/Tag/Tag';
6
6
  import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
7
7
  import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
8
8
  import { useThemeHooks } from '@redocly/theme/core/hooks';
9
+ import { CatalogAvatar } from '@redocly/theme/components/Catalog/CatalogAvatar';
9
10
 
10
11
  export type CatalogTagsWithTooltipProps = {
11
12
  items: string[];
12
13
  itemsToShow?: number;
13
14
  showPlaceholder?: boolean;
14
15
  tagProps?: TagProps;
16
+ showAvatars?: boolean;
15
17
  };
16
18
 
17
19
  export function CatalogTagsWithTooltip({
18
20
  items,
19
21
  itemsToShow = 1,
20
- showPlaceholder = true,
22
+ showPlaceholder = false,
23
+ showAvatars,
21
24
  tagProps,
22
25
  }: CatalogTagsWithTooltipProps): JSX.Element | null {
23
26
  const { useTranslate } = useThemeHooks();
@@ -26,12 +29,9 @@ export function CatalogTagsWithTooltip({
26
29
  if (!items || items.length === 0) {
27
30
  if (showPlaceholder) {
28
31
  return (
29
- <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
30
- {/* eslint-disable-next-line theme/require-translate */}
31
- <Tag style={{ backgroundColor: 'var(--catalog-tags-placeholder-bg-color)' }} color="grey">
32
- N/A
33
- </Tag>
34
- </CatalogTagsWrapper>
32
+ <CatalogTagsNotConnectedWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
33
+ {translate('catalog.notConnected', 'Not connected')}
34
+ </CatalogTagsNotConnectedWrapper>
35
35
  );
36
36
  }
37
37
  return null;
@@ -41,7 +41,14 @@ export function CatalogTagsWithTooltip({
41
41
  return (
42
42
  <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
43
43
  {items.map((item, index) => (
44
- <Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
44
+ <Tag
45
+ key={`${item}-${index}`}
46
+ {...tagProps}
47
+ {...(showAvatars && {
48
+ icon: <CatalogAvatar value={item} size="small" />,
49
+ })}
50
+ maxLength={CATALOG_TAG_MAX_LENGTH}
51
+ >
45
52
  <CatalogHighlight>{item}</CatalogHighlight>
46
53
  </Tag>
47
54
  ))}
@@ -59,6 +66,9 @@ export function CatalogTagsWithTooltip({
59
66
  <Tag
60
67
  key={`${item}-${index}`}
61
68
  {...tagProps}
69
+ {...(showAvatars && {
70
+ icon: <CatalogAvatar value={item} size="small" />,
71
+ })}
62
72
  textTransform="none"
63
73
  maxLength={CATALOG_TAG_MAX_LENGTH}
64
74
  >
@@ -77,10 +87,15 @@ export function CatalogTagsWithTooltip({
77
87
  const CatalogTagsWrapper = styled.div`
78
88
  display: flex;
79
89
  flex-wrap: wrap;
80
- gap: var(--catalog-tags-wrapper-gap);
81
90
  `;
82
91
 
83
92
  const MoreTagsButton = styled.span`
84
93
  font-size: var(--catalog-tags-more-button-font-size);
85
94
  margin-left: var(--catalog-tags-more-button-margin-left);
86
95
  `;
96
+
97
+ const CatalogTagsNotConnectedWrapper = styled.span`
98
+ font-size: var(--catalog-tags-not-connected-font-size);
99
+ line-height: var(--catalog-tags-not-connected-line-height);
100
+ color: var(--catalog-tags-not-connected-color);
101
+ `;