@redocly/theme 0.1.23 → 0.1.26
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/Cards/Card.d.ts +8 -0
- package/Cards/Card.js +25 -0
- package/Cards/CardsBlock.d.ts +3 -0
- package/Cards/CardsBlock.js +15 -0
- package/CodeBlock/CodeBlock.d.ts +3 -1
- package/CodeBlock/CodeBlock.js +3 -1
- package/CopyButton/CopyButton.js +1 -1
- package/Footer/Footer.js +1 -1
- package/JsonViewer/JsonViewer.d.ts +6 -2
- package/JsonViewer/JsonViewer.js +3 -1
- package/Markdown/{StyledMarkdown.d.ts → MarkdownWrapper.d.ts} +1 -1
- package/Markdown/{StyledMarkdown.js → MarkdownWrapper.js} +3 -3
- package/Markdown/index.d.ts +1 -1
- package/Markdown/index.js +1 -1
- package/Navbar/Navbar.js +1 -1
- package/OperationBadge/OperationBadge.d.ts +2 -1
- package/OperationBadge/OperationBadge.js +1 -0
- package/PageNavigation/NextPageLink.js +9 -3
- package/PageNavigation/PreviousPageLink.js +9 -3
- package/Panel/CodePanel.d.ts +5 -1
- package/Panel/CodePanel.js +3 -1
- package/Panel/ContentPanel.d.ts +5 -1
- package/Panel/ContentPanel.js +3 -1
- package/Panel/Panel.d.ts +3 -1
- package/Panel/Panel.js +3 -1
- package/Panel/PanelBody.d.ts +3 -1
- package/Panel/PanelBody.js +3 -1
- package/Panel/PanelComponent.js +1 -1
- package/Panel/PanelHeader.d.ts +3 -1
- package/Panel/PanelHeader.js +3 -1
- package/Panel/PanelHeaderTitle.d.ts +3 -1
- package/Panel/PanelHeaderTitle.js +3 -1
- package/SamplesPanelControls/SamplesPanelControls.d.ts +6 -2
- package/SamplesPanelControls/SamplesPanelControls.js +3 -1
- package/Search/ClearIcon.d.ts +3 -1
- package/Search/ClearIcon.js +3 -1
- package/Search/SearchIcon.d.ts +3 -1
- package/Search/SearchIcon.js +3 -1
- package/Search/SidebarSearch.d.ts +3 -1
- package/Search/SidebarSearch.js +3 -1
- package/Sidebar/ApiCallItem.d.ts +2 -1
- package/Sidebar/MenuContainer.d.ts +3 -1
- package/Sidebar/MenuContainer.js +3 -1
- package/Sidebar/SeparatorItem.d.ts +2 -0
- package/Sidebar/SeparatorItem.js +3 -1
- package/SidebarLogo/SidebarLogo.js +1 -1
- package/SourceCode/SourceCode.js +2 -2
- package/Tooltip/Tooltip.js +1 -1
- package/Typography/CompactTypography.d.ts +2 -6
- package/Typography/H1.js +1 -1
- package/Typography/H2.js +1 -1
- package/Typography/H3.js +1 -1
- package/Typography/SectionHeader.d.ts +3 -1
- package/Typography/SectionHeader.js +3 -1
- package/Typography/Typography.d.ts +14 -7
- package/Typography/Typography.js +31 -8
- package/globalStyle.js +1 -1
- package/icons/ShelfIcon/ShelfIcon.d.ts +3 -1
- package/icons/ShelfIcon/ShelfIcon.js +3 -1
- package/mocks/hooks/index.d.ts +9 -0
- package/mocks/hooks/index.js +16 -1
- package/package.json +1 -1
- package/src/Cards/Card.tsx +49 -0
- package/src/Cards/CardsBlock.tsx +9 -0
- package/src/CodeBlock/CodeBlock.ts +3 -1
- package/src/CopyButton/CopyButton.tsx +6 -1
- package/src/Footer/Footer.tsx +2 -2
- package/src/JsonViewer/JsonViewer.tsx +3 -1
- package/src/Markdown/{StyledMarkdown.tsx → MarkdownWrapper.tsx} +2 -2
- package/src/Markdown/index.ts +1 -1
- package/src/Navbar/Navbar.tsx +2 -2
- package/src/OperationBadge/OperationBadge.ts +1 -0
- package/src/PageNavigation/NextPageLink.tsx +16 -7
- package/src/PageNavigation/PreviousPageLink.tsx +16 -7
- package/src/Panel/CodePanel.ts +3 -1
- package/src/Panel/ContentPanel.ts +3 -1
- package/src/Panel/Panel.ts +3 -1
- package/src/Panel/PanelBody.ts +3 -1
- package/src/Panel/PanelComponent.tsx +1 -0
- package/src/Panel/PanelHeader.ts +3 -1
- package/src/Panel/PanelHeaderTitle.ts +3 -1
- package/src/SamplesPanelControls/SamplesPanelControls.ts +3 -1
- package/src/Search/ClearIcon.tsx +3 -1
- package/src/Search/SearchIcon.tsx +3 -1
- package/src/Search/SidebarSearch.tsx +3 -1
- package/src/Sidebar/MenuContainer.tsx +3 -1
- package/src/Sidebar/SeparatorItem.tsx +3 -1
- package/src/SidebarLogo/SidebarLogo.tsx +5 -1
- package/src/SourceCode/SourceCode.tsx +9 -2
- package/src/Tooltip/Tooltip.tsx +1 -0
- package/src/Typography/H1.ts +1 -1
- package/src/Typography/H2.ts +1 -1
- package/src/Typography/H3.ts +1 -1
- package/src/Typography/SectionHeader.ts +3 -1
- package/src/Typography/Typography.ts +25 -17
- package/src/globalStyle.ts +4 -0
- package/src/icons/ShelfIcon/ShelfIcon.tsx +3 -1
- package/src/mocks/hooks/index.ts +21 -0
package/src/Panel/Panel.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { PanelHeader } from '@theme/Panel/PanelHeader';
|
|
|
4
4
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
5
5
|
import { PanelComponent } from '@theme/Panel/PanelComponent';
|
|
6
6
|
|
|
7
|
-
export const Panel = styled(PanelComponent)
|
|
7
|
+
export const Panel = styled(PanelComponent).attrs(() => ({
|
|
8
|
+
'data-component-name': 'Panel/Panel',
|
|
9
|
+
}))`
|
|
8
10
|
border-radius: var(--panels-border-radius);
|
|
9
11
|
|
|
10
12
|
${PanelHeader} + ${PanelBody} {
|
package/src/Panel/PanelBody.ts
CHANGED
|
@@ -18,7 +18,9 @@ interface PanelBodyProps {
|
|
|
18
18
|
hidden?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const PanelBody = styled.div
|
|
21
|
+
export const PanelBody = styled.div.attrs(() => ({
|
|
22
|
+
'data-component-name': 'Panel/PanelBody',
|
|
23
|
+
}))<PanelBodyProps>`
|
|
22
24
|
${({ animate }) => animate && showPanelAnimation};
|
|
23
25
|
${({ hidden }) => hidden && 'visibility: hidden'};
|
|
24
26
|
|
package/src/Panel/PanelHeader.ts
CHANGED
|
@@ -7,7 +7,9 @@ export interface PanelHeaderProps {
|
|
|
7
7
|
toggle?: (e: BaseSyntheticEvent) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const PanelHeader = styled.div
|
|
10
|
+
export const PanelHeader = styled.div.attrs(() => ({
|
|
11
|
+
'data-component-name': 'Panel/PanelHeader',
|
|
12
|
+
}))<PanelHeaderProps>`
|
|
11
13
|
position: relative;
|
|
12
14
|
z-index: 1;
|
|
13
15
|
display: flex;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const PanelHeaderTitle = styled.span
|
|
3
|
+
export const PanelHeaderTitle = styled.span.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Panel/PanelHeaderTitle',
|
|
5
|
+
}))`
|
|
4
6
|
line-height: 1;
|
|
5
7
|
margin-right: 5px;
|
|
6
8
|
font-weight: 700;
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { CodeBlock } from '@theme/CodeBlock';
|
|
4
4
|
|
|
5
|
-
export const SamplesControlButton = styled.button
|
|
5
|
+
export const SamplesControlButton = styled.button.attrs(() => ({
|
|
6
|
+
'data-component-name': 'SamplesPanelControls/SamplesPanelControls',
|
|
7
|
+
}))`
|
|
6
8
|
background-color: var(--samples-panel-controls-background-color);
|
|
7
9
|
border: 0;
|
|
8
10
|
outline: 0;
|
package/src/Search/ClearIcon.tsx
CHANGED
|
@@ -15,7 +15,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const ClearIcon = styled(Icon)
|
|
18
|
+
export const ClearIcon = styled(Icon).attrs(() => ({
|
|
19
|
+
'data-component-name': 'Search/ClearIcon',
|
|
20
|
+
}))`
|
|
19
21
|
position: absolute;
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
width: 0.5em;
|
|
@@ -15,7 +15,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const SearchIcon = styled(Icon)
|
|
18
|
+
export const SearchIcon = styled(Icon).attrs(() => ({
|
|
19
|
+
'data-component-name': 'Search/SearchIcon',
|
|
20
|
+
}))`
|
|
19
21
|
position: absolute;
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
width: 1em;
|
|
@@ -3,7 +3,9 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { Search } from '@theme/Search/Search';
|
|
4
4
|
import { Popover } from '@theme/Search/Popover';
|
|
5
5
|
|
|
6
|
-
export const SidebarSearch = styled(Search)
|
|
6
|
+
export const SidebarSearch = styled(Search).attrs(() => ({
|
|
7
|
+
'data-component-name': 'Search/SidebarSearch',
|
|
8
|
+
}))`
|
|
7
9
|
--search-input-text-color: var(--sidebar-item-active-color);
|
|
8
10
|
|
|
9
11
|
${Popover} {
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
4
4
|
|
|
5
|
-
export const SeparatorItem = styled(MenuItemLabel)
|
|
5
|
+
export const SeparatorItem = styled(MenuItemLabel).attrs(() => ({
|
|
6
|
+
'data-component-name': 'Sidebar/SeparatorItem',
|
|
7
|
+
}))`
|
|
6
8
|
cursor: default;
|
|
7
9
|
font-weight: var(--font-weight-bold);
|
|
8
10
|
color: var(--sidebar-separator-label-color);
|
|
@@ -23,7 +23,11 @@ export function SidebarLogo({
|
|
|
23
23
|
const logo = <LogoImgEl src={imageUrl} alt={altText || 'logo'} />;
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<LogoWrap
|
|
26
|
+
<LogoWrap
|
|
27
|
+
data-cy={dataTestId}
|
|
28
|
+
style={{ backgroundColor }}
|
|
29
|
+
data-component-name="SidebarLogo/SidebarLogo"
|
|
30
|
+
>
|
|
27
31
|
{href ? <Link href={href}>{logo}</Link> : logo}
|
|
28
32
|
</LogoWrap>
|
|
29
33
|
);
|
|
@@ -56,7 +56,7 @@ export function SourceCode({
|
|
|
56
56
|
const _source = source || externalSource?.sample?.get?.(externalSource) || '';
|
|
57
57
|
if (withCopyButton) {
|
|
58
58
|
return (
|
|
59
|
-
<CopyButtonWrapper data={source}>
|
|
59
|
+
<CopyButtonWrapper data={source} data-component-name="SourceCode/SourceCode">
|
|
60
60
|
{({ renderCopyButton }) => (
|
|
61
61
|
<SampleControlsWrap>
|
|
62
62
|
<SampleControls data-cy="copy-button">{renderCopyButton()}</SampleControls>
|
|
@@ -67,5 +67,12 @@ export function SourceCode({
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return (
|
|
71
|
+
<Code
|
|
72
|
+
dataTestId={dataTestId}
|
|
73
|
+
lang={lang}
|
|
74
|
+
source={_source}
|
|
75
|
+
data-component-name="SourceCode/SourceCode"
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
71
78
|
}
|
package/src/Tooltip/Tooltip.tsx
CHANGED
package/src/Typography/H1.ts
CHANGED
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { typography } from '@theme/utils';
|
|
4
4
|
|
|
5
5
|
export const H1 = styled.h1.attrs(() => ({
|
|
6
|
-
'data-component-name': '
|
|
6
|
+
'data-component-name': 'Typography/H1',
|
|
7
7
|
}))`
|
|
8
8
|
color: var(--color-content);
|
|
9
9
|
margin: 0 0 25px;
|
package/src/Typography/H2.ts
CHANGED
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { typography } from '@theme/utils';
|
|
4
4
|
|
|
5
5
|
export const H2 = styled.h2.attrs(() => ({
|
|
6
|
-
'data-component-name': '
|
|
6
|
+
'data-component-name': 'Typography/H2',
|
|
7
7
|
}))`
|
|
8
8
|
color: var(--color-content);
|
|
9
9
|
margin: 0 0 20px;
|
package/src/Typography/H3.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const SectionHeader = styled.h2
|
|
3
|
+
export const SectionHeader = styled.h2.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Typography/SectionHeader',
|
|
5
|
+
}))`
|
|
4
6
|
color: var(--h-color);
|
|
5
7
|
font-size: 1.75em;
|
|
6
8
|
font-weight: var(--font-weight-regular);
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { color, typography as typographySystem, TypographyProps } from 'styled-system';
|
|
3
2
|
|
|
4
|
-
export
|
|
3
|
+
export interface TypographyProps {
|
|
4
|
+
color?: string;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontSize?: string;
|
|
7
|
+
fontStyle?: string;
|
|
8
|
+
fontWeight?: string;
|
|
9
|
+
lineHeight?: string;
|
|
10
|
+
letterSpacing?: string;
|
|
11
|
+
marginBottom?: string;
|
|
12
|
+
marginTop?: string;
|
|
13
|
+
textAlign?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Typography = styled.div.attrs(() => ({
|
|
5
17
|
'data-component-name': 'Typography/Typography',
|
|
6
|
-
}))<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
${color};
|
|
18
|
-
margin-top: ${({ mt }) => mt || '1em'};
|
|
19
|
-
margin-bottom: ${({ mb }) => mb || '1em'};
|
|
20
|
-
${typographySystem}
|
|
18
|
+
}))<TypographyProps>`
|
|
19
|
+
color: ${({ color }) => color || 'var(--color-content)'};
|
|
20
|
+
font-family: ${({ fontFamily }) => fontFamily || 'var(--font-family-base)'};
|
|
21
|
+
font-size: ${({ fontSize }) => fontSize || 'var(--font-size-base)'};
|
|
22
|
+
font-style: ${({ fontStyle }) => fontStyle};
|
|
23
|
+
font-weight: ${({ fontWeight }) => fontWeight || 'var(--font-weight-regular)'};
|
|
24
|
+
line-height: ${({ lineHeight }) => lineHeight || 'var(--line-height-base)'};
|
|
25
|
+
letter-spacing: ${({ letterSpacing }) => letterSpacing};
|
|
26
|
+
margin-bottom: ${({ marginBottom }) => marginBottom};
|
|
27
|
+
margin-top: ${({ marginTop }) => marginTop};
|
|
28
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
21
29
|
`;
|
package/src/globalStyle.ts
CHANGED
|
@@ -32,7 +32,9 @@ const IntShelfIcon = ({ className, style }: ShelfIconProps): JSX.Element => (
|
|
|
32
32
|
</svg>
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
export const ShelfIcon = styled(IntShelfIcon)
|
|
35
|
+
export const ShelfIcon = styled(IntShelfIcon).attrs(() => ({
|
|
36
|
+
'data-component-name': 'icons/ShelfIcon/ShelfIcon',
|
|
37
|
+
}))`
|
|
36
38
|
${({ size = '9px', float = '', direction, color }) => css`
|
|
37
39
|
height: ${size};
|
|
38
40
|
width: ${size};
|
package/src/mocks/hooks/index.ts
CHANGED
|
@@ -3,6 +3,12 @@ interface RawTheme {
|
|
|
3
3
|
settings?: any;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
interface PageLink {
|
|
7
|
+
label: string;
|
|
8
|
+
link: string;
|
|
9
|
+
type: 'link';
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export function useThemeSettings(name: string): RawTheme['settings'] {
|
|
7
13
|
return {
|
|
8
14
|
name,
|
|
@@ -15,3 +21,18 @@ export function useThemeSettings(name: string): RawTheme['settings'] {
|
|
|
15
21
|
},
|
|
16
22
|
};
|
|
17
23
|
}
|
|
24
|
+
|
|
25
|
+
export function useSidebarSiblingsData(): { nextPage: PageLink; prevPage: PageLink } {
|
|
26
|
+
return {
|
|
27
|
+
nextPage: {
|
|
28
|
+
type: 'link',
|
|
29
|
+
label: 'Page',
|
|
30
|
+
link: '#next',
|
|
31
|
+
},
|
|
32
|
+
prevPage: {
|
|
33
|
+
type: 'link',
|
|
34
|
+
label: 'Page',
|
|
35
|
+
link: '#prev',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|