@redocly/theme 0.4.7 → 0.4.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 (215) hide show
  1. package/Button/Button.d.ts +3 -3
  2. package/Button/Button.js +3 -7
  3. package/Cards/Card.d.ts +1 -1
  4. package/Cards/Card.js +14 -7
  5. package/ColorModeSwitcher/ColorModeSwitcher.js +13 -25
  6. package/CopyButton/CopyButton.js +13 -24
  7. package/CopyButton/CopyButtonWrapper.d.ts +4 -3
  8. package/CopyButton/CopyButtonWrapper.js +15 -26
  9. package/EditPageButton/EditPageButton.js +13 -4
  10. package/Footer/CustomFooter.d.ts +1 -1
  11. package/Footer/CustomFooter.js +15 -6
  12. package/Footer/CustomFooterNavItem.js +13 -4
  13. package/Footer/Footer.js +13 -4
  14. package/Footer/FooterColumn.js +18 -9
  15. package/Footer/FooterColumns.js +13 -3
  16. package/Footer/FooterCopyright.js +13 -2
  17. package/JsonViewer/JsonViewer.d.ts +4 -3
  18. package/JsonViewer/JsonViewer.js +17 -34
  19. package/LastUpdated/LastUpdated.js +13 -4
  20. package/Layout/PageLayout.d.ts +3 -3
  21. package/Layout/PageLayout.js +13 -4
  22. package/Layout/RootLayout.d.ts +4 -4
  23. package/Layout/RootLayout.js +13 -5
  24. package/Markdown/Admonition.d.ts +2 -2
  25. package/Markdown/Admonition.js +13 -5
  26. package/Markdown/CodeSample/CodeSample.js +14 -7
  27. package/Markdown/Details.d.ts +2 -2
  28. package/Markdown/Details.js +2 -4
  29. package/Markdown/Heading.d.ts +1 -1
  30. package/Markdown/Heading.js +15 -29
  31. package/Markdown/MarkdownLayout.d.ts +3 -3
  32. package/Markdown/MarkdownLayout.js +13 -9
  33. package/Markdown/MarkdownWrapper.d.ts +1 -1
  34. package/Markdown/Mermaid.js +2 -2
  35. package/Markdown/Sup.d.ts +1 -1
  36. package/Markdown/Sup.js +13 -2
  37. package/Markdown/Tabs/Tab.js +13 -2
  38. package/Markdown/Tabs/Tabs.d.ts +1 -1
  39. package/Markdown/Tabs/Tabs.js +21 -34
  40. package/Navbar/MobileNavbarDropdown.js +13 -3
  41. package/Navbar/MobileNavbarItem.js +14 -31
  42. package/Navbar/MobileNavbarMenu.js +15 -6
  43. package/Navbar/Navbar.d.ts +5 -5
  44. package/Navbar/Navbar.js +13 -10
  45. package/Navbar/NavbarDropdown.js +13 -3
  46. package/Navbar/NavbarItem.js +14 -8
  47. package/Navbar/NavbarMenu.js +15 -4
  48. package/NavbarLogo/NavbarLogo.d.ts +1 -1
  49. package/NavbarLogo/NavbarLogo.js +14 -3
  50. package/PageNavigation/NextPageLink.js +14 -3
  51. package/PageNavigation/PageNavigation.js +13 -4
  52. package/PageNavigation/PreviousPageLink.js +14 -3
  53. package/Panel/PanelComponent.d.ts +3 -3
  54. package/Panel/PanelComponent.js +14 -31
  55. package/Panel/PanelHeader.d.ts +1 -1
  56. package/Profile/Profile.d.ts +2 -2
  57. package/Profile/Profile.js +15 -9
  58. package/Search/Autocomplete.d.ts +1 -1
  59. package/Search/Autocomplete.js +3 -30
  60. package/Search/ClearIcon.d.ts +1 -1
  61. package/Search/ClearIcon.js +2 -3
  62. package/Search/Parameters.js +17 -17
  63. package/Search/Search.js +13 -3
  64. package/Search/SearchIcon.d.ts +1 -1
  65. package/Search/SearchIcon.js +2 -3
  66. package/Search/SearchItem.js +13 -30
  67. package/Search/utils.js +2 -28
  68. package/Sidebar/ApiCallItem.d.ts +1 -1
  69. package/Sidebar/ApiCallItem.js +13 -7
  70. package/Sidebar/ArrowBack.js +13 -5
  71. package/Sidebar/BackButton.d.ts +2 -2
  72. package/Sidebar/BackButton.js +13 -4
  73. package/Sidebar/Drilldown.d.ts +3 -3
  74. package/Sidebar/Drilldown.js +2 -6
  75. package/Sidebar/DrilldownMenu.d.ts +3 -3
  76. package/Sidebar/DrilldownMenu.js +13 -10
  77. package/Sidebar/DrilldownMenuItem.d.ts +1 -1
  78. package/Sidebar/DrilldownMenuItem.js +13 -6
  79. package/Sidebar/ExternalIcon.js +13 -7
  80. package/Sidebar/MenuGroup.d.ts +3 -3
  81. package/Sidebar/MenuGroup.js +13 -8
  82. package/Sidebar/MenuItem.d.ts +1 -1
  83. package/Sidebar/MenuItem.js +13 -7
  84. package/Sidebar/MenuLink.d.ts +1 -1
  85. package/Sidebar/MenuLinkItem.d.ts +3 -3
  86. package/Sidebar/MenuLinkItem.js +2 -2
  87. package/Sidebar/Separator.d.ts +1 -1
  88. package/Sidebar/Separator.js +13 -4
  89. package/Sidebar/SidebarLayout.d.ts +3 -3
  90. package/Sidebar/SidebarLayout.js +13 -7
  91. package/Sidebar/types/DrilldownMenuProps.d.ts +1 -1
  92. package/Sidebar/types/ItemState.d.ts +2 -2
  93. package/Sidebar/types/MenuItemProps.d.ts +1 -1
  94. package/Sidebar/types/NavItem.d.ts +1 -1
  95. package/SidebarLogo/SidebarLogo.js +14 -3
  96. package/SourceCode/SourceCode.d.ts +2 -1
  97. package/SourceCode/SourceCode.js +19 -32
  98. package/TableOfContent/TableOfContent.d.ts +1 -1
  99. package/TableOfContent/TableOfContent.js +21 -35
  100. package/TableOfContent/utils.d.ts +1 -1
  101. package/TableOfContent/utils.js +1 -4
  102. package/Tooltip/Tooltip.d.ts +1 -2
  103. package/Tooltip/Tooltip.js +3 -4
  104. package/hooks/useFullHeight.d.ts +1 -1
  105. package/hooks/useMobileMenu.d.ts +1 -1
  106. package/hooks/useOutsideClick.d.ts +1 -1
  107. package/icons/AlertIcon/AlertIcon.js +17 -20
  108. package/icons/ArrowIcon/ArrowIcon.js +13 -4
  109. package/icons/ColorModeIcon/ColorModeIcon.js +15 -7
  110. package/icons/ShelfIcon/ShelfIcon.d.ts +2 -2
  111. package/icons/ShelfIcon/ShelfIcon.js +13 -4
  112. package/mocks/Link.js +2 -5
  113. package/package.json +1 -1
  114. package/src/Button/Button.tsx +4 -3
  115. package/src/Cards/Card.tsx +3 -3
  116. package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +1 -1
  117. package/src/CopyButton/CopyButton.tsx +1 -1
  118. package/src/CopyButton/CopyButtonWrapper.tsx +8 -2
  119. package/src/EditPageButton/EditPageButton.tsx +0 -1
  120. package/src/Footer/CustomFooter.tsx +2 -2
  121. package/src/Footer/CustomFooterNavItem.tsx +0 -1
  122. package/src/Footer/Footer.tsx +0 -1
  123. package/src/Footer/FooterColumn.tsx +0 -1
  124. package/src/Footer/FooterColumns.tsx +0 -1
  125. package/src/Footer/FooterCopyright.tsx +0 -1
  126. package/src/JsonViewer/JsonViewer.tsx +5 -2
  127. package/src/LastUpdated/LastUpdated.tsx +0 -1
  128. package/src/Layout/PageLayout.tsx +3 -6
  129. package/src/Layout/RootLayout.tsx +4 -4
  130. package/src/Markdown/Admonition.tsx +2 -2
  131. package/src/Markdown/CodeSample/CodeSample.tsx +1 -1
  132. package/src/Markdown/Details.tsx +2 -2
  133. package/src/Markdown/Heading.tsx +2 -1
  134. package/src/Markdown/MarkdownLayout.tsx +3 -3
  135. package/src/Markdown/MarkdownWrapper.tsx +2 -1
  136. package/src/Markdown/Mermaid.tsx +0 -1
  137. package/src/Markdown/Sup.tsx +1 -1
  138. package/src/Markdown/Tabs/Tab.tsx +0 -1
  139. package/src/Markdown/Tabs/Tabs.tsx +2 -2
  140. package/src/Navbar/MobileNavbarDropdown.tsx +0 -1
  141. package/src/Navbar/MobileNavbarItem.tsx +1 -1
  142. package/src/Navbar/MobileNavbarMenu.tsx +0 -1
  143. package/src/Navbar/Navbar.tsx +6 -5
  144. package/src/Navbar/NavbarDropdown.tsx +0 -1
  145. package/src/Navbar/NavbarItem.tsx +0 -1
  146. package/src/Navbar/NavbarMenu.tsx +0 -1
  147. package/src/NavbarLogo/NavbarLogo.tsx +2 -2
  148. package/src/PageNavigation/NextPageLink.tsx +0 -1
  149. package/src/PageNavigation/PageNavigation.tsx +0 -1
  150. package/src/PageNavigation/PreviousPageLink.tsx +0 -1
  151. package/src/Panel/PanelComponent.tsx +6 -9
  152. package/src/Panel/PanelHeader.ts +1 -1
  153. package/src/Profile/Profile.tsx +1 -1
  154. package/src/Search/Autocomplete.tsx +2 -8
  155. package/src/Search/ClearIcon.tsx +1 -1
  156. package/src/Search/Parameters.tsx +0 -1
  157. package/src/Search/Search.tsx +0 -1
  158. package/src/Search/SearchIcon.tsx +1 -1
  159. package/src/Search/SearchItem.tsx +1 -1
  160. package/src/Search/utils.tsx +0 -1
  161. package/src/Sidebar/ApiCallItem.tsx +2 -2
  162. package/src/Sidebar/ArrowBack.tsx +0 -1
  163. package/src/Sidebar/BackButton.tsx +2 -5
  164. package/src/Sidebar/Drilldown.tsx +4 -3
  165. package/src/Sidebar/DrilldownMenu.tsx +4 -3
  166. package/src/Sidebar/DrilldownMenuItem.tsx +1 -2
  167. package/src/Sidebar/ExternalIcon.tsx +0 -1
  168. package/src/Sidebar/MenuGroup.tsx +4 -3
  169. package/src/Sidebar/MenuItem.tsx +2 -2
  170. package/src/Sidebar/MenuLink.tsx +3 -1
  171. package/src/Sidebar/MenuLinkItem.tsx +4 -6
  172. package/src/Sidebar/Separator.tsx +2 -2
  173. package/src/Sidebar/SidebarLayout.tsx +3 -3
  174. package/src/Sidebar/types/DrilldownMenuProps.ts +1 -1
  175. package/src/Sidebar/types/ItemState.ts +2 -2
  176. package/src/Sidebar/types/MenuItemProps.ts +1 -1
  177. package/src/Sidebar/types/NavItem.ts +1 -1
  178. package/src/SidebarLogo/SidebarLogo.tsx +0 -1
  179. package/src/SourceCode/SourceCode.tsx +8 -2
  180. package/src/TableOfContent/TableOfContent.tsx +4 -4
  181. package/src/TableOfContent/utils.ts +2 -5
  182. package/src/Tooltip/Tooltip.tsx +1 -1
  183. package/src/hooks/useFullHeight.ts +2 -1
  184. package/src/hooks/useMobileMenu.ts +2 -1
  185. package/src/hooks/useOutsideClick.ts +2 -1
  186. package/src/icons/AlertIcon/AlertIcon.tsx +0 -1
  187. package/src/icons/ArrowIcon/ArrowIcon.tsx +0 -1
  188. package/src/icons/ColorModeIcon/ColorModeIcon.tsx +0 -1
  189. package/src/icons/ShelfIcon/ShelfIcon.tsx +2 -2
  190. package/src/mocks/Link.tsx +0 -1
  191. package/src/types/portal/src/shared/types.d.ts +2 -1
  192. package/src/ui/Box.tsx +2 -8
  193. package/src/ui/Burger.tsx +1 -1
  194. package/src/ui/Dropdown.tsx +3 -2
  195. package/src/ui/Flex.tsx +4 -3
  196. package/src/ui/Tiles/ThinTile.tsx +4 -3
  197. package/src/ui/Tiles/WideTile.tsx +5 -4
  198. package/src/ui/UniversalLink.tsx +11 -11
  199. package/src/ui/darkColors.tsx +9 -1
  200. package/src/ui/index.tsx +2 -3
  201. package/ui/Box.d.ts +1 -1
  202. package/ui/Burger.d.ts +1 -1
  203. package/ui/Burger.js +13 -5
  204. package/ui/Dropdown.d.ts +1 -1
  205. package/ui/Dropdown.js +14 -32
  206. package/ui/Flex.d.ts +3 -3
  207. package/ui/Flex.js +2 -2
  208. package/ui/Tiles/ThinTile.d.ts +2 -1
  209. package/ui/Tiles/ThinTile.js +14 -30
  210. package/ui/Tiles/WideTile.d.ts +1 -1
  211. package/ui/Tiles/WideTile.js +14 -30
  212. package/ui/UniversalLink.d.ts +5 -5
  213. package/ui/UniversalLink.js +3 -26
  214. package/ui/darkColors.js +1 -1
  215. package/ui/index.d.ts +3 -3
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  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
- }: React.PropsWithChildren<AdmonitionProps>): JSX.Element {
18
+ }: PropsWithChildren<AdmonitionProps>): JSX.Element {
19
19
  return (
20
20
  <Wrapper type={type} data-component-name="Markdown/Admonition">
21
21
  <AlertIcon type={type} />
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import { useState } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
 
4
4
  import { ClipboardService } from '@theme/utils/ClipboardService';
@@ -1,11 +1,11 @@
1
- import React from 'react';
2
1
  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 }: React.PropsWithChildren<DetailsProps>): JSX.Element {
8
+ export function Details({ summary, children }: PropsWithChildren<DetailsProps>): JSX.Element {
9
9
  return (
10
10
  <StyledDetails>
11
11
  <summary>{summary}</summary>
@@ -1,4 +1,5 @@
1
- import React, { createElement, PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
+ import { createElement } from 'react';
2
3
 
3
4
  import { concatClassNames } from '@theme/utils';
4
5
 
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  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: React.ReactNode;
12
- markdownWrapper: React.ReactNode;
11
+ tableOfContent: ReactNode;
12
+ markdownWrapper: ReactNode;
13
13
  showPrevButton?: boolean;
14
14
  showNextButton?: boolean;
15
15
  editPage?: {
@@ -1,4 +1,5 @@
1
- import styled, { css, FlattenSimpleInterpolation } from 'styled-components';
1
+ import type { FlattenSimpleInterpolation } from 'styled-components';
2
+ import styled, { css } from 'styled-components';
2
3
 
3
4
  import { typography } from '@theme/utils';
4
5
 
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  type MermaidProps = {
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  export function Sup({ children }: PropsWithChildren<unknown>): JSX.Element {
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  type TabProps = {
@@ -1,4 +1,5 @@
1
- import React, { useState, PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
+ import { useState } from 'react';
2
3
  import styled from 'styled-components';
3
4
 
4
5
  import { Tab } from '@theme/Markdown/Tabs/Tab';
@@ -38,7 +39,6 @@ const TabList = styled.ol`
38
39
  `;
39
40
 
40
41
  const TabContent = styled.div`
41
- padding: 10px 5px;
42
42
  border: 1px solid #ccc;
43
43
  border-top: none;
44
44
  padding: 1rem;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import { useState } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { useLocation } from 'react-router-dom';
4
4
 
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
@@ -1,9 +1,10 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
2
+ import type { ReactNode } from 'react';
3
+
4
+ import type { ResolvedConfigLinks } from '@theme/types/portal';
3
5
 
4
6
  import { useThemeSettings } from '@portal/hooks';
5
7
  import { DEFAULT_THEME_NAME } from '@portal/constants';
6
- import { ResolvedConfigLinks } from '@theme/types/portal';
7
8
  import { NavbarMenu } from '@theme/Navbar';
8
9
  import { useMobileMenu } from '@theme/hooks/useMobileMenu';
9
10
  import { MobileNavbarMenuButton } from '@theme/Navbar/MobileNavbarMenuButton';
@@ -12,9 +13,9 @@ import { ColorModeSwitcher } from '@theme/ColorModeSwitcher/ColorModeSwitcher';
12
13
 
13
14
  interface NavbarProps {
14
15
  menu: ResolvedConfigLinks;
15
- logo: React.ReactNode;
16
- search: React.ReactNode;
17
- profile?: React.ReactNode;
16
+ logo: ReactNode;
17
+ search: ReactNode;
18
+ profile?: ReactNode;
18
19
  }
19
20
 
20
21
  export function Navbar({ menu, logo, search, profile }: NavbarProps): JSX.Element | null {
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
  import { useLocation } from 'react-router-dom';
4
3
 
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
3
+ import type { LogoConfig } from '@theme/types/portal';
4
+
4
5
  import { Link } from '@portal/Link';
5
- import { LogoConfig } from '@theme/types/portal';
6
6
 
7
7
  export type NavbarLogoProps = { logo: Pick<LogoConfig, 'image' | 'link' | 'altText'> };
8
8
 
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { ResolvedNavItemWithLink } from '@theme/types/portal';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import { PreviousPageLink } from '@theme/PageNavigation/PreviousPageLink';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { ResolvedNavItemWithLink } from '@theme/types/portal';
@@ -1,15 +1,12 @@
1
- import React, {
2
- BaseSyntheticEvent,
3
- PropsWithChildren,
4
- ReactNode,
5
- useEffect,
6
- useState,
7
- } from 'react';
1
+ import type { BaseSyntheticEvent, PropsWithChildren, ReactNode } from 'react';
2
+ import { useEffect, useState } from 'react';
8
3
  import styled from 'styled-components';
9
4
 
5
+ import type { PanelHeaderProps } from '@theme/Panel/PanelHeader';
6
+
10
7
  import { ShelfIcon } from '@theme/icons';
11
8
  import { PanelBody } from '@theme/Panel/PanelBody';
12
- import { PanelHeader, PanelHeaderProps } from '@theme/Panel/PanelHeader';
9
+ import { PanelHeader } from '@theme/Panel/PanelHeader';
13
10
  import { PanelHeaderTitle } from '@theme/Panel/PanelHeaderTitle';
14
11
 
15
12
  export interface PanelComponentProps {
@@ -18,7 +15,7 @@ export interface PanelComponentProps {
18
15
  renderChildrenHidden?: boolean;
19
16
  header?: ReactNode | ((props: PanelHeaderProps) => ReactNode);
20
17
  onToggle?: (expanded: boolean) => void;
21
- description?: React.ReactNode;
18
+ description?: ReactNode;
22
19
  }
23
20
 
24
21
  export function PanelComponent({
@@ -1,4 +1,4 @@
1
- import { BaseSyntheticEvent } from 'react';
1
+ import type { BaseSyntheticEvent } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  export interface PanelHeaderProps {
@@ -1,4 +1,4 @@
1
- import React, { memo } from 'react';
1
+ import { memo } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
 
4
4
  import { stringToHslColor } from '@theme/utils';
@@ -1,11 +1,5 @@
1
- import React, {
2
- ChangeEvent,
3
- KeyboardEvent,
4
- ReactNode,
5
- SyntheticEvent,
6
- useEffect,
7
- useState,
8
- } from 'react';
1
+ import type { ChangeEvent, KeyboardEvent, ReactNode, SyntheticEvent } from 'react';
2
+ import { useEffect, useState } from 'react';
9
3
  import { useLocation } from 'react-router-dom';
10
4
  import styled from 'styled-components';
11
5
 
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  const Icon = (props: SVGProps<SVGSVGElement>) => (
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import type { OperationParameter } from '@portal/types';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  import { usePreloadHistory } from '@portal/usePreloadHistory';
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  const Icon = (props: SVGProps<SVGSVGElement>) => (
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef } from 'react';
1
+ import { useEffect, useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import type { ActiveItem, SearchDocument } from '@portal/types';
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  export const highlight = (text: string | string[]): JSX.Element | string => {
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
3
+ import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
4
+
4
5
  import { OperationBadge } from '@theme/OperationBadge';
5
- import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
6
6
  import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
7
7
  import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
8
8
  import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  const Arrow = ({ className }: { className?: string }): JSX.Element => (
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
2
+ import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import { ArrowBack } from '@theme/Sidebar/ArrowBack';
5
5
 
@@ -7,10 +7,7 @@ interface BackButtonProps {
7
7
  back: () => void;
8
8
  }
9
9
 
10
- export function BackButton({
11
- children,
12
- back,
13
- }: React.PropsWithChildren<BackButtonProps>): JSX.Element {
10
+ export function BackButton({ children, back }: PropsWithChildren<BackButtonProps>): JSX.Element {
14
11
  return (
15
12
  <Button onClick={back} data-component-name="Sidebar/BackButton">
16
13
  <ArrowBack />
@@ -1,11 +1,12 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
2
+ import type { PropsWithChildren } from 'react';
3
+
4
+ import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
3
5
 
4
6
  import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
5
7
  import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
6
8
  import { DrilldownMenuItem } from '@theme/Sidebar/DrilldownMenuItem';
7
9
  import { DrilldownMenu } from '@theme/Sidebar/DrilldownMenu';
8
- import { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
9
10
 
10
11
  interface DrilldownProps extends DrilldownMenuProps {
11
12
  isExpanded: boolean;
@@ -17,7 +18,7 @@ export function Drilldown({
17
18
  item,
18
19
  expand,
19
20
  ...props
20
- }: React.PropsWithChildren<DrilldownProps>): JSX.Element {
21
+ }: PropsWithChildren<DrilldownProps>): JSX.Element {
21
22
  return (
22
23
  <Wrapper data-component-name="Sidebar/Drilldown">
23
24
  <DrilldownLabel onClick={expand}>
@@ -1,7 +1,8 @@
1
- import React from 'react';
2
1
  import styled, { keyframes } from 'styled-components';
2
+ import type { PropsWithChildren } from 'react';
3
+
4
+ import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
3
5
 
4
- import { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
5
6
  import { BackButton } from '@theme/Sidebar/BackButton';
6
7
  import { DrilldownMenuItem } from '@theme/Sidebar/DrilldownMenuItem';
7
8
 
@@ -10,7 +11,7 @@ export function DrilldownMenu({
10
11
  back,
11
12
  prevActiveItem,
12
13
  children,
13
- }: React.PropsWithChildren<DrilldownMenuProps>): JSX.Element {
14
+ }: PropsWithChildren<DrilldownMenuProps>): JSX.Element {
14
15
  return (
15
16
  <MenuContainer data-component-name="Sidebar/DrilldownMenu">
16
17
  <MenuContent>
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
- import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
3
+ import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
5
4
 
6
5
  export function DrilldownMenuItem({ item }: MenuItemProps): JSX.Element {
7
6
  return (
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  const Icon = ({ className }: { className?: string }): JSX.Element => (
@@ -1,8 +1,9 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
2
+ import type { PropsWithChildren } from 'react';
3
+
4
+ import type { ItemState } from '@theme/Sidebar/types/ItemState';
3
5
 
4
6
  import { ArrowIcon } from '@theme/icons/ArrowIcon/ArrowIcon';
5
- import { ItemState } from '@theme/Sidebar/types/ItemState';
6
7
  import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
7
8
  import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
8
9
  import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
@@ -18,7 +19,7 @@ export function MenuGroup({
18
19
  isExpanded,
19
20
  toggleExpanded,
20
21
  children,
21
- }: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
22
+ }: PropsWithChildren<MenuGroupProps>): JSX.Element {
22
23
  return (
23
24
  <Wrapper data-component-name="Sidebar/MenuGroup">
24
25
  <MenuLinkItem item={item}>
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
- import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
3
+ import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
4
+
5
5
  import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
6
6
  import { ExternalIcon } from '@theme/Sidebar/ExternalIcon';
7
7
  import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
@@ -1,6 +1,8 @@
1
1
  import styled from 'styled-components';
2
2
 
3
- import { UniversalLink, UniversalLinkProps } from '@theme/ui/UniversalLink';
3
+ import type { UniversalLinkProps } from '@theme/ui/UniversalLink';
4
+
5
+ import { UniversalLink } from '@theme/ui/UniversalLink';
4
6
 
5
7
  export const MenuLink = styled(UniversalLink).attrs(() => ({
6
8
  'data-component-name': 'Sidebar/MenuLink',
@@ -1,13 +1,11 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
2
+ import type { PropsWithChildren } from 'react';
3
+
4
+ import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
3
5
 
4
6
  import { MenuLink } from '@theme/Sidebar/MenuLink';
5
- import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
6
7
 
7
- export function MenuLinkItem({
8
- item,
9
- children,
10
- }: React.PropsWithChildren<MenuItemProps>): JSX.Element {
8
+ export function MenuLinkItem({ item, children }: PropsWithChildren<MenuItemProps>): JSX.Element {
11
9
  return (
12
10
  <Wrapper data-component-name="Sidebar/MenuLinkItem">
13
11
  {item.link ? (
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
- import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
3
+ import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
4
+
5
5
  import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
6
6
  import { SeparatorItem } from '@theme/Sidebar/SeparatorItem';
7
7
 
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  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';
@@ -10,8 +10,8 @@ import { DEFAULT_THEME_NAME } from '@portal/constants';
10
10
  import { SidebarSearch } from '@theme/Search/SidebarSearch';
11
11
 
12
12
  interface SidebarLayoutProps {
13
- versions: React.ReactNode;
14
- menu: React.ReactNode;
13
+ versions: ReactNode;
14
+ menu: ReactNode;
15
15
  }
16
16
 
17
17
  export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null {
@@ -1,4 +1,4 @@
1
- import { ItemState } from '@theme/Sidebar/types/ItemState';
1
+ import type { ItemState } from '@theme/Sidebar/types/ItemState';
2
2
 
3
3
  export interface DrilldownMenuProps {
4
4
  back: () => void;
@@ -1,5 +1,5 @@
1
- import { NavItem } from '@theme/Sidebar/types/NavItem';
2
- import { MenuStyle } from '@theme/Sidebar/types/MenuStyle';
1
+ import type { NavItem } from '@theme/Sidebar/types/NavItem';
2
+ import type { MenuStyle } from '@theme/Sidebar/types/MenuStyle';
3
3
 
4
4
  export interface ItemState extends NavItem {
5
5
  items: ItemState[];
@@ -1,4 +1,4 @@
1
- import { ItemState } from '@theme/Sidebar/types/ItemState';
1
+ import type { ItemState } from '@theme/Sidebar/types/ItemState';
2
2
 
3
3
  export interface MenuItemProps {
4
4
  item: ItemState;
@@ -1,4 +1,4 @@
1
- import { MenuStyle } from '@theme/Sidebar/types/MenuStyle';
1
+ import type { MenuStyle } from '@theme/Sidebar/types/MenuStyle';
2
2
 
3
3
  export interface NavItem {
4
4
  label?: string;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from 'styled-components';
3
2
 
4
3
  export interface LogoProps {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
 
3
3
  import { highlight, addLineNumbers } from '@theme/utils';
4
4
  import {
@@ -17,6 +17,7 @@ export interface SourceCodeProps extends CommonCodeProps {
17
17
  lang: string;
18
18
  source?: string;
19
19
  externalSource?: ExternalSource;
20
+ onCopyClick?: () => void;
20
21
  withCopyButton?: boolean;
21
22
  dataTestId?: string;
22
23
  }
@@ -67,6 +68,7 @@ export function SourceCode({
67
68
  lang,
68
69
  source,
69
70
  externalSource,
71
+ onCopyClick,
70
72
  withCopyButton,
71
73
  dataTestId = 'source-code',
72
74
  withLineNumbers,
@@ -86,7 +88,11 @@ export function SourceCode({
86
88
 
87
89
  if (withCopyButton) {
88
90
  return (
89
- <CopyButtonWrapper data={sourceCode} data-component-name="SourceCode/SourceCode">
91
+ <CopyButtonWrapper
92
+ data={sourceCode}
93
+ onCopyClick={onCopyClick}
94
+ data-component-name="SourceCode/SourceCode"
95
+ >
90
96
  {({ renderCopyButton }) => (
91
97
  <SampleControlsWrap>
92
98
  <SampleControls data-cy="copy-button">{renderCopyButton()}</SampleControls>
@@ -1,12 +1,13 @@
1
- import React, { useRef } from 'react';
1
+ import { useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
+ import type { MdHeading } from '@theme/types/portal';
5
+
4
6
  import { getDisplayedHeadingsIds, getDisplayedHeadings, getLeastDepth } from './utils';
5
7
 
6
8
  import { useFullHeight } from '@theme/hooks/useFullHeight';
7
9
  import { useThemeSettings } from '@portal/hooks';
8
10
  import { useActiveHeading } from '@theme/hooks/useActiveHeading';
9
- import { MdHeading } from '@theme/types/portal';
10
11
  import { DEFAULT_THEME_NAME } from '@portal/constants';
11
12
 
12
13
  interface TableOfContentProps {
@@ -85,13 +86,12 @@ const MenuItem = styled.a<{ depth: number }>`
85
86
  background-color: var(--toc-item-background-color);
86
87
  cursor: pointer;
87
88
  font-size: var(--toc-item-font-size);
88
- font-family: var(--toc-item-font-family);
89
89
  padding: var(--toc-item-padding-vertical) var(--toc-item-padding-horizontal);
90
90
  padding-left: calc(var(--toc-item-nested-offset) * ${({ depth }) => depth});
91
91
  transition: background-color 0.3s, color 0.3s;
92
92
  text-decoration: none;
93
93
  word-break: break-word;
94
- font-family: var(--heading-font-family);
94
+ font-family: var(--heading-font-family, var(--toc-item-font-family));
95
95
 
96
96
  :hover,
97
97
  &.active {
@@ -1,4 +1,4 @@
1
- import { MdHeading } from '@theme/types/portal';
1
+ import type { MdHeading } from '@theme/types/portal';
2
2
 
3
3
  export function getDisplayedHeadings(
4
4
  headings: Array<MdHeading | null> | null | undefined,
@@ -14,10 +14,7 @@ export function getDisplayedHeadings(
14
14
  if (idx === 0 && heading.depth === 1) {
15
15
  return false;
16
16
  }
17
- if (heading.depth && heading.depth > tocMaxDepth) {
18
- return false;
19
- }
20
- return true;
17
+ return !(heading.depth && heading.depth > tocMaxDepth);
21
18
  });
22
19
  }
23
20
 
@@ -1,4 +1,4 @@
1
- import React, { useEffect, memo, useRef } from 'react';
1
+ import { useEffect, memo, useRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import type { PropsWithChildren, ReactNode } from 'react';
4
4
 
@@ -1,4 +1,5 @@
1
- import { useCallback, useEffect, MutableRefObject, useMemo } from 'react';
1
+ import type { MutableRefObject } from 'react';
2
+ import { useCallback, useEffect, useMemo } from 'react';
2
3
  import throttle from 'lodash.throttle';
3
4
 
4
5
  export function useFullHeight(element: MutableRefObject<HTMLElement | null>): void {