@redocly/theme 0.11.5 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/lib/I18n/LanguagePicker.d.ts +4 -0
  2. package/lib/I18n/LanguagePicker.js +111 -0
  3. package/lib/I18n/index.d.ts +1 -0
  4. package/lib/I18n/index.js +6 -0
  5. package/lib/components/Cards/Card.js +3 -1
  6. package/lib/components/Catalog/Catalog.js +14 -9
  7. package/lib/components/Catalog/CatalogCard.js +6 -1
  8. package/lib/components/Catalog/useCatalog.js +4 -1
  9. package/lib/components/CodeSample/CodeSample.js +11 -3
  10. package/lib/components/Feedback/Comment.js +12 -4
  11. package/lib/components/Feedback/Rating.js +8 -2
  12. package/lib/components/Feedback/Reasons.js +11 -4
  13. package/lib/components/Feedback/Sentiment.js +12 -4
  14. package/lib/components/Feedback/Thumbs.js +31 -18
  15. package/lib/components/Feedback/useReportDialog.js +8 -2
  16. package/lib/components/Filter/Filter.js +15 -8
  17. package/lib/components/Footer/FooterColumn.js +4 -2
  18. package/lib/components/Footer/FooterCopyright.d.ts +1 -2
  19. package/lib/components/Footer/FooterCopyright.js +6 -1
  20. package/lib/components/LastUpdated/LastUpdated.js +8 -4
  21. package/lib/components/Markdown/MarkdownLayout.js +6 -1
  22. package/lib/components/Menu/MenuGroup.js +3 -1
  23. package/lib/components/Menu/MenuItem.js +3 -1
  24. package/lib/components/Navbar/MobileNavbarItem.js +6 -2
  25. package/lib/components/Navbar/Navbar.d.ts +1 -0
  26. package/lib/components/Navbar/Navbar.js +6 -1
  27. package/lib/components/Navbar/NavbarDropdown.js +3 -1
  28. package/lib/components/Navbar/NavbarItem.js +9 -4
  29. package/lib/components/PageNavigation/NextButton.js +7 -2
  30. package/lib/components/PageNavigation/PreviousButton.js +10 -2
  31. package/lib/components/Profile/LoginLink.js +6 -1
  32. package/lib/components/Profile/UserProfileMenu.js +10 -4
  33. package/lib/components/Search/Autocomplete.d.ts +3 -3
  34. package/lib/components/Search/Autocomplete.js +21 -11
  35. package/lib/components/Search/ClearIcon.js +1 -1
  36. package/lib/components/Search/Search.js +6 -4
  37. package/lib/components/Separator/Separator.js +3 -1
  38. package/lib/components/Sidebar/DrilldownMenu.js +6 -1
  39. package/lib/components/Sidebar/DrilldownMenuItem.js +4 -2
  40. package/lib/components/Sidebar/types.d.ts +2 -0
  41. package/lib/components/TableOfContent/TableOfContent.js +6 -1
  42. package/lib/icons/SpinnerIcon/SpinnerIcon.d.ts +8 -0
  43. package/lib/icons/SpinnerIcon/SpinnerIcon.js +32 -0
  44. package/lib/icons/SpinnerIcon/index.d.ts +1 -0
  45. package/lib/icons/SpinnerIcon/index.js +6 -0
  46. package/lib/icons/index.d.ts +1 -0
  47. package/lib/icons/index.js +1 -0
  48. package/lib/index.d.ts +1 -0
  49. package/lib/index.js +1 -0
  50. package/lib/layouts/Forbidden.js +8 -2
  51. package/lib/layouts/NotFound.js +8 -2
  52. package/lib/mocks/hooks/index.d.ts +15 -1
  53. package/lib/mocks/hooks/index.js +19 -1
  54. package/lib/mocks/search.d.ts +1 -0
  55. package/lib/mocks/search.js +1 -0
  56. package/lib/mocks/utils.d.ts +5 -0
  57. package/lib/mocks/utils.js +9 -1
  58. package/lib/types/portal/index.d.ts +1 -0
  59. package/lib/types/portal/index.js +1 -0
  60. package/lib/types/portal/src/shared/types/catalog.d.ts +4 -0
  61. package/lib/types/portal/src/shared/types/nav.d.ts +7 -0
  62. package/package.json +1 -1
  63. package/src/I18n/LanguagePicker.tsx +113 -0
  64. package/src/I18n/index.ts +1 -0
  65. package/src/components/Cards/Card.tsx +5 -1
  66. package/src/components/Catalog/Catalog.tsx +23 -6
  67. package/src/components/Catalog/CatalogCard.tsx +8 -1
  68. package/src/components/Catalog/useCatalog.ts +4 -2
  69. package/src/components/CodeSample/CodeSample.tsx +22 -4
  70. package/src/components/Feedback/Comment.tsx +25 -4
  71. package/src/components/Feedback/Rating.tsx +15 -2
  72. package/src/components/Feedback/Reasons.tsx +23 -5
  73. package/src/components/Feedback/Sentiment.tsx +25 -4
  74. package/src/components/Feedback/Thumbs.tsx +61 -46
  75. package/src/components/Feedback/useReportDialog.ts +11 -2
  76. package/src/components/Filter/Filter.tsx +17 -9
  77. package/src/components/Footer/CustomFooter.tsx +1 -1
  78. package/src/components/Footer/FooterColumn.tsx +5 -3
  79. package/src/components/Footer/FooterCopyright.tsx +12 -3
  80. package/src/components/LastUpdated/LastUpdated.tsx +10 -2
  81. package/src/components/Markdown/MarkdownLayout.tsx +11 -1
  82. package/src/components/Menu/MenuGroup.tsx +4 -1
  83. package/src/components/Menu/MenuItem.tsx +3 -1
  84. package/src/components/Navbar/MobileNavbarItem.tsx +7 -1
  85. package/src/components/Navbar/Navbar.tsx +8 -0
  86. package/src/components/Navbar/NavbarDropdown.tsx +3 -1
  87. package/src/components/Navbar/NavbarItem.tsx +9 -3
  88. package/src/components/PageNavigation/NextButton.tsx +8 -2
  89. package/src/components/PageNavigation/PreviousButton.tsx +11 -2
  90. package/src/components/Profile/LoginLink.tsx +11 -1
  91. package/src/components/Profile/UserProfileMenu.tsx +13 -3
  92. package/src/components/Search/Autocomplete.tsx +31 -17
  93. package/src/components/Search/ClearIcon.tsx +1 -1
  94. package/src/components/Search/Search.tsx +8 -7
  95. package/src/components/Separator/Separator.tsx +4 -1
  96. package/src/components/Sidebar/DrilldownMenu.tsx +8 -1
  97. package/src/components/Sidebar/DrilldownMenuItem.tsx +7 -2
  98. package/src/components/Sidebar/types.ts +2 -0
  99. package/src/components/TableOfContent/TableOfContent.tsx +11 -1
  100. package/src/icons/SpinnerIcon/SpinnerIcon.tsx +42 -0
  101. package/src/icons/SpinnerIcon/index.ts +1 -0
  102. package/src/icons/index.ts +1 -0
  103. package/src/index.ts +1 -0
  104. package/src/layouts/Forbidden.tsx +18 -3
  105. package/src/layouts/NotFound.tsx +17 -3
  106. package/src/mocks/hooks/index.ts +20 -1
  107. package/src/mocks/search.ts +2 -0
  108. package/src/mocks/utils.ts +13 -0
  109. package/src/types/portal/index.ts +1 -0
  110. package/src/types/portal/src/shared/types/catalog.ts +4 -0
  111. package/src/types/portal/src/shared/types/i18n.d.ts +3 -0
  112. package/src/types/portal/src/shared/types/nav.ts +7 -0
@@ -2,8 +2,21 @@ export function withPathPrefix(link: string): string {
2
2
  return link;
3
3
  }
4
4
 
5
+ export function withoutPathPrefix(link: string): string {
6
+ return link;
7
+ }
8
+
5
9
  export function timeAgo(lastModified: string | Date): string {
6
10
  // should return format(lastModified) in portal
7
11
  const d = new Date(lastModified);
8
12
  return `${d.getDate()}-${d.getMonth() + 1}-${d.getFullYear()}`;
9
13
  }
14
+
15
+ export function getPathnameForLocale(
16
+ pathname: string,
17
+ _defaultLocale: string,
18
+ _newLocale: string,
19
+ _allLocales: { code: string; name: string }[],
20
+ ) {
21
+ return `${pathname}`;
22
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './src/shared/types/nav';
2
+ export * from './src/shared/types/i18n';
2
3
  export type { MdHeading } from './src/shared/types/markdown';
@@ -10,9 +10,11 @@ export type FilteredCatalog = {
10
10
  export type Filter = {
11
11
  type?: 'select' | 'checkboxes';
12
12
  title: string;
13
+ titleTranslationKey?: string;
13
14
  property: string;
14
15
  parentFilter?: string;
15
16
  missingCategoryName?: string;
17
+ missingCategoryNameTranslationKey?: string;
16
18
  options?: string[];
17
19
  };
18
20
 
@@ -24,7 +26,9 @@ export type CatalogConfig = {
24
26
  requiredPermission?: string;
25
27
  separateVersions?: boolean;
26
28
  title?: string;
29
+ titleTranslationKey?: string;
27
30
  description?: string;
31
+ descriptionTranslationKey?: string;
28
32
  };
29
33
 
30
34
  export type ResolvedFilter = Omit<Filter, 'options'> & {
@@ -0,0 +1,3 @@
1
+ export declare interface TFunction {
2
+ (value?: string, options?: string | TOptions): string;
3
+ }
@@ -6,6 +6,7 @@ export type ResolvedNavLinkItem = {
6
6
  metadata?: Record<string, unknown>;
7
7
  link: string;
8
8
  label: string;
9
+ labelTranslationKey?: string;
9
10
  items?: ResolvedNavItem[];
10
11
  sidebar?: ResolvedNavItem[]; // for API catalog it contains the corresponding sidebar first item
11
12
  external?: boolean;
@@ -27,6 +28,7 @@ export type ResolvedNavGroupItem = {
27
28
  metadata?: Record<string, unknown>;
28
29
  link?: string;
29
30
  label?: string;
31
+ labelTranslationKey?: string;
30
32
  items?: ResolvedNavItem[];
31
33
  sidebar?: ResolvedNavItem[]; // for API catalog it contains the corresponding sidebar first item
32
34
  external?: boolean;
@@ -52,6 +54,7 @@ export type ResolvedNavItem =
52
54
  type: 'separator';
53
55
  metadata?: Record<string, unknown>;
54
56
  label?: string;
57
+ labelTranslationKey?: string;
55
58
  routeSlug?: never;
56
59
 
57
60
  version?: string;
@@ -74,6 +77,7 @@ export type ResolvedNavItem =
74
77
  routeSlug?: never;
75
78
 
76
79
  label: string;
80
+ labelTranslationKey?: string;
77
81
  link?: undefined;
78
82
  items?: ResolvedNavItem[]; // for typescript
79
83
  sidebar?: ResolvedNavItem[]; // for typescript
@@ -120,10 +124,13 @@ export type NavItem = {
120
124
  page?: string;
121
125
  directory?: string;
122
126
  group?: string;
127
+ groupTranslationKey?: string;
123
128
  label?: string;
129
+ labelTranslationKey?: string;
124
130
  href?: never;
125
131
  items?: NavItem[];
126
132
  separator?: string;
133
+ separatorTranslationKey?: string;
127
134
  separatorLine?: boolean;
128
135
  version?: string;
129
136
  menuStyle?: MenuStyle;