@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,235 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig } from '@redocly/config';
4
+
5
+ import { BffCatalogEntityList } from '@redocly/theme/core/types';
6
+ import { breakpoints } from '@redocly/theme/core/utils';
7
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
8
+ import { H3 } from '@redocly/theme/components/Typography/H3';
9
+ import { FilterContent } from '@redocly/theme/components/Filter/FilterContent';
10
+ import { Sidebar, SidebarHeader } from '@redocly/theme/components/Sidebar/Sidebar';
11
+ import { CatalogSwitcherItem } from '@redocly/theme/core';
12
+ import { CatalogSelector } from '@redocly/theme/components/Catalog/CatalogSelector';
13
+ import { SidebarActions } from '@redocly/theme/components/SidebarActions/SidebarActions';
14
+ import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
15
+ import { FilterInput } from '@redocly/theme/components/Filter/FilterInput';
16
+ import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/CatalogViewModeToggle';
17
+ import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
18
+ import { CatalogEntities } from '@redocly/theme/components/Catalog/CatalogEntities';
19
+
20
+ export type CatalogProps = {
21
+ catalogConfig: CatalogEntityConfig;
22
+ entitiesTypes: string[];
23
+ initialEntitiesList?: BffCatalogEntityList;
24
+ catalogSwitcherItems: CatalogSwitcherItem[];
25
+ };
26
+
27
+ export function Catalog(props: CatalogProps): JSX.Element {
28
+ const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems } = props;
29
+
30
+ const { useTranslate, useCatalog } = useThemeHooks();
31
+
32
+ const { translate } = useTranslate();
33
+
34
+ const {
35
+ filters,
36
+ searchQuery,
37
+ setSearchQuery,
38
+ filterQuery,
39
+ sortOption,
40
+ setSortOption,
41
+ handleSortClick,
42
+ isColumnSorted,
43
+ viewMode,
44
+ setViewMode,
45
+ entitiesCounter,
46
+ setEntitiesCounter,
47
+ onChangeViewClick,
48
+ onChangeCollapseSidebarClick,
49
+ layout,
50
+ collapsedSidebar,
51
+ } = useCatalog(catalogConfig, initialEntitiesList?.page.total || 0);
52
+
53
+ return (
54
+ <>
55
+ <CatalogPageWrapper data-component-name="Catalog/Catalog">
56
+ <FiltersSidebar
57
+ collapsed={collapsedSidebar}
58
+ header={
59
+ collapsedSidebar ? null : (
60
+ <CatalogSelector
61
+ catalogSwitcherItems={catalogSwitcherItems}
62
+ setSearchQuery={setSearchQuery}
63
+ setSortOption={setSortOption}
64
+ />
65
+ )
66
+ }
67
+ menu={
68
+ <FilterContent
69
+ setFilterTerm={setSearchQuery}
70
+ filters={filters}
71
+ filterTerm={searchQuery}
72
+ hideSearch={true}
73
+ showCounter={false}
74
+ filterValuesCasing="sentence"
75
+ />
76
+ }
77
+ footer={
78
+ <SidebarActions
79
+ layout={layout}
80
+ collapsedSidebar={collapsedSidebar}
81
+ isApiDocs={false}
82
+ onChangeViewClick={onChangeViewClick}
83
+ onChangeCollapseSidebarClick={onChangeCollapseSidebarClick}
84
+ />
85
+ }
86
+ />
87
+ <CatalogPageContent>
88
+ <CatalogPageDescription>
89
+ <CatalogTitleWrapper>
90
+ <CatalogTitle data-translation-key={catalogConfig?.titleTranslationKey}>
91
+ {translate(catalogConfig?.titleTranslationKey)}{' '}
92
+ </CatalogTitle>
93
+ <CounterTag borderless>{entitiesCounter}</CounterTag>
94
+ </CatalogTitleWrapper>
95
+ <CatalogDescription data-translation-key={catalogConfig?.descriptionTranslationKey}>
96
+ {translate(catalogConfig?.descriptionTranslationKey)}
97
+ </CatalogDescription>
98
+ </CatalogPageDescription>
99
+
100
+ <CatalogActionsRow>
101
+ <CatalogSearchInputWrapper>
102
+ <FilterInput
103
+ value={searchQuery}
104
+ onChange={(updatedTerm) => setSearchQuery(updatedTerm)}
105
+ />
106
+ </CatalogSearchInputWrapper>
107
+
108
+ <CatalogControlsWrapper>
109
+ <CatalogSortButton onSortChange={setSortOption} currentSort={sortOption} />
110
+ <CatalogViewModeToggle viewMode={viewMode} onViewModeChange={setViewMode} />
111
+ </CatalogControlsWrapper>
112
+ </CatalogActionsRow>
113
+
114
+ <CatalogEntities
115
+ catalogConfig={catalogConfig}
116
+ excludedEntities={catalogConfig?.excludes}
117
+ filterQuery={filterQuery}
118
+ entitiesTypes={entitiesTypes}
119
+ sortOption={sortOption}
120
+ searchQuery={searchQuery}
121
+ viewMode={viewMode}
122
+ setEntitiesCounter={setEntitiesCounter}
123
+ initialEntitiesList={initialEntitiesList}
124
+ setSortOption={setSortOption}
125
+ handleSortClick={handleSortClick}
126
+ isColumnSorted={isColumnSorted}
127
+ />
128
+ </CatalogPageContent>
129
+ </CatalogPageWrapper>
130
+ </>
131
+ );
132
+ }
133
+
134
+ const CatalogActionsRow = styled.div`
135
+ display: flex;
136
+ align-items: center;
137
+ `;
138
+
139
+ const CatalogControlsWrapper = styled.div`
140
+ display: var(--catalog-controls-wrapper-display);
141
+ align-items: var(--catalog-controls-wrapper-align-items);
142
+ margin-left: var(--catalog-controls-wrapper-margin-left);
143
+ gap: var(--catalog-controls-wrapper-gap);
144
+ `;
145
+
146
+ const CatalogPageContent = styled.main`
147
+ flex: 1;
148
+ width: var(--catalog-page-content-width-mobile);
149
+ margin: var(--catalog-page-content-margin-mobile);
150
+
151
+ @media screen and (min-width: ${breakpoints.medium}) {
152
+ width: var(--catalog-page-content-width-desktop);
153
+ padding: var(--catalog-page-padding);
154
+ }
155
+ `;
156
+
157
+ const CatalogTitleWrapper = styled.div`
158
+ display: flex;
159
+ align-items: center;
160
+ color: var(--catalog-title-text-color);
161
+ font-weight: var(--catalog-title-font-weight) !important;
162
+ font-size: var(--catalog-title-font-size);
163
+ `;
164
+
165
+ const CatalogTitle = styled(H3)`
166
+ color: var(--catalog-title-text-color);
167
+ font-weight: var(--catalog-title-font-weight) !important;
168
+ font-size: var(--catalog-title-font-size);
169
+ margin: var(--catalog-title-margin);
170
+ margin-right: var(--catalog-title-spacing-right);
171
+ `;
172
+
173
+ const CatalogDescription = styled.p`
174
+ color: var(--catalog-description-text-color);
175
+ font-weight: var(--catalog-description-font-weight);
176
+ font-size: var(--catalog-description-font-size);
177
+ margin: var(--catalog-description-margin);
178
+ line-height: var(--catalog-description-line-height);
179
+ `;
180
+
181
+ const CatalogPageWrapper = styled.div`
182
+ --sidebar-width: var(--catalog-sidebar-width);
183
+
184
+ display: flex;
185
+ flex-direction: column;
186
+
187
+ font-weight: var(--catalog-page-wrapper-font-weight);
188
+ color: var(--catalog-page-wrapper-text-color);
189
+ font-size: var(--catalog-page-wrapper-font-size);
190
+ font-family: var(--catalog-page-wrapper-font-family);
191
+ line-height: var(--catalog-page-wrapper-line-height);
192
+
193
+ hr {
194
+ border: 0;
195
+ width: var(--catalog-hr-width);
196
+ margin: var(--catalog-hr-margin);
197
+ border-top: var(--catalog-hr-border-width) solid var(--catalog-hr-border-color);
198
+ }
199
+ a:not([role='button']) {
200
+ text-decoration: var(--catalog-link-text-decoration);
201
+ color: var(--catalog-link-color);
202
+ font-weight: var(--catalog-link-font-weight);
203
+ }
204
+
205
+ @media screen and (min-width: ${breakpoints.medium}) {
206
+ flex-direction: row;
207
+ padding: 0;
208
+ }
209
+ `;
210
+
211
+ const CatalogPageDescription = styled.div`
212
+ margin: var(--catalog-heading-margin);
213
+ display: var(--catalog-page-description-display-mobile);
214
+
215
+ @media screen and (min-width: ${breakpoints.medium}) {
216
+ display: var(--catalog-page-description-display-desktop);
217
+ }
218
+ `;
219
+
220
+ const FiltersSidebar = styled(Sidebar)`
221
+ display: var(--catalog-sidebar-display-mobile);
222
+
223
+ @media screen and (min-width: ${breakpoints.medium}) {
224
+ display: var(--catalog-sidebar-display-desktop);
225
+ }
226
+ --menu-container-padding-top: var(--catalog-sidebar-menu-container-padding-top);
227
+
228
+ ${SidebarHeader} {
229
+ border: none;
230
+ }
231
+ `;
232
+
233
+ const CatalogSearchInputWrapper = styled.div`
234
+ width: var(--catalog-search-input-wrapper-width);
235
+ `;
@@ -0,0 +1,58 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { SortOption, CatalogViewMode } from '@redocly/theme/core/types';
5
+ import { FilterInput } from '@redocly/theme/components/Filter/FilterInput';
6
+ import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
7
+ import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/CatalogViewModeToggle';
8
+
9
+ export type CatalogActionsRowProps = {
10
+ searchQuery: string;
11
+ setSearchQuery: (updatedTerm: string) => void;
12
+ sortOption: SortOption | null;
13
+ setSortOption: (option: SortOption | null) => void;
14
+ viewMode?: CatalogViewMode;
15
+ onViewModeChange?: (mode: CatalogViewMode) => void;
16
+ style?: React.CSSProperties;
17
+ };
18
+
19
+ export function CatalogActionsRow({
20
+ searchQuery,
21
+ setSearchQuery,
22
+ sortOption,
23
+ setSortOption,
24
+ viewMode,
25
+ onViewModeChange,
26
+ style,
27
+ }: CatalogActionsRowProps): JSX.Element {
28
+ return (
29
+ <CatalogActionsRowWrapper style={style}>
30
+ <CatalogSearchInputWrapper>
31
+ <FilterInput value={searchQuery} onChange={(updatedTerm) => setSearchQuery(updatedTerm)} />
32
+ </CatalogSearchInputWrapper>
33
+
34
+ <CatalogControlsWrapper>
35
+ <CatalogSortButton onSortChange={setSortOption} currentSort={sortOption} />
36
+ {viewMode && onViewModeChange && (
37
+ <CatalogViewModeToggle viewMode={viewMode} onViewModeChange={onViewModeChange} />
38
+ )}
39
+ </CatalogControlsWrapper>
40
+ </CatalogActionsRowWrapper>
41
+ );
42
+ }
43
+
44
+ export const CatalogActionsRowWrapper = styled.div`
45
+ display: flex;
46
+ align-items: center;
47
+ `;
48
+
49
+ export const CatalogControlsWrapper = styled.div`
50
+ display: var(--catalog-controls-wrapper-display);
51
+ align-items: var(--catalog-controls-wrapper-align-items);
52
+ margin-left: var(--catalog-controls-wrapper-margin-left);
53
+ gap: var(--catalog-controls-wrapper-gap);
54
+ `;
55
+
56
+ export const CatalogSearchInputWrapper = styled.div`
57
+ width: var(--catalog-search-input-wrapper-width);
58
+ `;
@@ -0,0 +1,227 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig } from '@redocly/config';
4
+
5
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
6
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
7
+ import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
8
+ import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
9
+ import { ArrowRightIcon } from '@redocly/theme/icons/ArrowRightIcon/ArrowRightIcon';
10
+ import { ArrowUpRightIcon } from '@redocly/theme/icons/ArrowUpRightIcon/ArrowUpRightIcon';
11
+ import { CatalogTagsWithTooltip } from '@redocly/theme/components/Catalog/CatalogTagsWithTooltip';
12
+ import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
13
+ import { getPathPrefix } from '@redocly/theme/core';
14
+
15
+ export type CatalogCardProps = {
16
+ entity: BffCatalogEntity;
17
+ catalogConfig: CatalogEntityConfig;
18
+ };
19
+
20
+ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.Element {
21
+ const { useTelemetry } = useThemeHooks();
22
+ const telemetry = useTelemetry();
23
+ const pathPrefix = getPathPrefix();
24
+
25
+ return (
26
+ <CatalogCardWrapper
27
+ data-component-name="Catalog/CatalogCardView/CatalogCard"
28
+ onClick={() => {
29
+ window.location.assign(
30
+ `${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${entity.key}`,
31
+ );
32
+ telemetry.send({ type: 'catalog_item.clicked' });
33
+ }}
34
+ >
35
+ <CardContent>
36
+ <CardHeader>
37
+ <HeaderIconWrapper>
38
+ <CatalogEntityIcon entityType={entity.type} />
39
+ </HeaderIconWrapper>
40
+ <CardTitle>
41
+ <CatalogHighlight>{entity.title}</CatalogHighlight>
42
+ </CardTitle>
43
+ </CardHeader>
44
+
45
+ <CardDescription>
46
+ <CatalogHighlight>{entity.summary ?? ''}</CatalogHighlight>
47
+ </CardDescription>
48
+
49
+ <CardMetadataSection>
50
+ <MetadataColumn>
51
+ <MetadataLabel>Domains:</MetadataLabel>
52
+ <CatalogTagsWithTooltip
53
+ items={entity.domains?.map((domain) => domain.title) || []}
54
+ tagProps={{
55
+ style: {
56
+ fontSize: 'var(--catalog-card-font-size)',
57
+ backgroundColor: 'var(--catalog-card-icon-bg-color)',
58
+ },
59
+ icon: <GraphIcon color="var(--color-green-8)" />,
60
+ }}
61
+ />
62
+ </MetadataColumn>
63
+
64
+ <MetadataColumn>
65
+ <MetadataLabel>Owners:</MetadataLabel>
66
+ <CatalogTagsWithTooltip
67
+ items={entity.owners?.map((owner) => owner.key) || []}
68
+ tagProps={{
69
+ style: {
70
+ fontSize: 'var(--catalog-card-font-size)',
71
+ backgroundColor: 'var(--catalog-card-icon-bg-color)',
72
+ borderRadius: 'var(--border-radius-xl)',
73
+ },
74
+ }}
75
+ />
76
+ </MetadataColumn>
77
+ </CardMetadataSection>
78
+ </CardContent>
79
+
80
+ <Divider />
81
+
82
+ <CardFooter>
83
+ <CatalogTagsWithTooltip
84
+ items={entity.tags || []}
85
+ tagProps={{
86
+ style: {
87
+ fontSize: 'var(--catalog-card-font-size)',
88
+ borderRadius: 'var(--border-radius)',
89
+ },
90
+ borderless: true,
91
+ color: 'grey',
92
+ }}
93
+ itemsToShow={3}
94
+ />
95
+
96
+ <ArrowCircle>
97
+ <ArrowRightIcon size="16px" />
98
+ <ArrowUpRightIcon size="16px" />
99
+ </ArrowCircle>
100
+ </CardFooter>
101
+ </CatalogCardWrapper>
102
+ );
103
+ }
104
+
105
+ const HeaderIconWrapper = styled.div`
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ width: var(--catalog-card-icon-width);
110
+ height: var(--catalog-card-icon-height);
111
+ border-radius: var(--catalog-card-icon-border-radius);
112
+ background-color: var(--catalog-card-icon-bg-color);
113
+ flex-shrink: 0;
114
+ border: var(--catalog-card-icon-border-width) solid var(--catalog-card-icon-border-color);
115
+ margin-right: var(--catalog-card-icon-margin-right);
116
+ `;
117
+
118
+ const CardHeader = styled.div`
119
+ display: flex;
120
+ align-items: center;
121
+ `;
122
+
123
+ const MetadataLabel = styled.div`
124
+ font-size: var(--catalog-metadata-label-font-size);
125
+ font-weight: var(--catalog-metadata-label-font-weight);
126
+ color: var(--catalog-metadata-label-color);
127
+ margin-bottom: var(--catalog-metadata-label-margin-bottom);
128
+ `;
129
+
130
+ const CardMetadataSection = styled.div`
131
+ display: flex;
132
+ justify-content: space-between;
133
+ margin-top: var(--catalog-metadata-section-margin-top);
134
+ gap: var(--catalog-metadata-section-gap);
135
+ width: 100%;
136
+ `;
137
+
138
+ const MetadataColumn = styled.div`
139
+ display: flex;
140
+ flex-direction: column;
141
+ flex: 1;
142
+ width: calc(50% - var(--catalog-metadata-column-half-gap)); /* 50% minus half the gap */
143
+ `;
144
+
145
+ const ArrowCircle = styled.div`
146
+ width: var(--catalog-arrow-circle-size);
147
+ height: var(--catalog-arrow-circle-size);
148
+ border-radius: var(--catalog-arrow-circle-radius);
149
+ background-color: var(--catalog-arrow-circle-bg-color);
150
+ display: flex;
151
+ align-items: center;
152
+ justify-content: center;
153
+ position: relative;
154
+
155
+ ${ArrowRightIcon}, ${ArrowUpRightIcon} {
156
+ position: absolute;
157
+ transition: opacity 0.2s ease-in-out;
158
+ }
159
+ `;
160
+
161
+ const CardContent = styled.div`
162
+ padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
163
+ `;
164
+
165
+ const CardFooter = styled.div`
166
+ display: flex;
167
+ align-items: center;
168
+ justify-content: space-between;
169
+ padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
170
+ `;
171
+
172
+ const Divider = styled.div`
173
+ width: 100%;
174
+ height: 1px;
175
+ background-color: var(--catalog-card-divider-color);
176
+ `;
177
+
178
+ const CatalogCardWrapper = styled.div`
179
+ min-height: var(--catalog-card-min-height);
180
+ height: 100%;
181
+ color: var(--catalog-card-text-color);
182
+ font-size: var(--catalog-card-font-size);
183
+ font-weight: var(--catalog-card-font-weight);
184
+ background-color: var(--catalog-card-bg-color);
185
+ border: var(--catalog-card-border-width) var(--catalog-card-border-style)
186
+ var(--catalog-card-border-color);
187
+ transition: all 0.2s ease-in-out;
188
+ border-radius: var(--catalog-card-border-radius);
189
+ cursor: pointer;
190
+ display: flex;
191
+ flex-direction: column;
192
+ ${ArrowRightIcon} {
193
+ opacity: 1;
194
+ }
195
+ ${ArrowUpRightIcon} {
196
+ opacity: 0;
197
+ }
198
+ &:hover {
199
+ ${ArrowRightIcon} {
200
+ opacity: 0;
201
+ }
202
+ ${ArrowUpRightIcon} {
203
+ opacity: 1;
204
+ }
205
+ border-color: var(--catalog-card-border-color-hover);
206
+ }
207
+ `;
208
+
209
+ const CardTitle = styled.div`
210
+ color: var(--catalog-card-title-color);
211
+ font-size: var(--catalog-card-title-font-size);
212
+ font-weight: var(--catalog-card-title-font-weight);
213
+ line-height: var(--catalog-card-title-line-height);
214
+ margin: 0;
215
+ `;
216
+
217
+ const CardDescription = styled.div`
218
+ margin-top: var(--catalog-card-description-margin-top);
219
+ color: var(--catalog-card-description-color);
220
+ font-size: var(--catalog-card-description-font-size);
221
+ font-weight: var(--catalog-card-description-font-weight);
222
+ line-height: var(--catalog-card-description-line-height);
223
+ white-space: nowrap;
224
+ overflow: hidden;
225
+ text-overflow: ellipsis;
226
+ width: 100%;
227
+ `;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { CatalogEntityConfig } from '@redocly/config';
4
+
5
+ import { BffCatalogEntity } from '@redocly/theme/core/types';
6
+ import { CatalogCard } from '@redocly/theme/components/Catalog/CatalogCardView/CatalogCard';
7
+
8
+ export type CatalogCardViewProps = {
9
+ entities: BffCatalogEntity[];
10
+ catalogConfig: CatalogEntityConfig;
11
+ };
12
+
13
+ export function CatalogCardView({ entities, catalogConfig }: CatalogCardViewProps) {
14
+ return (
15
+ <CatalogCardsWrapper data-component-name="Catalog/CatalogCardView/CatalogCardView">
16
+ {entities.map((entity) => (
17
+ <CatalogCard key={entity.id} entity={entity} catalogConfig={catalogConfig} />
18
+ ))}
19
+ </CatalogCardsWrapper>
20
+ );
21
+ }
22
+
23
+ const CatalogCardsWrapper = styled.div`
24
+ display: grid;
25
+ grid-template-columns: repeat(auto-fill, minmax(var(--catalog-card-min-width), 1fr));
26
+ gap: var(--catalog-cards-group-gap);
27
+ margin-bottom: var(--spacing-xl);
28
+ margin-top: var(--spacing-xl);
29
+ `;
@@ -0,0 +1,107 @@
1
+ import React, { JSX, useEffect } from 'react';
2
+ import { CatalogEntityConfig } from '@redocly/config';
3
+
4
+ import { BffCatalogEntity, BffCatalogEntityList, SortOption } from '@redocly/theme/core/types';
5
+ import { useThemeHooks, useCatalogEntities } from '@redocly/theme/core/hooks';
6
+ import { ArrowDownIcon } from '@redocly/theme/icons/ArrowDownIcon/ArrowDownIcon';
7
+ import { CatalogCardView } from '@redocly/theme/components/Catalog/CatalogCardView/CatalogCardView';
8
+ import { CatalogTableView } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
9
+ import { HighlightContext } from '@redocly/theme/components/Catalog/CatalogHighlight';
10
+ import { LoadMore } from '@redocly/theme/components/LoadMore/LoadMore';
11
+ import { CatalogEntitiesEmptyState } from '@redocly/theme/components/Catalog/CatalogEntitiesEmptyState';
12
+
13
+ export type CatalogEntitiesProps = {
14
+ catalogConfig: CatalogEntityConfig;
15
+ excludedEntities?: CatalogEntityConfig['excludes'];
16
+ filterQuery: string;
17
+ entitiesTypes: string[];
18
+ searchQuery: string;
19
+ viewMode: string;
20
+ setEntitiesCounter: (counter: number) => void;
21
+ initialEntitiesList?: BffCatalogEntityList;
22
+ sortOption: SortOption | null;
23
+ setSortOption: (sortOption: SortOption | null) => void;
24
+ handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
25
+ isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
26
+ };
27
+
28
+ const LOAD_MORE_THRESHOLD = 10;
29
+
30
+ export function CatalogEntities(props: CatalogEntitiesProps): JSX.Element {
31
+ const {
32
+ catalogConfig,
33
+ excludedEntities,
34
+ filterQuery,
35
+ entitiesTypes,
36
+ sortOption,
37
+ searchQuery,
38
+ viewMode,
39
+ setEntitiesCounter,
40
+ setSortOption,
41
+ handleSortClick,
42
+ isColumnSorted,
43
+ } = props;
44
+
45
+ const { useFetchCatalogEntities } = useThemeHooks();
46
+
47
+ const { initialFilter } = useCatalogEntities({
48
+ entitiesTypes,
49
+ excludedEntities,
50
+ });
51
+
52
+ const {
53
+ items: entities,
54
+ query,
55
+ total,
56
+ } = useFetchCatalogEntities(
57
+ {
58
+ limit: LOAD_MORE_THRESHOLD,
59
+ filter:
60
+ initialFilter && filterQuery
61
+ ? `${initialFilter} AND ${filterQuery}`
62
+ : initialFilter || filterQuery,
63
+ sort: sortOption || undefined,
64
+ search: searchQuery,
65
+ },
66
+ props.initialEntitiesList,
67
+ );
68
+
69
+ const shouldShowLoadMore =
70
+ query.hasNextPage ||
71
+ (query.isPlaceholderData && entities && entities.length >= LOAD_MORE_THRESHOLD);
72
+
73
+ useEffect(() => {
74
+ setEntitiesCounter(total || 0);
75
+ }, [total, setEntitiesCounter]);
76
+
77
+ if (!query.isPending && (!entities || entities.length === 0)) {
78
+ return <CatalogEntitiesEmptyState />;
79
+ }
80
+
81
+ return (
82
+ <HighlightContext.Provider value={[searchQuery]} data-component-name="Catalog/CatalogEntities">
83
+ {viewMode === 'cards' ? (
84
+ <CatalogCardView entities={entities} catalogConfig={catalogConfig} />
85
+ ) : (
86
+ <CatalogTableView<BffCatalogEntity>
87
+ entities={entities}
88
+ catalogConfig={catalogConfig}
89
+ setSortOption={setSortOption}
90
+ currentSortOption={sortOption}
91
+ handleSortClick={handleSortClick}
92
+ isColumnSorted={isColumnSorted}
93
+ />
94
+ )}
95
+
96
+ {shouldShowLoadMore && (
97
+ <LoadMore
98
+ icon={<ArrowDownIcon size="var(--catalog-load-more-icon-size)" />}
99
+ onClick={query.fetchNextPage}
100
+ disabled={query.isFetchingNextPage}
101
+ blinking={query.isFetchingNextPage}
102
+ label={query.isFetchingNextPage ? 'Loading...' : 'Load More'}
103
+ />
104
+ )}
105
+ </HighlightContext.Provider>
106
+ );
107
+ }
@@ -0,0 +1,38 @@
1
+ import React, { JSX } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export function CatalogEntitiesEmptyState(): JSX.Element {
5
+ return (
6
+ <EmptyStateWrapper data-component-name="Catalog/CatalogEntitiesEmptyState">
7
+ <EmptyStateHeader>No entities yet</EmptyStateHeader>
8
+ <EmptyStateText>Start by adding your first entity to</EmptyStateText>
9
+ <EmptyStateText>begin building your catalog.</EmptyStateText>
10
+ </EmptyStateWrapper>
11
+ );
12
+ }
13
+
14
+ const EmptyStateWrapper = styled.div`
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ justify-content: center;
19
+ padding: var(--catalog-empty-state-padding);
20
+ text-align: center;
21
+ min-height: var(--catalog-empty-state-min-height);
22
+ `;
23
+
24
+ const EmptyStateHeader = styled.p`
25
+ color: var(--catalog-empty-state-header-text-color);
26
+ font-size: var(--catalog-empty-state-header-font-size);
27
+ font-weight: var(--catalog-empty-state-header-font-weight);
28
+ line-height: var(--catalog-empty-state-header-line-height);
29
+ margin: 0;
30
+ `;
31
+
32
+ const EmptyStateText = styled.p`
33
+ color: var(--catalog-empty-state-text-color);
34
+ font-size: var(--catalog-empty-state-font-size);
35
+ font-weight: var(--catalog-empty-state-font-weight);
36
+ line-height: var(--catalog-empty-state-line-height);
37
+ margin: 0;
38
+ `;