@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.
- package/Button/Button.d.ts +3 -3
- package/Button/Button.js +3 -7
- package/Cards/Card.d.ts +1 -1
- package/Cards/Card.js +14 -7
- package/ColorModeSwitcher/ColorModeSwitcher.js +13 -25
- package/CopyButton/CopyButton.js +13 -24
- package/CopyButton/CopyButtonWrapper.d.ts +4 -3
- package/CopyButton/CopyButtonWrapper.js +15 -26
- package/EditPageButton/EditPageButton.js +13 -4
- package/Footer/CustomFooter.d.ts +1 -1
- package/Footer/CustomFooter.js +15 -6
- package/Footer/CustomFooterNavItem.js +13 -4
- package/Footer/Footer.js +13 -4
- package/Footer/FooterColumn.js +18 -9
- package/Footer/FooterColumns.js +13 -3
- package/Footer/FooterCopyright.js +13 -2
- package/JsonViewer/JsonViewer.d.ts +4 -3
- package/JsonViewer/JsonViewer.js +17 -34
- package/LastUpdated/LastUpdated.js +13 -4
- package/Layout/PageLayout.d.ts +3 -3
- package/Layout/PageLayout.js +13 -4
- package/Layout/RootLayout.d.ts +4 -4
- package/Layout/RootLayout.js +13 -5
- package/Markdown/Admonition.d.ts +2 -2
- package/Markdown/Admonition.js +13 -5
- package/Markdown/CodeSample/CodeSample.js +14 -7
- package/Markdown/Details.d.ts +2 -2
- package/Markdown/Details.js +2 -4
- package/Markdown/Heading.d.ts +1 -1
- package/Markdown/Heading.js +15 -29
- package/Markdown/MarkdownLayout.d.ts +3 -3
- package/Markdown/MarkdownLayout.js +13 -9
- package/Markdown/MarkdownWrapper.d.ts +1 -1
- package/Markdown/Mermaid.js +2 -2
- package/Markdown/Sup.d.ts +1 -1
- package/Markdown/Sup.js +13 -2
- package/Markdown/Tabs/Tab.js +13 -2
- package/Markdown/Tabs/Tabs.d.ts +1 -1
- package/Markdown/Tabs/Tabs.js +21 -34
- package/Navbar/MobileNavbarDropdown.js +13 -3
- package/Navbar/MobileNavbarItem.js +14 -31
- package/Navbar/MobileNavbarMenu.js +15 -6
- package/Navbar/Navbar.d.ts +5 -5
- package/Navbar/Navbar.js +13 -10
- package/Navbar/NavbarDropdown.js +13 -3
- package/Navbar/NavbarItem.js +14 -8
- package/Navbar/NavbarMenu.js +15 -4
- package/NavbarLogo/NavbarLogo.d.ts +1 -1
- package/NavbarLogo/NavbarLogo.js +14 -3
- package/PageNavigation/NextPageLink.js +14 -3
- package/PageNavigation/PageNavigation.js +13 -4
- package/PageNavigation/PreviousPageLink.js +14 -3
- package/Panel/PanelComponent.d.ts +3 -3
- package/Panel/PanelComponent.js +14 -31
- package/Panel/PanelHeader.d.ts +1 -1
- package/Profile/Profile.d.ts +2 -2
- package/Profile/Profile.js +15 -9
- package/Search/Autocomplete.d.ts +1 -1
- package/Search/Autocomplete.js +3 -30
- package/Search/ClearIcon.d.ts +1 -1
- package/Search/ClearIcon.js +2 -3
- package/Search/Parameters.js +17 -17
- package/Search/Search.js +13 -3
- package/Search/SearchIcon.d.ts +1 -1
- package/Search/SearchIcon.js +2 -3
- package/Search/SearchItem.js +13 -30
- package/Search/utils.js +2 -28
- package/Sidebar/ApiCallItem.d.ts +1 -1
- package/Sidebar/ApiCallItem.js +13 -7
- package/Sidebar/ArrowBack.js +13 -5
- package/Sidebar/BackButton.d.ts +2 -2
- package/Sidebar/BackButton.js +13 -4
- package/Sidebar/Drilldown.d.ts +3 -3
- package/Sidebar/Drilldown.js +2 -6
- package/Sidebar/DrilldownMenu.d.ts +3 -3
- package/Sidebar/DrilldownMenu.js +13 -10
- package/Sidebar/DrilldownMenuItem.d.ts +1 -1
- package/Sidebar/DrilldownMenuItem.js +13 -6
- package/Sidebar/ExternalIcon.js +13 -7
- package/Sidebar/MenuGroup.d.ts +3 -3
- package/Sidebar/MenuGroup.js +13 -8
- package/Sidebar/MenuItem.d.ts +1 -1
- package/Sidebar/MenuItem.js +13 -7
- package/Sidebar/MenuLink.d.ts +1 -1
- package/Sidebar/MenuLinkItem.d.ts +3 -3
- package/Sidebar/MenuLinkItem.js +2 -2
- package/Sidebar/Separator.d.ts +1 -1
- package/Sidebar/Separator.js +13 -4
- package/Sidebar/SidebarLayout.d.ts +3 -3
- package/Sidebar/SidebarLayout.js +13 -7
- package/Sidebar/types/DrilldownMenuProps.d.ts +1 -1
- package/Sidebar/types/ItemState.d.ts +2 -2
- package/Sidebar/types/MenuItemProps.d.ts +1 -1
- package/Sidebar/types/NavItem.d.ts +1 -1
- package/SidebarLogo/SidebarLogo.js +14 -3
- package/SourceCode/SourceCode.d.ts +2 -1
- package/SourceCode/SourceCode.js +19 -32
- package/TableOfContent/TableOfContent.d.ts +1 -1
- package/TableOfContent/TableOfContent.js +21 -35
- package/TableOfContent/utils.d.ts +1 -1
- package/TableOfContent/utils.js +1 -4
- package/Tooltip/Tooltip.d.ts +1 -2
- package/Tooltip/Tooltip.js +3 -4
- package/hooks/useFullHeight.d.ts +1 -1
- package/hooks/useMobileMenu.d.ts +1 -1
- package/hooks/useOutsideClick.d.ts +1 -1
- package/icons/AlertIcon/AlertIcon.js +17 -20
- package/icons/ArrowIcon/ArrowIcon.js +13 -4
- package/icons/ColorModeIcon/ColorModeIcon.js +15 -7
- package/icons/ShelfIcon/ShelfIcon.d.ts +2 -2
- package/icons/ShelfIcon/ShelfIcon.js +13 -4
- package/mocks/Link.js +2 -5
- package/package.json +1 -1
- package/src/Button/Button.tsx +4 -3
- package/src/Cards/Card.tsx +3 -3
- package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +1 -1
- package/src/CopyButton/CopyButton.tsx +1 -1
- package/src/CopyButton/CopyButtonWrapper.tsx +8 -2
- package/src/EditPageButton/EditPageButton.tsx +0 -1
- package/src/Footer/CustomFooter.tsx +2 -2
- package/src/Footer/CustomFooterNavItem.tsx +0 -1
- package/src/Footer/Footer.tsx +0 -1
- package/src/Footer/FooterColumn.tsx +0 -1
- package/src/Footer/FooterColumns.tsx +0 -1
- package/src/Footer/FooterCopyright.tsx +0 -1
- package/src/JsonViewer/JsonViewer.tsx +5 -2
- package/src/LastUpdated/LastUpdated.tsx +0 -1
- package/src/Layout/PageLayout.tsx +3 -6
- package/src/Layout/RootLayout.tsx +4 -4
- package/src/Markdown/Admonition.tsx +2 -2
- package/src/Markdown/CodeSample/CodeSample.tsx +1 -1
- package/src/Markdown/Details.tsx +2 -2
- package/src/Markdown/Heading.tsx +2 -1
- package/src/Markdown/MarkdownLayout.tsx +3 -3
- package/src/Markdown/MarkdownWrapper.tsx +2 -1
- package/src/Markdown/Mermaid.tsx +0 -1
- package/src/Markdown/Sup.tsx +1 -1
- package/src/Markdown/Tabs/Tab.tsx +0 -1
- package/src/Markdown/Tabs/Tabs.tsx +2 -2
- package/src/Navbar/MobileNavbarDropdown.tsx +0 -1
- package/src/Navbar/MobileNavbarItem.tsx +1 -1
- package/src/Navbar/MobileNavbarMenu.tsx +0 -1
- package/src/Navbar/Navbar.tsx +6 -5
- package/src/Navbar/NavbarDropdown.tsx +0 -1
- package/src/Navbar/NavbarItem.tsx +0 -1
- package/src/Navbar/NavbarMenu.tsx +0 -1
- package/src/NavbarLogo/NavbarLogo.tsx +2 -2
- package/src/PageNavigation/NextPageLink.tsx +0 -1
- package/src/PageNavigation/PageNavigation.tsx +0 -1
- package/src/PageNavigation/PreviousPageLink.tsx +0 -1
- package/src/Panel/PanelComponent.tsx +6 -9
- package/src/Panel/PanelHeader.ts +1 -1
- package/src/Profile/Profile.tsx +1 -1
- package/src/Search/Autocomplete.tsx +2 -8
- package/src/Search/ClearIcon.tsx +1 -1
- package/src/Search/Parameters.tsx +0 -1
- package/src/Search/Search.tsx +0 -1
- package/src/Search/SearchIcon.tsx +1 -1
- package/src/Search/SearchItem.tsx +1 -1
- package/src/Search/utils.tsx +0 -1
- package/src/Sidebar/ApiCallItem.tsx +2 -2
- package/src/Sidebar/ArrowBack.tsx +0 -1
- package/src/Sidebar/BackButton.tsx +2 -5
- package/src/Sidebar/Drilldown.tsx +4 -3
- package/src/Sidebar/DrilldownMenu.tsx +4 -3
- package/src/Sidebar/DrilldownMenuItem.tsx +1 -2
- package/src/Sidebar/ExternalIcon.tsx +0 -1
- package/src/Sidebar/MenuGroup.tsx +4 -3
- package/src/Sidebar/MenuItem.tsx +2 -2
- package/src/Sidebar/MenuLink.tsx +3 -1
- package/src/Sidebar/MenuLinkItem.tsx +4 -6
- package/src/Sidebar/Separator.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +3 -3
- package/src/Sidebar/types/DrilldownMenuProps.ts +1 -1
- package/src/Sidebar/types/ItemState.ts +2 -2
- package/src/Sidebar/types/MenuItemProps.ts +1 -1
- package/src/Sidebar/types/NavItem.ts +1 -1
- package/src/SidebarLogo/SidebarLogo.tsx +0 -1
- package/src/SourceCode/SourceCode.tsx +8 -2
- package/src/TableOfContent/TableOfContent.tsx +4 -4
- package/src/TableOfContent/utils.ts +2 -5
- package/src/Tooltip/Tooltip.tsx +1 -1
- package/src/hooks/useFullHeight.ts +2 -1
- package/src/hooks/useMobileMenu.ts +2 -1
- package/src/hooks/useOutsideClick.ts +2 -1
- package/src/icons/AlertIcon/AlertIcon.tsx +0 -1
- package/src/icons/ArrowIcon/ArrowIcon.tsx +0 -1
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +0 -1
- package/src/icons/ShelfIcon/ShelfIcon.tsx +2 -2
- package/src/mocks/Link.tsx +0 -1
- package/src/types/portal/src/shared/types.d.ts +2 -1
- package/src/ui/Box.tsx +2 -8
- package/src/ui/Burger.tsx +1 -1
- package/src/ui/Dropdown.tsx +3 -2
- package/src/ui/Flex.tsx +4 -3
- package/src/ui/Tiles/ThinTile.tsx +4 -3
- package/src/ui/Tiles/WideTile.tsx +5 -4
- package/src/ui/UniversalLink.tsx +11 -11
- package/src/ui/darkColors.tsx +9 -1
- package/src/ui/index.tsx +2 -3
- package/ui/Box.d.ts +1 -1
- package/ui/Burger.d.ts +1 -1
- package/ui/Burger.js +13 -5
- package/ui/Dropdown.d.ts +1 -1
- package/ui/Dropdown.js +14 -32
- package/ui/Flex.d.ts +3 -3
- package/ui/Flex.js +2 -2
- package/ui/Tiles/ThinTile.d.ts +2 -1
- package/ui/Tiles/ThinTile.js +14 -30
- package/ui/Tiles/WideTile.d.ts +1 -1
- package/ui/Tiles/WideTile.js +14 -30
- package/ui/UniversalLink.d.ts +5 -5
- package/ui/UniversalLink.js +3 -26
- package/ui/darkColors.js +1 -1
- 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
|
-
}:
|
|
18
|
+
}: PropsWithChildren<AdmonitionProps>): JSX.Element {
|
|
19
19
|
return (
|
|
20
20
|
<Wrapper type={type} data-component-name="Markdown/Admonition">
|
|
21
21
|
<AlertIcon type={type} />
|
package/src/Markdown/Details.tsx
CHANGED
|
@@ -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 }:
|
|
8
|
+
export function Details({ summary, children }: PropsWithChildren<DetailsProps>): JSX.Element {
|
|
9
9
|
return (
|
|
10
10
|
<StyledDetails>
|
|
11
11
|
<summary>{summary}</summary>
|
package/src/Markdown/Heading.tsx
CHANGED
|
@@ -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:
|
|
12
|
-
markdownWrapper:
|
|
11
|
+
tableOfContent: ReactNode;
|
|
12
|
+
markdownWrapper: ReactNode;
|
|
13
13
|
showPrevButton?: boolean;
|
|
14
14
|
showNextButton?: boolean;
|
|
15
15
|
editPage?: {
|
package/src/Markdown/Mermaid.tsx
CHANGED
package/src/Markdown/Sup.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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;
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -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:
|
|
16
|
-
search:
|
|
17
|
-
profile?:
|
|
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,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,15 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
|
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?:
|
|
18
|
+
description?: ReactNode;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
export function PanelComponent({
|
package/src/Panel/PanelHeader.ts
CHANGED
package/src/Profile/Profile.tsx
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
|
package/src/Search/ClearIcon.tsx
CHANGED
package/src/Search/Search.tsx
CHANGED
package/src/Search/utils.tsx
CHANGED
|
@@ -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,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
|
-
}:
|
|
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
|
-
}:
|
|
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,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
|
-
}:
|
|
22
|
+
}: PropsWithChildren<MenuGroupProps>): JSX.Element {
|
|
22
23
|
return (
|
|
23
24
|
<Wrapper data-component-name="Sidebar/MenuGroup">
|
|
24
25
|
<MenuLinkItem item={item}>
|
package/src/Sidebar/MenuItem.tsx
CHANGED
|
@@ -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';
|
package/src/Sidebar/MenuLink.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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:
|
|
14
|
-
menu:
|
|
13
|
+
versions: ReactNode;
|
|
14
|
+
menu: ReactNode;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null {
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
return true;
|
|
17
|
+
return !(heading.depth && heading.depth > tocMaxDepth);
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
20
|
|
package/src/Tooltip/Tooltip.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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 {
|