@redocly/theme 0.59.0-next.1 → 0.59.0-rc.1

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 (130) hide show
  1. package/lib/components/Accordion/Accordion.js +17 -7
  2. package/lib/components/Accordion/AccordionBody.js +17 -7
  3. package/lib/components/Admonition/Admonition.js +17 -7
  4. package/lib/components/Badge/Badge.js +17 -7
  5. package/lib/components/Breadcrumbs/Breadcrumb.js +17 -7
  6. package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +17 -7
  7. package/lib/components/Button/Button.js +17 -7
  8. package/lib/components/Buttons/AIAssistantButton.js +17 -7
  9. package/lib/components/Buttons/CopyButton.js +17 -7
  10. package/lib/components/Catalog/Catalog.d.ts +6 -0
  11. package/lib/components/Catalog/Catalog.js +7 -6
  12. package/lib/components/Catalog/CatalogEntities.js +17 -7
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +17 -7
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +17 -7
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +17 -7
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +17 -7
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +17 -7
  18. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +17 -7
  19. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +17 -7
  20. package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +17 -7
  21. package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +17 -7
  22. package/lib/components/Catalog/CatalogSortButton.js +17 -7
  23. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +17 -7
  24. package/lib/components/Catalog/CatalogTagsWithTooltip.js +1 -1
  25. package/lib/components/Catalog/CatalogViewModeToggle.js +17 -7
  26. package/lib/components/CatalogClassic/CatalogClassicActions.js +17 -7
  27. package/lib/components/CatalogClassic/CatalogClassicCard.js +17 -7
  28. package/lib/components/CatalogClassic/CatalogClassicHighlight.js +17 -7
  29. package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +17 -7
  30. package/lib/components/CodeBlock/CodeBlock.js +17 -7
  31. package/lib/components/CodeBlock/CodeBlockContainer.js +17 -7
  32. package/lib/components/CodeBlock/CodeBlockTabs.js +17 -7
  33. package/lib/components/Dropdown/Dropdown.js +17 -7
  34. package/lib/components/Dropdown/DropdownMenuItem.js +17 -7
  35. package/lib/components/Feedback/Comment.js +17 -7
  36. package/lib/components/Feedback/Feedback.js +17 -7
  37. package/lib/components/Feedback/Mood.js +17 -7
  38. package/lib/components/Feedback/Rating.js +17 -7
  39. package/lib/components/Feedback/Reasons.js +17 -7
  40. package/lib/components/Feedback/Scale.js +17 -7
  41. package/lib/components/Feedback/Sentiment.js +17 -7
  42. package/lib/components/Feedback/Stars.js +17 -7
  43. package/lib/components/Filter/FilterContent.js +17 -7
  44. package/lib/components/Filter/FilterInput.js +17 -7
  45. package/lib/components/Image/Image.js +17 -7
  46. package/lib/components/JsonViewer/JsonViewer.js +17 -7
  47. package/lib/components/JsonViewer/helpers.js +17 -7
  48. package/lib/components/LastUpdated/LastUpdated.js +17 -7
  49. package/lib/components/Link/Link.js +17 -7
  50. package/lib/components/Markdown/Markdown.js +17 -7
  51. package/lib/components/Marker/Marker.js +17 -7
  52. package/lib/components/Menu/MenuContainer.js +17 -7
  53. package/lib/components/Menu/MenuItem.js +17 -7
  54. package/lib/components/Menu/MenuMobile.js +17 -7
  55. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +1 -0
  56. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +11 -0
  57. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +1 -0
  58. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +5 -0
  59. package/lib/components/PageActions/PageActions.js +17 -7
  60. package/lib/components/PageNavigation/NextButton.js +17 -7
  61. package/lib/components/Panel/Panel.js +17 -7
  62. package/lib/components/Panel/PanelBody.js +17 -7
  63. package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +17 -7
  64. package/lib/components/Search/SearchAiConversationInput.js +17 -7
  65. package/lib/components/Search/SearchAiDialog.js +17 -7
  66. package/lib/components/Search/SearchDialog.js +17 -7
  67. package/lib/components/Search/SearchFilter.js +17 -7
  68. package/lib/components/Search/SearchGroups.js +17 -7
  69. package/lib/components/Search/SearchHighlight.js +17 -7
  70. package/lib/components/Search/SearchItem.js +17 -7
  71. package/lib/components/Search/SearchRecent.js +17 -7
  72. package/lib/components/Search/SearchShortcut.js +17 -7
  73. package/lib/components/Search/SearchSuggestedPages.js +17 -7
  74. package/lib/components/Search/SearchTrigger.js +17 -7
  75. package/lib/components/Segmented/Segmented.js +17 -7
  76. package/lib/components/Select/Select.js +17 -7
  77. package/lib/components/Select/SelectInput.js +17 -7
  78. package/lib/components/Select/variables.js +2 -2
  79. package/lib/components/Sidebar/Sidebar.js +17 -7
  80. package/lib/components/SidebarActions/styled.js +17 -7
  81. package/lib/components/SkipContent/SkipContent.js +17 -7
  82. package/lib/components/Switch/Switch.js +17 -7
  83. package/lib/components/TableOfContent/TableOfContent.js +17 -7
  84. package/lib/components/Tag/Tag.js +4 -4
  85. package/lib/components/Tooltip/Tooltip.js +17 -7
  86. package/lib/components/VersionPicker/VersionPicker.js +17 -7
  87. package/lib/core/contexts/CodeSnippetContext.js +17 -7
  88. package/lib/core/templates/Markdown.js +17 -7
  89. package/lib/core/types/hooks.d.ts +4 -1
  90. package/lib/core/types/l10n.d.ts +1 -1
  91. package/lib/core/utils/download-code-walkthrough.js +17 -7
  92. package/lib/core/utils/get-file-icon.js +17 -7
  93. package/lib/ext/process-scorecard.d.ts +5 -0
  94. package/lib/ext/process-scorecard.js +11 -0
  95. package/lib/icons/GenericIcon/GenericIcon.js +17 -7
  96. package/lib/icons/Spinner/Spinner.js +17 -7
  97. package/lib/index.d.ts +2 -0
  98. package/lib/index.js +19 -7
  99. package/lib/layouts/OIDCForbidden.js +17 -7
  100. package/lib/layouts/ThreePanelLayout.js +17 -7
  101. package/lib/markdoc/components/Cards/Cards.js +17 -7
  102. package/lib/markdoc/components/CodeGroup/CodeGroup.js +17 -7
  103. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +17 -7
  104. package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +17 -7
  105. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +17 -7
  106. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +17 -7
  107. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +17 -7
  108. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +17 -7
  109. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +17 -7
  110. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +17 -7
  111. package/lib/markdoc/components/CodeWalkthrough/Input.js +17 -7
  112. package/lib/markdoc/components/Heading/Heading.js +17 -7
  113. package/lib/markdoc/components/HtmlBlock/HtmlBlock.js +17 -7
  114. package/lib/markdoc/components/InlineSvg/InlineSvg.js +17 -7
  115. package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +17 -7
  116. package/lib/markdoc/components/Tabs/TabList.js +17 -7
  117. package/lib/markdoc/components/Tabs/Tabs.js +17 -7
  118. package/lib/markdoc/default.d.ts +104 -1
  119. package/lib/markdoc/default.js +17 -7
  120. package/package.json +4 -4
  121. package/src/components/Catalog/Catalog.tsx +15 -4
  122. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +5 -1
  123. package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +9 -0
  124. package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +1 -0
  125. package/src/components/Select/variables.ts +2 -2
  126. package/src/components/Tag/Tag.tsx +6 -6
  127. package/src/core/types/hooks.ts +1 -0
  128. package/src/core/types/l10n.ts +1 -0
  129. package/src/ext/process-scorecard.ts +13 -0
  130. package/src/index.ts +2 -0
@@ -20,8 +20,11 @@ import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/Catalog
20
20
  import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
21
21
  import { CatalogEntities } from '@redocly/theme/components/Catalog/CatalogEntities';
22
22
 
23
+ type CatalogFiltersWithCounts = Record<string, { value: string; count: number }[]>;
24
+
23
25
  export type CatalogProps = {
24
26
  catalogConfig: CatalogEntityConfig;
27
+ filters?: CatalogFiltersWithCounts;
25
28
  entitiesTypes: string[];
26
29
  initialEntitiesList?: BffCatalogEntityList;
27
30
  catalogSwitcherItems: CatalogSwitcherItem[];
@@ -29,9 +32,11 @@ export type CatalogProps = {
29
32
  };
30
33
 
31
34
  const customCatalogOptionsCasing = (str: string): string => {
32
- if (!str) return str;
35
+ const trimmedStr = str.trim();
36
+ if (!trimmedStr) return trimmedStr;
37
+
38
+ const words = trimmedStr.split(/[\s-_]+/);
33
39
 
34
- const words = str.split(/[\s-_]+/);
35
40
  return words
36
41
  .map((word, index) => {
37
42
  if (index === 0 && word.toLowerCase() === 'api') {
@@ -45,6 +50,7 @@ const customCatalogOptionsCasing = (str: string): string => {
45
50
  export function Catalog(props: CatalogProps): JSX.Element {
46
51
  const {
47
52
  catalogConfig,
53
+ filters: serverFilters,
48
54
  entitiesTypes,
49
55
  initialEntitiesList,
50
56
  catalogSwitcherItems,
@@ -72,7 +78,12 @@ export function Catalog(props: CatalogProps): JSX.Element {
72
78
  onChangeCollapseSidebarClick,
73
79
  layout,
74
80
  collapsedSidebar,
75
- } = useCatalog(catalogConfig, initialEntitiesList?.page.total || 0, initialViewMode);
81
+ } = useCatalog(
82
+ catalogConfig,
83
+ serverFilters,
84
+ initialEntitiesList?.page.total || 0,
85
+ initialViewMode,
86
+ );
76
87
 
77
88
  return (
78
89
  <>
@@ -94,7 +105,7 @@ export function Catalog(props: CatalogProps): JSX.Element {
94
105
  filters={filters}
95
106
  filterTerm={searchQuery}
96
107
  hideSearch={true}
97
- showCounter={false}
108
+ showCounter={true}
98
109
  filterValuesCasing={customCatalogOptionsCasing}
99
110
  />
100
111
  }
@@ -23,7 +23,11 @@ export function CatalogTagsWithTooltip({
23
23
  if (showPlaceholder) {
24
24
  return (
25
25
  <CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
26
- <Tag style={{ backgroundColor: 'var(--catalog-tags-placeholder-bg-color)' }} color="grey">
26
+ <Tag
27
+ variant="outline"
28
+ style={{ backgroundColor: 'var(--catalog-tags-placeholder-bg-color)' }}
29
+ color="grey"
30
+ >
27
31
  N/A
28
32
  </Tag>
29
33
  </CatalogTagsWrapper>
@@ -0,0 +1,9 @@
1
+ // interface AdditionalOverviewInfoProps {
2
+ // info: any;
3
+ // }
4
+
5
+ // export function AdditionalOverviewInfo(_props: AdditionalOverviewInfoProps) {
6
+ // return null;
7
+ // }
8
+
9
+ export const AdditionalOverviewInfo: any = null;
@@ -0,0 +1 @@
1
+ export const AfterOpenApiDescription: any = null;
@@ -10,7 +10,7 @@ export const select = css`
10
10
  --select-text-color: var(--text-color-secondary); // @presenter Color
11
11
  --select-border-radius: var(--border-radius); // @presenter BorderRadius
12
12
  --select-border: var(--border-width) var(--border-style) var(--border-color-primary); // @presenter Border
13
-
13
+
14
14
  --select-input-padding-vertical: 6px; // @presenter Spacing
15
15
  --select-input-padding-horizontal: 6px; // @presenter Spacing
16
16
  --select-input-padding: var(--select-input-padding-vertical) var(--select-input-padding-horizontal);
@@ -38,7 +38,7 @@ export const select = css`
38
38
  --select-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
39
39
  --select-list-item-bg-color-active: transparent; // @presenter Color
40
40
  --select-list-item-bg-color-hover: var(--menu-item-bg-color-hover); // @presenter Color
41
- --select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
41
+ --select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
42
42
 
43
43
  --select-placeholder-color: var(--color-warm-grey-6); // @presenter Color
44
44
  // @tokens End
@@ -229,23 +229,23 @@ const TagWrapper = styled.div.attrs(({ className, color, size }: TagProps) => ({
229
229
  color: var(--tag-color);
230
230
  background-color: ${({ variant }) =>
231
231
  variant === 'filled' ? 'var(--tag-bg-color)' : 'transparent'};
232
- ${({ borderless, variant }) =>
232
+ ${({ borderless }) =>
233
233
  borderless
234
234
  ? ''
235
- : `border: var(--tag-border-width) var(--tag-border-style) ${variant === 'filled' ? 'transparent' : 'var(--tag-border-color)'};`}
235
+ : `border: var(--tag-border-width) var(--tag-border-style) var(--tag-border-color);`}
236
236
  border-radius: var(--tag-border-radius);
237
237
 
238
238
  svg {
239
239
  width: var(--tag-icon-width);
240
240
  height: var(--tag-icon-height);
241
241
  }
242
-
242
+ /*
243
243
  &:hover {
244
244
  background-color: ${({ variant }) =>
245
- variant === 'filled' ? 'var(--tag-bg-color-hover)' : 'transparent'};
245
+ variant === 'filled' ? 'var(--tag-bg-color-hover)' : 'transparent'};
246
246
  border-color: ${({ variant }) =>
247
- variant === 'outline' ? 'var(--tag-border-color-hover)' : 'transparent'};
248
- }
247
+ variant === 'outline' ? 'var(--tag-border-color-hover)' : 'transparent'};
248
+ } */
249
249
 
250
250
  &:focus-visible {
251
251
  outline: 1px solid var(--tag-border-color-focused);
@@ -142,6 +142,7 @@ export type ThemeHooks = {
142
142
  | undefined;
143
143
  useCatalog: (
144
144
  config?: CatalogEntityConfig,
145
+ serverFilters?: Record<string, { value: string; count: number }[]>,
145
146
  entitiesCounterInitial?: number,
146
147
  initialViewMode?: CatalogViewMode,
147
148
  ) => UseCatalogResponse;
@@ -146,6 +146,7 @@ export type TranslationKey =
146
146
  | 'catalog.entity.metadata.title'
147
147
  | 'catalog.entity.schema.title'
148
148
  | 'catalog.entity.properties.apiDescription.title'
149
+ | 'catalog.backToAllLabel'
149
150
  | 'sidebar.menu.backLabel'
150
151
  | 'sidebar.menu.backToLabel'
151
152
  | 'sidebar.actions.show'
@@ -0,0 +1,13 @@
1
+ import { useCallback } from 'react';
2
+
3
+ import type { CatalogItem } from '@redocly/theme';
4
+
5
+ export function useProcessScorecard(): {
6
+ processScorecard: <T = any>(scorecard: T, api: CatalogItem) => T;
7
+ processInfo: <T>(info: T) => T;
8
+ } {
9
+ return {
10
+ processScorecard: useCallback((scorecard) => scorecard, []),
11
+ processInfo: useCallback((info) => info, []),
12
+ };
13
+ }
package/src/index.ts CHANGED
@@ -93,9 +93,11 @@ export * from '@redocly/theme/components/Sidebar/Sidebar';
93
93
  /* OpenApiDocs */
94
94
  export * from '@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiOperation';
95
95
  export * from '@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle';
96
+ export * from '@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiDescription';
96
97
  export * from '@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation';
97
98
  export * from '@redocly/theme/components/OpenApiDocs/hooks/OpenApiFooter';
98
99
  export * from '@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader';
100
+ export * from '@redocly/theme/components/OpenApiDocs/hooks/AdditionalOverviewInfo';
99
101
  /* SidebarActions */
100
102
  export * from '@redocly/theme/components/SidebarActions/ChangeViewButton';
101
103
  export * from '@redocly/theme/components/SidebarActions/SidebarActions';