@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.
Files changed (122) hide show
  1. package/CodeBlock/CodeBlock.js +2 -1
  2. package/Markdown/StyledMarkdown.d.ts +0 -2
  3. package/Markdown/StyledMarkdown.js +5 -16
  4. package/Markdown/index.d.ts +0 -1
  5. package/Markdown/index.js +0 -1
  6. package/Navbar/NavbarMenu.js +1 -1
  7. package/OperationBadge/OperationBadge.js +1 -1
  8. package/Search/ClearIcon.js +2 -2
  9. package/Search/Input.js +1 -1
  10. package/Search/Popover.js +1 -1
  11. package/Search/SearchIcon.js +2 -2
  12. package/Sidebar/ApiCallItem.js +1 -1
  13. package/TableOfContent/TableOfContent.js +5 -6
  14. package/globalStyle.d.ts +1 -0
  15. package/globalStyle.js +25 -3
  16. package/mocks/Link.js +4 -1
  17. package/mocks/hooks/usePageData.js +4 -1
  18. package/package.json +1 -1
  19. package/src/CodeBlock/CodeBlock.ts +3 -42
  20. package/src/Markdown/StyledMarkdown.tsx +14 -28
  21. package/src/Markdown/index.ts +0 -1
  22. package/src/Navbar/NavbarMenu.tsx +1 -1
  23. package/src/OperationBadge/OperationBadge.ts +5 -2
  24. package/src/Search/ClearIcon.tsx +12 -13
  25. package/src/Search/Input.tsx +7 -7
  26. package/src/Search/Popover.tsx +2 -2
  27. package/src/Search/SearchIcon.tsx +12 -13
  28. package/src/Sidebar/ApiCallItem.tsx +1 -2
  29. package/src/TableOfContent/TableOfContent.tsx +6 -4
  30. package/src/globalStyle.ts +829 -536
  31. package/src/mocks/Link.tsx +5 -2
  32. package/src/mocks/hooks/usePageData.ts +4 -1
  33. package/src/ui/Typography.tsx +12 -89
  34. package/src/ui/UniversalLink.tsx +3 -8
  35. package/src/utils/ClipboardService.ts +3 -86
  36. package/src/utils/isUrl.ts +4 -4
  37. package/src/utils/theme-helpers.ts +46 -0
  38. package/ui/Typography.d.ts +2 -71
  39. package/ui/Typography.js +15 -93
  40. package/ui/UniversalLink.js +1 -5
  41. package/utils/ClipboardService.d.ts +1 -5
  42. package/utils/ClipboardService.js +2 -73
  43. package/utils/isUrl.d.ts +2 -2
  44. package/utils/isUrl.js +4 -4
  45. package/utils/theme-helpers.d.ts +1 -0
  46. package/utils/theme-helpers.js +42 -2
  47. package/Markdown/CodeSample/CodeSample.d.ts +0 -8
  48. package/Markdown/CodeSample/CodeSample.js +0 -30
  49. package/Markdown/CodeSample/index.d.ts +0 -3
  50. package/Markdown/CodeSample/index.js +0 -19
  51. package/Markdown/CodeSample/styled.d.ts +0 -5
  52. package/Markdown/CodeSample/styled.js +0 -109
  53. package/Markdown/CodeSample/types.d.ts +0 -9
  54. package/Markdown/CodeSample/types.js +0 -2
  55. package/src/Button/Button.stories.tsx +0 -74
  56. package/src/Button/__tests__/Button.test.tsx +0 -42
  57. package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
  58. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
  59. package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
  60. package/src/CopyButton/CopyButton.stories.tsx +0 -18
  61. package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
  62. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
  63. package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
  64. package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
  65. package/src/Footer/Footer.stories.tsx +0 -57
  66. package/src/Footer/__tests__/Footer.test.tsx +0 -55
  67. package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +0 -253
  68. package/src/Headings/Headings.stories.tsx +0 -36
  69. package/src/Headings/__tests__/Headings.test.tsx +0 -24
  70. package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
  71. package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
  72. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
  73. package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
  74. package/src/Layout/__tests__/PageLayout.test.tsx +0 -17
  75. package/src/Layout/__tests__/RootLayout.test.tsx +0 -17
  76. package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +0 -38
  77. package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +0 -18
  78. package/src/Markdown/CodeSample/CodeSample.tsx +0 -39
  79. package/src/Markdown/CodeSample/index.ts +0 -3
  80. package/src/Markdown/CodeSample/styled.ts +0 -289
  81. package/src/Markdown/CodeSample/types.ts +0 -40
  82. package/src/Navbar/Navbar.stories.tsx +0 -32
  83. package/src/NavbarLogo/NavbarLogo.stories.tsx +0 -20
  84. package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +0 -47
  85. package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +0 -38
  86. package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
  87. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
  88. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
  89. package/src/Panel/CodePanel.stories.tsx +0 -26
  90. package/src/Panel/ContentPanel.stories.tsx +0 -26
  91. package/src/Panel/Panel.stories.tsx +0 -56
  92. package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
  93. package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
  94. package/src/Panel/__tests__/Panel.test.tsx +0 -53
  95. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
  96. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
  97. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
  98. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
  99. package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
  100. package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
  101. package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
  102. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
  103. package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
  104. package/src/SourceCode/SourceCode.stories.tsx +0 -29
  105. package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
  106. package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
  107. package/src/TableOfContent/TableOfContent.stories.tsx +0 -39
  108. package/src/Tooltip/Tooltip.stories.tsx +0 -27
  109. package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
  110. package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
  111. package/src/Welcome.stories.mdx +0 -7
  112. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
  113. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
  114. package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
  115. package/src/utils/__tests__/ClipboardService.test.ts +0 -24
  116. package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
  117. package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
  118. package/src/utils/__tests__/css-variables.test.ts +0 -20
  119. package/src/utils/__tests__/highlight.test.ts +0 -51
  120. package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
  121. package/src/utils/__tests__/media-css.test.ts +0 -20
  122. package/src/utils/__tests__/theme-helpers.test.ts +0 -25
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- import { ThemeProvider } from 'styled-components';
4
-
5
- import { TableOfContent } from '@theme/TableOfContent';
6
- import { generateMediaQueries } from '@theme/utils/media-css';
7
-
8
- const breakpoints = { small: '1rem', medium: '1rem', large: '1rem' };
9
-
10
- const theme = {
11
- mediaQueries: generateMediaQueries(breakpoints),
12
- };
13
-
14
- export default {
15
- title: 'Portal/TableOfContent',
16
- component: TableOfContent,
17
- decorators: [
18
- (Story) => (
19
- <ThemeProvider theme={theme}>
20
- <Story />
21
- </ThemeProvider>
22
- ),
23
- ],
24
- } as ComponentMeta<typeof TableOfContent>;
25
-
26
- const Template: ComponentStory<typeof TableOfContent> = (args) => (
27
- <TableOfContent {...args}>Click</TableOfContent>
28
- );
29
-
30
- export const Default = Template.bind({});
31
- Default.args = {
32
- headings: [
33
- { id: '1', value: 'test 1', depth: 1 },
34
- { id: '2', value: 'test 2', depth: 1 },
35
- { id: '3', value: 'test 3', depth: 2 },
36
- { id: '4', value: 'test 4', depth: 2 },
37
- { id: '5', value: 'test 5', depth: 1 },
38
- ],
39
- };
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- import { Tooltip } from '@theme/Tooltip';
5
-
6
- export default {
7
- title: 'Components/Tooltip',
8
- component: Tooltip,
9
- } as ComponentMeta<typeof Tooltip>;
10
-
11
- const Template: ComponentStory<typeof Tooltip> = (args) => {
12
- return (
13
- <>
14
- <div style={{ padding: '50px' }}>
15
- <Tooltip {...args}>
16
- <button>Sample</button>
17
- </Tooltip>
18
- </div>
19
- </>
20
- );
21
- };
22
-
23
- export const Default = Template.bind({});
24
- Default.args = {
25
- open: true,
26
- tip: 'Try me!',
27
- };
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { render, fireEvent } from '@testing-library/react';
3
-
4
- import { Tooltip } from '@theme/Tooltip';
5
-
6
- describe('Tooltip', () => {
7
- it('renders closed', () => {
8
- const { container } = render(
9
- <Tooltip tip="Try me!">
10
- <button>test</button>
11
- </Tooltip>,
12
- );
13
- container;
14
- expect(container.firstChild).toMatchSnapshot();
15
- });
16
-
17
- it('renders opened', () => {
18
- const { container } = render(
19
- <Tooltip tip="Try me!" open={true} placement="bottom" dataTestId="tooltip-opened">
20
- <button>test</button>
21
- </Tooltip>,
22
- );
23
-
24
- expect(container.firstChild).toMatchSnapshot();
25
- });
26
-
27
- it('should open and close on mouse enter/leave event', () => {
28
- const { getByText } = render(
29
- <Tooltip tip="Try me!" dataTestId="tooltip">
30
- <button>test</button>
31
- </Tooltip>,
32
- );
33
-
34
- fireEvent.mouseEnter(getByText('test'));
35
- expect(getByText('Try me!')).toBeTruthy();
36
-
37
- fireEvent.mouseLeave(getByText('test'));
38
- // expect(getByText('Try me!')).toBeFalsy();
39
- expect(() => getByText('Try me!')).toThrow();
40
- });
41
- });
@@ -1,83 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Tooltip renders closed 1`] = `
4
- .c0 {
5
- position: relative;
6
- display: inline-block;
7
- }
8
-
9
- <div
10
- class="c0 tooltip-default"
11
- >
12
- <button>
13
- test
14
- </button>
15
- </div>
16
- `;
17
-
18
- exports[`Tooltip renders opened 1`] = `
19
- .c0 {
20
- position: relative;
21
- display: inline-block;
22
- }
23
-
24
- .c1 {
25
- display: inline-block;
26
- position: absolute;
27
- text-align: center;
28
- padding: 10px 20px;
29
- max-width: 250px;
30
- white-space: normal;
31
- overflow-wrap: break-word;
32
- border-radius: var(--global-border-radius);
33
- pointer-events: none;
34
- -webkit-transition: opacity 0.3s ease-out;
35
- transition: opacity 0.3s ease-out;
36
- font-size: 13px;
37
- background: var(--tooltip-background-color);
38
- color: var(--tooltip-color);
39
- box-shadow: rgb(0 0 0 / 25%) 0 2px 4px;
40
- width: 120px;
41
- bottom: 0;
42
- left: 50%;
43
- -webkit-transform: translate(-50%,99%);
44
- -ms-transform: translate(-50%,99%);
45
- transform: translate(-50%,99%);
46
- margin-bottom: -10px;
47
- }
48
-
49
- .c1::after {
50
- position: absolute;
51
- content: ' ';
52
- display: inline-block;
53
- width: 0;
54
- height: 0;
55
- border-color: var(--tooltip-background-color);
56
- }
57
-
58
- .c1::after {
59
- border-left: 5px solid transparent;
60
- border-right: 5px solid transparent;
61
- border-bottom-width: 6px;
62
- border-bottom-style: solid;
63
- top: 0;
64
- left: 50%;
65
- -webkit-transform: translate(-50%,-99%);
66
- -ms-transform: translate(-50%,-99%);
67
- transform: translate(-50%,-99%);
68
- }
69
-
70
- <div
71
- class="c0 tooltip-default"
72
- >
73
- <button>
74
- test
75
- </button>
76
- <span
77
- class="c1"
78
- data-cy="tooltip-opened"
79
- >
80
- Try me!
81
- </span>
82
- </div>
83
- `;
@@ -1,7 +0,0 @@
1
- import { Meta } from '@storybook/addon-docs';
2
-
3
- <Meta title="Welcome" />
4
-
5
- # @redocly/theme
6
-
7
- Welcome to storybook for [@redocly/theme](https://www.npmjs.com/package/@redocly/theme) package.
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { Story, ComponentMeta } from '@storybook/react';
3
-
4
- import { ShelfIcon, ShelfIconProps } from '@theme/icons/ShelfIcon';
5
-
6
- export default {
7
- title: 'Icons/ShelfIcon',
8
- component: ShelfIcon,
9
- argTypes: {},
10
- } as ComponentMeta<typeof ShelfIcon>;
11
-
12
- const Template: Story<ShelfIconProps> = (args) => <ShelfIcon {...args} />;
13
-
14
- export const Right = Template.bind({});
15
- Right.args = {
16
- direction: 'right',
17
- size: '20px',
18
- };
19
-
20
- export const Down = Template.bind({});
21
- Down.args = {
22
- direction: 'down',
23
- size: '20px',
24
- };
25
-
26
- export const Left = Template.bind({});
27
- Left.args = {
28
- direction: 'left',
29
- size: '20px',
30
- };
31
-
32
- export const Up = Template.bind({});
33
- Up.args = {
34
- direction: 'up',
35
- size: '20px',
36
- };
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
-
4
- import { ShelfIcon } from '@theme/icons/ShelfIcon';
5
-
6
- describe('ShelfIcon', () => {
7
- it('renders right', () => {
8
- const { container } = render(<ShelfIcon direction={'right'} />);
9
-
10
- expect(container.firstChild).toMatchSnapshot();
11
- });
12
-
13
- it('renders left', () => {
14
- const { container } = render(<ShelfIcon direction={'left'} />);
15
-
16
- expect(container.firstChild).toMatchSnapshot();
17
- });
18
-
19
- it('renders up', () => {
20
- const { container } = render(<ShelfIcon direction={'up'} />);
21
-
22
- expect(container.firstChild).toMatchSnapshot();
23
- });
24
-
25
- it('renders down', () => {
26
- const { container } = render(<ShelfIcon direction={'down'} />);
27
-
28
- expect(container.firstChild).toMatchSnapshot();
29
- });
30
-
31
- it('renders with float left', () => {
32
- const { container } = render(<ShelfIcon direction={'right'} float={'left'} />);
33
-
34
- expect(container.firstChild).toMatchSnapshot();
35
- });
36
-
37
- it('renders with float right', () => {
38
- const { container } = render(<ShelfIcon direction={'right'} float={'right'} />);
39
-
40
- expect(container.firstChild).toMatchSnapshot();
41
- });
42
-
43
- it('renders with big size', () => {
44
- const { container } = render(<ShelfIcon direction={'right'} size={'30px'} />);
45
-
46
- expect(container.firstChild).toMatchSnapshot();
47
- });
48
-
49
- it('renders with color', () => {
50
- const { container } = render(<ShelfIcon direction={'right'} color={'orange'} />);
51
-
52
- expect(container.firstChild).toMatchSnapshot();
53
- });
54
- });
@@ -1,235 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ShelfIcon renders down 1`] = `
4
- .c0 {
5
- height: 9px;
6
- width: 9px;
7
- -webkit-transform: rotateZ(90deg);
8
- -ms-transform: rotateZ(90deg);
9
- transform: rotateZ(90deg);
10
- fill: inherit;
11
- vertical-align: middle;
12
- -webkit-transition: -webkit-transform 0.2s ease-out;
13
- -webkit-transition: transform 0.2s ease-out;
14
- transition: transform 0.2s ease-out;
15
- }
16
-
17
- <svg
18
- aria-hidden="true"
19
- class="c0"
20
- viewBox="0 0 4.25 7"
21
- xmlns="http://www.w3.org/2000/svg"
22
- >
23
- <path
24
- 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"
25
- />
26
- <path
27
- 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"
28
- />
29
- </svg>
30
- `;
31
-
32
- exports[`ShelfIcon renders left 1`] = `
33
- .c0 {
34
- height: 9px;
35
- width: 9px;
36
- -webkit-transform: rotateZ(180deg);
37
- -ms-transform: rotateZ(180deg);
38
- transform: rotateZ(180deg);
39
- fill: inherit;
40
- vertical-align: middle;
41
- -webkit-transition: -webkit-transform 0.2s ease-out;
42
- -webkit-transition: transform 0.2s ease-out;
43
- transition: transform 0.2s ease-out;
44
- }
45
-
46
- <svg
47
- aria-hidden="true"
48
- class="c0"
49
- viewBox="0 0 4.25 7"
50
- xmlns="http://www.w3.org/2000/svg"
51
- >
52
- <path
53
- 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"
54
- />
55
- <path
56
- 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"
57
- />
58
- </svg>
59
- `;
60
-
61
- exports[`ShelfIcon renders right 1`] = `
62
- .c0 {
63
- height: 9px;
64
- width: 9px;
65
- -webkit-transform: rotateZ(0deg);
66
- -ms-transform: rotateZ(0deg);
67
- transform: rotateZ(0deg);
68
- fill: inherit;
69
- vertical-align: middle;
70
- -webkit-transition: -webkit-transform 0.2s ease-out;
71
- -webkit-transition: transform 0.2s ease-out;
72
- transition: transform 0.2s ease-out;
73
- }
74
-
75
- <svg
76
- aria-hidden="true"
77
- class="c0"
78
- viewBox="0 0 4.25 7"
79
- xmlns="http://www.w3.org/2000/svg"
80
- >
81
- <path
82
- 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"
83
- />
84
- <path
85
- 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"
86
- />
87
- </svg>
88
- `;
89
-
90
- exports[`ShelfIcon renders up 1`] = `
91
- .c0 {
92
- height: 9px;
93
- width: 9px;
94
- -webkit-transform: rotateZ(270deg);
95
- -ms-transform: rotateZ(270deg);
96
- transform: rotateZ(270deg);
97
- fill: inherit;
98
- vertical-align: middle;
99
- -webkit-transition: -webkit-transform 0.2s ease-out;
100
- -webkit-transition: transform 0.2s ease-out;
101
- transition: transform 0.2s ease-out;
102
- }
103
-
104
- <svg
105
- aria-hidden="true"
106
- class="c0"
107
- viewBox="0 0 4.25 7"
108
- xmlns="http://www.w3.org/2000/svg"
109
- >
110
- <path
111
- 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"
112
- />
113
- <path
114
- 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"
115
- />
116
- </svg>
117
- `;
118
-
119
- exports[`ShelfIcon renders with big size 1`] = `
120
- .c0 {
121
- height: 30px;
122
- width: 30px;
123
- -webkit-transform: rotateZ(0deg);
124
- -ms-transform: rotateZ(0deg);
125
- transform: rotateZ(0deg);
126
- fill: inherit;
127
- vertical-align: middle;
128
- -webkit-transition: -webkit-transform 0.2s ease-out;
129
- -webkit-transition: transform 0.2s ease-out;
130
- transition: transform 0.2s ease-out;
131
- }
132
-
133
- <svg
134
- aria-hidden="true"
135
- class="c0"
136
- viewBox="0 0 4.25 7"
137
- xmlns="http://www.w3.org/2000/svg"
138
- >
139
- <path
140
- 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"
141
- />
142
- <path
143
- 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"
144
- />
145
- </svg>
146
- `;
147
-
148
- exports[`ShelfIcon renders with color 1`] = `
149
- .c0 {
150
- height: 9px;
151
- width: 9px;
152
- -webkit-transform: rotateZ(0deg);
153
- -ms-transform: rotateZ(0deg);
154
- transform: rotateZ(0deg);
155
- fill: orange;
156
- vertical-align: middle;
157
- -webkit-transition: -webkit-transform 0.2s ease-out;
158
- -webkit-transition: transform 0.2s ease-out;
159
- transition: transform 0.2s ease-out;
160
- }
161
-
162
- <svg
163
- aria-hidden="true"
164
- class="c0"
165
- viewBox="0 0 4.25 7"
166
- xmlns="http://www.w3.org/2000/svg"
167
- >
168
- <path
169
- 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"
170
- />
171
- <path
172
- 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"
173
- />
174
- </svg>
175
- `;
176
-
177
- exports[`ShelfIcon renders with float left 1`] = `
178
- .c0 {
179
- height: 9px;
180
- width: 9px;
181
- float: left;
182
- -webkit-transform: rotateZ(0deg);
183
- -ms-transform: rotateZ(0deg);
184
- transform: rotateZ(0deg);
185
- fill: inherit;
186
- vertical-align: middle;
187
- -webkit-transition: -webkit-transform 0.2s ease-out;
188
- -webkit-transition: transform 0.2s ease-out;
189
- transition: transform 0.2s ease-out;
190
- }
191
-
192
- <svg
193
- aria-hidden="true"
194
- class="c0"
195
- viewBox="0 0 4.25 7"
196
- xmlns="http://www.w3.org/2000/svg"
197
- >
198
- <path
199
- 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"
200
- />
201
- <path
202
- 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"
203
- />
204
- </svg>
205
- `;
206
-
207
- exports[`ShelfIcon renders with float right 1`] = `
208
- .c0 {
209
- height: 9px;
210
- width: 9px;
211
- float: right;
212
- -webkit-transform: rotateZ(0deg);
213
- -ms-transform: rotateZ(0deg);
214
- transform: rotateZ(0deg);
215
- fill: inherit;
216
- vertical-align: middle;
217
- -webkit-transition: -webkit-transform 0.2s ease-out;
218
- -webkit-transition: transform 0.2s ease-out;
219
- transition: transform 0.2s ease-out;
220
- }
221
-
222
- <svg
223
- aria-hidden="true"
224
- class="c0"
225
- viewBox="0 0 4.25 7"
226
- xmlns="http://www.w3.org/2000/svg"
227
- >
228
- <path
229
- 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"
230
- />
231
- <path
232
- 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"
233
- />
234
- </svg>
235
- `;
@@ -1,24 +0,0 @@
1
- import { ClipboardService } from '@theme/utils';
2
-
3
- describe('ClipboardService', () => {
4
- describe('isSupported', () => {
5
- it('should call queryCommandSupported', () => {
6
- const queryCommandSupportedMock = jest.fn().mockReturnValue(true);
7
- Object.assign(global.document, { queryCommandSupported: queryCommandSupportedMock });
8
-
9
- expect(ClipboardService.isSupported()).toBe(true);
10
- expect(queryCommandSupportedMock).toBeCalledTimes(1);
11
- expect(queryCommandSupportedMock).toBeCalledWith('copy');
12
- });
13
-
14
- it('should return false, when queryCommandSupported is not defined', () => {
15
- Object.assign(global.document, { queryCommandSupported: undefined });
16
- expect(ClipboardService.isSupported()).toBe(false);
17
- });
18
-
19
- it('should return false, when document is not defined', () => {
20
- Object.assign(global, { document: undefined });
21
- expect(ClipboardService.isSupported()).toBe(false);
22
- });
23
- });
24
- });
@@ -1,5 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`highlight should work with correct lang name 1`] = `"<span class=\\"token keyword\\">int</span> name <span class=\\"token operator\\">=</span> <span class=\\"token string\\">\\"John\\"</span>"`;
4
-
5
- exports[`highlight should work with mapped lang name 1`] = `"<span class=\\"token keyword\\">int</span> name <span class=\\"token operator\\">=</span> <span class=\\"token string\\">\\"John\\"</span>"`;
@@ -1,5 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`jsonToHTML should work with maxExpandLevel 1 1`] = `"<div data-cy=\\"json-sample\\" class=\\"redoc-json\\"><code><button class=\\"collapser\\" aria-label=\\"collapse\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"id\\"</span>: <span class=\\"token string\\">&quot;600dc3b5d617e547a0e74cb9&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"name\\"</span>: <span class=\\"token string\\">&quot;Mitchell Fitzgerald&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"about\\"</span>: <span class=\\"token string\\">&quot;lorem ipsum&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"address\\"</span>: <span class=\\"token string\\">&quot;48 Avenue, City, North&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"company\\"</span>: <span class=\\"token string\\">&quot;Test&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"bio\\"</span>: <span class=\\"token keyword\\">null</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"nicknames\\"</span>: <button class=\\"collapser\\" aria-label=\\"expand\\"></button><span class=\\"token punctuation\\">[</span><span class=\\"ellipsis\\"></span><ul class=\\"array collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"token string\\">&quot;Mitch&quot;</span>,</div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"token string\\">&quot;Fitz&quot;</span>,</div></li><li><div class=\\"hoverable collapsed\\"><button class=\\"collapser\\" aria-label=\\"expand\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"title\\"</span>: <span class=\\"token string\\">&quot;MitFitz&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"createdAt\\"</span>: <span class=\\"token string\\">&quot;2022-04-19T11:46:00.019Z&quot;</span></div></li></ul><span class=\\"token punctuation\\">}</span></div></li></ul><span class=\\"token punctuation\\">]</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"age\\"</span>: <span class=\\"token number\\">27</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"isBanned\\"</span>: <span class=\\"token boolean\\">true</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"link\\"</span>: <span class=\\"token string\\">&quot;</span><a href=\\"https://google.com\\">https://google.com</a><span class=\\"token string\\">&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"emptyArray\\"</span>: <span class=\\"token punctuation\\">[ ]</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"empty\\"</span>: <span class=\\"token punctuation\\">{ }</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"contacts\\"</span>: <button class=\\"collapser\\" aria-label=\\"expand\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"phone\\"</span>: <button class=\\"collapser\\" aria-label=\\"expand\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"code\\"</span>: <span class=\\"token string\\">&quot;+1&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"rest\\"</span>: <span class=\\"token string\\">&quot;999&quot;</span></div></li></ul><span class=\\"token punctuation\\">}</span></div></li></ul><span class=\\"token punctuation\\">}</span></div></li></ul><span class=\\"token punctuation\\">}</span></code></div>"`;
4
-
5
- exports[`jsonToHTML should work with maxExpandLevel 3 1`] = `"<div data-cy=\\"json-sample\\" class=\\"redoc-json\\"><code><button class=\\"collapser\\" aria-label=\\"collapse\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"id\\"</span>: <span class=\\"token string\\">&quot;600dc3b5d617e547a0e74cb9&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"name\\"</span>: <span class=\\"token string\\">&quot;Mitchell Fitzgerald&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"about\\"</span>: <span class=\\"token string\\">&quot;lorem ipsum&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"address\\"</span>: <span class=\\"token string\\">&quot;48 Avenue, City, North&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"company\\"</span>: <span class=\\"token string\\">&quot;Test&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"bio\\"</span>: <span class=\\"token keyword\\">null</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"nicknames\\"</span>: <button class=\\"collapser\\" aria-label=\\"collapse\\"></button><span class=\\"token punctuation\\">[</span><span class=\\"ellipsis\\"></span><ul class=\\"array collapsible\\"><li><div class=\\"hoverable \\"><span class=\\"token string\\">&quot;Mitch&quot;</span>,</div></li><li><div class=\\"hoverable \\"><span class=\\"token string\\">&quot;Fitz&quot;</span>,</div></li><li><div class=\\"hoverable \\"><button class=\\"collapser\\" aria-label=\\"collapse\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"title\\"</span>: <span class=\\"token string\\">&quot;MitFitz&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"createdAt\\"</span>: <span class=\\"token string\\">&quot;2022-04-19T11:46:00.019Z&quot;</span></div></li></ul><span class=\\"token punctuation\\">}</span></div></li></ul><span class=\\"token punctuation\\">]</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"age\\"</span>: <span class=\\"token number\\">27</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"isBanned\\"</span>: <span class=\\"token boolean\\">true</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"link\\"</span>: <span class=\\"token string\\">&quot;</span><a href=\\"https://google.com\\">https://google.com</a><span class=\\"token string\\">&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"emptyArray\\"</span>: <span class=\\"token punctuation\\">[ ]</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"empty\\"</span>: <span class=\\"token punctuation\\">{ }</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"contacts\\"</span>: <button class=\\"collapser\\" aria-label=\\"collapse\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable \\"><span class=\\"property token string\\">\\"phone\\"</span>: <button class=\\"collapser\\" aria-label=\\"collapse\\"></button><span class=\\"token punctuation\\">{</span><span class=\\"ellipsis\\"></span><ul class=\\"obj collapsible\\"><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"code\\"</span>: <span class=\\"token string\\">&quot;+1&quot;</span><span class=\\"token punctuation\\">,</span></div></li><li><div class=\\"hoverable collapsed\\"><span class=\\"property token string\\">\\"rest\\"</span>: <span class=\\"token string\\">&quot;999&quot;</span></div></li></ul><span class=\\"token punctuation\\">}</span></div></li></ul><span class=\\"token punctuation\\">}</span></div></li></ul><span class=\\"token punctuation\\">}</span></code></div>"`;
@@ -1,20 +0,0 @@
1
- import { getCssColorVariable } from '@theme/utils';
2
-
3
- describe('css-variables', () => {
4
- afterEach(() => {
5
- document.documentElement.removeAttribute('style');
6
- });
7
-
8
- describe('getCssColorVariable', () => {
9
- it('should return variable', () => {
10
- expect(getCssColorVariable('--test')).toBe('var(--test)');
11
- });
12
- it('should return color', () => {
13
- expect(getCssColorVariable('#ffffff')).toBe('#ffffff');
14
- });
15
- it('should return defaultValue', () => {
16
- expect(getCssColorVariable('')).toBe('inherit');
17
- expect(getCssColorVariable('', '#000000')).toBe('#000000');
18
- });
19
- });
20
- });
@@ -1,51 +0,0 @@
1
- import * as Prism from 'prismjs';
2
-
3
- import { highlight, mapLang } from '@theme/utils';
4
-
5
- jest.mock('prismjs', () => {
6
- const original = jest.requireActual('prismjs');
7
- return {
8
- __isModule: true,
9
- ...original,
10
- highlight: jest.fn().mockImplementation((...args) => {
11
- return original.highlight(...args);
12
- }),
13
- };
14
- });
15
-
16
- describe('highlight', () => {
17
- beforeEach(() => {
18
- jest.clearAllMocks();
19
- });
20
-
21
- it('should work with correct lang name', () => {
22
- const highlighted = highlight('int name = "John"', 'cpp');
23
-
24
- expect(highlighted).toMatchSnapshot();
25
- });
26
-
27
- it('should work with mapped lang name', () => {
28
- const highlighted = highlight('int name = "John"', 'c++');
29
-
30
- expect(highlighted).toMatchSnapshot();
31
- });
32
-
33
- it('should have default value for lang', () => {
34
- const highlightSpy = jest.spyOn(Prism, 'highlight');
35
-
36
- highlight('i++');
37
-
38
- expect(highlightSpy).toBeCalledTimes(1);
39
- expect(highlightSpy).toBeCalledWith('i++', expect.any(Object), 'clike');
40
- });
41
-
42
- describe('mapLang', () => {
43
- it('should work with known lang', () => {
44
- expect(mapLang('node.js')).toBe('js');
45
- });
46
-
47
- it('should work with unknown lang', () => {
48
- expect(mapLang('ada')).toBe('clike');
49
- });
50
- });
51
- });