@redocly/theme 0.4.7 → 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.
- package/Button/Button.d.ts +1 -1
- package/Cards/Card.d.ts +1 -1
- package/Cards/Card.js +1 -1
- package/CopyButton/CopyButtonWrapper.d.ts +2 -1
- package/CopyButton/CopyButtonWrapper.js +2 -1
- package/Footer/CustomFooter.d.ts +1 -1
- package/JsonViewer/JsonViewer.d.ts +1 -0
- package/JsonViewer/JsonViewer.js +2 -2
- package/Markdown/CodeSample/CodeSample.d.ts +10 -3
- package/Markdown/CodeSample/CodeSample.js +24 -5
- package/Markdown/Heading.d.ts +1 -1
- package/Markdown/MarkdownWrapper.d.ts +1 -1
- package/Markdown/Sup.d.ts +1 -1
- package/Markdown/Tabs/Tabs.d.ts +1 -1
- package/Navbar/Navbar.d.ts +1 -1
- package/NavbarLogo/NavbarLogo.d.ts +1 -1
- package/Panel/PanelComponent.d.ts +3 -2
- package/Panel/PanelHeader.d.ts +1 -1
- package/Search/Autocomplete.d.ts +1 -1
- package/Search/ClearIcon.d.ts +1 -1
- package/Search/SearchIcon.d.ts +1 -1
- package/Sidebar/ApiCallItem.d.ts +1 -1
- package/Sidebar/Drilldown.d.ts +1 -1
- package/Sidebar/DrilldownMenu.d.ts +1 -1
- package/Sidebar/DrilldownMenuItem.d.ts +1 -1
- package/Sidebar/MenuGroup.d.ts +1 -1
- package/Sidebar/MenuItem.d.ts +1 -1
- package/Sidebar/MenuLink.d.ts +1 -1
- package/Sidebar/MenuLinkItem.d.ts +1 -1
- package/Sidebar/Separator.d.ts +1 -1
- 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/SourceCode/SourceCode.d.ts +2 -1
- package/SourceCode/SourceCode.js +2 -2
- package/TableOfContent/TableOfContent.d.ts +1 -1
- package/TableOfContent/TableOfContent.js +1 -1
- package/TableOfContent/utils.d.ts +1 -1
- package/TableOfContent/utils.js +1 -4
- package/hooks/useFullHeight.d.ts +1 -1
- package/hooks/useMobileMenu.d.ts +1 -1
- package/hooks/useOutsideClick.d.ts +1 -1
- package/package.json +1 -1
- package/src/Button/Button.tsx +2 -1
- package/src/Cards/Card.tsx +3 -2
- package/src/CopyButton/CopyButtonWrapper.tsx +7 -1
- package/src/Footer/CustomFooter.tsx +2 -1
- package/src/JsonViewer/JsonViewer.tsx +5 -2
- package/src/Markdown/CodeSample/CodeSample.tsx +36 -7
- package/src/Markdown/Heading.tsx +2 -1
- package/src/Markdown/MarkdownWrapper.tsx +2 -1
- package/src/Markdown/Sup.tsx +2 -1
- package/src/Markdown/Tabs/Tabs.tsx +2 -1
- package/src/Navbar/Navbar.tsx +2 -1
- package/src/NavbarLogo/NavbarLogo.tsx +2 -1
- package/src/Panel/PanelComponent.tsx +5 -8
- package/src/Panel/PanelHeader.ts +1 -1
- package/src/Search/Autocomplete.tsx +2 -8
- package/src/Search/ClearIcon.tsx +2 -1
- package/src/Search/SearchIcon.tsx +2 -1
- package/src/Sidebar/ApiCallItem.tsx +2 -1
- package/src/Sidebar/Drilldown.tsx +2 -1
- package/src/Sidebar/DrilldownMenu.tsx +2 -1
- package/src/Sidebar/DrilldownMenuItem.tsx +1 -1
- package/src/Sidebar/MenuGroup.tsx +2 -1
- package/src/Sidebar/MenuItem.tsx +2 -1
- package/src/Sidebar/MenuLink.tsx +3 -1
- package/src/Sidebar/MenuLinkItem.tsx +2 -1
- package/src/Sidebar/Separator.tsx +2 -1
- 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/SourceCode/SourceCode.tsx +7 -1
- package/src/TableOfContent/TableOfContent.tsx +3 -3
- package/src/TableOfContent/utils.ts +2 -5
- package/src/hooks/useFullHeight.ts +2 -1
- package/src/hooks/useMobileMenu.ts +2 -1
- package/src/hooks/useOutsideClick.ts +2 -1
- package/src/ui/Box.tsx +2 -8
- package/src/ui/Burger.tsx +2 -1
- package/src/ui/Dropdown.tsx +2 -1
- package/src/ui/Flex.tsx +2 -1
- package/src/ui/Tiles/ThinTile.tsx +4 -3
- package/src/ui/Tiles/WideTile.tsx +4 -3
- package/src/ui/UniversalLink.tsx +2 -1
- package/src/ui/darkColors.tsx +9 -1
- package/src/ui/index.tsx +1 -1
- package/ui/Box.d.ts +1 -1
- package/ui/Burger.d.ts +1 -1
- package/ui/Dropdown.d.ts +1 -1
- package/ui/Flex.d.ts +1 -1
- package/ui/Tiles/ThinTile.d.ts +2 -1
- package/ui/Tiles/ThinTile.js +1 -1
- package/ui/Tiles/WideTile.d.ts +1 -1
- package/ui/Tiles/WideTile.js +1 -1
- package/ui/UniversalLink.d.ts +1 -1
- package/ui/darkColors.js +1 -1
- package/ui/index.d.ts +1 -1
|
@@ -3,29 +3,58 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { ClipboardService } from '@theme/utils/ClipboardService';
|
|
5
5
|
|
|
6
|
-
|
|
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({
|
|
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),
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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>
|
package/src/Markdown/Heading.tsx
CHANGED
package/src/Markdown/Sup.tsx
CHANGED
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { ResolvedConfigLinks } from '@theme/types/portal';
|
|
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';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { LogoConfig } from '@theme/types/portal';
|
|
5
|
+
|
|
4
6
|
import { Link } from '@portal/Link';
|
|
5
|
-
import { LogoConfig } from '@theme/types/portal';
|
|
6
7
|
|
|
7
8
|
export type NavbarLogoProps = { logo: Pick<LogoConfig, 'image' | 'link' | 'altText'> };
|
|
8
9
|
|
|
@@ -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 React, { 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 {
|
package/src/Panel/PanelHeader.ts
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 React, { 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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
|
|
4
6
|
import { OperationBadge } from '@theme/OperationBadge';
|
|
5
|
-
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
6
7
|
import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
|
|
7
8
|
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
8
9
|
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
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;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled, { keyframes } from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
4
|
+
import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
5
|
+
|
|
5
6
|
import { BackButton } from '@theme/Sidebar/BackButton';
|
|
6
7
|
import { DrilldownMenuItem } from '@theme/Sidebar/DrilldownMenuItem';
|
|
7
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
4
|
+
import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
5
|
|
|
6
6
|
export function DrilldownMenuItem({ item }: MenuItemProps): JSX.Element {
|
|
7
7
|
return (
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { ItemState } from '@theme/Sidebar/types/ItemState';
|
|
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';
|
package/src/Sidebar/MenuItem.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
4
|
+
import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
|
|
5
6
|
import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
|
|
6
7
|
import { ExternalIcon } from '@theme/Sidebar/ExternalIcon';
|
|
7
8
|
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,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
|
|
4
6
|
import { MenuLink } from '@theme/Sidebar/MenuLink';
|
|
5
|
-
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
6
7
|
|
|
7
8
|
export function MenuLinkItem({
|
|
8
9
|
item,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
4
|
+
import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
|
|
5
6
|
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
6
7
|
import { SeparatorItem } from '@theme/Sidebar/SeparatorItem';
|
|
7
8
|
|
|
@@ -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[];
|
|
@@ -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
1
|
import React, { 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
|
|
|
@@ -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 {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
import { useHistory } from 'react-router-dom';
|
|
3
4
|
|
|
4
5
|
export function useMobileMenu(initialState = false): [boolean, Dispatch<SetStateAction<boolean>>] {
|
package/src/ui/Box.tsx
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
space,
|
|
3
|
-
position,
|
|
4
|
-
flex,
|
|
5
|
-
textAlign,
|
|
6
|
-
color,
|
|
7
|
-
border,
|
|
8
|
-
layout,
|
|
1
|
+
import type {
|
|
9
2
|
SpaceProps,
|
|
10
3
|
LayoutProps,
|
|
11
4
|
TextAlignProps,
|
|
@@ -14,6 +7,7 @@ import {
|
|
|
14
7
|
FlexProps,
|
|
15
8
|
BordersProps,
|
|
16
9
|
} from 'styled-system';
|
|
10
|
+
import { space, position, flex, textAlign, color, border, layout } from 'styled-system';
|
|
17
11
|
import styled from 'styled-components';
|
|
18
12
|
|
|
19
13
|
export interface BoxProps
|
package/src/ui/Burger.tsx
CHANGED
package/src/ui/Dropdown.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { Version } from '@theme/types/portal';
|
|
5
|
+
|
|
4
6
|
import { Link } from '@portal/Link';
|
|
5
|
-
import { Version } from '@theme/types/portal';
|
|
6
7
|
|
|
7
8
|
type DropdownProps = {
|
|
8
9
|
items: Version[];
|
package/src/ui/Flex.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import type { FlexboxProps, WidthProps } from 'styled-system';
|
|
4
|
+
import { flexbox, width } from 'styled-system';
|
|
4
5
|
|
|
5
6
|
import { Box } from '@theme/ui/Box';
|
|
6
7
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React, { Component } from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
|
|
4
5
|
import { Link } from '@portal/Link';
|
|
@@ -28,7 +29,7 @@ const ThinTileWrapper = styled(Link)<{ bgColor?: string; bgImage?: string }>`
|
|
|
28
29
|
display: flex;
|
|
29
30
|
flex-direction: column;
|
|
30
31
|
border-radius: 10px;
|
|
31
|
-
box-shadow:
|
|
32
|
+
box-shadow: 0 10px 30px 0 rgba(35, 35, 35, 0.1);
|
|
32
33
|
box-sizing: border-box;
|
|
33
34
|
transition: box-shadow 0.25s ease;
|
|
34
35
|
padding: 24px;
|
|
@@ -40,7 +41,7 @@ const ThinTileWrapper = styled(Link)<{ bgColor?: string; bgImage?: string }>`
|
|
|
40
41
|
background-repeat: no-repeat;
|
|
41
42
|
|
|
42
43
|
:hover {
|
|
43
|
-
box-shadow:
|
|
44
|
+
box-shadow: 0 10px 100px 0 rgba(35, 35, 35, 0.2);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
${({ theme }) => theme.mediaQueries.small} {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { TileProps } from '@theme/ui';
|
|
5
|
+
|
|
4
6
|
import { Link } from '@portal/Link';
|
|
5
|
-
import { TileProps } from '@theme/ui';
|
|
6
7
|
import { TileText } from '@theme/ui/Tiles/TileText';
|
|
7
8
|
import { TileHeader } from '@theme/ui/Tiles/TileHeader';
|
|
8
9
|
|
|
@@ -18,7 +19,7 @@ const WideTileWrapper = styled(Link)<{
|
|
|
18
19
|
display: inline-flex;
|
|
19
20
|
flex-direction: ${({ withIcon }) => (withIcon ? 'column' : 'row')};
|
|
20
21
|
border-radius: 10px;
|
|
21
|
-
box-shadow:
|
|
22
|
+
box-shadow: 0 10px 30px 0 rgba(35, 35, 35, 0.1);
|
|
22
23
|
background-color: ${({ bgColor }) => bgColor || 'var(--wide-tile-background-color)'};
|
|
23
24
|
background-image: ${({ bgImage }) => (bgImage ? `url(${bgImage})` : 'none')};
|
|
24
25
|
background-repeat: no-repeat;
|
|
@@ -31,7 +32,7 @@ const WideTileWrapper = styled(Link)<{
|
|
|
31
32
|
width: 100%;
|
|
32
33
|
transition: box-shadow 0.25s ease;
|
|
33
34
|
:hover {
|
|
34
|
-
box-shadow:
|
|
35
|
+
box-shadow: 0 10px 30px 0 rgba(35, 35, 35, 0.2);
|
|
35
36
|
}
|
|
36
37
|
:before {
|
|
37
38
|
content: ${({ disableArrow }) => (disableArrow ? 'none' : '""')};
|
package/src/ui/UniversalLink.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { LinkProps } from 'react-router-dom';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
5
|
|
|
5
6
|
import { isUrl } from '@theme/utils/isUrl';
|
package/src/ui/darkColors.tsx
CHANGED
|
@@ -17,8 +17,16 @@ export const darkMode = css`
|
|
|
17
17
|
--link-hover-text-color: #57a5fd;
|
|
18
18
|
--link-text-color: #57a5fd;
|
|
19
19
|
--code-block-background-color: #1e2633;
|
|
20
|
-
--admonition-attention-background-color:
|
|
20
|
+
--admonition-attention-background-color: var(--color-primary-300);
|
|
21
|
+
--admonition-attention-icon-color: var(--color-emphasis-700);
|
|
21
22
|
--admonition-warning-background-color: #614b17;
|
|
23
|
+
--admonition-warning-icon-color: #4c3b12;
|
|
24
|
+
--admonition-success-background-color: #267e74;
|
|
25
|
+
--admonition-success-icon-color: #38b9a5;
|
|
26
|
+
--admonition-danger-background-color: #d6524c;
|
|
27
|
+
--admonition-danger-icon-color: #d13e37;
|
|
28
|
+
--admonition-info-background-color: #696969;
|
|
29
|
+
--admonition-info-icon-color: #505050;
|
|
22
30
|
--inline-code-background-color: #1e2633;
|
|
23
31
|
--toc-item-active-background-color: #1e2633;
|
|
24
32
|
--sidebar-item-active-background-color: #1e2633;
|
package/src/ui/index.tsx
CHANGED
package/ui/Box.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpaceProps, LayoutProps, TextAlignProps, ColorProps, PositionProps, FlexProps, BordersProps } from 'styled-system';
|
|
1
|
+
import type { SpaceProps, LayoutProps, TextAlignProps, ColorProps, PositionProps, FlexProps, BordersProps } from 'styled-system';
|
|
2
2
|
export interface BoxProps extends SpaceProps, LayoutProps, PositionProps, FlexProps, TextAlignProps, ColorProps, BordersProps {
|
|
3
3
|
}
|
|
4
4
|
export declare const Box: import("styled-components").StyledComponent<"div", any, {
|
package/ui/Burger.d.ts
CHANGED
package/ui/Dropdown.d.ts
CHANGED
package/ui/Flex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FlexboxProps, WidthProps } from 'styled-system';
|
|
2
|
+
import type { FlexboxProps, WidthProps } from 'styled-system';
|
|
3
3
|
export interface FlexProps extends FlexboxProps, WidthProps {
|
|
4
4
|
}
|
|
5
5
|
export declare const Flex: import("styled-components").StyledComponent<"div", any, {
|
package/ui/Tiles/ThinTile.d.ts
CHANGED
package/ui/Tiles/ThinTile.js
CHANGED
|
@@ -52,7 +52,7 @@ var Link_1 = require("../../mocks/Link");
|
|
|
52
52
|
var Flex_1 = require("../../ui/Flex");
|
|
53
53
|
var TileText_1 = require("../../ui/Tiles/TileText");
|
|
54
54
|
var TileHeader_1 = require("../../ui/Tiles/TileHeader");
|
|
55
|
-
var ThinTileWrapper = (0, styled_components_1.default)(Link_1.Link)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n box-shadow:
|
|
55
|
+
var ThinTileWrapper = (0, styled_components_1.default)(Link_1.Link)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n box-shadow: 0 10px 30px 0 rgba(35, 35, 35, 0.1);\n box-sizing: border-box;\n transition: box-shadow 0.25s ease;\n padding: 24px;\n margin-bottom: 20px;\n text-decoration: none;\n width: 100%;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n\n :hover {\n box-shadow: 0 10px 100px 0 rgba(35, 35, 35, 0.2);\n }\n\n ", " {\n width: calc(50% - 20px);\n margin-right: 10px;\n margin-left: 10px;\n }\n\n ", " {\n width: 250px;\n }\n\n ", " {\n width: 280px;\n }\n\n &.external-url {\n :after {\n display: none;\n }\n }\n"], ["\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n box-shadow: 0 10px 30px 0 rgba(35, 35, 35, 0.1);\n box-sizing: border-box;\n transition: box-shadow 0.25s ease;\n padding: 24px;\n margin-bottom: 20px;\n text-decoration: none;\n width: 100%;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n\n :hover {\n box-shadow: 0 10px 100px 0 rgba(35, 35, 35, 0.2);\n }\n\n ", " {\n width: calc(50% - 20px);\n margin-right: 10px;\n margin-left: 10px;\n }\n\n ", " {\n width: 250px;\n }\n\n ", " {\n width: 280px;\n }\n\n &.external-url {\n :after {\n display: none;\n }\n }\n"])), function (_a) {
|
|
56
56
|
var bgColor = _a.bgColor;
|
|
57
57
|
return bgColor || 'var(--thin-tile-background-color)';
|
|
58
58
|
}, function (_a) {
|
package/ui/Tiles/WideTile.d.ts
CHANGED