@redocly/theme 0.55.0-next.7 → 0.55.0-next.8

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 (273) hide show
  1. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -0
  2. package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -1
  3. package/lib/components/Catalog/Catalog.d.ts +11 -0
  4. package/lib/components/Catalog/Catalog.js +138 -0
  5. package/lib/components/Catalog/CatalogActionsRow.d.ts +15 -0
  6. package/lib/components/Catalog/CatalogActionsRow.js +34 -0
  7. package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +8 -0
  8. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +179 -0
  9. package/lib/components/Catalog/CatalogCardView/CatalogCardView.d.ts +8 -0
  10. package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +20 -0
  11. package/lib/components/Catalog/CatalogEntities.d.ts +18 -0
  12. package/lib/components/Catalog/CatalogEntities.js +63 -0
  13. package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -0
  14. package/lib/components/Catalog/CatalogEntitiesEmptyState.js +38 -0
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +12 -0
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +133 -0
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +7 -0
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +49 -0
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +6 -0
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +48 -0
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +6 -0
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +111 -0
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +6 -0
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +25 -0
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +6 -0
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +69 -0
  27. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +7 -0
  28. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +48 -0
  29. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +6 -0
  30. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +19 -0
  31. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +6 -0
  32. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +20 -0
  33. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +6 -0
  34. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +20 -0
  35. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +6 -0
  36. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +23 -0
  37. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +6 -0
  38. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +21 -0
  39. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +6 -0
  40. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +24 -0
  41. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +6 -0
  42. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +21 -0
  43. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +21 -0
  44. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +37 -0
  45. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +10 -0
  46. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -0
  47. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +25 -0
  48. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +27 -0
  49. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +22 -0
  50. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +60 -0
  51. package/lib/components/Catalog/CatalogEntityIcon.d.ts +5 -0
  52. package/lib/components/Catalog/CatalogEntityIcon.js +38 -0
  53. package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +5 -0
  54. package/lib/components/Catalog/CatalogEntityTypeIcon.js +42 -0
  55. package/lib/components/Catalog/CatalogHighlight.d.ts +4 -0
  56. package/lib/components/Catalog/CatalogHighlight.js +48 -0
  57. package/lib/components/Catalog/CatalogPageDescription.d.ts +9 -0
  58. package/lib/components/Catalog/CatalogPageDescription.js +52 -0
  59. package/lib/components/Catalog/CatalogSelector.d.ts +12 -0
  60. package/lib/components/Catalog/CatalogSelector.js +48 -0
  61. package/lib/components/Catalog/CatalogSortButton.d.ts +10 -0
  62. package/lib/components/Catalog/CatalogSortButton.js +71 -0
  63. package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.d.ts +5 -0
  64. package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +19 -0
  65. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -0
  66. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +63 -0
  67. package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.d.ts +5 -0
  68. package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +19 -0
  69. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +11 -0
  70. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +101 -0
  71. package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +31 -0
  72. package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +106 -0
  73. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +27 -0
  74. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +127 -0
  75. package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +6 -0
  76. package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +20 -0
  77. package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.d.ts +7 -0
  78. package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +66 -0
  79. package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +9 -0
  80. package/lib/components/Catalog/CatalogTagsWithTooltip.js +46 -0
  81. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +7 -0
  82. package/lib/components/Catalog/CatalogViewModeToggle.js +67 -0
  83. package/lib/components/Catalog/variables.d.ts +1 -0
  84. package/lib/components/Catalog/variables.dark.d.ts +1 -0
  85. package/lib/components/Catalog/variables.dark.js +8 -0
  86. package/lib/components/Catalog/variables.js +354 -0
  87. package/lib/components/CatalogClassic/CatalogClassicHighlight.js +1 -1
  88. package/lib/components/Filter/Filter.d.ts +1 -1
  89. package/lib/components/Filter/Filter.js +2 -2
  90. package/lib/components/Filter/FilterCheckboxes.d.ts +1 -1
  91. package/lib/components/Filter/FilterCheckboxes.js +4 -4
  92. package/lib/components/Filter/FilterContent.d.ts +3 -1
  93. package/lib/components/Filter/FilterContent.js +34 -4
  94. package/lib/components/Filter/FilterInput.js +35 -3
  95. package/lib/components/Filter/FilterSelect.d.ts +1 -1
  96. package/lib/components/Filter/FilterSelect.js +4 -4
  97. package/lib/components/LoadMore/LoadMore.d.ts +8 -0
  98. package/lib/components/LoadMore/LoadMore.js +18 -0
  99. package/lib/components/Markdown/Markdown.js +1 -1
  100. package/lib/components/PageNavigation/NavigationButton.d.ts +13 -0
  101. package/lib/components/PageNavigation/NavigationButton.js +32 -0
  102. package/lib/components/PageNavigation/NextButton.js +10 -29
  103. package/lib/components/PageNavigation/PageNavigation.js +1 -1
  104. package/lib/components/PageNavigation/PreviousButton.js +11 -27
  105. package/lib/components/Search/SearchAiConversationInput.js +2 -1
  106. package/lib/components/Select/Select.js +3 -3
  107. package/lib/components/Sidebar/Sidebar.d.ts +3 -0
  108. package/lib/components/Sidebar/Sidebar.js +3 -2
  109. package/lib/components/Tag/Tag.d.ts +3 -1
  110. package/lib/components/Tag/Tag.js +54 -2
  111. package/lib/components/Tag/variables.js +21 -0
  112. package/lib/components/Tooltip/Tooltip.d.ts +2 -1
  113. package/lib/components/Tooltip/Tooltip.js +26 -19
  114. package/lib/components/Tooltip/variables.js +17 -0
  115. package/lib/core/constants/catalog.d.ts +1 -0
  116. package/lib/core/constants/catalog.js +5 -0
  117. package/lib/core/constants/index.d.ts +1 -0
  118. package/lib/core/constants/index.js +1 -0
  119. package/lib/core/constants/search.d.ts +1 -0
  120. package/lib/core/constants/search.js +2 -1
  121. package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
  122. package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
  123. package/lib/core/hooks/catalog/useCatalogEntities.d.ts +4 -0
  124. package/lib/core/hooks/catalog/useCatalogEntities.js +17 -0
  125. package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.d.ts +15 -0
  126. package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.js +23 -0
  127. package/lib/core/hooks/catalog/useCatalogTableViewRow.d.ts +11 -0
  128. package/lib/core/hooks/catalog/useCatalogTableViewRow.js +26 -0
  129. package/lib/core/hooks/index.d.ts +2 -0
  130. package/lib/core/hooks/index.js +2 -0
  131. package/lib/core/hooks/use-user-teams.d.ts +1 -0
  132. package/lib/core/hooks/use-user-teams.js +10 -0
  133. package/lib/core/styles/dark.js +2 -0
  134. package/lib/core/styles/global.js +63 -60
  135. package/lib/core/types/catalog.d.ts +118 -5
  136. package/lib/core/types/filter.d.ts +1 -0
  137. package/lib/core/types/hooks.d.ts +11 -4
  138. package/lib/core/types/index.d.ts +1 -0
  139. package/lib/core/types/index.js +1 -0
  140. package/lib/core/types/l10n.d.ts +1 -1
  141. package/lib/core/types/telemetry.d.ts +32 -0
  142. package/lib/core/types/telemetry.js +3 -0
  143. package/lib/icons/AscSortIcon/AscSortIcon.d.ts +9 -0
  144. package/lib/icons/AscSortIcon/AscSortIcon.js +25 -0
  145. package/lib/icons/CardsIcon/CardsIcon.d.ts +9 -0
  146. package/lib/icons/CardsIcon/CardsIcon.js +25 -0
  147. package/lib/icons/CaretDownIcon/CaretDownIcon.d.ts +9 -0
  148. package/lib/icons/CaretDownIcon/CaretDownIcon.js +22 -0
  149. package/lib/icons/CaretUpIcon/CaretUpIcon.d.ts +9 -0
  150. package/lib/icons/CaretUpIcon/CaretUpIcon.js +22 -0
  151. package/lib/icons/DescSortIcon/DescSortIcon.d.ts +9 -0
  152. package/lib/icons/DescSortIcon/DescSortIcon.js +25 -0
  153. package/lib/icons/EntityTypeIcon/EntityTypeIcon.d.ts +9 -0
  154. package/lib/icons/EntityTypeIcon/EntityTypeIcon.js +26 -0
  155. package/lib/icons/GithubIcon/GithubIcon.d.ts +9 -0
  156. package/lib/icons/GithubIcon/GithubIcon.js +22 -0
  157. package/lib/icons/GraphIcon/GraphIcon.d.ts +9 -0
  158. package/lib/icons/GraphIcon/GraphIcon.js +22 -0
  159. package/lib/icons/PeopleIcon/PeopleIcon.d.ts +9 -0
  160. package/lib/icons/PeopleIcon/PeopleIcon.js +27 -0
  161. package/lib/icons/SlackIcon/SlackIcon.d.ts +9 -0
  162. package/lib/icons/SlackIcon/SlackIcon.js +29 -0
  163. package/lib/icons/SortIcon/SortIcon.d.ts +9 -0
  164. package/lib/icons/SortIcon/SortIcon.js +25 -0
  165. package/lib/icons/TableIcon/TableIcon.d.ts +9 -0
  166. package/lib/icons/TableIcon/TableIcon.js +22 -0
  167. package/lib/icons/TagsIcon/TagsIcon.d.ts +9 -0
  168. package/lib/icons/TagsIcon/TagsIcon.js +24 -0
  169. package/lib/index.d.ts +18 -0
  170. package/lib/index.js +19 -0
  171. package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
  172. package/lib/markdoc/components/Tabs/Tab.js +10 -2
  173. package/lib/markdoc/components/Tabs/TabList.js +2 -2
  174. package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -1
  175. package/lib/markdoc/components/Tabs/Tabs.js +2 -2
  176. package/package.json +2 -1
  177. package/src/components/Breadcrumbs/Breadcrumbs.tsx +7 -2
  178. package/src/components/Catalog/Catalog.tsx +235 -0
  179. package/src/components/Catalog/CatalogActionsRow.tsx +58 -0
  180. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +227 -0
  181. package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +29 -0
  182. package/src/components/Catalog/CatalogEntities.tsx +107 -0
  183. package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -0
  184. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +207 -0
  185. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +60 -0
  186. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +67 -0
  187. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +93 -0
  188. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +35 -0
  189. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +83 -0
  190. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +62 -0
  191. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +36 -0
  192. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +38 -0
  193. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +33 -0
  194. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +41 -0
  195. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +42 -0
  196. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +39 -0
  197. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +31 -0
  198. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +97 -0
  199. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +80 -0
  200. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +92 -0
  201. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +127 -0
  202. package/src/components/Catalog/CatalogEntityIcon.tsx +41 -0
  203. package/src/components/Catalog/CatalogEntityTypeIcon.tsx +48 -0
  204. package/src/components/Catalog/CatalogHighlight.tsx +56 -0
  205. package/src/components/Catalog/CatalogPageDescription.tsx +72 -0
  206. package/src/components/Catalog/CatalogSelector.tsx +67 -0
  207. package/src/components/Catalog/CatalogSortButton.tsx +78 -0
  208. package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +26 -0
  209. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +77 -0
  210. package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +26 -0
  211. package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +120 -0
  212. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +176 -0
  213. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +180 -0
  214. package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +28 -0
  215. package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +77 -0
  216. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +83 -0
  217. package/src/components/Catalog/CatalogViewModeToggle.tsx +65 -0
  218. package/src/components/Catalog/variables.dark.ts +5 -0
  219. package/src/components/Catalog/variables.ts +351 -0
  220. package/src/components/CatalogClassic/CatalogClassicHighlight.tsx +1 -1
  221. package/src/components/Filter/Filter.tsx +10 -2
  222. package/src/components/Filter/FilterCheckboxes.tsx +8 -4
  223. package/src/components/Filter/FilterContent.tsx +21 -5
  224. package/src/components/Filter/FilterInput.tsx +16 -4
  225. package/src/components/Filter/FilterSelect.tsx +8 -4
  226. package/src/components/LoadMore/LoadMore.tsx +38 -0
  227. package/src/components/Markdown/Markdown.tsx +1 -1
  228. package/src/components/PageNavigation/NavigationButton.tsx +68 -0
  229. package/src/components/PageNavigation/NextButton.tsx +20 -43
  230. package/src/components/PageNavigation/PageNavigation.tsx +1 -1
  231. package/src/components/PageNavigation/PreviousButton.tsx +20 -43
  232. package/src/components/Search/SearchAiConversationInput.tsx +3 -0
  233. package/src/components/Select/Select.tsx +5 -3
  234. package/src/components/Sidebar/Sidebar.tsx +1 -1
  235. package/src/components/Tag/Tag.tsx +67 -1
  236. package/src/components/Tag/variables.ts +21 -0
  237. package/src/components/Tooltip/Tooltip.tsx +31 -22
  238. package/src/components/Tooltip/variables.ts +17 -0
  239. package/src/core/constants/catalog.ts +1 -0
  240. package/src/core/constants/index.ts +1 -0
  241. package/src/core/constants/search.ts +2 -0
  242. package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
  243. package/src/core/hooks/catalog/useCatalogEntities.ts +16 -0
  244. package/src/core/hooks/catalog/useCatalogTableHeaderCellActions.ts +38 -0
  245. package/src/core/hooks/catalog/useCatalogTableViewRow.ts +40 -0
  246. package/src/core/hooks/index.ts +2 -0
  247. package/src/core/hooks/use-user-teams.ts +8 -0
  248. package/src/core/styles/dark.ts +2 -0
  249. package/src/core/styles/global.ts +3 -0
  250. package/src/core/types/catalog.ts +143 -5
  251. package/src/core/types/filter.ts +1 -0
  252. package/src/core/types/hooks.ts +32 -5
  253. package/src/core/types/index.ts +1 -0
  254. package/src/core/types/l10n.ts +20 -0
  255. package/src/core/types/telemetry.ts +36 -0
  256. package/src/core/utils/load-and-navigate.ts +5 -4
  257. package/src/icons/AscSortIcon/AscSortIcon.tsx +29 -0
  258. package/src/icons/CardsIcon/CardsIcon.tsx +38 -0
  259. package/src/icons/CaretDownIcon/CaretDownIcon.tsx +26 -0
  260. package/src/icons/CaretUpIcon/CaretUpIcon.tsx +26 -0
  261. package/src/icons/DescSortIcon/DescSortIcon.tsx +29 -0
  262. package/src/icons/EntityTypeIcon/EntityTypeIcon.tsx +49 -0
  263. package/src/icons/GithubIcon/GithubIcon.tsx +35 -0
  264. package/src/icons/GraphIcon/GraphIcon.tsx +26 -0
  265. package/src/icons/PeopleIcon/PeopleIcon.tsx +46 -0
  266. package/src/icons/SlackIcon/SlackIcon.tsx +61 -0
  267. package/src/icons/SortIcon/SortIcon.tsx +29 -0
  268. package/src/icons/TableIcon/TableIcon.tsx +26 -0
  269. package/src/icons/TagsIcon/TagsIcon.tsx +41 -0
  270. package/src/index.ts +20 -0
  271. package/src/markdoc/components/Tabs/Tab.tsx +12 -1
  272. package/src/markdoc/components/Tabs/TabList.tsx +2 -1
  273. package/src/markdoc/components/Tabs/Tabs.tsx +8 -3
@@ -0,0 +1,176 @@
1
+ import React, { ReactNode } from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
4
+
5
+ import { EntityType, SortOption, BffCatalogEntity } from '@redocly/theme/core/types';
6
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
7
+ import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
8
+ import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
9
+ import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
10
+ import { CatalogTableHeaderCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableHeaderCell';
11
+ import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
12
+ import { CatalogTableViewRow } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableViewRow';
13
+
14
+ export type BaseEntity = {
15
+ id: string;
16
+ key: string;
17
+ type: string;
18
+ title: string;
19
+ summary?: string | null;
20
+ };
21
+
22
+ export type CatalogTableViewProps<T extends BaseEntity> = {
23
+ entities: T[];
24
+ entitiesCatalogConfig?: EntitiesCatalogConfig;
25
+ catalogConfig: CatalogEntityConfig;
26
+ columns?: CatalogColumn<T>[];
27
+ setSortOption: (sortOption: SortOption | null) => void;
28
+ currentSortOption?: SortOption | null;
29
+ handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
30
+ isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
31
+ };
32
+
33
+ export type CatalogColumn<T> = {
34
+ key: string;
35
+ title: string;
36
+ render: (entity: T) => ReactNode;
37
+ width?: string;
38
+ minWidth?: string;
39
+ sortable?: boolean;
40
+ sortKey?: string;
41
+ };
42
+
43
+ export const getEntityTagColor = (type: EntityType): string => {
44
+ switch (type) {
45
+ case 'service':
46
+ return 'blue';
47
+ case 'domain':
48
+ return 'grass';
49
+ case 'team':
50
+ return 'purple';
51
+ case 'user':
52
+ return 'yellow';
53
+ case 'api-description':
54
+ return 'sky';
55
+ default:
56
+ const exhaustiveCheck: never = type;
57
+ throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
58
+ }
59
+ };
60
+
61
+ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
62
+ {
63
+ key: 'entity',
64
+ title: 'Entity',
65
+ render: (entity) => <CatalogEntityCell entity={entity} />,
66
+ width: '3fr',
67
+ minWidth: '250px',
68
+ sortable: true,
69
+ sortKey: 'title',
70
+ },
71
+ {
72
+ key: 'type',
73
+ title: 'Type',
74
+ render: (entity) => (
75
+ <EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
76
+ {entity.type}
77
+ </EntityTypeTag>
78
+ ),
79
+ width: '2fr',
80
+ minWidth: '120px',
81
+ sortable: true,
82
+ sortKey: 'type',
83
+ },
84
+ {
85
+ key: 'domains',
86
+ title: 'Domains',
87
+ render: (entity) => (
88
+ <CatalogDomainsCell domains={entity.domains?.map((domain) => domain.title) || []} />
89
+ ),
90
+ width: '2fr',
91
+ minWidth: '150px',
92
+ },
93
+ {
94
+ key: 'owners',
95
+ title: 'Owners',
96
+ render: (entity) => (
97
+ <CatalogOwnersCell owners={entity.owners?.map((owner) => owner.title) || []} />
98
+ ),
99
+ width: '2fr',
100
+ minWidth: '150px',
101
+ },
102
+ {
103
+ key: 'tags',
104
+ title: 'Tags',
105
+ render: (entity) => <CatalogTagsCell entity={entity} />,
106
+ width: '2fr',
107
+ minWidth: '120px',
108
+ },
109
+ ];
110
+
111
+ export const CatalogTableView = <T extends BaseEntity>({
112
+ entities,
113
+ entitiesCatalogConfig,
114
+ catalogConfig,
115
+ columns = baseColumns as CatalogColumn<BaseEntity>[],
116
+ setSortOption,
117
+ currentSortOption,
118
+ handleSortClick,
119
+ isColumnSorted,
120
+ }: CatalogTableViewProps<T>) => {
121
+ return (
122
+ <CatalogTableWrapper data-component-name="Catalog/CatalogTableView">
123
+ <CatalogTableHeader
124
+ columnsWidths={columns.map((column) => column.width || '1fr')}
125
+ columnsMinWidths={columns.map((column) => column.minWidth || 'auto')}
126
+ >
127
+ {columns.map((column) => (
128
+ <CatalogTableHeaderCell<T>
129
+ key={column.key}
130
+ column={column}
131
+ setSortOption={setSortOption}
132
+ currentSortOption={currentSortOption}
133
+ handleSortClick={handleSortClick}
134
+ isColumnSorted={isColumnSorted}
135
+ />
136
+ ))}
137
+ </CatalogTableHeader>
138
+ <div>
139
+ {entities.map((entity) => (
140
+ <CatalogTableViewRow
141
+ key={entity.id}
142
+ entity={entity}
143
+ entitiesCatalogConfig={entitiesCatalogConfig}
144
+ catalogConfig={catalogConfig}
145
+ columns={columns}
146
+ />
147
+ ))}
148
+ </div>
149
+ </CatalogTableWrapper>
150
+ );
151
+ };
152
+
153
+ const EntityTypeTag = styled(Tag)`
154
+ font-size: var(--font-size-base);
155
+ background-color: transparent;
156
+ text-transform: lowercase;
157
+ `;
158
+
159
+ const CatalogTableWrapper = styled.div`
160
+ width: 100%;
161
+ border-bottom: 1px solid var(--catalog-table-border-color);
162
+ margin-bottom: var(--spacing-xl);
163
+ margin-top: var(--spacing-xl);
164
+ `;
165
+
166
+ const CatalogTableHeader = styled.div<{ columnsWidths: string[]; columnsMinWidths: string[] }>`
167
+ display: grid;
168
+ grid-template-columns: ${({ columnsWidths, columnsMinWidths }) =>
169
+ columnsWidths
170
+ .map((width, index) =>
171
+ columnsMinWidths[index] !== 'auto' ? `minmax(${columnsMinWidths[index]}, ${width})` : width,
172
+ )
173
+ .join(' ')};
174
+ background: var(--catalog-table-header-bg-color);
175
+ font-weight: var(--catalog-table-header-font-weight);
176
+ `;
@@ -0,0 +1,180 @@
1
+ import React, { ReactNode } from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
4
+
5
+ import { EntityType, BffCatalogEntity } from '@redocly/theme/core/types';
6
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
7
+ import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
8
+ import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
9
+ import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
10
+ import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
11
+ import { useCatalogTableViewRow } from '@redocly/theme/core/hooks/catalog/useCatalogTableViewRow';
12
+
13
+ export type BaseEntity = {
14
+ id: string;
15
+ key: string;
16
+ type: string;
17
+ title: string;
18
+ summary?: string | null;
19
+ };
20
+
21
+ export type CatalogTableViewRowProps<T extends BaseEntity> = {
22
+ entity: T;
23
+ entitiesCatalogConfig?: EntitiesCatalogConfig;
24
+ catalogConfig: CatalogEntityConfig;
25
+ columns?: CatalogColumn<T>[];
26
+ };
27
+
28
+ export type CatalogColumn<T> = {
29
+ key: string;
30
+ title: string;
31
+ render: (entity: T) => ReactNode;
32
+ width?: string;
33
+ minWidth?: string;
34
+ sortable?: boolean;
35
+ sortKey?: string;
36
+ };
37
+
38
+ export const getEntityTagColor = (type: EntityType): string => {
39
+ switch (type) {
40
+ case 'service':
41
+ return 'blue';
42
+ case 'domain':
43
+ return 'grass';
44
+ case 'team':
45
+ return 'purple';
46
+ case 'user':
47
+ return 'yellow';
48
+ case 'api-description':
49
+ return 'sky';
50
+ default:
51
+ const exhaustiveCheck: never = type;
52
+ throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
53
+ }
54
+ };
55
+
56
+ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
57
+ {
58
+ key: 'entity',
59
+ title: 'Entity',
60
+ render: (entity) => <CatalogEntityCell entity={entity} />,
61
+ width: '3fr',
62
+ minWidth: '250px',
63
+ sortable: true,
64
+ sortKey: 'title',
65
+ },
66
+ {
67
+ key: 'type',
68
+ title: 'Type',
69
+ render: (entity) => (
70
+ <EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
71
+ {entity.type}
72
+ </EntityTypeTag>
73
+ ),
74
+ width: '2fr',
75
+ minWidth: '120px',
76
+ sortable: true,
77
+ sortKey: 'type',
78
+ },
79
+ {
80
+ key: 'domains',
81
+ title: 'Domains',
82
+ render: (entity) => (
83
+ <CatalogDomainsCell domains={entity.domains?.map((domain) => domain.title) || []} />
84
+ ),
85
+ width: '2fr',
86
+ minWidth: '150px',
87
+ },
88
+ {
89
+ key: 'owners',
90
+ title: 'Owners',
91
+ render: (entity) => (
92
+ <CatalogOwnersCell owners={entity.owners?.map((owner) => owner.title) || []} />
93
+ ),
94
+ width: '2fr',
95
+ minWidth: '150px',
96
+ },
97
+ {
98
+ key: 'tags',
99
+ title: 'Tags',
100
+ render: (entity) => <CatalogTagsCell entity={entity} />,
101
+ width: '2fr',
102
+ minWidth: '120px',
103
+ },
104
+ ];
105
+
106
+ export const CatalogTableViewRow = <T extends BaseEntity>({
107
+ entity,
108
+ entitiesCatalogConfig,
109
+ catalogConfig,
110
+ columns = baseColumns as CatalogColumn<BaseEntity>[],
111
+ }: CatalogTableViewRowProps<T>) => {
112
+ const { getEntityDetailsLink } = useCatalogTableViewRow({
113
+ entityKey: entity.key,
114
+ entityType: entity.type,
115
+ catalogConfig,
116
+ entitiesCatalogConfig,
117
+ });
118
+
119
+ const handleRowClick = (): void => {
120
+ window.location.assign(getEntityDetailsLink());
121
+ };
122
+
123
+ return (
124
+ <TableRow
125
+ key={entity.id}
126
+ columnsWidths={columns.map((column) => column.width || '1fr')}
127
+ columnsMinWidths={columns.map((column) => column.minWidth || 'auto')}
128
+ onClick={() => handleRowClick()}
129
+ >
130
+ {columns.map((column) => (
131
+ <TableCell
132
+ key={column.key}
133
+ className={column.key === 'entity' ? '' : 'tooltip-cell-container'}
134
+ >
135
+ {column.render(entity)}
136
+ </TableCell>
137
+ ))}
138
+ </TableRow>
139
+ );
140
+ };
141
+
142
+ const EntityTypeTag = styled(Tag)`
143
+ font-size: var(--font-size-base);
144
+ background-color: transparent;
145
+ text-transform: lowercase;
146
+ `;
147
+
148
+ const TableRow = styled.div<{ columnsWidths: string[]; columnsMinWidths: string[] }>`
149
+ display: grid;
150
+ grid-template-columns: ${({ columnsWidths, columnsMinWidths }) =>
151
+ columnsWidths
152
+ .map((width, index) =>
153
+ columnsMinWidths[index] !== 'auto' ? `minmax(${columnsMinWidths[index]}, ${width})` : width,
154
+ )
155
+ .join(' ')};
156
+ border-bottom: 1px solid var(--catalog-table-border-color);
157
+ cursor: pointer;
158
+ transition: background-color 0.2s ease;
159
+
160
+ &:last-child {
161
+ border-bottom: none;
162
+ }
163
+
164
+ &:hover {
165
+ background-color: var(--catalog-table-row-hover-bg-color);
166
+ }
167
+ `;
168
+
169
+ const TableCell = styled.div`
170
+ padding: var(--catalog-table-cell-padding);
171
+ display: flex;
172
+ align-items: center;
173
+ position: relative;
174
+ width: 100%;
175
+ overflow: hidden;
176
+
177
+ &.tooltip-cell-container {
178
+ overflow: visible;
179
+ }
180
+ `;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { CatalogTagsWithTooltip } from '@redocly/theme/components/Catalog/CatalogTagsWithTooltip';
5
+
6
+ export type CatalogTagsCellProps = {
7
+ entity: BffCatalogEntity;
8
+ };
9
+
10
+ export function CatalogTagsCell({ entity }: CatalogTagsCellProps) {
11
+ return (
12
+ <div data-component-name="Catalog/CatalogTableView/CatalogTagsCell">
13
+ <CatalogTagsWithTooltip
14
+ data-testid="catalog-tags-cell"
15
+ items={entity.tags || []}
16
+ showPlaceholder={false}
17
+ tagProps={{
18
+ style: {
19
+ fontSize: 'var(--font-size-base)',
20
+ borderRadius: 'var(--border-radius)',
21
+ },
22
+ borderless: true,
23
+ color: 'grey',
24
+ }}
25
+ />
26
+ </div>
27
+ );
28
+ }
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
5
+
6
+ export type CatalogUserEntityCellProps = {
7
+ name: string;
8
+ email: string;
9
+ };
10
+
11
+ const extractInitials = (name: string) => {
12
+ return name
13
+ .split(' ')
14
+ .map((n) => n[0])
15
+ .join('');
16
+ };
17
+
18
+ export function CatalogUserEntityCell({ name, email }: CatalogUserEntityCellProps) {
19
+ return (
20
+ <EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogUserEntityCell">
21
+ <Avatar>{extractInitials(name)}</Avatar>
22
+ <EntityTitleContent>
23
+ <EntityTitle>
24
+ <CatalogHighlight>{name}</CatalogHighlight>
25
+ </EntityTitle>
26
+ <Email>
27
+ <CatalogHighlight>{email}</CatalogHighlight>
28
+ </Email>
29
+ </EntityTitleContent>
30
+ </EntityTitleCellWrapper>
31
+ );
32
+ }
33
+
34
+ const EntityTitleCellWrapper = styled.div`
35
+ display: flex;
36
+ align-items: center;
37
+ gap: 6px;
38
+ max-width: 100%;
39
+ `;
40
+
41
+ const Avatar = styled.div`
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: 32px;
46
+ height: 32px;
47
+ border-radius: 50%;
48
+ background-color: var(--catalog-avatar-bg-color);
49
+ flex-shrink: 0;
50
+ font-size: 14px;
51
+ font-weight: 400;
52
+ `;
53
+
54
+ const EntityTitleContent = styled.div`
55
+ display: flex;
56
+ flex-direction: column;
57
+ overflow: hidden;
58
+ `;
59
+
60
+ const EntityTitle = styled.div`
61
+ font-size: var(--catalog-table-entity-title-font-size);
62
+ line-height: var(--catalog-table-entity-title-line-height);
63
+ font-weight: var(--catalog-table-entity-title-font-weight);
64
+ white-space: nowrap;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ `;
68
+
69
+ export const Email = styled.div`
70
+ font-size: var(--catalog-table-entity-summary-font-size);
71
+ line-height: var(--catalog-table-entity-summary-line-height);
72
+ color: var(--color-blue-6);
73
+ white-space: nowrap;
74
+ overflow: hidden;
75
+ text-overflow: ellipsis;
76
+ width: 100%;
77
+ `;
@@ -0,0 +1,83 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { CATALOG_TAG_MAX_LENGTH } from '@redocly/theme/core/constants';
5
+
6
+ import { Tag, TagProps } from '../Tag/Tag';
7
+ import { CatalogHighlight } from './CatalogHighlight';
8
+ import { TooltipComponent } from '../Tooltip/Tooltip';
9
+
10
+ export type CatalogTagsWithTooltipProps = {
11
+ items: string[];
12
+ itemsToShow?: number;
13
+ showPlaceholder?: boolean;
14
+ tagProps?: TagProps;
15
+ };
16
+
17
+ export function CatalogTagsWithTooltip({
18
+ items,
19
+ itemsToShow = 1,
20
+ showPlaceholder = true,
21
+ tagProps,
22
+ }: CatalogTagsWithTooltipProps): JSX.Element | null {
23
+ if (!items || items.length === 0) {
24
+ if (showPlaceholder) {
25
+ return (
26
+ <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
27
+ <Tag style={{ backgroundColor: 'var(--catalog-tags-placeholder-bg-color)' }} color="grey">
28
+ N/A
29
+ </Tag>
30
+ </CatalogTagsWrapper>
31
+ );
32
+ }
33
+ return null;
34
+ }
35
+
36
+ if (items.length <= itemsToShow) {
37
+ return (
38
+ <TooltipComponent
39
+ tip={items.join(', ')}
40
+ placement="bottom"
41
+ className="catalog"
42
+ width="400px"
43
+ disabled={items.join(', ').length <= CATALOG_TAG_MAX_LENGTH}
44
+ >
45
+ <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
46
+ {items.map((item, index) => (
47
+ <Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
48
+ <CatalogHighlight>{item}</CatalogHighlight>
49
+ </Tag>
50
+ ))}
51
+ </CatalogTagsWrapper>
52
+ </TooltipComponent>
53
+ );
54
+ }
55
+
56
+ const displayedItems = items.slice(0, itemsToShow);
57
+ const remainingCount = items.length - itemsToShow;
58
+
59
+ return (
60
+ <TooltipComponent tip={items.join(', ')} placement="bottom" className="catalog" width="400px">
61
+ <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
62
+ {displayedItems.map((item, index) => (
63
+ <Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
64
+ <CatalogHighlight>{item}</CatalogHighlight>
65
+ </Tag>
66
+ ))}
67
+
68
+ <MoreTagsButton>+{remainingCount} more</MoreTagsButton>
69
+ </CatalogTagsWrapper>
70
+ </TooltipComponent>
71
+ );
72
+ }
73
+
74
+ const CatalogTagsWrapper = styled.div`
75
+ display: flex;
76
+ flex-wrap: wrap;
77
+ gap: var(--catalog-tags-wrapper-gap);
78
+ `;
79
+
80
+ const MoreTagsButton = styled.span`
81
+ font-size: var(--catalog-tags-more-button-font-size);
82
+ margin-left: var(--catalog-tags-more-button-margin-left);
83
+ `;
@@ -0,0 +1,65 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { TableIcon } from '@redocly/theme/icons/TableIcon/TableIcon';
5
+ import { CardsIcon } from '@redocly/theme/icons/CardsIcon/CardsIcon';
6
+ import { CatalogViewMode } from '@redocly/theme/core';
7
+
8
+ function useViewMode(initialViewMode: CatalogViewMode) {
9
+ const [viewMode, setViewMode] = useState<CatalogViewMode | null>(null);
10
+
11
+ useEffect(() => {
12
+ setViewMode(initialViewMode);
13
+ }, [initialViewMode]);
14
+
15
+ return viewMode;
16
+ }
17
+
18
+ export type CatalogViewModeToggleProps = {
19
+ viewMode: CatalogViewMode;
20
+ onViewModeChange: (mode: CatalogViewMode) => void;
21
+ };
22
+
23
+ export function CatalogViewModeToggle({
24
+ viewMode: initialViewMode,
25
+ onViewModeChange,
26
+ }: CatalogViewModeToggleProps) {
27
+ const viewMode = useViewMode(initialViewMode);
28
+
29
+ return (
30
+ <ViewModeToggleWrapper data-component-name="Catalog/CatalogViewModeToggle">
31
+ <ViewModeButton
32
+ className={viewMode === 'table' ? 'active' : ''}
33
+ onClick={() => onViewModeChange('table')}
34
+ >
35
+ <TableIcon size="var(--catalog-view-mode-table-icon-size)" />
36
+ </ViewModeButton>
37
+ <ViewModeButton
38
+ className={viewMode === 'cards' ? 'active' : ''}
39
+ onClick={() => onViewModeChange('cards')}
40
+ >
41
+ <CardsIcon size="var(--catalog-view-mode-cards-icon-size)" />
42
+ </ViewModeButton>
43
+ </ViewModeToggleWrapper>
44
+ );
45
+ }
46
+
47
+ const ViewModeToggleWrapper = styled.div`
48
+ display: flex;
49
+ gap: var(--catalog-view-mode-toggle-gap);
50
+ `;
51
+
52
+ const ViewModeButton = styled.button`
53
+ width: var(--catalog-view-mode-button-width);
54
+ height: var(--catalog-view-mode-button-height);
55
+ background-color: transparent;
56
+ cursor: pointer;
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ border-radius: var(--catalog-view-mode-button-border-radius);
61
+
62
+ &.active {
63
+ background-color: var(--catalog-view-mode-toggle-active-bg-color);
64
+ }
65
+ `;
@@ -0,0 +1,5 @@
1
+ import { css } from 'styled-components';
2
+
3
+ export const catalogDarkMode = css`
4
+ --catalog-avatar-bg-color: #3b3c45;
5
+ `;