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

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 (286) 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/SkipContent/SkipContent.d.ts +2 -0
  110. package/lib/components/SkipContent/SkipContent.js +68 -0
  111. package/lib/components/SkipContent/variables.d.ts +1 -0
  112. package/lib/components/SkipContent/variables.js +23 -0
  113. package/lib/components/Tag/Tag.d.ts +3 -1
  114. package/lib/components/Tag/Tag.js +54 -2
  115. package/lib/components/Tag/variables.js +21 -0
  116. package/lib/components/Tooltip/Tooltip.d.ts +2 -1
  117. package/lib/components/Tooltip/Tooltip.js +26 -19
  118. package/lib/components/Tooltip/variables.js +17 -0
  119. package/lib/core/constants/catalog.d.ts +1 -0
  120. package/lib/core/constants/catalog.js +5 -0
  121. package/lib/core/constants/common.d.ts +1 -0
  122. package/lib/core/constants/common.js +2 -1
  123. package/lib/core/constants/index.d.ts +1 -0
  124. package/lib/core/constants/index.js +1 -0
  125. package/lib/core/constants/search.d.ts +1 -0
  126. package/lib/core/constants/search.js +2 -1
  127. package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
  128. package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
  129. package/lib/core/hooks/catalog/useCatalogEntities.d.ts +4 -0
  130. package/lib/core/hooks/catalog/useCatalogEntities.js +17 -0
  131. package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.d.ts +15 -0
  132. package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.js +23 -0
  133. package/lib/core/hooks/catalog/useCatalogTableViewRow.d.ts +11 -0
  134. package/lib/core/hooks/catalog/useCatalogTableViewRow.js +26 -0
  135. package/lib/core/hooks/index.d.ts +2 -0
  136. package/lib/core/hooks/index.js +2 -0
  137. package/lib/core/hooks/use-user-teams.d.ts +1 -0
  138. package/lib/core/hooks/use-user-teams.js +10 -0
  139. package/lib/core/styles/dark.js +2 -0
  140. package/lib/core/styles/global.js +65 -60
  141. package/lib/core/types/catalog.d.ts +118 -5
  142. package/lib/core/types/filter.d.ts +1 -0
  143. package/lib/core/types/hooks.d.ts +11 -4
  144. package/lib/core/types/index.d.ts +1 -0
  145. package/lib/core/types/index.js +1 -0
  146. package/lib/core/types/l10n.d.ts +1 -1
  147. package/lib/core/types/telemetry.d.ts +32 -0
  148. package/lib/core/types/telemetry.js +3 -0
  149. package/lib/icons/AscSortIcon/AscSortIcon.d.ts +9 -0
  150. package/lib/icons/AscSortIcon/AscSortIcon.js +25 -0
  151. package/lib/icons/CardsIcon/CardsIcon.d.ts +9 -0
  152. package/lib/icons/CardsIcon/CardsIcon.js +25 -0
  153. package/lib/icons/CaretDownIcon/CaretDownIcon.d.ts +9 -0
  154. package/lib/icons/CaretDownIcon/CaretDownIcon.js +22 -0
  155. package/lib/icons/CaretUpIcon/CaretUpIcon.d.ts +9 -0
  156. package/lib/icons/CaretUpIcon/CaretUpIcon.js +22 -0
  157. package/lib/icons/DescSortIcon/DescSortIcon.d.ts +9 -0
  158. package/lib/icons/DescSortIcon/DescSortIcon.js +25 -0
  159. package/lib/icons/EntityTypeIcon/EntityTypeIcon.d.ts +9 -0
  160. package/lib/icons/EntityTypeIcon/EntityTypeIcon.js +26 -0
  161. package/lib/icons/GithubIcon/GithubIcon.d.ts +9 -0
  162. package/lib/icons/GithubIcon/GithubIcon.js +22 -0
  163. package/lib/icons/GraphIcon/GraphIcon.d.ts +9 -0
  164. package/lib/icons/GraphIcon/GraphIcon.js +22 -0
  165. package/lib/icons/PeopleIcon/PeopleIcon.d.ts +9 -0
  166. package/lib/icons/PeopleIcon/PeopleIcon.js +27 -0
  167. package/lib/icons/SlackIcon/SlackIcon.d.ts +9 -0
  168. package/lib/icons/SlackIcon/SlackIcon.js +29 -0
  169. package/lib/icons/SortIcon/SortIcon.d.ts +9 -0
  170. package/lib/icons/SortIcon/SortIcon.js +25 -0
  171. package/lib/icons/TableIcon/TableIcon.d.ts +9 -0
  172. package/lib/icons/TableIcon/TableIcon.js +22 -0
  173. package/lib/icons/TagsIcon/TagsIcon.d.ts +9 -0
  174. package/lib/icons/TagsIcon/TagsIcon.js +24 -0
  175. package/lib/index.d.ts +18 -0
  176. package/lib/index.js +19 -0
  177. package/lib/layouts/PageLayout.js +2 -1
  178. package/lib/layouts/RootLayout.js +2 -0
  179. package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
  180. package/lib/markdoc/components/Tabs/Tab.js +10 -2
  181. package/lib/markdoc/components/Tabs/TabList.js +2 -2
  182. package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -1
  183. package/lib/markdoc/components/Tabs/Tabs.js +2 -2
  184. package/package.json +2 -1
  185. package/src/components/Breadcrumbs/Breadcrumbs.tsx +7 -2
  186. package/src/components/Catalog/Catalog.tsx +235 -0
  187. package/src/components/Catalog/CatalogActionsRow.tsx +58 -0
  188. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +227 -0
  189. package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +29 -0
  190. package/src/components/Catalog/CatalogEntities.tsx +107 -0
  191. package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -0
  192. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +207 -0
  193. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +60 -0
  194. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +67 -0
  195. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +93 -0
  196. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +35 -0
  197. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +83 -0
  198. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +62 -0
  199. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +36 -0
  200. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +38 -0
  201. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +33 -0
  202. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +41 -0
  203. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +42 -0
  204. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +39 -0
  205. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +31 -0
  206. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +97 -0
  207. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +80 -0
  208. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +92 -0
  209. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +127 -0
  210. package/src/components/Catalog/CatalogEntityIcon.tsx +41 -0
  211. package/src/components/Catalog/CatalogEntityTypeIcon.tsx +48 -0
  212. package/src/components/Catalog/CatalogHighlight.tsx +56 -0
  213. package/src/components/Catalog/CatalogPageDescription.tsx +72 -0
  214. package/src/components/Catalog/CatalogSelector.tsx +67 -0
  215. package/src/components/Catalog/CatalogSortButton.tsx +78 -0
  216. package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +26 -0
  217. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +77 -0
  218. package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +26 -0
  219. package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +120 -0
  220. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +176 -0
  221. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +180 -0
  222. package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +28 -0
  223. package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +77 -0
  224. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +83 -0
  225. package/src/components/Catalog/CatalogViewModeToggle.tsx +65 -0
  226. package/src/components/Catalog/variables.dark.ts +5 -0
  227. package/src/components/Catalog/variables.ts +351 -0
  228. package/src/components/CatalogClassic/CatalogClassicHighlight.tsx +1 -1
  229. package/src/components/Filter/Filter.tsx +10 -2
  230. package/src/components/Filter/FilterCheckboxes.tsx +8 -4
  231. package/src/components/Filter/FilterContent.tsx +21 -5
  232. package/src/components/Filter/FilterInput.tsx +16 -4
  233. package/src/components/Filter/FilterSelect.tsx +8 -4
  234. package/src/components/LoadMore/LoadMore.tsx +38 -0
  235. package/src/components/Markdown/Markdown.tsx +1 -1
  236. package/src/components/PageNavigation/NavigationButton.tsx +68 -0
  237. package/src/components/PageNavigation/NextButton.tsx +20 -43
  238. package/src/components/PageNavigation/PageNavigation.tsx +1 -1
  239. package/src/components/PageNavigation/PreviousButton.tsx +20 -43
  240. package/src/components/Search/SearchAiConversationInput.tsx +3 -0
  241. package/src/components/Select/Select.tsx +5 -3
  242. package/src/components/Sidebar/Sidebar.tsx +1 -1
  243. package/src/components/SkipContent/SkipContent.tsx +47 -0
  244. package/src/components/SkipContent/variables.ts +20 -0
  245. package/src/components/Tag/Tag.tsx +67 -1
  246. package/src/components/Tag/variables.ts +21 -0
  247. package/src/components/Tooltip/Tooltip.tsx +31 -22
  248. package/src/components/Tooltip/variables.ts +17 -0
  249. package/src/core/constants/catalog.ts +1 -0
  250. package/src/core/constants/common.ts +1 -0
  251. package/src/core/constants/index.ts +1 -0
  252. package/src/core/constants/search.ts +2 -0
  253. package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
  254. package/src/core/hooks/catalog/useCatalogEntities.ts +16 -0
  255. package/src/core/hooks/catalog/useCatalogTableHeaderCellActions.ts +38 -0
  256. package/src/core/hooks/catalog/useCatalogTableViewRow.ts +40 -0
  257. package/src/core/hooks/index.ts +2 -0
  258. package/src/core/hooks/use-user-teams.ts +8 -0
  259. package/src/core/styles/dark.ts +2 -0
  260. package/src/core/styles/global.ts +5 -0
  261. package/src/core/types/catalog.ts +143 -5
  262. package/src/core/types/filter.ts +1 -0
  263. package/src/core/types/hooks.ts +32 -5
  264. package/src/core/types/index.ts +1 -0
  265. package/src/core/types/l10n.ts +22 -1
  266. package/src/core/types/telemetry.ts +36 -0
  267. package/src/core/utils/load-and-navigate.ts +5 -4
  268. package/src/icons/AscSortIcon/AscSortIcon.tsx +29 -0
  269. package/src/icons/CardsIcon/CardsIcon.tsx +38 -0
  270. package/src/icons/CaretDownIcon/CaretDownIcon.tsx +26 -0
  271. package/src/icons/CaretUpIcon/CaretUpIcon.tsx +26 -0
  272. package/src/icons/DescSortIcon/DescSortIcon.tsx +29 -0
  273. package/src/icons/EntityTypeIcon/EntityTypeIcon.tsx +49 -0
  274. package/src/icons/GithubIcon/GithubIcon.tsx +35 -0
  275. package/src/icons/GraphIcon/GraphIcon.tsx +26 -0
  276. package/src/icons/PeopleIcon/PeopleIcon.tsx +46 -0
  277. package/src/icons/SlackIcon/SlackIcon.tsx +61 -0
  278. package/src/icons/SortIcon/SortIcon.tsx +29 -0
  279. package/src/icons/TableIcon/TableIcon.tsx +26 -0
  280. package/src/icons/TagsIcon/TagsIcon.tsx +41 -0
  281. package/src/index.ts +20 -0
  282. package/src/layouts/PageLayout.tsx +4 -1
  283. package/src/layouts/RootLayout.tsx +2 -0
  284. package/src/markdoc/components/Tabs/Tab.tsx +12 -1
  285. package/src/markdoc/components/Tabs/TabList.tsx +2 -1
  286. package/src/markdoc/components/Tabs/Tabs.tsx +8 -3
@@ -0,0 +1,83 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
5
+ import { EntityTypeProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty';
6
+ import { GitProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty';
7
+ import { TagsProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty';
8
+ import { ApiDescriptionProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty';
9
+ import { UserEmailProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty';
10
+ import { DomainsProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty';
11
+ import { OwnersProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty';
12
+ import { ContactProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty';
13
+
14
+ type PropertyRenderer = {
15
+ key: string;
16
+ condition: (entity: BffCatalogEntity) => boolean;
17
+ component: React.ComponentType<{ entity: BffCatalogEntity }>;
18
+ };
19
+
20
+ const propertyRenderers: PropertyRenderer[] = [
21
+ {
22
+ key: 'type',
23
+ condition: (entity) => !!entity.type,
24
+ component: EntityTypeProperty,
25
+ },
26
+ {
27
+ key: 'contact',
28
+ condition: (entity) => !!entity.contact?.slack?.channels,
29
+ component: ContactProperty,
30
+ },
31
+ {
32
+ key: 'git',
33
+ condition: (entity) => !!entity.git,
34
+ component: GitProperty,
35
+ },
36
+ {
37
+ key: 'tags',
38
+ condition: (entity) => !!entity.tags,
39
+ component: TagsProperty,
40
+ },
41
+ {
42
+ key: 'api-description',
43
+ condition: (entity) => entity.type === 'api-description' && !!entity.metadata?.descriptionFile,
44
+ component: ApiDescriptionProperty,
45
+ },
46
+ {
47
+ key: 'user-email',
48
+ condition: (entity) => entity.type === 'user' && !!entity.metadata?.email,
49
+ component: UserEmailProperty,
50
+ },
51
+ {
52
+ key: 'domains',
53
+ condition: (entity) => (entity.domains?.length ?? 0) > 0,
54
+ component: DomainsProperty,
55
+ },
56
+ {
57
+ key: 'owners',
58
+ condition: (entity) => (entity.owners?.length ?? 0) > 0,
59
+ component: OwnersProperty,
60
+ },
61
+ ];
62
+
63
+ export type CatalogEntityPropertiesProps = {
64
+ entity: BffCatalogEntity;
65
+ };
66
+
67
+ export function CatalogEntityProperties({ entity }: CatalogEntityPropertiesProps): JSX.Element {
68
+ return (
69
+ <CatalogEntityPropertiesGridWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties">
70
+ {propertyRenderers
71
+ .filter((renderer) => renderer.condition(entity))
72
+ .map((renderer) => (
73
+ <renderer.component key={renderer.key + entity.id} entity={entity} />
74
+ ))}
75
+ </CatalogEntityPropertiesGridWrapper>
76
+ );
77
+ }
78
+
79
+ const CatalogEntityPropertiesGridWrapper = styled.div`
80
+ display: grid;
81
+ grid-template-columns: repeat(auto-fill, minmax(325px, 1fr));
82
+ gap: var(--spacing-base);
83
+ `;
@@ -0,0 +1,62 @@
1
+ import React, { ReactNode, JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export type CatalogEntityPropertyCardProps = {
5
+ header: ReactNode;
6
+ content: ReactNode;
7
+ onClick?: () => void;
8
+ };
9
+
10
+ export function CatalogEntityPropertyCard({
11
+ header,
12
+ content,
13
+ onClick,
14
+ }: CatalogEntityPropertyCardProps): JSX.Element {
15
+ return (
16
+ <CatalogEntityPropertyWrapper
17
+ data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard"
18
+ onClick={onClick}
19
+ >
20
+ <CardHeader>{header}</CardHeader>
21
+ <CardContent>{content}</CardContent>
22
+ </CatalogEntityPropertyWrapper>
23
+ );
24
+ }
25
+
26
+ const CatalogEntityPropertyWrapper = styled.div`
27
+ display: flex;
28
+ flex-direction: column;
29
+ color: var(--catalog-card-text-color);
30
+ background-color: var(--catalog-card-bg-color);
31
+ border: var(--catalog-card-border-width) var(--catalog-card-border-style)
32
+ var(--catalog-card-border-color);
33
+ border-radius: var(--catalog-card-border-radius, 8px);
34
+ transition: all 0.2s ease-in-out;
35
+ height: 100%;
36
+ padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
37
+ gap: var(--catalog-card-content-gap-vertical);
38
+
39
+ &:hover {
40
+ border-color: var(--catalog-card-border-color-hover);
41
+ }
42
+
43
+ ${(props) =>
44
+ props.onClick &&
45
+ `
46
+ cursor: pointer;
47
+ `}
48
+ `;
49
+
50
+ const CardHeader = styled.div`
51
+ display: flex;
52
+ align-items: center;
53
+ gap: var(--catalog-card-content-gap);
54
+ `;
55
+
56
+ const CardContent = styled.div`
57
+ flex: 1;
58
+ display: flex;
59
+ align-items: center;
60
+ gap: var(--catalog-card-content-gap);
61
+ flex-wrap: wrap;
62
+ `;
@@ -0,0 +1,36 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { SlackIcon } from '@redocly/theme/icons/SlackIcon/SlackIcon';
5
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
6
+ import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
7
+
8
+ export type ContactPropertyProps = {
9
+ entity: BffCatalogEntity;
10
+ };
11
+
12
+ export function ContactProperty({ entity }: ContactPropertyProps): JSX.Element {
13
+ const channels = entity.contact?.slack?.channels;
14
+
15
+ return (
16
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty">
17
+ <CatalogEntityPropertyCard
18
+ header={
19
+ <>
20
+ <SlackIcon />
21
+ Slack channels
22
+ </>
23
+ }
24
+ content={
25
+ <>
26
+ {channels?.map((channel) => (
27
+ <Tag key={channel.name} style={{ backgroundColor: 'var(--bg-color)' }}>
28
+ {channel.name}
29
+ </Tag>
30
+ ))}
31
+ </>
32
+ }
33
+ />
34
+ </div>
35
+ );
36
+ }
@@ -0,0 +1,38 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
5
+ import { Tag } from '@redocly/theme';
6
+
7
+ import { CatalogEntityPropertyCard } from './CatalogEntityPropertyCard';
8
+
9
+ export type DomainsPropertyProps = {
10
+ entity: BffCatalogEntity;
11
+ };
12
+
13
+ export function DomainsProperty({ entity }: DomainsPropertyProps): JSX.Element {
14
+ const { domains = [] } = entity;
15
+
16
+ return (
17
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty">
18
+ <CatalogEntityPropertyCard
19
+ header={
20
+ <>
21
+ <GraphIcon />
22
+ Domains
23
+ </>
24
+ }
25
+ content={
26
+ <>
27
+ {domains?.map((domain) => (
28
+ <Tag key={domain?.id} style={{ backgroundColor: 'var(--bg-color)' }}>
29
+ <GraphIcon />
30
+ {domain?.title}
31
+ </Tag>
32
+ ))}
33
+ </>
34
+ }
35
+ />
36
+ </div>
37
+ );
38
+ }
@@ -0,0 +1,33 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { EntityTypeIcon } from '@redocly/theme/icons/EntityTypeIcon/EntityTypeIcon';
5
+ import { capitalize } from '@redocly/theme/core/utils';
6
+ import { CatalogEntityTypeIcon } from '@redocly/theme/components/Catalog/CatalogEntityTypeIcon';
7
+
8
+ import { CatalogEntityPropertyCard } from './CatalogEntityPropertyCard';
9
+
10
+ export type EntityTypePropertyProps = {
11
+ entity: BffCatalogEntity;
12
+ };
13
+
14
+ export function EntityTypeProperty({ entity }: EntityTypePropertyProps): JSX.Element {
15
+ return (
16
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty">
17
+ <CatalogEntityPropertyCard
18
+ header={
19
+ <>
20
+ <EntityTypeIcon />
21
+ Entity type
22
+ </>
23
+ }
24
+ content={
25
+ <>
26
+ <CatalogEntityTypeIcon entityType={entity.type} />
27
+ <strong>{capitalize(entity.type)}</strong>
28
+ </>
29
+ }
30
+ />
31
+ </div>
32
+ );
33
+ }
@@ -0,0 +1,41 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { GithubIcon } from '@redocly/theme/icons/GithubIcon/GithubIcon';
5
+ import { removeLeadingSlash } from '@redocly/theme/core/utils';
6
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
7
+ import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
8
+
9
+ export type GitPropertyProps = {
10
+ entity: BffCatalogEntity;
11
+ };
12
+
13
+ export function GitProperty({ entity }: GitPropertyProps): JSX.Element {
14
+ const git = entity.git;
15
+
16
+ return (
17
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/GitProperty">
18
+ <CatalogEntityPropertyCard
19
+ header={
20
+ <>
21
+ <GithubIcon />
22
+ Repositories
23
+ </>
24
+ }
25
+ content={
26
+ <>
27
+ {git?.map((repo) => {
28
+ const url = new URL(repo);
29
+ const repoName = removeLeadingSlash(url.pathname);
30
+ return (
31
+ <Tag key={repo} style={{ backgroundColor: 'var(--bg-color)' }}>
32
+ {repoName}
33
+ </Tag>
34
+ );
35
+ })}
36
+ </>
37
+ }
38
+ />
39
+ </div>
40
+ );
41
+ }
@@ -0,0 +1,42 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
5
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
6
+ import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
7
+
8
+ export type OwnersPropertyProps = {
9
+ entity: BffCatalogEntity;
10
+ };
11
+
12
+ export function OwnersProperty({ entity }: OwnersPropertyProps): JSX.Element {
13
+ const { owners = [] } = entity;
14
+
15
+ return (
16
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty">
17
+ <CatalogEntityPropertyCard
18
+ header={
19
+ <>
20
+ <PeopleIcon />
21
+ Owners
22
+ </>
23
+ }
24
+ content={
25
+ <>
26
+ {owners.map((owner) => (
27
+ <Tag
28
+ key={owner?.id}
29
+ style={{
30
+ backgroundColor: 'var(--bg-color)',
31
+ borderRadius: 'var(--border-radius-xl)',
32
+ }}
33
+ >
34
+ {owner?.title}
35
+ </Tag>
36
+ ))}
37
+ </>
38
+ }
39
+ />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,39 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { TagsIcon } from '@redocly/theme/icons/TagsIcon/TagsIcon';
5
+ import { CatalogTagsWithTooltip } from '@redocly/theme';
6
+ import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
7
+
8
+ export type TagsPropertyProps = {
9
+ entity: BffCatalogEntity;
10
+ };
11
+
12
+ export function TagsProperty({ entity }: TagsPropertyProps): JSX.Element {
13
+ return (
14
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty">
15
+ <CatalogEntityPropertyCard
16
+ header={
17
+ <>
18
+ <TagsIcon />
19
+ Tags
20
+ </>
21
+ }
22
+ content={
23
+ <CatalogTagsWithTooltip
24
+ itemsToShow={8}
25
+ items={entity.tags || []}
26
+ tagProps={{
27
+ style: {
28
+ fontSize: 'var(--font-size-base)',
29
+ borderRadius: 'var(--border-radius)',
30
+ },
31
+ borderless: true,
32
+ color: 'grey',
33
+ }}
34
+ />
35
+ }
36
+ />
37
+ </div>
38
+ );
39
+ }
@@ -0,0 +1,31 @@
1
+ import React, { JSX } from 'react';
2
+
3
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
4
+ import { EmailIcon } from '@redocly/theme/icons/EmailIcon/EmailIcon';
5
+ import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
6
+ import { Email } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogUserEntityCell';
7
+
8
+ export type UserEmailPropertyProps = {
9
+ entity: BffCatalogEntity;
10
+ };
11
+
12
+ export function UserEmailProperty({ entity }: UserEmailPropertyProps): JSX.Element {
13
+ const email = entity.metadata?.email;
14
+
15
+ return (
16
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty">
17
+ <CatalogEntityPropertyCard
18
+ header={
19
+ <>
20
+ <EmailIcon />
21
+ Email
22
+ </>
23
+ }
24
+ content={<Email>{email}</Email>}
25
+ onClick={() => {
26
+ window.open(`mailto:${email}`, '_blank');
27
+ }}
28
+ />
29
+ </div>
30
+ );
31
+ }
@@ -0,0 +1,97 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
4
+
5
+ import {
6
+ BffCatalogEntity,
7
+ BffCatalogRelatedEntity,
8
+ EntityType,
9
+ SortOption,
10
+ } from '@redocly/theme/core/types';
11
+ import {
12
+ CatalogColumn,
13
+ getEntityTagColor,
14
+ } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
15
+ import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
16
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
17
+ import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable';
18
+
19
+ const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
20
+ {
21
+ key: 'entity',
22
+ title: 'Entity',
23
+ render: (entity) => <CatalogEntityCell entity={entity} />,
24
+ sortable: true,
25
+ sortKey: 'title',
26
+ },
27
+ {
28
+ key: 'type',
29
+ title: 'Type',
30
+ render: (entity) => (
31
+ <EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
32
+ {entity.type}
33
+ </EntityTypeTag>
34
+ ),
35
+ sortable: true,
36
+ sortKey: 'type',
37
+ },
38
+ ];
39
+
40
+ export type CatalogEntityDefaultRelationsProps = {
41
+ entity: BffCatalogEntity;
42
+ entitiesCatalogConfig: EntitiesCatalogConfig;
43
+ catalogConfig: CatalogEntityConfig;
44
+ relations: BffCatalogRelatedEntity[];
45
+ query: {
46
+ fetchNextPage: () => void;
47
+ isFetchingNextPage: boolean;
48
+ };
49
+ searchQuery: string;
50
+ setSearchQuery: (query: string) => void;
51
+ sortOption: SortOption | null;
52
+ setSortOption: (sortOption: SortOption | null) => void;
53
+ handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
54
+ isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
55
+ shouldShowLoadMore: boolean;
56
+ };
57
+
58
+ export function CatalogEntityDefaultRelations({
59
+ entity,
60
+ relations,
61
+ query,
62
+ searchQuery,
63
+ setSearchQuery,
64
+ entitiesCatalogConfig,
65
+ catalogConfig,
66
+ sortOption,
67
+ setSortOption,
68
+ handleSortClick,
69
+ isColumnSorted,
70
+ shouldShowLoadMore,
71
+ }: CatalogEntityDefaultRelationsProps): JSX.Element {
72
+ return (
73
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations">
74
+ <CatalogEntityRelationsTable
75
+ entity={entity}
76
+ catalogConfig={catalogConfig}
77
+ entitiesCatalogConfig={entitiesCatalogConfig}
78
+ relations={relations}
79
+ query={query}
80
+ searchQuery={searchQuery}
81
+ setSearchQuery={setSearchQuery}
82
+ heading="Related entities"
83
+ columns={columns}
84
+ sortOption={sortOption}
85
+ setSortOption={setSortOption}
86
+ handleSortClick={handleSortClick}
87
+ isColumnSorted={isColumnSorted}
88
+ shouldShowLoadMore={shouldShowLoadMore}
89
+ />
90
+ </div>
91
+ );
92
+ }
93
+
94
+ const EntityTypeTag = styled(Tag)`
95
+ font-size: var(--font-size-base);
96
+ background-color: transparent;
97
+ `;
@@ -0,0 +1,80 @@
1
+ import React, { JSX } from 'react';
2
+ import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
3
+
4
+ import { BffCatalogEntity, BffCatalogRelatedEntityList } from '@redocly/theme/core/types';
5
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
6
+ import { CatalogEntityDefaultRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations';
7
+ import { CatalogEntityTeamRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations';
8
+
9
+ export type CatalogEntityRelationsProps = {
10
+ entity: BffCatalogEntity;
11
+ entitiesCatalogConfig: EntitiesCatalogConfig;
12
+ catalogConfig: CatalogEntityConfig;
13
+ initialRelations: BffCatalogRelatedEntityList;
14
+ };
15
+ const LOAD_MORE_THRESHOLD = 10;
16
+
17
+ export function CatalogEntityRelations({
18
+ entity,
19
+ entitiesCatalogConfig,
20
+ initialRelations,
21
+ catalogConfig,
22
+ }: CatalogEntityRelationsProps): JSX.Element | null {
23
+ const { useCatalogSort, useCatalogSearch, useFetchCatalogEntitiesRelations } = useThemeHooks();
24
+ const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
25
+ const { searchQuery, setSearchQuery } = useCatalogSearch();
26
+
27
+ const { items: relations, query } = useFetchCatalogEntitiesRelations(
28
+ { entityKey: entity.key, search: searchQuery, sort: sortOption ?? undefined },
29
+ initialRelations,
30
+ );
31
+
32
+ if (relations.length === 0) {
33
+ return null;
34
+ }
35
+
36
+ const shouldShowLoadMore =
37
+ query.hasNextPage ||
38
+ (query.isPlaceholderData && relations && relations.length >= LOAD_MORE_THRESHOLD);
39
+
40
+ switch (entity.type) {
41
+ case 'team':
42
+ return (
43
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityTeamRelations">
44
+ <CatalogEntityTeamRelations
45
+ entity={entity}
46
+ catalogConfig={catalogConfig}
47
+ entitiesCatalogConfig={entitiesCatalogConfig}
48
+ relations={relations}
49
+ query={query}
50
+ searchQuery={searchQuery}
51
+ setSearchQuery={setSearchQuery}
52
+ sortOption={sortOption}
53
+ setSortOption={setSortOption}
54
+ handleSortClick={handleSortClick}
55
+ isColumnSorted={isColumnSorted}
56
+ shouldShowLoadMore={shouldShowLoadMore}
57
+ />
58
+ </div>
59
+ );
60
+ default:
61
+ return (
62
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityDefaultRelations">
63
+ <CatalogEntityDefaultRelations
64
+ entity={entity}
65
+ catalogConfig={catalogConfig}
66
+ entitiesCatalogConfig={entitiesCatalogConfig}
67
+ relations={relations}
68
+ query={query}
69
+ searchQuery={searchQuery}
70
+ setSearchQuery={setSearchQuery}
71
+ sortOption={sortOption}
72
+ setSortOption={setSortOption}
73
+ handleSortClick={handleSortClick}
74
+ isColumnSorted={isColumnSorted}
75
+ shouldShowLoadMore={shouldShowLoadMore}
76
+ />
77
+ </div>
78
+ );
79
+ }
80
+ }
@@ -0,0 +1,92 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
4
+
5
+ import { ArrowDownIcon } from '@redocly/theme/icons/ArrowDownIcon/ArrowDownIcon';
6
+ import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '@redocly/theme/core/types';
7
+ import { LoadMore } from '@redocly/theme/components/LoadMore/LoadMore';
8
+ import {
9
+ CatalogColumn,
10
+ CatalogTableView,
11
+ } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
12
+ import { CatalogActionsRow } from '@redocly/theme/components/Catalog/CatalogActionsRow';
13
+ import { HighlightContext } from '@redocly/theme/components/Catalog/CatalogHighlight';
14
+
15
+ export type CatalogEntityRelationsTableProps = {
16
+ entity: BffCatalogEntity;
17
+ entitiesCatalogConfig: EntitiesCatalogConfig;
18
+ catalogConfig: CatalogEntityConfig;
19
+ relations: BffCatalogRelatedEntity[];
20
+ query: {
21
+ fetchNextPage: () => void;
22
+ isFetchingNextPage: boolean;
23
+ };
24
+ searchQuery: string;
25
+ setSearchQuery: (query: string) => void;
26
+ heading: string;
27
+ filter?: string;
28
+ columns: CatalogColumn<BffCatalogRelatedEntity>[];
29
+ sortOption: SortOption | null;
30
+ setSortOption: (sortOption: SortOption | null) => void;
31
+ handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
32
+ isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
33
+ shouldShowLoadMore: boolean;
34
+ };
35
+
36
+ export function CatalogEntityRelationsTable({
37
+ entitiesCatalogConfig,
38
+ catalogConfig,
39
+ relations,
40
+ query,
41
+ searchQuery,
42
+ setSearchQuery,
43
+ heading,
44
+ columns,
45
+ setSortOption,
46
+ sortOption,
47
+ handleSortClick,
48
+ isColumnSorted,
49
+ shouldShowLoadMore,
50
+ }: CatalogEntityRelationsTableProps): JSX.Element {
51
+ return (
52
+ <div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable">
53
+ <Heading>{heading}</Heading>
54
+ <CatalogActionsRow
55
+ searchQuery={searchQuery}
56
+ setSearchQuery={setSearchQuery}
57
+ sortOption={sortOption}
58
+ setSortOption={setSortOption}
59
+ style={{ marginBottom: '12px' }}
60
+ />
61
+ {relations.length > 0 && (
62
+ <HighlightContext.Provider value={[searchQuery]}>
63
+ <CatalogTableView
64
+ entities={relations}
65
+ entitiesCatalogConfig={entitiesCatalogConfig}
66
+ catalogConfig={catalogConfig}
67
+ columns={columns}
68
+ setSortOption={setSortOption}
69
+ currentSortOption={sortOption}
70
+ handleSortClick={handleSortClick}
71
+ isColumnSorted={isColumnSorted}
72
+ />
73
+ </HighlightContext.Provider>
74
+ )}
75
+ {shouldShowLoadMore && (
76
+ <LoadMore
77
+ icon={<ArrowDownIcon size="var(--catalog-load-more-icon-size)" />}
78
+ onClick={query.fetchNextPage}
79
+ disabled={query.isFetchingNextPage}
80
+ blinking={query.isFetchingNextPage}
81
+ label={query.isFetchingNextPage ? 'Loading...' : 'Load More'}
82
+ />
83
+ )}
84
+ </div>
85
+ );
86
+ }
87
+
88
+ const Heading = styled.h2`
89
+ margin: var(--spacing-base) 0;
90
+ font-size: var(--font-size-md);
91
+ color: var(--catalog-metadata-heading-color);
92
+ `;