@redocly/theme 0.1.10 → 0.1.13
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/CodeBlock/CodeBlock.js +2 -1
- package/Markdown/StyledMarkdown.d.ts +0 -2
- package/Markdown/StyledMarkdown.js +5 -16
- package/Markdown/index.d.ts +0 -1
- package/Markdown/index.js +0 -1
- package/Navbar/NavbarMenu.js +1 -1
- package/OperationBadge/OperationBadge.js +1 -1
- package/Search/ClearIcon.js +2 -2
- package/Search/Input.js +1 -1
- package/Search/Popover.js +1 -1
- package/Search/SearchIcon.js +2 -2
- package/Sidebar/ApiCallItem.js +1 -1
- package/TableOfContent/TableOfContent.js +5 -6
- package/globalStyle.d.ts +1 -0
- package/globalStyle.js +25 -3
- package/mocks/Link.js +4 -1
- package/mocks/hooks/usePageData.js +4 -1
- package/package.json +1 -1
- package/src/CodeBlock/CodeBlock.ts +3 -42
- package/src/Markdown/StyledMarkdown.tsx +14 -28
- package/src/Markdown/index.ts +0 -1
- package/src/Navbar/NavbarMenu.tsx +1 -1
- package/src/OperationBadge/OperationBadge.ts +5 -2
- package/src/Search/ClearIcon.tsx +12 -13
- package/src/Search/Input.tsx +7 -7
- package/src/Search/Popover.tsx +2 -2
- package/src/Search/SearchIcon.tsx +12 -13
- package/src/Sidebar/ApiCallItem.tsx +1 -2
- package/src/TableOfContent/TableOfContent.tsx +6 -4
- package/src/globalStyle.ts +829 -536
- package/src/mocks/Link.tsx +5 -2
- package/src/mocks/hooks/usePageData.ts +4 -1
- package/src/ui/Typography.tsx +12 -89
- package/src/ui/UniversalLink.tsx +3 -8
- package/src/utils/ClipboardService.ts +3 -86
- package/src/utils/isUrl.ts +4 -4
- package/src/utils/theme-helpers.ts +46 -0
- package/ui/Typography.d.ts +2 -71
- package/ui/Typography.js +15 -93
- package/ui/UniversalLink.js +1 -5
- package/utils/ClipboardService.d.ts +1 -5
- package/utils/ClipboardService.js +2 -73
- package/utils/isUrl.d.ts +2 -2
- package/utils/isUrl.js +4 -4
- package/utils/theme-helpers.d.ts +1 -0
- package/utils/theme-helpers.js +42 -2
- package/Markdown/CodeSample/CodeSample.d.ts +0 -8
- package/Markdown/CodeSample/CodeSample.js +0 -30
- package/Markdown/CodeSample/index.d.ts +0 -3
- package/Markdown/CodeSample/index.js +0 -19
- package/Markdown/CodeSample/styled.d.ts +0 -5
- package/Markdown/CodeSample/styled.js +0 -109
- package/Markdown/CodeSample/types.d.ts +0 -9
- package/Markdown/CodeSample/types.js +0 -2
- package/src/Button/Button.stories.tsx +0 -74
- package/src/Button/__tests__/Button.test.tsx +0 -42
- package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
- package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
- package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
- package/src/CopyButton/CopyButton.stories.tsx +0 -18
- package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
- package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
- package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
- package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
- package/src/Footer/Footer.stories.tsx +0 -57
- package/src/Footer/__tests__/Footer.test.tsx +0 -55
- package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +0 -253
- package/src/Headings/Headings.stories.tsx +0 -36
- package/src/Headings/__tests__/Headings.test.tsx +0 -24
- package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
- package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
- package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
- package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
- package/src/Layout/__tests__/PageLayout.test.tsx +0 -17
- package/src/Layout/__tests__/RootLayout.test.tsx +0 -17
- package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +0 -38
- package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +0 -18
- package/src/Markdown/CodeSample/CodeSample.tsx +0 -39
- package/src/Markdown/CodeSample/index.ts +0 -3
- package/src/Markdown/CodeSample/styled.ts +0 -289
- package/src/Markdown/CodeSample/types.ts +0 -40
- package/src/Navbar/Navbar.stories.tsx +0 -32
- package/src/NavbarLogo/NavbarLogo.stories.tsx +0 -20
- package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +0 -47
- package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +0 -38
- package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
- package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
- package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
- package/src/Panel/CodePanel.stories.tsx +0 -26
- package/src/Panel/ContentPanel.stories.tsx +0 -26
- package/src/Panel/Panel.stories.tsx +0 -56
- package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
- package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
- package/src/Panel/__tests__/Panel.test.tsx +0 -53
- package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
- package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
- package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
- package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
- package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
- package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
- package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
- package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
- package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
- package/src/SourceCode/SourceCode.stories.tsx +0 -29
- package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
- package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
- package/src/TableOfContent/TableOfContent.stories.tsx +0 -39
- package/src/Tooltip/Tooltip.stories.tsx +0 -27
- package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
- package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
- package/src/Welcome.stories.mdx +0 -7
- package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
- package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
- package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
- package/src/utils/__tests__/ClipboardService.test.ts +0 -24
- package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
- package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
- package/src/utils/__tests__/css-variables.test.ts +0 -20
- package/src/utils/__tests__/highlight.test.ts +0 -51
- package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
- package/src/utils/__tests__/media-css.test.ts +0 -20
- package/src/utils/__tests__/theme-helpers.test.ts +0 -25
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { SidebarLogo } from '@theme/SidebarLogo';
|
|
5
|
-
|
|
6
|
-
describe('SidebarLogo', () => {
|
|
7
|
-
it('renders', () => {
|
|
8
|
-
const { container } = render(
|
|
9
|
-
<SidebarLogo
|
|
10
|
-
imageUrl="https://test.com/logo.png"
|
|
11
|
-
href="https://test.com"
|
|
12
|
-
dataTestId="test"
|
|
13
|
-
/>,
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('renders without href', () => {
|
|
20
|
-
const { container } = render(
|
|
21
|
-
<SidebarLogo imageUrl="https://test.com/logo.png" dataTestId="test" />,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('renders nothing, if imageUrl not provided', () => {
|
|
28
|
-
const { container } = render(<SidebarLogo href="https://test.com" />);
|
|
29
|
-
|
|
30
|
-
expect(container.firstChild).toBeNull();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`SidebarLogo renders 1`] = `
|
|
4
|
-
.c2 {
|
|
5
|
-
max-height: var(--logo-max-height);
|
|
6
|
-
max-width: var(--logo-max-width);
|
|
7
|
-
padding: var(--logo-padding);
|
|
8
|
-
width: 100%;
|
|
9
|
-
display: block;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.c0 {
|
|
13
|
-
text-align: center;
|
|
14
|
-
line-height: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.c1 {
|
|
18
|
-
display: inline-block;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
<div
|
|
22
|
-
class="c0"
|
|
23
|
-
data-cy="test"
|
|
24
|
-
>
|
|
25
|
-
<a
|
|
26
|
-
class="c1"
|
|
27
|
-
href="https://test.com"
|
|
28
|
-
>
|
|
29
|
-
<img
|
|
30
|
-
alt="logo"
|
|
31
|
-
class="c2"
|
|
32
|
-
src="https://test.com/logo.png"
|
|
33
|
-
/>
|
|
34
|
-
</a>
|
|
35
|
-
</div>
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
exports[`SidebarLogo renders without href 1`] = `
|
|
39
|
-
.c1 {
|
|
40
|
-
max-height: var(--logo-max-height);
|
|
41
|
-
max-width: var(--logo-max-width);
|
|
42
|
-
padding: var(--logo-padding);
|
|
43
|
-
width: 100%;
|
|
44
|
-
display: block;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.c0 {
|
|
48
|
-
text-align: center;
|
|
49
|
-
line-height: 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
<div
|
|
53
|
-
class="c0"
|
|
54
|
-
data-cy="test"
|
|
55
|
-
>
|
|
56
|
-
<img
|
|
57
|
-
alt="logo"
|
|
58
|
-
class="c1"
|
|
59
|
-
src="https://test.com/logo.png"
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
`;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { SourceCode } from '@theme/SourceCode';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Components/SourceCode',
|
|
8
|
-
component: SourceCode,
|
|
9
|
-
} as ComponentMeta<typeof SourceCode>;
|
|
10
|
-
|
|
11
|
-
const Template: ComponentStory<typeof SourceCode> = (args) => <SourceCode {...args} />;
|
|
12
|
-
|
|
13
|
-
export const WithoutCopyButton = Template.bind({});
|
|
14
|
-
WithoutCopyButton.args = {
|
|
15
|
-
lang: 'php',
|
|
16
|
-
source: `$client = new Rebilly\\Client([
|
|
17
|
-
'apiKey' => 'YourApiKeyHere',
|
|
18
|
-
'baseUrl' => 'https://api.rebilly.com',
|
|
19
|
-
]);`,
|
|
20
|
-
};
|
|
21
|
-
export const WithCopyButton = Template.bind({});
|
|
22
|
-
WithCopyButton.args = {
|
|
23
|
-
lang: 'php',
|
|
24
|
-
withCopyButton: true,
|
|
25
|
-
source: `$client = new Rebilly\\Client([
|
|
26
|
-
'apiKey' => 'YourApiKeyHere',
|
|
27
|
-
'baseUrl' => 'https://api.rebilly.com',
|
|
28
|
-
]);`,
|
|
29
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
-
|
|
5
|
-
import { SourceCode } from '@theme/SourceCode';
|
|
6
|
-
|
|
7
|
-
describe('SourceCode', () => {
|
|
8
|
-
it('renders without copy button', () => {
|
|
9
|
-
const { container } = renderWithTheme(
|
|
10
|
-
<SourceCode source={`let count = 1; count++;`} lang="js" dataTestId="without-copy-button" />,
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('renders with copy button', () => {
|
|
17
|
-
const { container } = renderWithTheme(
|
|
18
|
-
<SourceCode
|
|
19
|
-
source={`let count = 1; count++;`}
|
|
20
|
-
lang="js"
|
|
21
|
-
withCopyButton
|
|
22
|
-
dataTestId="with-copy-button"
|
|
23
|
-
/>,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('renders with external source', () => {
|
|
30
|
-
const { container } = renderWithTheme(
|
|
31
|
-
<SourceCode
|
|
32
|
-
externalSource={{ sample: { get: () => `let count = 1; count++;`, lang: 'js' } }}
|
|
33
|
-
lang="js"
|
|
34
|
-
dataTestId="with-external-source"
|
|
35
|
-
/>,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('renders with external source when it returns null', () => {
|
|
42
|
-
const { container } = renderWithTheme(
|
|
43
|
-
<SourceCode externalSource={{ sample: { get: () => '', lang: 'js' } }} lang="js" />,
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
47
|
-
});
|
|
48
|
-
});
|