@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,56 @@
1
+ import React, { JSX } from 'react';
2
+ import { findAll } from 'highlight-words-core';
3
+ import styled from 'styled-components';
4
+
5
+ export const HighlightContext = React.createContext<string[]>([]);
6
+
7
+ export type CatalogHighlightProps = React.PropsWithChildren;
8
+
9
+ export function CatalogHighlight(props: CatalogHighlightProps): JSX.Element | null {
10
+ const { children } = props;
11
+ const searchWords = React.useContext(HighlightContext);
12
+
13
+ if (!searchWords.length) {
14
+ return children ? <>{children}</> : null;
15
+ }
16
+
17
+ function highlight(str: string, childIdx: number = 0) {
18
+ const chunks = findAll({
19
+ searchWords,
20
+ textToHighlight: str,
21
+ });
22
+
23
+ return (
24
+ <span data-component-name="Catalog/CatalogHighlight" key={childIdx}>
25
+ {chunks.map((chunk, idx) => {
26
+ const { end, highlight, start } = chunk;
27
+ const text = str.substr(start, end - start);
28
+ if (highlight) {
29
+ return <HighlightedText key={idx}>{text}</HighlightedText>;
30
+ } else {
31
+ return text;
32
+ }
33
+ })}
34
+ </span>
35
+ );
36
+ }
37
+
38
+ if (typeof children === 'string') {
39
+ return highlight(children);
40
+ } else if (Array.isArray(children)) {
41
+ return (
42
+ <>
43
+ {children.map((child, idx) =>
44
+ typeof children === 'string' ? highlight(child, idx) : child || null,
45
+ )}
46
+ </>
47
+ );
48
+ } else {
49
+ return <>{children}</>;
50
+ }
51
+ }
52
+
53
+ const HighlightedText = styled.span`
54
+ background-color: var(--catalog-highlight-bg-color);
55
+ color: var(--catalog-highlight-text-color);
56
+ `;
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { breakpoints } from '@redocly/theme/core/utils';
5
+ import { H3 } from '@redocly/theme/components/Typography/H3';
6
+
7
+ import { CounterTag } from '../Tags/CounterTag';
8
+
9
+ export type CatalogPageDescriptionProps = {
10
+ title: string;
11
+ titleTranslationKey?: string;
12
+ description: string;
13
+ descriptionTranslationKey?: string;
14
+ tag: number | string;
15
+ };
16
+
17
+ export function CatalogPageDescription({
18
+ title,
19
+ titleTranslationKey,
20
+ description,
21
+ descriptionTranslationKey,
22
+ tag,
23
+ }: CatalogPageDescriptionProps) {
24
+ return (
25
+ <CatalogPageDescriptionWrapper>
26
+ <CatalogTitleWrapper>
27
+ <CatalogTitle data-translation-key={titleTranslationKey}>{title}</CatalogTitle>
28
+ <CounterTag borderless>{tag}</CounterTag>
29
+ </CatalogTitleWrapper>
30
+ <CatalogDescription data-translation-key={descriptionTranslationKey}>
31
+ {description}
32
+ </CatalogDescription>
33
+ </CatalogPageDescriptionWrapper>
34
+ );
35
+ }
36
+
37
+ const CatalogPageDescriptionWrapper = styled.div`
38
+ margin: var(--catalog-heading-margin);
39
+ display: var(--catalog-page-description-display-mobile);
40
+
41
+ @media screen and (min-width: ${breakpoints.medium}) {
42
+ display: var(--catalog-page-description-display-desktop);
43
+ }
44
+ `;
45
+
46
+ const CatalogTitleWrapper = styled.div`
47
+ display: flex;
48
+ align-items: center;
49
+ color: var(--catalog-title-text-color);
50
+ font-weight: var(--catalog-title-font-weight) !important;
51
+ font-size: var(--catalog-title-font-size);
52
+ `;
53
+
54
+ const CatalogTitle = styled(H3)`
55
+ color: var(--catalog-title-text-color);
56
+ font-weight: var(--catalog-title-font-weight) !important;
57
+ font-size: var(--catalog-title-font-size);
58
+ margin: var(--catalog-title-margin);
59
+ margin-right: var(--catalog-title-spacing-right);
60
+ `;
61
+
62
+ const CatalogDescription = styled.p`
63
+ color: var(--catalog-description-text-color);
64
+ font-weight: var(--catalog-description-font-weight);
65
+ font-size: var(--catalog-description-font-size);
66
+ margin: var(--catalog-description-margin);
67
+ line-height: var(--catalog-description-line-height);
68
+ display: -webkit-box;
69
+ -webkit-line-clamp: 3;
70
+ -webkit-box-orient: vertical;
71
+ overflow: hidden;
72
+ `;
@@ -0,0 +1,67 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+ import { useNavigate } from 'react-router-dom';
4
+
5
+ import { Select } from '@redocly/theme/components/Select/Select';
6
+ import { CatalogSwitcherItem, getPathPrefix, SortOption, useThemeHooks } from '@redocly/theme/core';
7
+ import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
8
+
9
+ export type CatalogSelectorProps = {
10
+ catalogSwitcherItems: CatalogSwitcherItem[];
11
+ setSearchQuery: (query: string) => void;
12
+ setSortOption: (option: SortOption | null) => void;
13
+ };
14
+
15
+ export function CatalogSelector({
16
+ catalogSwitcherItems,
17
+ setSearchQuery,
18
+ setSortOption,
19
+ }: CatalogSelectorProps): JSX.Element {
20
+ const { useTranslate } = useThemeHooks();
21
+
22
+ const { translate } = useTranslate();
23
+ const navigate = useNavigate();
24
+ const pathPrefix = getPathPrefix();
25
+
26
+ const options = catalogSwitcherItems.map((item) => ({
27
+ value: item.slug,
28
+ element: translate(item.labelTranslationKey),
29
+ label: translate(item.labelTranslationKey),
30
+ }));
31
+
32
+ const selectedCatalogItem = catalogSwitcherItems.find((item) => item.selected);
33
+
34
+ return (
35
+ <CatalogSelectWrapper data-component-name="Catalog/CatalogSelector">
36
+ <CatalogSelectLabel>Catalogs</CatalogSelectLabel>
37
+ <CatalogSelect
38
+ value={selectedCatalogItem?.slug}
39
+ options={options}
40
+ onChange={(value) => {
41
+ navigate(`${pathPrefix}/catalogs/${value}`);
42
+ setSearchQuery('');
43
+ setSortOption(null);
44
+ }}
45
+ icon={<ChevronDownIcon color="var(--catalog-select-icon-color)" />}
46
+ />
47
+ </CatalogSelectWrapper>
48
+ );
49
+ }
50
+
51
+ export const CatalogSelectWrapper = styled.div`
52
+ margin-top: var(--catalog-select-wrapper-margin-top);
53
+ margin-bottom: var(--catalog-select-wrapper-margin-bottom);
54
+ `;
55
+
56
+ export const CatalogSelectLabel = styled.label`
57
+ display: block;
58
+ margin-bottom: var(--catalog-select-label-margin-bottom);
59
+ font-weight: var(--catalog-select-label-font-weight);
60
+ font-size: var(--catalog-select-label-font-size);
61
+ line-height: var(--catalog-select-label-line-height);
62
+ `;
63
+
64
+ export const CatalogSelect = styled(Select)`
65
+ border-radius: var(--catalog-select-border-radius);
66
+ --select-input-padding: var(--catalog-select-input-padding);
67
+ `;
@@ -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
+ `;