@redocly/theme 0.4.8 → 0.4.9

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 (170) 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 +25 -13
  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 +4 -13
  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 +4 -13
  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 +10 -3
  25. package/Markdown/CodeSample/CodeSample.js +17 -5
  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 +10 -13
  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 +3 -14
  45. package/PageNavigation/PageNavigation.js +4 -13
  46. package/PageNavigation/PreviousPageLink.js +3 -14
  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 +7 -13
  76. package/SidebarLogo/SidebarLogo.js +3 -14
  77. package/SourceCode/SourceCode.js +31 -18
  78. package/TableOfContent/TableOfContent.js +34 -20
  79. package/Tooltip/Tooltip.d.ts +2 -1
  80. package/Tooltip/Tooltip.js +4 -3
  81. package/icons/AlertIcon/AlertIcon.js +20 -17
  82. package/icons/ArrowIcon/ArrowIcon.js +4 -13
  83. package/icons/ColorModeIcon/ColorModeIcon.js +7 -15
  84. package/icons/ShelfIcon/ShelfIcon.d.ts +2 -2
  85. package/icons/ShelfIcon/ShelfIcon.js +4 -13
  86. package/mocks/Link.js +5 -2
  87. package/package.json +1 -1
  88. package/src/Button/Button.tsx +2 -2
  89. package/src/Cards/Card.tsx +1 -0
  90. package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +1 -1
  91. package/src/CopyButton/CopyButton.tsx +1 -1
  92. package/src/CopyButton/CopyButtonWrapper.tsx +1 -1
  93. package/src/EditPageButton/EditPageButton.tsx +1 -0
  94. package/src/Footer/CustomFooter.tsx +1 -0
  95. package/src/Footer/CustomFooterNavItem.tsx +1 -0
  96. package/src/Footer/Footer.tsx +1 -0
  97. package/src/Footer/FooterColumn.tsx +1 -0
  98. package/src/Footer/FooterColumns.tsx +1 -0
  99. package/src/Footer/FooterCopyright.tsx +1 -0
  100. package/src/JsonViewer/JsonViewer.tsx +1 -1
  101. package/src/LastUpdated/LastUpdated.tsx +1 -0
  102. package/src/Layout/PageLayout.tsx +6 -3
  103. package/src/Layout/RootLayout.tsx +4 -4
  104. package/src/Markdown/Admonition.tsx +2 -2
  105. package/src/Markdown/CodeSample/CodeSample.tsx +37 -8
  106. package/src/Markdown/Details.tsx +2 -2
  107. package/src/Markdown/Heading.tsx +1 -1
  108. package/src/Markdown/MarkdownLayout.tsx +3 -3
  109. package/src/Markdown/Mermaid.tsx +1 -0
  110. package/src/Markdown/Sup.tsx +1 -0
  111. package/src/Markdown/Tabs/Tab.tsx +1 -0
  112. package/src/Markdown/Tabs/Tabs.tsx +2 -1
  113. package/src/Navbar/MobileNavbarDropdown.tsx +1 -0
  114. package/src/Navbar/MobileNavbarItem.tsx +1 -1
  115. package/src/Navbar/MobileNavbarMenu.tsx +1 -0
  116. package/src/Navbar/Navbar.tsx +4 -4
  117. package/src/Navbar/NavbarDropdown.tsx +1 -0
  118. package/src/Navbar/NavbarItem.tsx +1 -0
  119. package/src/Navbar/NavbarMenu.tsx +1 -0
  120. package/src/NavbarLogo/NavbarLogo.tsx +1 -0
  121. package/src/PageNavigation/NextPageLink.tsx +1 -0
  122. package/src/PageNavigation/PageNavigation.tsx +1 -0
  123. package/src/PageNavigation/PreviousPageLink.tsx +1 -0
  124. package/src/Panel/PanelComponent.tsx +2 -2
  125. package/src/Profile/Profile.tsx +1 -1
  126. package/src/Search/Autocomplete.tsx +1 -1
  127. package/src/Search/ClearIcon.tsx +1 -0
  128. package/src/Search/Parameters.tsx +1 -0
  129. package/src/Search/Search.tsx +1 -0
  130. package/src/Search/SearchIcon.tsx +1 -0
  131. package/src/Search/SearchItem.tsx +1 -1
  132. package/src/Search/utils.tsx +1 -0
  133. package/src/Sidebar/ApiCallItem.tsx +1 -0
  134. package/src/Sidebar/ArrowBack.tsx +1 -0
  135. package/src/Sidebar/BackButton.tsx +5 -2
  136. package/src/Sidebar/Drilldown.tsx +2 -2
  137. package/src/Sidebar/DrilldownMenu.tsx +2 -2
  138. package/src/Sidebar/DrilldownMenuItem.tsx +1 -0
  139. package/src/Sidebar/ExternalIcon.tsx +1 -0
  140. package/src/Sidebar/MenuGroup.tsx +2 -2
  141. package/src/Sidebar/MenuItem.tsx +1 -0
  142. package/src/Sidebar/MenuLinkItem.tsx +5 -2
  143. package/src/Sidebar/Separator.tsx +1 -0
  144. package/src/Sidebar/SidebarLayout.tsx +3 -3
  145. package/src/SidebarLogo/SidebarLogo.tsx +1 -0
  146. package/src/SourceCode/SourceCode.tsx +1 -1
  147. package/src/TableOfContent/TableOfContent.tsx +1 -1
  148. package/src/Tooltip/Tooltip.tsx +1 -1
  149. package/src/icons/AlertIcon/AlertIcon.tsx +1 -0
  150. package/src/icons/ArrowIcon/ArrowIcon.tsx +1 -0
  151. package/src/icons/ColorModeIcon/ColorModeIcon.tsx +1 -0
  152. package/src/icons/ShelfIcon/ShelfIcon.tsx +2 -2
  153. package/src/mocks/Link.tsx +1 -0
  154. package/src/types/portal/src/shared/types.d.ts +1 -2
  155. package/src/ui/Burger.tsx +1 -0
  156. package/src/ui/Dropdown.tsx +1 -1
  157. package/src/ui/Flex.tsx +2 -2
  158. package/src/ui/Tiles/ThinTile.tsx +1 -1
  159. package/src/ui/Tiles/WideTile.tsx +1 -1
  160. package/src/ui/UniversalLink.tsx +10 -9
  161. package/src/ui/index.tsx +3 -2
  162. package/ui/Burger.js +5 -13
  163. package/ui/Dropdown.js +32 -14
  164. package/ui/Flex.d.ts +2 -2
  165. package/ui/Flex.js +2 -2
  166. package/ui/Tiles/ThinTile.js +29 -13
  167. package/ui/Tiles/WideTile.js +29 -13
  168. package/ui/UniversalLink.d.ts +4 -4
  169. package/ui/UniversalLink.js +26 -3
  170. package/ui/index.d.ts +3 -3
@@ -3,17 +3,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
4
  return cooked;
5
5
  };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
6
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
7
  if (k2 === undefined) k2 = k;
19
8
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -39,7 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
39
28
  };
40
29
  Object.defineProperty(exports, "__esModule", { value: true });
41
30
  exports.ShelfIcon = void 0;
42
- var jsx_runtime_1 = require("react/jsx-runtime");
31
+ var React = __importStar(require("react"));
43
32
  var styled_components_1 = __importStar(require("styled-components"));
44
33
  var utils_1 = require("../../utils");
45
34
  var directionMap = {
@@ -50,7 +39,9 @@ var directionMap = {
50
39
  };
51
40
  var IntShelfIcon = function (_a) {
52
41
  var className = _a.className, style = _a.style;
53
- return ((0, jsx_runtime_1.jsxs)("svg", __assign({ className: className, style: style, viewBox: "0 0 4.25 7", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0.205025 1.19467L3.00503 3.99467C3.27839 4.26804 3.72161 4.26804 3.99497 3.99467C4.26834 3.7213 4.26834 3.27809 3.99497 3.00472L1.19497 0.20472C0.921608 -0.0686469 0.478392 -0.0686469 0.205025 0.20472C-0.0683418 0.478087 -0.0683417 0.921303 0.205025 1.19467Z" }), (0, jsx_runtime_1.jsx)("path", { d: "M3.00503 3.00501L0.205025 5.80501C-0.0683417 6.07838 -0.0683417 6.5216 0.205025 6.79496C0.478392 7.06833 0.921608 7.06833 1.19497 6.79496L3.99497 3.99496C4.26834 3.7216 4.26834 3.27838 3.99497 3.00501C3.72161 2.73165 3.27839 2.73165 3.00503 3.00501Z" })] })));
42
+ return (React.createElement("svg", { className: className, style: style, viewBox: "0 0 4.25 7", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
43
+ React.createElement("path", { d: "M0.205025 1.19467L3.00503 3.99467C3.27839 4.26804 3.72161 4.26804 3.99497 3.99467C4.26834 3.7213 4.26834 3.27809 3.99497 3.00472L1.19497 0.20472C0.921608 -0.0686469 0.478392 -0.0686469 0.205025 0.20472C-0.0683418 0.478087 -0.0683417 0.921303 0.205025 1.19467Z" }),
44
+ React.createElement("path", { d: "M3.00503 3.00501L0.205025 5.80501C-0.0683417 6.07838 -0.0683417 6.5216 0.205025 6.79496C0.478392 7.06833 0.921608 7.06833 1.19497 6.79496L3.99497 3.99496C4.26834 3.7216 4.26834 3.27838 3.99497 3.00501C3.72161 2.73165 3.27839 2.73165 3.00503 3.00501Z" })));
54
45
  };
55
46
  exports.ShelfIcon = (0, styled_components_1.default)(IntShelfIcon).attrs(function () { return ({
56
47
  'data-component-name': 'icons/ShelfIcon/ShelfIcon',
package/mocks/Link.js CHANGED
@@ -10,15 +10,18 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
13
16
  Object.defineProperty(exports, "__esModule", { value: true });
14
17
  exports.Link = void 0;
15
- var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var react_1 = __importDefault(require("react"));
16
19
  var lodash_1 = require("lodash");
17
20
  // TODO: use real typings here
18
21
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
19
22
  function Link(props) {
20
23
  // We omit "active" property to avoid "Warning: Received `false` for a non-boolean attribute `active`."
21
24
  var filteredProps = (0, lodash_1.omit)(props, ['active', 'httpVerb', 'hasActiveSubItem']);
22
- return (0, jsx_runtime_1.jsx)("a", __assign({ href: filteredProps.to }, filteredProps));
25
+ return react_1.default.createElement("a", __assign({ href: filteredProps.to }, filteredProps));
23
26
  }
24
27
  exports.Link = Link;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Shared UI components",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1,6 +1,6 @@
1
+ import React from 'react';
1
2
  import type { FlattenSimpleInterpolation, Keyframes } from 'styled-components';
2
3
  import styled, { css, keyframes } from 'styled-components';
3
- import type { FC } from 'react';
4
4
 
5
5
  import { Link } from '@portal/Link';
6
6
 
@@ -140,7 +140,7 @@ const StyledButton = styled.button.attrs(({ color = 'default', extraClass }: But
140
140
  `}
141
141
  `;
142
142
 
143
- const ButtonComponent: FC<ButtonProps> = (props) => {
143
+ const ButtonComponent: React.FC<ButtonProps> = (props) => {
144
144
  if (props.to) {
145
145
  return (
146
146
  <Link to={props.to}>
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavItem } 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
 
4
4
  import { useThemeSettings } from '@portal/hooks';
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
3
  import { Button } from '@theme/Button';
4
4
 
@@ -1,4 +1,4 @@
1
- import { memo } from 'react';
1
+ import React, { memo } from 'react';
2
2
 
3
3
  import type { TooltipProps } from '@theme/Tooltip';
4
4
 
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import { Link } from '@portal/Link';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { NavGroupRecord, 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 { ResolvedNavItem, ResolvedNavLinkItem } 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 { NavGroupRecord, 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 { 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 { 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 { NavGroup } from '@theme/types/portal';
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement } from 'react';
2
- import { memo, useRef } from 'react';
2
+ import React, { memo, useRef } from 'react';
3
3
  import styled from 'styled-components';
4
4
 
5
5
  import { CopyButtonWrapper } from '@theme/CopyButton';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
  import { format } from 'timeago.js';
3
4
 
@@ -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,60 @@
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
5
 
6
- type CodeSampleProps = {
6
+ export interface MdCopyCodeProps {
7
+ enabled?: boolean;
8
+ buttonText?: string;
9
+ tooltipText?: string;
10
+ toasterText?: string;
11
+ toasterDuration?: number;
12
+ }
13
+
14
+ export type CodeSampleProps = {
7
15
  language: string;
8
16
  highlighted: string;
9
17
  rawContent: string;
18
+ copyCodeSnippet: MdCopyCodeProps;
19
+ };
20
+
21
+ const defaultCopyCodeSnippet = {
22
+ enabled: true,
23
+ buttonText: 'Copy',
24
+ tooltipText: 'Copy the code snippet',
25
+ toasterText: 'Copied',
26
+ toasterDuration: 1500,
10
27
  };
11
28
 
12
- export function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element {
29
+ export function CodeSample({
30
+ rawContent,
31
+ highlighted,
32
+ language,
33
+ copyCodeSnippet,
34
+ }: CodeSampleProps): JSX.Element {
13
35
  const langClassName = language ? `language-${language}` : '';
36
+ const copyCodeProps = { ...defaultCopyCodeSnippet, ...copyCodeSnippet };
14
37
 
15
38
  const [isCopied, setIsCopied] = useState(false);
16
39
 
17
40
  const copyCode = (code: string) => {
18
41
  ClipboardService.copyCustom(code);
19
42
  setIsCopied(true);
20
- setTimeout(() => setIsCopied(false), 1500);
43
+ setTimeout(() => setIsCopied(false), copyCodeProps.toasterDuration);
21
44
  };
22
45
 
23
46
  return (
24
47
  <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>
48
+ {copyCodeProps.enabled && (
49
+ <CodeSampleButtonContainer onClick={() => copyCode(rawContent)}>
50
+ {!isCopied && (
51
+ <CopyCodeButton title={copyCodeProps.tooltipText}>
52
+ {copyCodeProps.buttonText}
53
+ </CopyCodeButton>
54
+ )}
55
+ {isCopied && <DoneIndicator>{copyCodeProps.toasterText}</DoneIndicator>}
56
+ </CodeSampleButtonContainer>
57
+ )}
29
58
  <pre className={langClassName}>
30
59
  <code className={langClassName} dangerouslySetInnerHTML={{ __html: highlighted }} />
31
60
  </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,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 type { ResolvedConfigLinks } from '@theme/types/portal';
5
5
 
@@ -13,9 +13,9 @@ import { ColorModeSwitcher } from '@theme/ColorModeSwitcher/ColorModeSwitcher';
13
13
 
14
14
  interface NavbarProps {
15
15
  menu: ResolvedConfigLinks;
16
- logo: ReactNode;
17
- search: ReactNode;
18
- profile?: ReactNode;
16
+ logo: React.ReactNode;
17
+ search: React.ReactNode;
18
+ profile?: React.ReactNode;
19
19
  }
20
20
 
21
21
  export function Navbar({ menu, logo, search, profile }: NavbarProps): JSX.Element | null {
@@ -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,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavItemWithLink } 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 { PreviousPageLink } from '@theme/PageNavigation/PreviousPageLink';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
4
  import type { ResolvedNavItemWithLink } from '@theme/types/portal';
@@ -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';