@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.
Files changed (135) hide show
  1. package/CodeBlock/CodeBlock.js +2 -1
  2. package/Markdown/CodeSample/index.d.ts +0 -1
  3. package/Markdown/CodeSample/index.js +0 -1
  4. package/Markdown/CodeSample/styled.d.ts +0 -1
  5. package/Markdown/CodeSample/styled.js +10 -102
  6. package/Markdown/StyledMarkdown.d.ts +0 -2
  7. package/Markdown/StyledMarkdown.js +5 -16
  8. package/OperationBadge/OperationBadge.js +1 -1
  9. package/PageNavigation/NextPageLink.js +1 -1
  10. package/PageNavigation/PreviousPageLink.js +1 -1
  11. package/Search/ClearIcon.js +1 -1
  12. package/Search/Input.js +1 -1
  13. package/Search/Popover.js +1 -1
  14. package/Search/SearchIcon.js +1 -1
  15. package/Search/SearchItem.js +1 -1
  16. package/Sidebar/ApiCallItem.js +1 -1
  17. package/globalStyle.js +24 -6
  18. package/mocks/Link.js +1 -1
  19. package/mocks/hooks/usePageData.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/CodeBlock/CodeBlock.ts +3 -42
  22. package/src/Markdown/CodeSample/index.ts +0 -1
  23. package/src/Markdown/CodeSample/styled.ts +65 -195
  24. package/src/Markdown/StyledMarkdown.tsx +14 -28
  25. package/src/OperationBadge/OperationBadge.ts +5 -2
  26. package/src/PageNavigation/NextPageLink.tsx +2 -2
  27. package/src/PageNavigation/PreviousPageLink.tsx +2 -2
  28. package/src/Search/ClearIcon.tsx +1 -1
  29. package/src/Search/Input.tsx +7 -7
  30. package/src/Search/Popover.tsx +2 -2
  31. package/src/Search/SearchIcon.tsx +1 -1
  32. package/src/Search/SearchItem.tsx +1 -1
  33. package/src/Sidebar/ApiCallItem.tsx +1 -2
  34. package/src/globalStyle.ts +660 -461
  35. package/src/mocks/Link.tsx +1 -1
  36. package/src/mocks/hooks/usePageData.ts +1 -1
  37. package/src/ui/Typography.tsx +12 -89
  38. package/src/ui/UniversalLink.tsx +3 -8
  39. package/src/utils/ClipboardService.ts +3 -86
  40. package/src/utils/isUrl.ts +4 -4
  41. package/src/utils/theme-helpers.ts +46 -0
  42. package/ui/Typography.d.ts +2 -71
  43. package/ui/Typography.js +15 -93
  44. package/ui/UniversalLink.js +1 -5
  45. package/utils/ClipboardService.d.ts +1 -5
  46. package/utils/ClipboardService.js +2 -73
  47. package/utils/isUrl.d.ts +2 -2
  48. package/utils/isUrl.js +4 -4
  49. package/utils/theme-helpers.d.ts +1 -0
  50. package/utils/theme-helpers.js +42 -2
  51. package/Markdown/CodeSample/types.d.ts +0 -9
  52. package/Markdown/CodeSample/types.js +0 -2
  53. package/src/Button/Button.stories.tsx +0 -74
  54. package/src/Button/__tests__/Button.test.tsx +0 -42
  55. package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
  56. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
  57. package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
  58. package/src/CopyButton/CopyButton.stories.tsx +0 -18
  59. package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
  60. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
  61. package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
  62. package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
  63. package/src/DesignTokens/borders.stories.mdx +0 -20
  64. package/src/DesignTokens/colors.stories.mdx +0 -24
  65. package/src/DesignTokens/page-layout.stories.mdx +0 -12
  66. package/src/DesignTokens/tokens-generated.scss +0 -610
  67. package/src/DesignTokens/typography.stories.mdx +0 -36
  68. package/src/Footer/Footer.stories.tsx +0 -57
  69. package/src/Footer/__tests__/Footer.test.tsx +0 -55
  70. package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +0 -253
  71. package/src/Headings/Headings.stories.tsx +0 -36
  72. package/src/Headings/__tests__/Headings.test.tsx +0 -24
  73. package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
  74. package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
  75. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
  76. package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
  77. package/src/Layout/__tests__/PageLayout.test.tsx +0 -17
  78. package/src/Layout/__tests__/RootLayout.test.tsx +0 -17
  79. package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +0 -38
  80. package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +0 -18
  81. package/src/Markdown/CodeSample/types.ts +0 -40
  82. package/src/Navbar/Navbar.stories.tsx +0 -32
  83. package/src/Navbar/__tests__/Navbar.test.tsx +0 -55
  84. package/src/Navbar/__tests__/__snapshots__/Navbar.test.tsx.snap +0 -256
  85. package/src/NavbarLogo/NavbarLogo.stories.tsx +0 -20
  86. package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +0 -47
  87. package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +0 -38
  88. package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
  89. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
  90. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
  91. package/src/PageNavigation/PageNavigation.stories.tsx +0 -21
  92. package/src/PageNavigation/__tests__/NextPageLink.test.tsx +0 -29
  93. package/src/PageNavigation/__tests__/PageNavigation.test.tsx +0 -54
  94. package/src/PageNavigation/__tests__/PreviousPageLink.test.tsx +0 -29
  95. package/src/PageNavigation/__tests__/__snapshots__/NextPageLink.test.tsx.snap +0 -67
  96. package/src/PageNavigation/__tests__/__snapshots__/PageNavigation.test.tsx.snap +0 -275
  97. package/src/PageNavigation/__tests__/__snapshots__/PreviousPageLink.test.tsx.snap +0 -67
  98. package/src/Panel/CodePanel.stories.tsx +0 -26
  99. package/src/Panel/ContentPanel.stories.tsx +0 -26
  100. package/src/Panel/Panel.stories.tsx +0 -56
  101. package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
  102. package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
  103. package/src/Panel/__tests__/Panel.test.tsx +0 -53
  104. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
  105. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
  106. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
  107. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
  108. package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
  109. package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
  110. package/src/Search/__tests__/Input.test.tsx +0 -13
  111. package/src/Search/__tests__/__snapshots__/Input.test.tsx.snap +0 -36
  112. package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
  113. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
  114. package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
  115. package/src/SourceCode/SourceCode.stories.tsx +0 -29
  116. package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
  117. package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
  118. package/src/TableOfContent/TableOfContent.stories.tsx +0 -37
  119. package/src/TableOfContent/__tests__/TableOfContent.test.tsx +0 -61
  120. package/src/TableOfContent/__tests__/__snapshots__/TableOfContent.test.tsx.snap +0 -153
  121. package/src/Tooltip/Tooltip.stories.tsx +0 -27
  122. package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
  123. package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
  124. package/src/Welcome.stories.mdx +0 -7
  125. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
  126. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
  127. package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
  128. package/src/utils/__tests__/ClipboardService.test.ts +0 -24
  129. package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
  130. package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
  131. package/src/utils/__tests__/css-variables.test.ts +0 -20
  132. package/src/utils/__tests__/highlight.test.ts +0 -51
  133. package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
  134. package/src/utils/__tests__/media-css.test.ts +0 -20
  135. package/src/utils/__tests__/theme-helpers.test.ts +0 -25
@@ -5,81 +5,10 @@ var ClipboardService = /** @class */ (function () {
5
5
  function ClipboardService() {
6
6
  }
7
7
  ClipboardService.isSupported = function () {
8
- return (typeof document !== 'undefined' &&
9
- !!document.queryCommandSupported &&
10
- document.queryCommandSupported('copy'));
11
- };
12
- ClipboardService.selectElement = function (element) {
13
- if (!element) {
14
- return;
15
- }
16
- var range;
17
- var selection;
18
- if (document.body.createTextRange) {
19
- range = document.body.createTextRange();
20
- range.moveToElementText(element);
21
- range.select();
22
- }
23
- else if (document.createRange && window.getSelection) {
24
- selection = window.getSelection();
25
- range = document.createRange();
26
- range.selectNodeContents(element);
27
- selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
28
- selection === null || selection === void 0 ? void 0 : selection.addRange(range);
29
- }
30
- };
31
- ClipboardService.deselect = function () {
32
- if (document.selection) {
33
- document.selection.empty();
34
- }
35
- else if (window.getSelection) {
36
- var selection = window.getSelection();
37
- if (selection) {
38
- selection.removeAllRanges();
39
- }
40
- }
41
- };
42
- ClipboardService.copySelected = function () {
43
- var result;
44
- try {
45
- result = document.execCommand('copy');
46
- }
47
- catch (err) {
48
- result = false;
49
- }
50
- return result;
51
- };
52
- ClipboardService.copyElement = function (element) {
53
- ClipboardService.selectElement(element);
54
- var res = ClipboardService.copySelected();
55
- if (res) {
56
- ClipboardService.deselect();
57
- }
58
- return res;
8
+ return typeof (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) !== 'undefined';
59
9
  };
60
10
  ClipboardService.copyCustom = function (text) {
61
- var textArea = document.createElement('textarea');
62
- textArea.style.position = 'fixed';
63
- textArea.style.top = '0';
64
- textArea.style.left = '0';
65
- // Ensure it has a small width and height. Setting to 1px / 1em
66
- // doesn't work as this gives a negative w/h on some browsers.
67
- textArea.style.width = '2em';
68
- textArea.style.height = '2em';
69
- // We don't need padding, reducing the size if it does flash render.
70
- textArea.style.padding = '0';
71
- // Clean up any borders.
72
- textArea.style.border = 'none';
73
- textArea.style.outline = 'none';
74
- textArea.style.boxShadow = 'none';
75
- // Avoid flash of white box if rendered for any reason.
76
- textArea.style.background = 'transparent';
77
- textArea.value = text;
78
- document.body.appendChild(textArea);
79
- textArea.select();
80
- var res = ClipboardService.copySelected();
81
- document.body.removeChild(textArea);
82
- return res;
11
+ return navigator.clipboard.writeText(text);
83
12
  };
84
13
  return ClipboardService;
85
14
  }());
package/utils/isUrl.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Loosely validate a URL `string`.
8
8
  *
9
- * @param {String} string
9
+ * @param {String} input
10
10
  * @return {Boolean}
11
11
  */
12
- export declare function isUrl(string: string): boolean;
12
+ export declare function isUrl(input: unknown): boolean;
package/utils/isUrl.js CHANGED
@@ -12,14 +12,14 @@ var nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/;
12
12
  /**
13
13
  * Loosely validate a URL `string`.
14
14
  *
15
- * @param {String} string
15
+ * @param {String} input
16
16
  * @return {Boolean}
17
17
  */
18
- function isUrl(string) {
19
- if (typeof string !== 'string') {
18
+ function isUrl(input) {
19
+ if (typeof input !== 'string') {
20
20
  return false;
21
21
  }
22
- var match = string.match(protocolAndDomainRE);
22
+ var match = input.match(protocolAndDomainRE);
23
23
  if (!match) {
24
24
  return false;
25
25
  }
@@ -1,3 +1,4 @@
1
1
  import type { FlattenSimpleInterpolation } from 'styled-components';
2
2
  export declare function getTypographyCssRulesByComponentName(componentName: string, fallbackName?: string): Record<string, string>;
3
3
  export declare function typography(componentName: string, fallbackName?: string): FlattenSimpleInterpolation;
4
+ export declare function generateCodeBlockTokens(): FlattenSimpleInterpolation | string;
@@ -4,8 +4,38 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  return cooked;
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.typography = exports.getTypographyCssRulesByComponentName = void 0;
7
+ exports.generateCodeBlockTokens = exports.typography = exports.getTypographyCssRulesByComponentName = void 0;
8
8
  var styled_components_1 = require("styled-components");
9
+ var Token;
10
+ (function (Token) {
11
+ Token["Comment"] = "comment";
12
+ Token["Prolog"] = "prolog";
13
+ Token["Doctype"] = "doctype";
14
+ Token["Cdata"] = "cdata";
15
+ Token["Punctuation"] = "punctuation";
16
+ Token["property"] = "property";
17
+ Token["Tag"] = "tag";
18
+ Token["Number"] = "number";
19
+ Token["Constant"] = "constant";
20
+ Token["Symbol"] = "symbol";
21
+ Token["Boolean"] = "boolean";
22
+ Token["Selector"] = "selector";
23
+ Token["String"] = "string";
24
+ Token["Char"] = "char";
25
+ Token["Builtin"] = "builtin";
26
+ Token["Inserted"] = "inserted";
27
+ Token["Operator"] = "operator";
28
+ Token["Entity"] = "entity";
29
+ Token["Url"] = "url";
30
+ Token["Variable"] = "variable";
31
+ Token["Atrule"] = "atrule";
32
+ Token["Keyword"] = "keyword";
33
+ Token["Regex"] = "regex";
34
+ Token["Important"] = "important";
35
+ Token["Bold"] = "bold";
36
+ Token["Italic"] = "italic";
37
+ Token["Deleted"] = "deleted";
38
+ })(Token || (Token = {}));
9
39
  var typographyProperties = Object.entries({
10
40
  fontSize: 'font-size',
11
41
  fontWeight: 'font-weight',
@@ -29,4 +59,14 @@ function typography(componentName, fallbackName) {
29
59
  return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), getTypographyCssRulesByComponentName(componentName, fallbackName));
30
60
  }
31
61
  exports.typography = typography;
32
- var templateObject_1;
62
+ function generateCodeBlockTokens() {
63
+ var res = '';
64
+ for (var _i = 0, _a = Object.values(Token); _i < _a.length; _i++) {
65
+ var token = _a[_i];
66
+ var cssTokenColorVariableName = "--code-block-tokens-".concat(token, "-color");
67
+ res += ".token.".concat(token, " { color: var(").concat(cssTokenColorVariableName, ")}; }\n");
68
+ }
69
+ return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n pre& {\n color: var(--code-block-tokens-default-color);\n }\n ", "\n "], ["\n pre& {\n color: var(--code-block-tokens-default-color);\n }\n ", "\n "])), res);
70
+ }
71
+ exports.generateCodeBlockTokens = generateCodeBlockTokens;
72
+ var templateObject_1, templateObject_2;
@@ -1,9 +0,0 @@
1
- import { ITypography } from '../../ui/Typography';
2
- export declare type Token = 'comment' | 'prolog' | 'doctype' | 'cdata' | 'punctuation' | 'property' | 'tag' | 'number' | 'constant' | 'symbol' | 'boolean' | 'selector' | 'string' | 'char' | 'builtin' | 'inserted' | 'operator' | 'entity' | 'url' | 'variable' | 'atrule' | 'keyword' | 'regex' | 'important' | 'important' | 'bold' | 'italic' | 'entity' | 'deleted';
3
- export declare type Tokens = {
4
- [P in Token]?: {
5
- color: string;
6
- };
7
- } & {
8
- default?: ITypography;
9
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,74 +0,0 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- import { Button } from '@theme/Button';
5
-
6
- export default {
7
- title: 'Components/Button',
8
- component: Button,
9
- argTypes: {
10
- size: {
11
- control: 'radio',
12
- options: ['small', 'medium', 'large', 'xlarge'],
13
- },
14
- color: {
15
- control: 'radio',
16
- options: ['primary', 'secondary', 'default'],
17
- },
18
- },
19
- } as ComponentMeta<typeof Button>;
20
-
21
- const Template: ComponentStory<typeof Button> = (args) => <Button {...args}>Click</Button>;
22
-
23
- export const Primary = Template.bind({});
24
- Primary.args = {
25
- color: 'primary',
26
- disabled: false,
27
- blinking: false,
28
- fullWidth: false,
29
- variant: 'contained',
30
- size: 'small',
31
- extraClass: 'test',
32
- };
33
-
34
- export const Secondary = Template.bind({});
35
- Secondary.args = {
36
- color: 'secondary',
37
- disabled: false,
38
- blinking: false,
39
- fullWidth: false,
40
- variant: 'contained',
41
- size: 'small',
42
- extraClass: 'test',
43
- };
44
-
45
- export const Outlined = Template.bind({});
46
- Outlined.args = {
47
- color: 'primary',
48
- disabled: false,
49
- blinking: false,
50
- fullWidth: false,
51
- variant: 'outlined',
52
- size: 'small',
53
- extraClass: 'test',
54
- };
55
-
56
- export const Disabled = Template.bind({});
57
- Disabled.args = {
58
- color: 'secondary',
59
- disabled: true,
60
- blinking: false,
61
- fullWidth: false,
62
- variant: 'contained',
63
- size: 'small',
64
- };
65
-
66
- export const Large = Template.bind({});
67
- Large.args = {
68
- color: 'default',
69
- disabled: false,
70
- blinking: false,
71
- fullWidth: false,
72
- variant: 'contained',
73
- size: 'large',
74
- };
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
-
4
- import { Button } from '@theme/Button';
5
-
6
- describe('Button', () => {
7
- it('renders', () => {
8
- const { container } = render(<Button>Test</Button>);
9
-
10
- expect(container.firstChild).toMatchSnapshot();
11
- });
12
-
13
- it('renders blinking', () => {
14
- const { container } = render(<Button blinking>Test</Button>);
15
-
16
- expect(container.firstChild).toMatchSnapshot();
17
- });
18
-
19
- it('renders with extra class', () => {
20
- const { container } = render(<Button extraClass="quick-fox">Test</Button>);
21
-
22
- expect(container.firstChild).toHaveClass('quick-fox');
23
- });
24
-
25
- it('renders disabled', () => {
26
- const { container } = render(<Button disabled>Test</Button>);
27
-
28
- expect(container.firstChild).toMatchSnapshot();
29
- });
30
-
31
- it('renders full width', () => {
32
- const { container } = render(<Button fullWidth>Test</Button>);
33
-
34
- expect(container.firstChild).toMatchSnapshot();
35
- });
36
-
37
- it('renders outlined', () => {
38
- const { container } = render(<Button variant="outlined">Test</Button>);
39
-
40
- expect(container.firstChild).toMatchSnapshot();
41
- });
42
- });
@@ -1,274 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Button renders 1`] = `
4
- .c1 {
5
- -webkit-text-decoration: none;
6
- text-decoration: none;
7
- text-align: center;
8
- width: auto;
9
- outline: none;
10
- border: none;
11
- border-radius: var(--button-border-radius);
12
- font-weight: var(--button-font-weight);
13
- font-size: 14px;
14
- padding: 2px 20px;
15
- cursor: pointer;
16
- -webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
17
- transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
18
- line-height: 1;
19
- font-family: var(--button-font-family);
20
- box-shadow: var(--button-box-shadow);
21
- color: var(--button-color);
22
- background-color: var(--button-background-color);
23
- font-size: var(--button-medium-font-size);
24
- padding: var(--button-medium-padding);
25
- min-width: var(--button-medium-min-width);
26
- }
27
-
28
- .c1:hover {
29
- box-shadow: var(--button-active-box-shadow);
30
- }
31
-
32
- .c1:active {
33
- box-shadow: var(--button-active-box-shadow);
34
- }
35
-
36
- .c1:hover {
37
- background-color: var(--button-hover-background-color);
38
- }
39
-
40
- .c1:active {
41
- background-color: var(--button-active-background-color);
42
- }
43
-
44
- .c0 + .c0 {
45
- margin-left: 0.85em;
46
- }
47
-
48
- <button
49
- class="c0 c1 button-color-default"
50
- >
51
- Test
52
- </button>
53
- `;
54
-
55
- exports[`Button renders blinking 1`] = `
56
- .c1 {
57
- -webkit-text-decoration: none;
58
- text-decoration: none;
59
- text-align: center;
60
- width: auto;
61
- outline: none;
62
- border: none;
63
- border-radius: var(--button-border-radius);
64
- font-weight: var(--button-font-weight);
65
- font-size: 14px;
66
- padding: 2px 20px;
67
- cursor: pointer;
68
- -webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
69
- transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
70
- line-height: 1;
71
- font-family: var(--button-font-family);
72
- box-shadow: var(--button-box-shadow);
73
- color: var(--button-color);
74
- background-color: var(--button-background-color);
75
- font-size: var(--button-medium-font-size);
76
- padding: var(--button-medium-padding);
77
- min-width: var(--button-medium-min-width);
78
- pointer-events: none;
79
- -webkit-animation: hiqtTO 1.2s infinite;
80
- animation: hiqtTO 1.2s infinite;
81
- }
82
-
83
- .c1:hover {
84
- box-shadow: var(--button-active-box-shadow);
85
- }
86
-
87
- .c1:active {
88
- box-shadow: var(--button-active-box-shadow);
89
- }
90
-
91
- .c1:hover {
92
- background-color: var(--button-hover-background-color);
93
- }
94
-
95
- .c1:active {
96
- background-color: var(--button-active-background-color);
97
- }
98
-
99
- .c0 + .c0 {
100
- margin-left: 0.85em;
101
- }
102
-
103
- <button
104
- class="c0 c1 button-color-default"
105
- >
106
- Test
107
- </button>
108
- `;
109
-
110
- exports[`Button renders disabled 1`] = `
111
- .c1 {
112
- -webkit-text-decoration: none;
113
- text-decoration: none;
114
- text-align: center;
115
- width: auto;
116
- outline: none;
117
- border: none;
118
- border-radius: var(--button-border-radius);
119
- font-weight: var(--button-font-weight);
120
- font-size: 14px;
121
- padding: 2px 20px;
122
- cursor: pointer;
123
- -webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
124
- transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
125
- line-height: 1;
126
- font-family: var(--button-font-family);
127
- box-shadow: var(--button-box-shadow);
128
- color: var(--button-color);
129
- background-color: var(--button-background-color);
130
- font-size: var(--button-medium-font-size);
131
- padding: var(--button-medium-padding);
132
- min-width: var(--button-medium-min-width);
133
- }
134
-
135
- .c1:hover {
136
- box-shadow: var(--button-active-box-shadow);
137
- }
138
-
139
- .c1:active {
140
- box-shadow: var(--button-active-box-shadow);
141
- }
142
-
143
- .c1:hover {
144
- background-color: var(--button-hover-background-color);
145
- }
146
-
147
- .c1:active {
148
- background-color: var(--button-active-background-color);
149
- }
150
-
151
- .c0 + .c0 {
152
- margin-left: 0.85em;
153
- }
154
-
155
- .c1,
156
- .c1:hover {
157
- cursor: default;
158
- color: #999999;
159
- pointer-events: none;
160
- }
161
-
162
- <button
163
- class="c0 c1 button-color-default"
164
- disabled=""
165
- >
166
- Test
167
- </button>
168
- `;
169
-
170
- exports[`Button renders full width 1`] = `
171
- .c1 {
172
- -webkit-text-decoration: none;
173
- text-decoration: none;
174
- text-align: center;
175
- width: 100%;
176
- outline: none;
177
- border: none;
178
- border-radius: var(--button-border-radius);
179
- font-weight: var(--button-font-weight);
180
- font-size: 14px;
181
- padding: 2px 20px;
182
- cursor: pointer;
183
- -webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
184
- transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
185
- line-height: 1;
186
- font-family: var(--button-font-family);
187
- box-shadow: var(--button-box-shadow);
188
- color: var(--button-color);
189
- background-color: var(--button-background-color);
190
- font-size: var(--button-medium-font-size);
191
- padding: var(--button-medium-padding);
192
- min-width: var(--button-medium-min-width);
193
- }
194
-
195
- .c1:hover {
196
- box-shadow: var(--button-active-box-shadow);
197
- }
198
-
199
- .c1:active {
200
- box-shadow: var(--button-active-box-shadow);
201
- }
202
-
203
- .c1:hover {
204
- background-color: var(--button-hover-background-color);
205
- }
206
-
207
- .c1:active {
208
- background-color: var(--button-active-background-color);
209
- }
210
-
211
- .c0 + .c0 {
212
- margin-left: 0.85em;
213
- }
214
-
215
- <button
216
- class="c0 c1 button-color-default"
217
- >
218
- Test
219
- </button>
220
- `;
221
-
222
- exports[`Button renders outlined 1`] = `
223
- .c1 {
224
- -webkit-text-decoration: none;
225
- text-decoration: none;
226
- text-align: center;
227
- width: auto;
228
- outline: none;
229
- border: none;
230
- border-radius: var(--button-border-radius);
231
- font-weight: var(--button-font-weight);
232
- font-size: 14px;
233
- padding: 2px 20px;
234
- cursor: pointer;
235
- -webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
236
- transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
237
- line-height: 1;
238
- font-family: var(--button-font-family);
239
- box-shadow: var(--button-box-shadow);
240
- color: var(--button-background-color);
241
- border: 2px solid var(--button-background-color);
242
- background-color: transparent;
243
- font-size: var(--button-medium-font-size);
244
- padding: var(--button-medium-padding);
245
- min-width: var(--button-medium-min-width);
246
- }
247
-
248
- .c1:hover {
249
- box-shadow: var(--button-active-box-shadow);
250
- }
251
-
252
- .c1:active {
253
- box-shadow: var(--button-active-box-shadow);
254
- }
255
-
256
- .c1:hover {
257
- border: 2px solid var(--button-active-background-color);
258
- background-color: transparent;
259
- }
260
-
261
- .c1:active {
262
- border: 2px solid var(--button-outlined-active-border-color);
263
- }
264
-
265
- .c0 + .c0 {
266
- margin-left: 0.85em;
267
- }
268
-
269
- <button
270
- class="c0 c1 button-color-default"
271
- >
272
- Test
273
- </button>
274
- `;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
-
4
- import { CodeBlock } from '@theme/CodeBlock';
5
-
6
- describe('CodeBlock', () => {
7
- it('renders', () => {
8
- const { container } = render(<CodeBlock>Test</CodeBlock>);
9
-
10
- expect(container.firstChild).toMatchSnapshot();
11
- });
12
- });