@redocly/theme 0.1.11 → 0.1.14
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/CodeSample/index.d.ts +0 -1
- package/Markdown/CodeSample/index.js +0 -1
- package/Markdown/CodeSample/styled.d.ts +0 -1
- package/Markdown/CodeSample/styled.js +10 -102
- package/Markdown/StyledMarkdown.d.ts +0 -2
- package/Markdown/StyledMarkdown.js +5 -16
- package/OperationBadge/OperationBadge.js +1 -1
- package/PageNavigation/NextPageLink.js +1 -1
- package/PageNavigation/PreviousPageLink.js +1 -1
- package/Search/ClearIcon.js +1 -1
- package/Search/Input.js +1 -1
- package/Search/Popover.js +1 -1
- package/Search/SearchIcon.js +1 -1
- package/Search/SearchItem.js +1 -1
- package/Sidebar/ApiCallItem.js +1 -1
- package/globalStyle.js +24 -6
- package/mocks/Link.js +1 -1
- package/mocks/hooks/usePageData.d.ts +1 -1
- package/package.json +1 -1
- package/src/CodeBlock/CodeBlock.ts +3 -42
- package/src/Markdown/CodeSample/index.ts +0 -1
- package/src/Markdown/CodeSample/styled.ts +65 -195
- package/src/Markdown/StyledMarkdown.tsx +14 -28
- package/src/OperationBadge/OperationBadge.ts +5 -2
- package/src/PageNavigation/NextPageLink.tsx +2 -2
- package/src/PageNavigation/PreviousPageLink.tsx +2 -2
- package/src/Search/ClearIcon.tsx +1 -1
- package/src/Search/Input.tsx +7 -7
- package/src/Search/Popover.tsx +2 -2
- package/src/Search/SearchIcon.tsx +1 -1
- package/src/Search/SearchItem.tsx +1 -1
- package/src/Sidebar/ApiCallItem.tsx +1 -2
- package/src/globalStyle.ts +660 -461
- package/src/mocks/Link.tsx +1 -1
- package/src/mocks/hooks/usePageData.ts +1 -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/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/DesignTokens/borders.stories.mdx +0 -20
- package/src/DesignTokens/colors.stories.mdx +0 -24
- package/src/DesignTokens/page-layout.stories.mdx +0 -12
- package/src/DesignTokens/tokens-generated.scss +0 -610
- package/src/DesignTokens/typography.stories.mdx +0 -36
- 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/types.ts +0 -40
- package/src/Navbar/Navbar.stories.tsx +0 -32
- package/src/Navbar/__tests__/Navbar.test.tsx +0 -55
- package/src/Navbar/__tests__/__snapshots__/Navbar.test.tsx.snap +0 -256
- 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/PageNavigation/PageNavigation.stories.tsx +0 -21
- package/src/PageNavigation/__tests__/NextPageLink.test.tsx +0 -29
- package/src/PageNavigation/__tests__/PageNavigation.test.tsx +0 -54
- package/src/PageNavigation/__tests__/PreviousPageLink.test.tsx +0 -29
- package/src/PageNavigation/__tests__/__snapshots__/NextPageLink.test.tsx.snap +0 -67
- package/src/PageNavigation/__tests__/__snapshots__/PageNavigation.test.tsx.snap +0 -275
- package/src/PageNavigation/__tests__/__snapshots__/PreviousPageLink.test.tsx.snap +0 -67
- 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/Search/__tests__/Input.test.tsx +0 -13
- package/src/Search/__tests__/__snapshots__/Input.test.tsx.snap +0 -36
- 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 -37
- package/src/TableOfContent/__tests__/TableOfContent.test.tsx +0 -61
- package/src/TableOfContent/__tests__/__snapshots__/TableOfContent.test.tsx.snap +0 -153
- 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,37 +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) => <TableOfContent {...args} />;
|
|
27
|
-
|
|
28
|
-
export const Default = Template.bind({});
|
|
29
|
-
Default.args = {
|
|
30
|
-
headings: [
|
|
31
|
-
{ id: '1', value: 'test 1', depth: 1 },
|
|
32
|
-
{ id: '2', value: 'test 2', depth: 2 },
|
|
33
|
-
{ id: '3', value: 'test 3', depth: 3 },
|
|
34
|
-
{ id: '4', value: 'test 4', depth: 3 },
|
|
35
|
-
{ id: '5', value: 'test 5', depth: 2 },
|
|
36
|
-
],
|
|
37
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { TableOfContent } from '@theme';
|
|
4
|
-
import { renderWithTheme } from '../../../tests/utils';
|
|
5
|
-
|
|
6
|
-
describe('TableOfContent', () => {
|
|
7
|
-
it('renders', () => {
|
|
8
|
-
const { container } = renderWithTheme(
|
|
9
|
-
<TableOfContent
|
|
10
|
-
headings={[
|
|
11
|
-
{ id: '1', value: 'test 1', depth: 1 },
|
|
12
|
-
{ id: '2', value: 'test 2', depth: 1 },
|
|
13
|
-
null,
|
|
14
|
-
{ id: '3', value: '', depth: 2 },
|
|
15
|
-
{ id: '4', value: 'test 4', depth: 0 },
|
|
16
|
-
{ id: '4', value: 'test 4', depth: 5 },
|
|
17
|
-
{ id: '5', value: 'test 5', depth: 1 },
|
|
18
|
-
]}
|
|
19
|
-
tocMaxDepth={3}
|
|
20
|
-
contentWrapper={null}
|
|
21
|
-
/>,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('renders nothing with no headings', () => {
|
|
28
|
-
const { container } = renderWithTheme(
|
|
29
|
-
<TableOfContent headings={null} tocMaxDepth={3} contentWrapper={null} />,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
expect(container.firstChild).toBeNull();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('renders nothing with empty headings array', () => {
|
|
36
|
-
const { container } = renderWithTheme(
|
|
37
|
-
<TableOfContent headings={[]} tocMaxDepth={3} contentWrapper={null} />,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
expect(container.firstChild).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('renders nothing for single heading with depth 1', () => {
|
|
44
|
-
const { container } = renderWithTheme(
|
|
45
|
-
<TableOfContent
|
|
46
|
-
headings={[{ id: '3', value: 'test 3', depth: 1 }]}
|
|
47
|
-
tocMaxDepth={3}
|
|
48
|
-
contentWrapper={null}
|
|
49
|
-
/>,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
expect(container.firstChild).toBeNull();
|
|
53
|
-
});
|
|
54
|
-
it('renders nothing for single empty heading', () => {
|
|
55
|
-
const { container } = renderWithTheme(
|
|
56
|
-
<TableOfContent headings={[null]} tocMaxDepth={3} contentWrapper={null} />,
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
expect(container.firstChild).toBeNull();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TableOfContent renders 1`] = `
|
|
4
|
-
.c2 {
|
|
5
|
-
font-size: 0.8em;
|
|
6
|
-
padding: 10px 15px;
|
|
7
|
-
font-weight: bold;
|
|
8
|
-
text-transform: uppercase;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.c3 {
|
|
12
|
-
display: block;
|
|
13
|
-
color: var(--color-content);
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
font-size: 0.8em;
|
|
16
|
-
padding: 10px 15px;
|
|
17
|
-
padding-left: 0px;
|
|
18
|
-
-webkit-transition: background-color 0.3s,color 0.3s;
|
|
19
|
-
transition: background-color 0.3s,color 0.3s;
|
|
20
|
-
-webkit-text-decoration: none;
|
|
21
|
-
text-decoration: none;
|
|
22
|
-
word-break: break-word;
|
|
23
|
-
font-family: var(--h-font-family);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.c3:hover,
|
|
27
|
-
.c3.active {
|
|
28
|
-
color: var(--sidebar-item-active-color);
|
|
29
|
-
background-color: var(--sidebar-item-active-background-color);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.c3:empty {
|
|
33
|
-
padding: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.c4 {
|
|
37
|
-
display: block;
|
|
38
|
-
color: var(--color-content);
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
font-size: 0.8em;
|
|
41
|
-
padding: 10px 15px;
|
|
42
|
-
padding-left: 15px;
|
|
43
|
-
-webkit-transition: background-color 0.3s,color 0.3s;
|
|
44
|
-
transition: background-color 0.3s,color 0.3s;
|
|
45
|
-
-webkit-text-decoration: none;
|
|
46
|
-
text-decoration: none;
|
|
47
|
-
word-break: break-word;
|
|
48
|
-
font-family: var(--h-font-family);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.c4:hover,
|
|
52
|
-
.c4.active {
|
|
53
|
-
color: var(--sidebar-item-active-color);
|
|
54
|
-
background-color: var(--sidebar-item-active-background-color);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.c4:empty {
|
|
58
|
-
padding: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.c5 {
|
|
62
|
-
display: block;
|
|
63
|
-
color: var(--color-content);
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
font-size: 0.8em;
|
|
66
|
-
padding: 10px 15px;
|
|
67
|
-
padding-left: -15px;
|
|
68
|
-
-webkit-transition: background-color 0.3s,color 0.3s;
|
|
69
|
-
transition: background-color 0.3s,color 0.3s;
|
|
70
|
-
-webkit-text-decoration: none;
|
|
71
|
-
text-decoration: none;
|
|
72
|
-
word-break: break-word;
|
|
73
|
-
font-family: var(--h-font-family);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.c5:hover,
|
|
77
|
-
.c5.active {
|
|
78
|
-
color: var(--sidebar-item-active-color);
|
|
79
|
-
background-color: var(--sidebar-item-active-background-color);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.c5:empty {
|
|
83
|
-
padding: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.c0 {
|
|
87
|
-
font-size: 1rem;
|
|
88
|
-
background-color: transparent;
|
|
89
|
-
-webkit-flex-shrink: 0;
|
|
90
|
-
-ms-flex-negative: 0;
|
|
91
|
-
flex-shrink: 0;
|
|
92
|
-
display: none !important;
|
|
93
|
-
font-family: var(--font-family-base);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.c1 {
|
|
97
|
-
position: -webkit-sticky;
|
|
98
|
-
position: sticky;
|
|
99
|
-
top: calc(var(--navbar-height) + 20px);
|
|
100
|
-
max-height: calc(100vh - var(--navbar-height) - 20px);
|
|
101
|
-
border-left: 1px solid var(--global-border-color);
|
|
102
|
-
overflow-y: auto;
|
|
103
|
-
width: var(--toc-width);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@media screen and (min-width:85rem) {
|
|
107
|
-
.c0 {
|
|
108
|
-
width: var(--toc-width);
|
|
109
|
-
display: block !important;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
<aside
|
|
114
|
-
class="c0"
|
|
115
|
-
data-component-name="TableOfContent/TableOfContent"
|
|
116
|
-
>
|
|
117
|
-
<div
|
|
118
|
-
class="c1"
|
|
119
|
-
>
|
|
120
|
-
<div
|
|
121
|
-
class="c2"
|
|
122
|
-
>
|
|
123
|
-
On this page
|
|
124
|
-
</div>
|
|
125
|
-
<a
|
|
126
|
-
class="c3"
|
|
127
|
-
data-cy="toc-test 2"
|
|
128
|
-
href="#2"
|
|
129
|
-
>
|
|
130
|
-
test 2
|
|
131
|
-
</a>
|
|
132
|
-
<a
|
|
133
|
-
class="c4"
|
|
134
|
-
data-cy="toc-"
|
|
135
|
-
href="#3"
|
|
136
|
-
/>
|
|
137
|
-
<a
|
|
138
|
-
class="c5"
|
|
139
|
-
data-cy="toc-test 4"
|
|
140
|
-
href="#4"
|
|
141
|
-
>
|
|
142
|
-
test 4
|
|
143
|
-
</a>
|
|
144
|
-
<a
|
|
145
|
-
class="c3"
|
|
146
|
-
data-cy="toc-test 5"
|
|
147
|
-
href="#5"
|
|
148
|
-
>
|
|
149
|
-
test 5
|
|
150
|
-
</a>
|
|
151
|
-
</div>
|
|
152
|
-
</aside>
|
|
153
|
-
`;
|
|
@@ -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
|
-
`;
|
package/src/Welcome.stories.mdx
DELETED
|
@@ -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
|
-
});
|