@redocly/theme 0.55.0-rc.1 → 0.55.0

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 (353) hide show
  1. package/lib/components/Admonition/Admonition.js +4 -0
  2. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -0
  3. package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -1
  4. package/lib/components/Button/Button.d.ts +1 -0
  5. package/lib/components/Catalog/Catalog.d.ts +11 -0
  6. package/lib/components/Catalog/Catalog.js +138 -0
  7. package/lib/components/Catalog/CatalogActionsRow.d.ts +15 -0
  8. package/lib/components/Catalog/CatalogActionsRow.js +34 -0
  9. package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +8 -0
  10. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +179 -0
  11. package/lib/components/Catalog/CatalogCardView/CatalogCardView.d.ts +8 -0
  12. package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +20 -0
  13. package/lib/components/Catalog/CatalogEntities.d.ts +18 -0
  14. package/lib/components/Catalog/CatalogEntities.js +63 -0
  15. package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -0
  16. package/lib/components/Catalog/CatalogEntitiesEmptyState.js +38 -0
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +12 -0
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +133 -0
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +7 -0
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +49 -0
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +6 -0
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +48 -0
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +6 -0
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +111 -0
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +6 -0
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +25 -0
  27. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +6 -0
  28. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +69 -0
  29. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +7 -0
  30. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +48 -0
  31. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +6 -0
  32. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +19 -0
  33. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +6 -0
  34. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +20 -0
  35. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +6 -0
  36. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +20 -0
  37. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +6 -0
  38. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +23 -0
  39. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +6 -0
  40. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +21 -0
  41. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +6 -0
  42. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +24 -0
  43. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +6 -0
  44. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +21 -0
  45. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +21 -0
  46. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +37 -0
  47. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +10 -0
  48. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -0
  49. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +25 -0
  50. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +27 -0
  51. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +22 -0
  52. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +60 -0
  53. package/lib/components/Catalog/CatalogEntityIcon.d.ts +5 -0
  54. package/lib/components/Catalog/CatalogEntityIcon.js +38 -0
  55. package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +5 -0
  56. package/lib/components/Catalog/CatalogEntityTypeIcon.js +42 -0
  57. package/lib/components/Catalog/CatalogHighlight.d.ts +4 -0
  58. package/lib/components/Catalog/CatalogHighlight.js +48 -0
  59. package/lib/components/Catalog/CatalogPageDescription.d.ts +9 -0
  60. package/lib/components/Catalog/CatalogPageDescription.js +52 -0
  61. package/lib/components/Catalog/CatalogSelector.d.ts +12 -0
  62. package/lib/components/Catalog/CatalogSelector.js +48 -0
  63. package/lib/components/Catalog/CatalogSortButton.d.ts +10 -0
  64. package/lib/components/Catalog/CatalogSortButton.js +71 -0
  65. package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.d.ts +5 -0
  66. package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +19 -0
  67. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -0
  68. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +63 -0
  69. package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.d.ts +5 -0
  70. package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +19 -0
  71. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +11 -0
  72. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +101 -0
  73. package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +31 -0
  74. package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +106 -0
  75. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +27 -0
  76. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +127 -0
  77. package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +6 -0
  78. package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +20 -0
  79. package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.d.ts +7 -0
  80. package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +66 -0
  81. package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +9 -0
  82. package/lib/components/Catalog/CatalogTagsWithTooltip.js +46 -0
  83. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +7 -0
  84. package/lib/components/Catalog/CatalogViewModeToggle.js +67 -0
  85. package/lib/components/Catalog/variables.d.ts +1 -0
  86. package/lib/components/Catalog/variables.dark.d.ts +1 -0
  87. package/lib/components/Catalog/variables.dark.js +8 -0
  88. package/lib/components/Catalog/variables.js +354 -0
  89. package/lib/components/CatalogClassic/CatalogClassicHighlight.js +1 -1
  90. package/lib/components/Dropdown/variables.js +1 -1
  91. package/lib/components/Filter/Filter.d.ts +1 -1
  92. package/lib/components/Filter/Filter.js +2 -2
  93. package/lib/components/Filter/FilterCheckboxes.d.ts +1 -1
  94. package/lib/components/Filter/FilterCheckboxes.js +4 -4
  95. package/lib/components/Filter/FilterContent.d.ts +3 -1
  96. package/lib/components/Filter/FilterContent.js +34 -4
  97. package/lib/components/Filter/FilterInput.js +35 -3
  98. package/lib/components/Filter/FilterSelect.d.ts +1 -1
  99. package/lib/components/Filter/FilterSelect.js +4 -4
  100. package/lib/components/Image/Image.js +2 -2
  101. package/lib/components/LoadMore/LoadMore.d.ts +8 -0
  102. package/lib/components/LoadMore/LoadMore.js +18 -0
  103. package/lib/components/Markdown/Markdown.js +1 -1
  104. package/lib/components/Marker/Marker.d.ts +10 -0
  105. package/lib/components/Marker/Marker.js +62 -0
  106. package/lib/components/Menu/MenuItem.d.ts +1 -1
  107. package/lib/components/Menu/MenuItem.js +7 -3
  108. package/lib/components/PageNavigation/NavigationButton.d.ts +13 -0
  109. package/lib/components/PageNavigation/NavigationButton.js +32 -0
  110. package/lib/components/PageNavigation/NextButton.js +10 -29
  111. package/lib/components/PageNavigation/PageNavigation.js +1 -1
  112. package/lib/components/PageNavigation/PreviousButton.js +11 -27
  113. package/lib/components/Search/SearchAiConversationInput.js +2 -1
  114. package/lib/components/Select/Select.js +22 -6
  115. package/lib/components/Select/SelectInput.d.ts +1 -0
  116. package/lib/components/Select/SelectInput.js +7 -3
  117. package/lib/components/Select/variables.js +2 -2
  118. package/lib/components/Sidebar/Sidebar.d.ts +3 -0
  119. package/lib/components/Sidebar/Sidebar.js +3 -2
  120. package/lib/components/SkipContent/SkipContent.d.ts +2 -0
  121. package/lib/components/SkipContent/SkipContent.js +68 -0
  122. package/lib/components/SkipContent/variables.d.ts +1 -0
  123. package/lib/components/SkipContent/variables.js +23 -0
  124. package/lib/components/Tag/Tag.d.ts +3 -1
  125. package/lib/components/Tag/Tag.js +54 -2
  126. package/lib/components/Tag/variables.js +21 -0
  127. package/lib/components/Tooltip/Tooltip.d.ts +2 -1
  128. package/lib/components/Tooltip/Tooltip.js +26 -19
  129. package/lib/components/Tooltip/variables.js +17 -0
  130. package/lib/components/VersionPicker/VersionPicker.js +22 -3
  131. package/lib/components/VersionPicker/variables.js +1 -0
  132. package/lib/core/constants/catalog.d.ts +1 -0
  133. package/lib/core/constants/catalog.js +5 -0
  134. package/lib/core/constants/common.d.ts +1 -0
  135. package/lib/core/constants/common.js +2 -1
  136. package/lib/core/constants/index.d.ts +1 -0
  137. package/lib/core/constants/index.js +1 -0
  138. package/lib/core/constants/search.d.ts +1 -0
  139. package/lib/core/constants/search.js +2 -1
  140. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.d.ts +1 -1
  141. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.js +5 -2
  142. package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
  143. package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
  144. package/lib/core/hooks/catalog/useCatalogEntities.d.ts +4 -0
  145. package/lib/core/hooks/catalog/useCatalogEntities.js +17 -0
  146. package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.d.ts +15 -0
  147. package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.js +23 -0
  148. package/lib/core/hooks/catalog/useCatalogTableViewRow.d.ts +11 -0
  149. package/lib/core/hooks/catalog/useCatalogTableViewRow.js +26 -0
  150. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +17 -9
  151. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +242 -47
  152. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +9 -2
  153. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +2 -2
  154. package/lib/core/hooks/index.d.ts +3 -1
  155. package/lib/core/hooks/index.js +3 -1
  156. package/lib/core/hooks/use-active-page-version.d.ts +1 -0
  157. package/lib/core/hooks/{use-page-active-version.js → use-active-page-version.js} +3 -3
  158. package/lib/core/hooks/use-user-teams.d.ts +1 -0
  159. package/lib/core/hooks/use-user-teams.js +10 -0
  160. package/lib/core/styles/dark.js +2 -0
  161. package/lib/core/styles/global.js +65 -60
  162. package/lib/core/types/catalog.d.ts +118 -5
  163. package/lib/core/types/code-walkthrough.d.ts +13 -0
  164. package/lib/core/types/code-walkthrough.js +3 -0
  165. package/lib/core/types/filter.d.ts +1 -0
  166. package/lib/core/types/hooks.d.ts +11 -4
  167. package/lib/core/types/index.d.ts +3 -0
  168. package/lib/core/types/index.js +3 -0
  169. package/lib/core/types/l10n.d.ts +1 -1
  170. package/lib/core/types/marker.d.ts +4 -0
  171. package/lib/core/types/marker.js +3 -0
  172. package/lib/core/types/telemetry.d.ts +32 -0
  173. package/lib/core/types/telemetry.js +3 -0
  174. package/lib/core/utils/index.d.ts +1 -0
  175. package/lib/core/utils/index.js +1 -0
  176. package/lib/core/utils/js-utils.d.ts +18 -0
  177. package/lib/core/utils/js-utils.js +31 -0
  178. package/lib/core/utils/parse-style-string.d.ts +1 -0
  179. package/lib/core/utils/parse-style-string.js +23 -0
  180. package/lib/icons/AscSortIcon/AscSortIcon.d.ts +9 -0
  181. package/lib/icons/AscSortIcon/AscSortIcon.js +25 -0
  182. package/lib/icons/CardsIcon/CardsIcon.d.ts +9 -0
  183. package/lib/icons/CardsIcon/CardsIcon.js +25 -0
  184. package/lib/icons/CaretDownIcon/CaretDownIcon.d.ts +9 -0
  185. package/lib/icons/CaretDownIcon/CaretDownIcon.js +22 -0
  186. package/lib/icons/CaretUpIcon/CaretUpIcon.d.ts +9 -0
  187. package/lib/icons/CaretUpIcon/CaretUpIcon.js +22 -0
  188. package/lib/icons/DescSortIcon/DescSortIcon.d.ts +9 -0
  189. package/lib/icons/DescSortIcon/DescSortIcon.js +25 -0
  190. package/lib/icons/EntityTypeIcon/EntityTypeIcon.d.ts +9 -0
  191. package/lib/icons/EntityTypeIcon/EntityTypeIcon.js +26 -0
  192. package/lib/icons/GithubIcon/GithubIcon.d.ts +9 -0
  193. package/lib/icons/GithubIcon/GithubIcon.js +22 -0
  194. package/lib/icons/GraphIcon/GraphIcon.d.ts +9 -0
  195. package/lib/icons/GraphIcon/GraphIcon.js +22 -0
  196. package/lib/icons/PeopleIcon/PeopleIcon.d.ts +9 -0
  197. package/lib/icons/PeopleIcon/PeopleIcon.js +27 -0
  198. package/lib/icons/SlackIcon/SlackIcon.d.ts +9 -0
  199. package/lib/icons/SlackIcon/SlackIcon.js +29 -0
  200. package/lib/icons/SortIcon/SortIcon.d.ts +9 -0
  201. package/lib/icons/SortIcon/SortIcon.js +25 -0
  202. package/lib/icons/TableIcon/TableIcon.d.ts +9 -0
  203. package/lib/icons/TableIcon/TableIcon.js +22 -0
  204. package/lib/icons/TagsIcon/TagsIcon.d.ts +9 -0
  205. package/lib/icons/TagsIcon/TagsIcon.js +24 -0
  206. package/lib/index.d.ts +19 -1
  207. package/lib/index.js +20 -1
  208. package/lib/layouts/PageLayout.js +2 -1
  209. package/lib/layouts/RootLayout.js +2 -0
  210. package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +1 -2
  211. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +26 -20
  212. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +32 -3
  213. package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
  214. package/lib/markdoc/components/Tabs/Tab.js +10 -2
  215. package/lib/markdoc/components/Tabs/TabList.d.ts +1 -4
  216. package/lib/markdoc/components/Tabs/TabList.js +18 -38
  217. package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -1
  218. package/lib/markdoc/components/Tabs/Tabs.js +5 -9
  219. package/lib/markdoc/tags/code-step.js +0 -3
  220. package/lib/markdoc/tags/code-walkthrough.js +0 -1
  221. package/package.json +4 -3
  222. package/src/components/Admonition/Admonition.tsx +4 -0
  223. package/src/components/Breadcrumbs/Breadcrumbs.tsx +7 -2
  224. package/src/components/Button/Button.tsx +1 -1
  225. package/src/components/Catalog/Catalog.tsx +235 -0
  226. package/src/components/Catalog/CatalogActionsRow.tsx +58 -0
  227. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +227 -0
  228. package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +29 -0
  229. package/src/components/Catalog/CatalogEntities.tsx +107 -0
  230. package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -0
  231. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +207 -0
  232. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +60 -0
  233. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +67 -0
  234. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +93 -0
  235. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +35 -0
  236. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +83 -0
  237. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +62 -0
  238. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +36 -0
  239. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +38 -0
  240. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +33 -0
  241. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +41 -0
  242. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +42 -0
  243. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +39 -0
  244. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +31 -0
  245. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +97 -0
  246. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +80 -0
  247. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +92 -0
  248. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +127 -0
  249. package/src/components/Catalog/CatalogEntityIcon.tsx +41 -0
  250. package/src/components/Catalog/CatalogEntityTypeIcon.tsx +48 -0
  251. package/src/components/Catalog/CatalogHighlight.tsx +56 -0
  252. package/src/components/Catalog/CatalogPageDescription.tsx +72 -0
  253. package/src/components/Catalog/CatalogSelector.tsx +67 -0
  254. package/src/components/Catalog/CatalogSortButton.tsx +78 -0
  255. package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +26 -0
  256. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +77 -0
  257. package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +26 -0
  258. package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +120 -0
  259. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +176 -0
  260. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +180 -0
  261. package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +28 -0
  262. package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +77 -0
  263. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +83 -0
  264. package/src/components/Catalog/CatalogViewModeToggle.tsx +65 -0
  265. package/src/components/Catalog/variables.dark.ts +5 -0
  266. package/src/components/Catalog/variables.ts +351 -0
  267. package/src/components/CatalogClassic/CatalogClassicHighlight.tsx +1 -1
  268. package/src/components/Dropdown/variables.ts +1 -1
  269. package/src/components/Filter/Filter.tsx +10 -2
  270. package/src/components/Filter/FilterCheckboxes.tsx +8 -4
  271. package/src/components/Filter/FilterContent.tsx +21 -5
  272. package/src/components/Filter/FilterInput.tsx +16 -4
  273. package/src/components/Filter/FilterSelect.tsx +8 -4
  274. package/src/components/Image/Image.tsx +5 -9
  275. package/src/components/LoadMore/LoadMore.tsx +38 -0
  276. package/src/components/Markdown/Markdown.tsx +1 -1
  277. package/src/components/Marker/Marker.tsx +53 -0
  278. package/src/components/Menu/MenuItem.tsx +11 -2
  279. package/src/components/PageNavigation/NavigationButton.tsx +68 -0
  280. package/src/components/PageNavigation/NextButton.tsx +20 -43
  281. package/src/components/PageNavigation/PageNavigation.tsx +1 -1
  282. package/src/components/PageNavigation/PreviousButton.tsx +20 -43
  283. package/src/components/Search/SearchAiConversationInput.tsx +3 -0
  284. package/src/components/Select/Select.tsx +29 -4
  285. package/src/components/Select/SelectInput.tsx +20 -1
  286. package/src/components/Select/variables.ts +2 -2
  287. package/src/components/Sidebar/Sidebar.tsx +1 -1
  288. package/src/components/SkipContent/SkipContent.tsx +47 -0
  289. package/src/components/SkipContent/variables.ts +20 -0
  290. package/src/components/Tag/Tag.tsx +67 -1
  291. package/src/components/Tag/variables.ts +21 -0
  292. package/src/components/Tooltip/Tooltip.tsx +31 -22
  293. package/src/components/Tooltip/variables.ts +17 -0
  294. package/src/components/VersionPicker/VersionPicker.tsx +32 -2
  295. package/src/components/VersionPicker/variables.ts +1 -0
  296. package/src/core/constants/catalog.ts +1 -0
  297. package/src/core/constants/common.ts +1 -0
  298. package/src/core/constants/index.ts +1 -0
  299. package/src/core/constants/search.ts +2 -0
  300. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.tsx +6 -3
  301. package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
  302. package/src/core/hooks/catalog/useCatalogEntities.ts +16 -0
  303. package/src/core/hooks/catalog/useCatalogTableHeaderCellActions.ts +38 -0
  304. package/src/core/hooks/catalog/useCatalogTableViewRow.ts +40 -0
  305. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +326 -65
  306. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +9 -6
  307. package/src/core/hooks/index.ts +3 -1
  308. package/src/core/hooks/{use-page-active-version.ts → use-active-page-version.ts} +1 -1
  309. package/src/core/hooks/use-user-teams.ts +8 -0
  310. package/src/core/styles/dark.ts +2 -0
  311. package/src/core/styles/global.ts +5 -0
  312. package/src/core/types/catalog.ts +143 -5
  313. package/src/core/types/code-walkthrough.ts +15 -0
  314. package/src/core/types/filter.ts +1 -0
  315. package/src/core/types/hooks.ts +32 -5
  316. package/src/core/types/index.ts +3 -0
  317. package/src/core/types/l10n.ts +22 -1
  318. package/src/core/types/marker.ts +4 -0
  319. package/src/core/types/telemetry.ts +36 -0
  320. package/src/core/utils/index.ts +1 -0
  321. package/src/core/utils/js-utils.ts +31 -0
  322. package/src/core/utils/load-and-navigate.ts +5 -4
  323. package/src/core/utils/parse-style-string.ts +21 -0
  324. package/src/icons/AscSortIcon/AscSortIcon.tsx +29 -0
  325. package/src/icons/CardsIcon/CardsIcon.tsx +38 -0
  326. package/src/icons/CaretDownIcon/CaretDownIcon.tsx +26 -0
  327. package/src/icons/CaretUpIcon/CaretUpIcon.tsx +26 -0
  328. package/src/icons/DescSortIcon/DescSortIcon.tsx +29 -0
  329. package/src/icons/EntityTypeIcon/EntityTypeIcon.tsx +49 -0
  330. package/src/icons/GithubIcon/GithubIcon.tsx +35 -0
  331. package/src/icons/GraphIcon/GraphIcon.tsx +26 -0
  332. package/src/icons/PeopleIcon/PeopleIcon.tsx +46 -0
  333. package/src/icons/SlackIcon/SlackIcon.tsx +61 -0
  334. package/src/icons/SortIcon/SortIcon.tsx +29 -0
  335. package/src/icons/TableIcon/TableIcon.tsx +26 -0
  336. package/src/icons/TagsIcon/TagsIcon.tsx +41 -0
  337. package/src/index.ts +21 -1
  338. package/src/layouts/PageLayout.tsx +4 -1
  339. package/src/layouts/RootLayout.tsx +2 -0
  340. package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +76 -36
  341. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +8 -3
  342. package/src/markdoc/components/Tabs/Tab.tsx +12 -1
  343. package/src/markdoc/components/Tabs/TabList.tsx +40 -70
  344. package/src/markdoc/components/Tabs/Tabs.tsx +11 -10
  345. package/src/markdoc/tags/code-step.ts +0 -3
  346. package/src/markdoc/tags/code-walkthrough.ts +0 -1
  347. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +0 -1
  348. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +0 -5
  349. package/lib/core/hooks/use-page-active-version.d.ts +0 -1
  350. package/lib/ext/process-scorecard.d.ts +0 -5
  351. package/lib/ext/process-scorecard.js +0 -11
  352. package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +0 -1
  353. package/src/ext/process-scorecard.ts +0 -13
@@ -0,0 +1,78 @@
1
+ import React, { useCallback } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { SortOption } from '@redocly/theme/core/types';
5
+ import { AscSortIcon } from '@redocly/theme/icons/AscSortIcon/AscSortIcon';
6
+ import { DescSortIcon } from '@redocly/theme/icons/DescSortIcon/DescSortIcon';
7
+ import { Dropdown } from '@redocly/theme/components/Dropdown/Dropdown';
8
+ import { DropdownMenu } from '@redocly/theme/components/Dropdown/DropdownMenu';
9
+ import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
10
+
11
+ export type CatalogSortButtonProps = {
12
+ onSortChange: (sortOption: SortOption | null) => void;
13
+ currentSort?: SortOption | null;
14
+ };
15
+
16
+ export function CatalogSortButton({
17
+ onSortChange,
18
+ currentSort,
19
+ }: {
20
+ onSortChange: (sortOption: SortOption | null) => void;
21
+ currentSort?: SortOption | null;
22
+ }) {
23
+ const toggleSort = useCallback(
24
+ (field: string): void => {
25
+ const newSort = currentSort === `-${field}` ? field : `-${field}`;
26
+ onSortChange(newSort as SortOption);
27
+ },
28
+ [currentSort, onSortChange],
29
+ );
30
+
31
+ return (
32
+ <CatalogSortButtonWrapper
33
+ data-component-name="Catalog/CatalogSortButton"
34
+ trigger={
35
+ <SortTrigger>
36
+ <SortIconWrapper>
37
+ {currentSort === '-title' ? <DescSortIcon /> : <AscSortIcon />}
38
+ </SortIconWrapper>
39
+ <SortText>Sort</SortText>
40
+ </SortTrigger>
41
+ }
42
+ alignment="end"
43
+ >
44
+ <DropdownMenu>
45
+ <DropdownMenuItem onAction={() => toggleSort('title')}>
46
+ {currentSort === '-title' ? 'Title | A → Z' : 'Title | Z → A'}
47
+ </DropdownMenuItem>
48
+ </DropdownMenu>
49
+ </CatalogSortButtonWrapper>
50
+ );
51
+ }
52
+
53
+ const CatalogSortButtonWrapper = styled(Dropdown)``;
54
+
55
+ const SortTrigger = styled.div`
56
+ display: flex;
57
+ align-items: center;
58
+ gap: var(--catalog-sort-trigger-gap);
59
+ padding: var(--catalog-sort-trigger-padding);
60
+ border-radius: var(--catalog-sort-trigger-border-radius);
61
+ cursor: pointer;
62
+ &:hover {
63
+ background-color: var(--catalog-sort-trigger-hover-bg-color);
64
+ }
65
+ `;
66
+
67
+ const SortIconWrapper = styled.div`
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ color: var(--catalog-sort-icon-color);
72
+ `;
73
+
74
+ const SortText = styled.span`
75
+ font-size: var(--catalog-sort-text-font-size);
76
+ color: var(--catalog-sort-text-color);
77
+ font-weight: var(--catalog-sort-text-font-weight);
78
+ `;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ import { CatalogTagsWithTooltip } from '@redocly/theme/components/Catalog/CatalogTagsWithTooltip';
4
+
5
+ export type CatalogDomainsCellProps = {
6
+ domains: string[];
7
+ };
8
+
9
+ export function CatalogDomainsCell({ domains }: CatalogDomainsCellProps) {
10
+ return (
11
+ <div data-component-name="Catalog/CatalogTableView/CatalogDomainsCell">
12
+ <CatalogTagsWithTooltip
13
+ data-testid="catalog-domains-cell"
14
+ items={domains}
15
+ showPlaceholder={false}
16
+ tagProps={{
17
+ style: {
18
+ fontSize: 'var(--font-size-base)',
19
+ backgroundColor: 'transparent',
20
+ borderRadius: 'var(--border-radius-xl)',
21
+ },
22
+ }}
23
+ />
24
+ </div>
25
+ );
26
+ }
@@ -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
+ import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
6
+ import { BffCatalogRelatedEntity } from '@redocly/theme/core/types';
7
+
8
+ export type CatalogEntityCellProps = {
9
+ entity: BffCatalogRelatedEntity;
10
+ };
11
+
12
+ export function CatalogEntityCell({ entity }: CatalogEntityCellProps) {
13
+ return (
14
+ <EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
15
+ <IconContainer>
16
+ <CatalogEntityIcon entityType={entity.type} />
17
+ </IconContainer>
18
+ <EntityTitleContent>
19
+ <EntityTitle>
20
+ <CatalogHighlight>{entity.title}</CatalogHighlight>
21
+ </EntityTitle>
22
+ {entity.summary && (
23
+ <EntitySummary>
24
+ <CatalogHighlight>{entity.summary}</CatalogHighlight>
25
+ </EntitySummary>
26
+ )}
27
+ </EntityTitleContent>
28
+ </EntityTitleCellWrapper>
29
+ );
30
+ }
31
+
32
+ const EntityTitleCellWrapper = styled.div`
33
+ display: flex;
34
+ align-items: center;
35
+ gap: var(--catalog-table-title-cell-gap);
36
+ max-width: 100%;
37
+ `;
38
+
39
+ const IconContainer = styled.div`
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ width: var(--catalog-table-icon-width);
44
+ height: var(--catalog-table-icon-height);
45
+ border-radius: var(--catalog-table-icon-border-radius);
46
+ background-color: var(--catalog-table-icon-bg-color);
47
+ flex-shrink: 0;
48
+ border: var(--catalog-table-icon-border-width) solid var(--catalog-table-icon-border-color);
49
+ `;
50
+
51
+ const EntityTitleContent = styled.div`
52
+ display: flex;
53
+ flex-direction: column;
54
+ max-width: calc(
55
+ 100% - var(--catalog-table-entity-title-content-offset)
56
+ ); /* Account for icon width (30px) + gap (12px) */
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
+ const EntitySummary = 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(--catalog-table-description-color);
73
+ white-space: nowrap;
74
+ overflow: hidden;
75
+ text-overflow: ellipsis;
76
+ width: 100%;
77
+ `;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ import { CatalogTagsWithTooltip } from '@redocly/theme/components/Catalog/CatalogTagsWithTooltip';
4
+
5
+ export type CatalogOwnersCellProps = {
6
+ owners: string[];
7
+ };
8
+
9
+ export function CatalogOwnersCell({ owners }: CatalogOwnersCellProps) {
10
+ return (
11
+ <div data-component-name="Catalog/CatalogTableView/CatalogOwnersCell">
12
+ <CatalogTagsWithTooltip
13
+ data-testid="catalog-owners-cell"
14
+ items={owners}
15
+ showPlaceholder={false}
16
+ tagProps={{
17
+ style: {
18
+ fontSize: 'var(--font-size-base)',
19
+ backgroundColor: 'transparent',
20
+ borderRadius: 'var(--border-radius-xl)',
21
+ },
22
+ }}
23
+ />
24
+ </div>
25
+ );
26
+ }
@@ -0,0 +1,120 @@
1
+ import React from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import { SortOption } from '@redocly/theme/core/types';
5
+ import { CaretDownIcon } from '@redocly/theme/icons/CaretDownIcon/CaretDownIcon';
6
+ import { CaretUpIcon } from '@redocly/theme/icons/CaretUpIcon/CaretUpIcon';
7
+ import { useCatalogTableHeaderCellActions } from '@redocly/theme/core/hooks/catalog/useCatalogTableHeaderCellActions';
8
+
9
+ import { BaseEntity, CatalogColumn } from './CatalogTableView';
10
+
11
+ export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
12
+ column: CatalogColumn<T>;
13
+ setSortOption: (sortOption: SortOption | null) => void;
14
+ currentSortOption?: SortOption | null;
15
+ handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
16
+ isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
17
+ };
18
+
19
+ export const CatalogTableHeaderCell = <T extends BaseEntity>({
20
+ column,
21
+ handleSortClick,
22
+ isColumnSorted,
23
+ setSortOption,
24
+ }: CatalogTableHeaderCellProps<T>) => {
25
+ const { handleCellClick, sortKey, isUpActive, isDownActive } = useCatalogTableHeaderCellActions({
26
+ column,
27
+ handleSortClick,
28
+ isColumnSorted,
29
+ setSortOption,
30
+ });
31
+
32
+ return (
33
+ <TableHeaderCellWrapper
34
+ key={column.key}
35
+ data-component-name="Catalog/CatalogTableView/CatalogTableHeaderCell"
36
+ onClick={handleCellClick}
37
+ $sortable={Boolean(column.sortable && sortKey)}
38
+ >
39
+ <HeaderContent>
40
+ <HeaderTitle>{column.title}</HeaderTitle>
41
+ {column.sortable && sortKey && (
42
+ <SortIndicator>
43
+ <SortArrow $isActive={isUpActive}>
44
+ <CaretUpIcon
45
+ size="9px"
46
+ color={
47
+ isUpActive
48
+ ? 'var(--catalog-table-header-sort-icon-color-active)'
49
+ : 'var(--catalog-table-header-sort-icon-color-inactive)'
50
+ }
51
+ />
52
+ </SortArrow>
53
+ <SortArrow $isActive={isDownActive}>
54
+ <CaretDownIcon
55
+ size="9px"
56
+ color={
57
+ isDownActive
58
+ ? 'var(--catalog-table-header-sort-icon-color-active)'
59
+ : 'var(--catalog-table-header-sort-icon-color-inactive)'
60
+ }
61
+ />
62
+ </SortArrow>
63
+ </SortIndicator>
64
+ )}
65
+ </HeaderContent>
66
+ </TableHeaderCellWrapper>
67
+ );
68
+ };
69
+
70
+ const TableHeaderCellWrapper = styled.div<{ $sortable: boolean }>`
71
+ padding: var(--catalog-table-header-cell-padding);
72
+ border-bottom: 1px solid var(--catalog-table-border-color);
73
+ ${(props) =>
74
+ props.$sortable &&
75
+ css`
76
+ cursor: pointer;
77
+ user-select: none;
78
+ `}
79
+ `;
80
+
81
+ const HeaderContent = styled.div`
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: space-between;
85
+ width: 100%;
86
+ `;
87
+
88
+ const HeaderTitle = styled.span`
89
+ flex: 1;
90
+ `;
91
+
92
+ const SortIndicator = styled.div`
93
+ display: flex;
94
+ flex-direction: column;
95
+ align-items: center;
96
+ justify-content: center;
97
+ margin-left: 8px;
98
+ gap: 2px;
99
+ color: var(--catalog-table-header-sort-indicator-color);
100
+ `;
101
+
102
+ const SortArrow = styled.div<{ $isActive: boolean }>`
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ width: 14px;
107
+ height: 9px;
108
+ border-radius: 2px;
109
+ transition: background-color 0.2s ease;
110
+
111
+ svg {
112
+ display: block;
113
+ }
114
+
115
+ ${(props) =>
116
+ props.$isActive &&
117
+ css`
118
+ background-color: var(--catalog-table-header-sort-arrow-bg-active);
119
+ `}
120
+ `;
@@ -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
+ `;