@redocly/theme 0.4.8 → 0.4.10

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 (177) hide show
  1. package/Button/Button.d.ts +2 -2
  2. package/Button/Button.js +7 -3
  3. package/Cards/Card.js +6 -13
  4. package/ColorModeSwitcher/ColorModeSwitcher.js +29 -18
  5. package/CopyButton/CopyButton.js +24 -13
  6. package/CopyButton/CopyButtonWrapper.d.ts +2 -2
  7. package/CopyButton/CopyButtonWrapper.js +25 -13
  8. package/EditPageButton/EditPageButton.js +4 -13
  9. package/Footer/CustomFooter.js +6 -15
  10. package/Footer/CustomFooterNavItem.js +4 -13
  11. package/Footer/Footer.js +6 -16
  12. package/Footer/FooterColumn.js +9 -18
  13. package/Footer/FooterColumns.js +3 -13
  14. package/Footer/FooterCopyright.js +2 -13
  15. package/JsonViewer/JsonViewer.d.ts +3 -3
  16. package/JsonViewer/JsonViewer.js +33 -16
  17. package/LastUpdated/LastUpdated.js +6 -16
  18. package/Layout/PageLayout.d.ts +3 -3
  19. package/Layout/PageLayout.js +4 -13
  20. package/Layout/RootLayout.d.ts +4 -4
  21. package/Layout/RootLayout.js +5 -13
  22. package/Markdown/Admonition.d.ts +2 -2
  23. package/Markdown/Admonition.js +5 -13
  24. package/Markdown/CodeSample/CodeSample.d.ts +1 -2
  25. package/Markdown/CodeSample/CodeSample.js +18 -4
  26. package/Markdown/Details.d.ts +2 -2
  27. package/Markdown/Details.js +4 -2
  28. package/Markdown/Heading.js +29 -15
  29. package/Markdown/MarkdownLayout.d.ts +3 -3
  30. package/Markdown/MarkdownLayout.js +9 -13
  31. package/Markdown/Mermaid.js +2 -2
  32. package/Markdown/Sup.js +2 -13
  33. package/Markdown/Tabs/Tab.js +2 -13
  34. package/Markdown/Tabs/Tabs.js +34 -21
  35. package/Navbar/MobileNavbarDropdown.js +3 -13
  36. package/Navbar/MobileNavbarItem.js +31 -14
  37. package/Navbar/MobileNavbarMenu.js +6 -15
  38. package/Navbar/Navbar.d.ts +4 -4
  39. package/Navbar/Navbar.js +12 -16
  40. package/Navbar/NavbarDropdown.js +3 -13
  41. package/Navbar/NavbarItem.js +8 -14
  42. package/Navbar/NavbarMenu.js +4 -15
  43. package/NavbarLogo/NavbarLogo.js +3 -14
  44. package/PageNavigation/NextPageLink.js +5 -16
  45. package/PageNavigation/PageNavigation.js +6 -16
  46. package/PageNavigation/PreviousPageLink.js +5 -16
  47. package/Panel/PanelComponent.d.ts +2 -1
  48. package/Panel/PanelComponent.js +31 -14
  49. package/Profile/Profile.d.ts +2 -2
  50. package/Profile/Profile.js +9 -15
  51. package/Search/Autocomplete.js +30 -3
  52. package/Search/ClearIcon.js +3 -2
  53. package/Search/Parameters.js +17 -17
  54. package/Search/Search.js +3 -13
  55. package/Search/SearchIcon.js +3 -2
  56. package/Search/SearchItem.js +30 -13
  57. package/Search/utils.js +28 -2
  58. package/Sidebar/ApiCallItem.js +7 -13
  59. package/Sidebar/ArrowBack.js +5 -13
  60. package/Sidebar/BackButton.d.ts +2 -2
  61. package/Sidebar/BackButton.js +4 -13
  62. package/Sidebar/Drilldown.d.ts +2 -2
  63. package/Sidebar/Drilldown.js +6 -2
  64. package/Sidebar/DrilldownMenu.d.ts +2 -2
  65. package/Sidebar/DrilldownMenu.js +10 -13
  66. package/Sidebar/DrilldownMenuItem.js +6 -13
  67. package/Sidebar/ExternalIcon.js +7 -13
  68. package/Sidebar/MenuGroup.d.ts +2 -2
  69. package/Sidebar/MenuGroup.js +8 -13
  70. package/Sidebar/MenuItem.js +7 -13
  71. package/Sidebar/MenuLinkItem.d.ts +2 -2
  72. package/Sidebar/MenuLinkItem.js +2 -2
  73. package/Sidebar/Separator.js +4 -13
  74. package/Sidebar/SidebarLayout.d.ts +3 -3
  75. package/Sidebar/SidebarLayout.js +9 -16
  76. package/SidebarLogo/SidebarLogo.js +3 -14
  77. package/SourceCode/SourceCode.js +31 -18
  78. package/TableOfContent/TableOfContent.js +36 -23
  79. package/Tooltip/Tooltip.d.ts +2 -1
  80. package/Tooltip/Tooltip.js +4 -3
  81. package/globalStyle.js +10 -9
  82. package/hooks/useDefaultThemeSettings.d.ts +2 -0
  83. package/hooks/useDefaultThemeSettings.js +9 -0
  84. package/icons/AlertIcon/AlertIcon.js +20 -17
  85. package/icons/ArrowIcon/ArrowIcon.js +4 -13
  86. package/icons/ColorModeIcon/ColorModeIcon.js +7 -15
  87. package/icons/ShelfIcon/ShelfIcon.d.ts +2 -2
  88. package/icons/ShelfIcon/ShelfIcon.js +4 -13
  89. package/mocks/Link.js +5 -2
  90. package/mocks/types.d.ts +4 -0
  91. package/package.json +1 -1
  92. package/src/Button/Button.tsx +2 -2
  93. package/src/Cards/Card.tsx +1 -0
  94. package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +3 -4
  95. package/src/CopyButton/CopyButton.tsx +1 -1
  96. package/src/CopyButton/CopyButtonWrapper.tsx +1 -1
  97. package/src/EditPageButton/EditPageButton.tsx +1 -0
  98. package/src/Footer/CustomFooter.tsx +1 -0
  99. package/src/Footer/CustomFooterNavItem.tsx +1 -0
  100. package/src/Footer/Footer.tsx +3 -3
  101. package/src/Footer/FooterColumn.tsx +1 -0
  102. package/src/Footer/FooterColumns.tsx +1 -0
  103. package/src/Footer/FooterCopyright.tsx +1 -0
  104. package/src/JsonViewer/JsonViewer.tsx +1 -1
  105. package/src/LastUpdated/LastUpdated.tsx +3 -3
  106. package/src/Layout/PageLayout.tsx +6 -3
  107. package/src/Layout/RootLayout.tsx +4 -4
  108. package/src/Markdown/Admonition.tsx +2 -2
  109. package/src/Markdown/CodeSample/CodeSample.tsx +24 -7
  110. package/src/Markdown/Details.tsx +2 -2
  111. package/src/Markdown/Heading.tsx +1 -1
  112. package/src/Markdown/MarkdownLayout.tsx +3 -3
  113. package/src/Markdown/Mermaid.tsx +1 -0
  114. package/src/Markdown/Sup.tsx +1 -0
  115. package/src/Markdown/Tabs/Tab.tsx +1 -0
  116. package/src/Markdown/Tabs/Tabs.tsx +2 -1
  117. package/src/Navbar/MobileNavbarDropdown.tsx +1 -0
  118. package/src/Navbar/MobileNavbarItem.tsx +1 -1
  119. package/src/Navbar/MobileNavbarMenu.tsx +1 -0
  120. package/src/Navbar/Navbar.tsx +6 -7
  121. package/src/Navbar/NavbarDropdown.tsx +1 -0
  122. package/src/Navbar/NavbarItem.tsx +1 -0
  123. package/src/Navbar/NavbarMenu.tsx +1 -0
  124. package/src/NavbarLogo/NavbarLogo.tsx +1 -0
  125. package/src/PageNavigation/NextPageLink.tsx +4 -3
  126. package/src/PageNavigation/PageNavigation.tsx +3 -3
  127. package/src/PageNavigation/PreviousPageLink.tsx +4 -3
  128. package/src/Panel/PanelComponent.tsx +2 -2
  129. package/src/Profile/Profile.tsx +1 -1
  130. package/src/Search/Autocomplete.tsx +1 -1
  131. package/src/Search/ClearIcon.tsx +1 -0
  132. package/src/Search/Parameters.tsx +1 -0
  133. package/src/Search/Search.tsx +1 -0
  134. package/src/Search/SearchIcon.tsx +1 -0
  135. package/src/Search/SearchItem.tsx +1 -1
  136. package/src/Search/utils.tsx +1 -0
  137. package/src/Sidebar/ApiCallItem.tsx +1 -0
  138. package/src/Sidebar/ArrowBack.tsx +1 -0
  139. package/src/Sidebar/BackButton.tsx +5 -2
  140. package/src/Sidebar/Drilldown.tsx +2 -2
  141. package/src/Sidebar/DrilldownMenu.tsx +2 -2
  142. package/src/Sidebar/DrilldownMenuItem.tsx +1 -0
  143. package/src/Sidebar/ExternalIcon.tsx +1 -0
  144. package/src/Sidebar/MenuGroup.tsx +2 -2
  145. package/src/Sidebar/MenuItem.tsx +1 -0
  146. package/src/Sidebar/MenuLinkItem.tsx +5 -2
  147. package/src/Sidebar/Separator.tsx +1 -0
  148. package/src/Sidebar/SidebarLayout.tsx +5 -6
  149. package/src/SidebarLogo/SidebarLogo.tsx +1 -0
  150. package/src/SourceCode/SourceCode.tsx +1 -1
  151. package/src/TableOfContent/TableOfContent.tsx +3 -4
  152. package/src/Tooltip/Tooltip.tsx +1 -1
  153. package/src/globalStyle.ts +54 -0
  154. package/src/hooks/useDefaultThemeSettings.ts +8 -0
  155. package/src/icons/AlertIcon/AlertIcon.tsx +1 -0
  156. package/src/icons/ArrowIcon/ArrowIcon.tsx +1 -0
  157. package/src/icons/ColorModeIcon/ColorModeIcon.tsx +1 -0
  158. package/src/icons/ShelfIcon/ShelfIcon.tsx +2 -2
  159. package/src/mocks/Link.tsx +1 -0
  160. package/src/mocks/types.ts +4 -0
  161. package/src/types/portal/src/shared/types.d.ts +1 -2
  162. package/src/ui/Burger.tsx +1 -0
  163. package/src/ui/Dropdown.tsx +1 -1
  164. package/src/ui/Flex.tsx +2 -2
  165. package/src/ui/Tiles/ThinTile.tsx +1 -1
  166. package/src/ui/Tiles/WideTile.tsx +1 -1
  167. package/src/ui/UniversalLink.tsx +10 -9
  168. package/src/ui/index.tsx +3 -2
  169. package/ui/Burger.js +5 -13
  170. package/ui/Dropdown.js +32 -14
  171. package/ui/Flex.d.ts +2 -2
  172. package/ui/Flex.js +2 -2
  173. package/ui/Tiles/ThinTile.js +29 -13
  174. package/ui/Tiles/WideTile.js +29 -13
  175. package/ui/UniversalLink.d.ts +4 -4
  176. package/ui/UniversalLink.js +26 -3
  177. package/ui/index.d.ts +3 -3
@@ -1,11 +1,14 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren, ReactNode } from 'react';
3
3
 
4
4
  interface PageLayoutProps {
5
- sidebar?: ReactNode;
5
+ sidebar?: React.ReactNode;
6
6
  }
7
7
 
8
- export function PageLayout({ sidebar, children }: PropsWithChildren<PageLayoutProps>): JSX.Element {
8
+ export function PageLayout({
9
+ sidebar,
10
+ children,
11
+ }: React.PropsWithChildren<PageLayoutProps>): JSX.Element {
9
12
  return (
10
13
  <Container data-component-name="Layout/PageLayout">
11
14
  {sidebar}
@@ -1,9 +1,9 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren, ReactNode } from 'react';
3
3
 
4
4
  interface LayoutConfig {
5
- navbar: ReactNode;
6
- footer: ReactNode;
5
+ navbar: React.ReactNode;
6
+ footer: React.ReactNode;
7
7
  }
8
8
 
9
9
  const Wrapper = styled.div``;
@@ -12,7 +12,7 @@ export function RootLayout({
12
12
  navbar,
13
13
  footer,
14
14
  children,
15
- }: PropsWithChildren<LayoutConfig>): JSX.Element {
15
+ }: React.PropsWithChildren<LayoutConfig>): JSX.Element {
16
16
  return (
17
17
  // TODO: rewrite it to avoid passing components as props
18
18
  <Wrapper data-component-name="Layout/RootLayout">
@@ -1,5 +1,5 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import { AlertIcon } from '@theme/icons/AlertIcon/AlertIcon';
5
5
 
@@ -15,7 +15,7 @@ export function Admonition({
15
15
  type = 'info',
16
16
  name,
17
17
  children,
18
- }: PropsWithChildren<AdmonitionProps>): JSX.Element {
18
+ }: React.PropsWithChildren<AdmonitionProps>): JSX.Element {
19
19
  return (
20
20
  <Wrapper type={type} data-component-name="Markdown/Admonition">
21
21
  <AlertIcon type={type} />
@@ -1,31 +1,48 @@
1
- import { useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
 
4
4
  import { ClipboardService } from '@theme/utils/ClipboardService';
5
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
5
6
 
6
- type CodeSampleProps = {
7
+ export type CodeSampleProps = {
7
8
  language: string;
8
9
  highlighted: string;
9
10
  rawContent: string;
10
11
  };
11
12
 
13
+ const defaultCopyCodeSnippet = {
14
+ hide: false,
15
+ buttonText: 'Copy',
16
+ tooltipText: 'Copy the code snippet',
17
+ toasterText: 'Copied',
18
+ toasterDuration: 1500,
19
+ };
20
+
12
21
  export function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element {
13
22
  const langClassName = language ? `language-${language}` : '';
23
+ const { copyCodeSnippet } = useDefaultThemeSettings();
24
+ const copyCodeProps = { ...copyCodeSnippet, ...defaultCopyCodeSnippet };
14
25
 
15
26
  const [isCopied, setIsCopied] = useState(false);
16
27
 
17
28
  const copyCode = (code: string) => {
18
29
  ClipboardService.copyCustom(code);
19
30
  setIsCopied(true);
20
- setTimeout(() => setIsCopied(false), 1500);
31
+ setTimeout(() => setIsCopied(false), copyCodeProps.toasterDuration);
21
32
  };
22
33
 
23
34
  return (
24
35
  <Wrapper className="code-sample" data-component-name="Markdown/CodeSample/CodeSample">
25
- <CodeSampleButtonContainer onClick={() => copyCode(rawContent)}>
26
- {!isCopied && <CopyCodeButton title="Copy the code snippet">Copy</CopyCodeButton>}
27
- {isCopied && <DoneIndicator>Copied</DoneIndicator>}
28
- </CodeSampleButtonContainer>
36
+ {!copyCodeProps.hide && (
37
+ <CodeSampleButtonContainer onClick={() => copyCode(rawContent)}>
38
+ {!isCopied && (
39
+ <CopyCodeButton title={copyCodeProps.tooltipText}>
40
+ {copyCodeProps.buttonText}
41
+ </CopyCodeButton>
42
+ )}
43
+ {isCopied && <DoneIndicator>{copyCodeProps.toasterText}</DoneIndicator>}
44
+ </CodeSampleButtonContainer>
45
+ )}
29
46
  <pre className={langClassName}>
30
47
  <code className={langClassName} dangerouslySetInnerHTML={{ __html: highlighted }} />
31
48
  </pre>
@@ -1,11 +1,11 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  type DetailsProps = {
5
5
  summary: string;
6
6
  };
7
7
 
8
- export function Details({ summary, children }: PropsWithChildren<DetailsProps>): JSX.Element {
8
+ export function Details({ summary, children }: React.PropsWithChildren<DetailsProps>): JSX.Element {
9
9
  return (
10
10
  <StyledDetails>
11
11
  <summary>{summary}</summary>
@@ -1,5 +1,5 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- import { createElement } from 'react';
2
+ import React, { createElement } from 'react';
3
3
 
4
4
  import { concatClassNames } from '@theme/utils';
5
5
 
@@ -1,5 +1,5 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { ReactNode } from 'react';
3
3
 
4
4
  import { PageWrapper } from '@theme/Markdown/PageWrapper';
5
5
  import { ContainerWrapper } from '@theme/Markdown/ContainerWrapper';
@@ -8,8 +8,8 @@ import { EditPageButton } from '@theme/EditPageButton';
8
8
  import { LastUpdated } from '@theme/LastUpdated/LastUpdated';
9
9
 
10
10
  type MarkdownLayoutProps = {
11
- tableOfContent: ReactNode;
12
- markdownWrapper: ReactNode;
11
+ tableOfContent: React.ReactNode;
12
+ markdownWrapper: React.ReactNode;
13
13
  showPrevButton?: boolean;
14
14
  showNextButton?: boolean;
15
15
  editPage?: {
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  type MermaidProps = {
@@ -1,4 +1,5 @@
1
1
  import type { PropsWithChildren } from 'react';
2
+ import React from 'react';
2
3
  import styled from 'styled-components';
3
4
 
4
5
  export function Sup({ children }: PropsWithChildren<unknown>): JSX.Element {
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  type TabProps = {
@@ -1,5 +1,5 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- import { useState } from 'react';
2
+ import React, { useState } from 'react';
3
3
  import styled from 'styled-components';
4
4
 
5
5
  import { Tab } from '@theme/Markdown/Tabs/Tab';
@@ -39,6 +39,7 @@ const TabList = styled.ol`
39
39
  `;
40
40
 
41
41
  const TabContent = styled.div`
42
+ padding: 10px 5px;
42
43
  border: 1px solid #ccc;
43
44
  border-top: none;
44
45
  padding: 1rem;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { useLocation } from 'react-router-dom';
4
4
 
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
@@ -1,26 +1,25 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { ReactNode } from 'react';
3
3
 
4
4
  import type { ResolvedConfigLinks } from '@theme/types/portal';
5
5
 
6
- import { useThemeSettings } from '@portal/hooks';
7
- import { DEFAULT_THEME_NAME } from '@portal/constants';
8
6
  import { NavbarMenu } from '@theme/Navbar';
9
7
  import { useMobileMenu } from '@theme/hooks/useMobileMenu';
10
8
  import { MobileNavbarMenuButton } from '@theme/Navbar/MobileNavbarMenuButton';
11
9
  import { MobileNavbarMenu } from '@theme/Navbar/MobileNavbarMenu';
12
10
  import { ColorModeSwitcher } from '@theme/ColorModeSwitcher/ColorModeSwitcher';
11
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
13
12
 
14
13
  interface NavbarProps {
15
14
  menu: ResolvedConfigLinks;
16
- logo: ReactNode;
17
- search: ReactNode;
18
- profile?: ReactNode;
15
+ logo: React.ReactNode;
16
+ search: React.ReactNode;
17
+ profile?: React.ReactNode;
19
18
  }
20
19
 
21
20
  export function Navbar({ menu, logo, search, profile }: NavbarProps): JSX.Element | null {
22
21
  const [isOpen, setIsOpen] = useMobileMenu(false);
23
- const { search: searchSettings, navbar } = useThemeSettings(DEFAULT_THEME_NAME);
22
+ const { search: searchSettings, navbar } = useDefaultThemeSettings();
24
23
  const hideSearch =
25
24
  searchSettings?.hide || (searchSettings?.placement && searchSettings?.placement !== 'navbar');
26
25
 
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
  import { useLocation } from 'react-router-dom';
3
4
 
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { LogoConfig } from '@theme/types/portal';
@@ -1,10 +1,11 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavItemWithLink } from '@theme/types/portal';
4
5
 
5
- import { useThemeSettings, useSidebarSiblingsData } from '@portal/hooks';
6
- import { DEFAULT_THEME_NAME } from '@portal/constants';
6
+ import { useSidebarSiblingsData } from '@portal/hooks';
7
7
  import { Button } from '@theme/Button/Button';
8
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
8
9
 
9
10
  interface NextPageType {
10
11
  nextPage?: ResolvedNavItemWithLink | null;
@@ -12,7 +13,7 @@ interface NextPageType {
12
13
 
13
14
  export function NextPageLink(): JSX.Element {
14
15
  const { nextPage }: NextPageType = useSidebarSiblingsData() || {};
15
- const { navigation } = useThemeSettings(DEFAULT_THEME_NAME);
16
+ const { navigation } = useDefaultThemeSettings();
16
17
 
17
18
  if (!nextPage || navigation?.hide || navigation?.nextPageLink?.hide) {
18
19
  return <div>&nbsp;</div>;
@@ -1,9 +1,9 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import { PreviousPageLink } from '@theme/PageNavigation/PreviousPageLink';
4
5
  import { NextPageLink } from '@theme/PageNavigation/NextPageLink';
5
- import { useThemeSettings } from '@portal/hooks';
6
- import { DEFAULT_THEME_NAME } from '@portal/constants';
6
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
7
7
 
8
8
  type PageNavigationProps = {
9
9
  showPrevButton?: boolean;
@@ -14,7 +14,7 @@ export function PageNavigation({
14
14
  showPrevButton = true,
15
15
  showNextButton = true,
16
16
  }: PageNavigationProps): JSX.Element | null {
17
- const { navigation } = useThemeSettings(DEFAULT_THEME_NAME);
17
+ const { navigation } = useDefaultThemeSettings();
18
18
 
19
19
  if (navigation?.hide) {
20
20
  return null;
@@ -1,9 +1,10 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavItemWithLink } from '@theme/types/portal';
4
5
 
5
- import { useThemeSettings, useSidebarSiblingsData } from '@portal/hooks';
6
- import { DEFAULT_THEME_NAME } from '@portal/constants';
6
+ import { useSidebarSiblingsData } from '@portal/hooks';
7
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
7
8
  import { Button } from '@theme/Button/Button';
8
9
 
9
10
  interface PreviousPageType {
@@ -12,7 +13,7 @@ interface PreviousPageType {
12
13
 
13
14
  export function PreviousPageLink(): JSX.Element {
14
15
  const { prevPage }: PreviousPageType = useSidebarSiblingsData() || {};
15
- const { navigation } = useThemeSettings(DEFAULT_THEME_NAME);
16
+ const { navigation } = useDefaultThemeSettings();
16
17
 
17
18
  if (!prevPage || navigation?.hide || navigation?.previousPageLink?.hide) {
18
19
  return <div>&nbsp;</div>;
@@ -1,5 +1,5 @@
1
1
  import type { BaseSyntheticEvent, PropsWithChildren, ReactNode } from 'react';
2
- import { useEffect, useState } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import styled from 'styled-components';
4
4
 
5
5
  import type { PanelHeaderProps } from '@theme/Panel/PanelHeader';
@@ -15,7 +15,7 @@ export interface PanelComponentProps {
15
15
  renderChildrenHidden?: boolean;
16
16
  header?: ReactNode | ((props: PanelHeaderProps) => ReactNode);
17
17
  onToggle?: (expanded: boolean) => void;
18
- description?: ReactNode;
18
+ description?: React.ReactNode;
19
19
  }
20
20
 
21
21
  export function PanelComponent({
@@ -1,4 +1,4 @@
1
- import { memo } from 'react';
1
+ import React, { memo } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
 
4
4
  import { stringToHslColor } from '@theme/utils';
@@ -1,5 +1,5 @@
1
1
  import type { ChangeEvent, KeyboardEvent, ReactNode, SyntheticEvent } from 'react';
2
- import { useEffect, useState } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import { useLocation } from 'react-router-dom';
4
4
  import styled from 'styled-components';
5
5
 
@@ -1,4 +1,5 @@
1
1
  import type { SVGProps } from 'react';
2
+ import React from 'react';
2
3
  import styled from 'styled-components';
3
4
 
4
5
  const Icon = (props: SVGProps<SVGSVGElement>) => (
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { OperationParameter } from '@portal/types';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import { usePreloadHistory } from '@portal/usePreloadHistory';
@@ -1,4 +1,5 @@
1
1
  import type { SVGProps } from 'react';
2
+ import React from 'react';
2
3
  import styled from 'styled-components';
3
4
 
4
5
  const Icon = (props: SVGProps<SVGSVGElement>) => (
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import type { ActiveItem, SearchDocument } from '@portal/types';
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  export const highlight = (text: string | string[]): JSX.Element | string => {
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  const Arrow = ({ className }: { className?: string }): JSX.Element => (
@@ -1,5 +1,5 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import { ArrowBack } from '@theme/Sidebar/ArrowBack';
5
5
 
@@ -7,7 +7,10 @@ interface BackButtonProps {
7
7
  back: () => void;
8
8
  }
9
9
 
10
- export function BackButton({ children, back }: PropsWithChildren<BackButtonProps>): JSX.Element {
10
+ export function BackButton({
11
+ children,
12
+ back,
13
+ }: React.PropsWithChildren<BackButtonProps>): JSX.Element {
11
14
  return (
12
15
  <Button onClick={back} data-component-name="Sidebar/BackButton">
13
16
  <ArrowBack />
@@ -1,5 +1,5 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
5
5
 
@@ -18,7 +18,7 @@ export function Drilldown({
18
18
  item,
19
19
  expand,
20
20
  ...props
21
- }: PropsWithChildren<DrilldownProps>): JSX.Element {
21
+ }: React.PropsWithChildren<DrilldownProps>): JSX.Element {
22
22
  return (
23
23
  <Wrapper data-component-name="Sidebar/Drilldown">
24
24
  <DrilldownLabel onClick={expand}>
@@ -1,5 +1,5 @@
1
+ import React from 'react';
1
2
  import styled, { keyframes } from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
5
5
 
@@ -11,7 +11,7 @@ export function DrilldownMenu({
11
11
  back,
12
12
  prevActiveItem,
13
13
  children,
14
- }: PropsWithChildren<DrilldownMenuProps>): JSX.Element {
14
+ }: React.PropsWithChildren<DrilldownMenuProps>): JSX.Element {
15
15
  return (
16
16
  <MenuContainer data-component-name="Sidebar/DrilldownMenu">
17
17
  <MenuContent>
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  const Icon = ({ className }: { className?: string }): JSX.Element => (
@@ -1,5 +1,5 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import type { ItemState } from '@theme/Sidebar/types/ItemState';
5
5
 
@@ -19,7 +19,7 @@ export function MenuGroup({
19
19
  isExpanded,
20
20
  toggleExpanded,
21
21
  children,
22
- }: PropsWithChildren<MenuGroupProps>): JSX.Element {
22
+ }: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
23
23
  return (
24
24
  <Wrapper data-component-name="Sidebar/MenuGroup">
25
25
  <MenuLinkItem item={item}>
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
@@ -1,11 +1,14 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
5
5
 
6
6
  import { MenuLink } from '@theme/Sidebar/MenuLink';
7
7
 
8
- export function MenuLinkItem({ item, children }: PropsWithChildren<MenuItemProps>): JSX.Element {
8
+ export function MenuLinkItem({
9
+ item,
10
+ children,
11
+ }: React.PropsWithChildren<MenuItemProps>): JSX.Element {
9
12
  return (
10
13
  <Wrapper data-component-name="Sidebar/MenuLinkItem">
11
14
  {item.link ? (
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
@@ -1,23 +1,22 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
- import type { ReactNode } from 'react';
3
3
 
4
4
  import { Sidebar } from '@theme/Sidebar/Sidebar';
5
5
  import { useMobileMenu } from '@theme/hooks/useMobileMenu';
6
6
  import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
7
7
  import { MenuContainer } from '@theme/Sidebar/MenuContainer';
8
- import { useThemeSettings } from '@portal/hooks';
9
- import { DEFAULT_THEME_NAME } from '@portal/constants';
10
8
  import { SidebarSearch } from '@theme/Search/SidebarSearch';
9
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
11
10
 
12
11
  interface SidebarLayoutProps {
13
- versions: ReactNode;
14
- menu: ReactNode;
12
+ versions: React.ReactNode;
13
+ menu: React.ReactNode;
15
14
  }
16
15
 
17
16
  export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null {
18
17
  const [isOpen, setIsOpen] = useMobileMenu();
19
18
  const toggleMenu = () => setIsOpen(!isOpen);
20
- const { search, sidebar } = useThemeSettings(DEFAULT_THEME_NAME);
19
+ const { search, sidebar } = useDefaultThemeSettings();
21
20
 
22
21
  if (sidebar?.hide) {
23
22
  return null;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  export interface LogoProps {
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
 
3
3
  import { highlight, addLineNumbers } from '@theme/utils';
4
4
  import {
@@ -1,4 +1,4 @@
1
- import { useRef } from 'react';
1
+ import React, { useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import type { MdHeading } from '@theme/types/portal';
@@ -6,9 +6,8 @@ import type { MdHeading } from '@theme/types/portal';
6
6
  import { getDisplayedHeadingsIds, getDisplayedHeadings, getLeastDepth } from './utils';
7
7
 
8
8
  import { useFullHeight } from '@theme/hooks/useFullHeight';
9
- import { useThemeSettings } from '@portal/hooks';
10
9
  import { useActiveHeading } from '@theme/hooks/useActiveHeading';
11
- import { DEFAULT_THEME_NAME } from '@portal/constants';
10
+ import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
12
11
 
13
12
  interface TableOfContentProps {
14
13
  headings?: Array<MdHeading | null> | null | undefined;
@@ -21,7 +20,7 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
21
20
 
22
21
  const sidebar = useRef<HTMLDivElement | null>(null);
23
22
  useFullHeight(sidebar);
24
- const { toc } = useThemeSettings(DEFAULT_THEME_NAME);
23
+ const { toc } = useDefaultThemeSettings();
25
24
 
26
25
  const displayedHeadings = getDisplayedHeadings(headings, tocMaxDepth);
27
26
  const leastDepth = getLeastDepth(displayedHeadings);
@@ -1,4 +1,4 @@
1
- import { useEffect, memo, useRef } from 'react';
1
+ import React, { useEffect, memo, useRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import type { PropsWithChildren, ReactNode } from 'react';
4
4