@atlaskit/code 15.6.8 → 15.6.10
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/CHANGELOG.md +15 -0
- package/dist/cjs/bidi-warning/ui/styled.js +3 -1
- package/dist/cjs/code.js +1 -0
- package/dist/cjs/internal/theme/get-theme.js +1 -0
- package/dist/cjs/internal/theme/styles.js +5 -2
- package/dist/es2019/bidi-warning/ui/styled.js +3 -1
- package/dist/es2019/code.js +1 -0
- package/dist/es2019/internal/theme/get-theme.js +1 -0
- package/dist/es2019/internal/theme/styles.js +4 -1
- package/dist/esm/bidi-warning/ui/styled.js +3 -1
- package/dist/esm/code.js +1 -0
- package/dist/esm/internal/theme/get-theme.js +1 -0
- package/dist/esm/internal/theme/styles.js +4 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/internal/theme/styles.d.ts +1 -13
- package/dist/types-ts4.5/constants.d.ts +1 -1
- package/dist/types-ts4.5/internal/theme/styles.d.ts +1 -13
- package/package.json +12 -4
- package/__perf__/code-block-100-lines.tsx +0 -7
- package/__perf__/code-block-1000-lines.tsx +0 -7
- package/__perf__/code-block-4458-lines.tsx +0 -7
- package/__perf__/code-block-500-lines.tsx +0 -7
- package/__perf__/code-block-no-syntax-highlighting.tsx +0 -7
- package/__perf__/code-block-syntax-highlighting.tsx +0 -31
- package/__perf__/inline-code.tsx +0 -5
- package/__perf__/source-code-examples/100-line-example.tsx +0 -113
- package/__perf__/source-code-examples/1000-line-example.tsx +0 -1000
- package/__perf__/source-code-examples/4458-line-example.tsx +0 -4461
- package/__perf__/source-code-examples/500-line-example.tsx +0 -501
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/code
|
|
2
2
|
|
|
3
|
+
## 15.6.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#105601](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105601)
|
|
8
|
+
[`948a599bf836d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/948a599bf836d) -
|
|
9
|
+
Update dependencies and remove unused internal exports.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 15.6.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 15.6.8
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -33,8 +33,10 @@ var decoration = (0, _react2.css)({
|
|
|
33
33
|
background: "var(--ds-background-warning, ".concat(_colors.Y75, ")"),
|
|
34
34
|
color: "var(--ds-text-warning, #7F5F01)",
|
|
35
35
|
content: '"<"attr(data-bidi-character-code)">"',
|
|
36
|
-
|
|
36
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
37
|
+
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
37
38
|
fontStyle: 'normal',
|
|
39
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
38
40
|
lineHeight: '18px',
|
|
39
41
|
/**
|
|
40
42
|
* Ensures the decoration receives pointer events when it occurs with
|
package/dist/cjs/code.js
CHANGED
|
@@ -39,6 +39,7 @@ var styles = (0, _react2.css)({
|
|
|
39
39
|
boxDecorationBreak: 'clone',
|
|
40
40
|
color: "var(--ds-text, #172B4D)",
|
|
41
41
|
font: "var(--ds-font-code, normal 400 0.875em/1 ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
42
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
42
43
|
lineHeight: 'inherit',
|
|
43
44
|
overflow: 'auto',
|
|
44
45
|
overflowWrap: 'break-word',
|
|
@@ -21,6 +21,7 @@ var Y1100 = '#7A5D1A';
|
|
|
21
21
|
var getBaseTheme = exports.getBaseTheme = function getBaseTheme() {
|
|
22
22
|
return {
|
|
23
23
|
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
24
25
|
fontFamilyItalic: "SFMono-MediumItalic, ".concat((0, _tokens.getTokenValue)('font.family.code')),
|
|
25
26
|
backgroundColor: "var(--ds-background-neutral, ".concat(colors.N20, ")"),
|
|
26
27
|
textColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getLineNumWidth = exports.getCodeStyles = exports.getCodeBlockTheme = exports.getCodeBlockStyles =
|
|
7
|
+
exports.getLineNumWidth = exports.getCodeStyles = exports.getCodeBlockTheme = exports.getCodeBlockStyles = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _constants = require("./constants");
|
|
10
10
|
var _getTheme = require("./get-theme");
|
|
@@ -195,9 +195,10 @@ var syntaxKeywordColors = function syntaxKeywordColors(theme) {
|
|
|
195
195
|
/**
|
|
196
196
|
* Styles applied at the root element level, common across code/codeblock
|
|
197
197
|
*/
|
|
198
|
-
var getBaseCodeStyles =
|
|
198
|
+
var getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
199
199
|
return {
|
|
200
200
|
fontSize: _constants.CODE_FONT_SIZE,
|
|
201
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
201
202
|
fontFamily: theme.fontFamily,
|
|
202
203
|
fontWeight: "var(--ds-font-weight-regular, 400)",
|
|
203
204
|
backgroundColor: "var(".concat(_constants.VAR_CODE_BG_COLOR, ",").concat(theme.backgroundColor, ")"),
|
|
@@ -223,6 +224,7 @@ var getCodeBlockStyles = exports.getCodeBlockStyles = function getCodeBlockStyle
|
|
|
223
224
|
tabSize: 4
|
|
224
225
|
},
|
|
225
226
|
display: 'flex',
|
|
227
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
226
228
|
lineHeight: _constants.CODE_LINE_HEIGHT,
|
|
227
229
|
overflowX: 'auto',
|
|
228
230
|
whiteSpace: 'pre',
|
|
@@ -309,6 +311,7 @@ var getCodeStyles = exports.getCodeStyles = function getCodeStyles() {
|
|
|
309
311
|
display: 'inline',
|
|
310
312
|
padding: '2px 0.5ch',
|
|
311
313
|
boxDecorationBreak: 'clone',
|
|
314
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
312
315
|
fontSize: '0.875em',
|
|
313
316
|
overflow: 'auto',
|
|
314
317
|
overflowWrap: 'break-word',
|
|
@@ -25,8 +25,10 @@ const decoration = css({
|
|
|
25
25
|
background: `var(--ds-background-warning, ${Y75})`,
|
|
26
26
|
color: "var(--ds-text-warning, #7F5F01)",
|
|
27
27
|
content: '"<"attr(data-bidi-character-code)">"',
|
|
28
|
-
|
|
28
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
29
|
+
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
29
30
|
fontStyle: 'normal',
|
|
31
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
30
32
|
lineHeight: '18px',
|
|
31
33
|
/**
|
|
32
34
|
* Ensures the decoration receives pointer events when it occurs with
|
package/dist/es2019/code.js
CHANGED
|
@@ -21,6 +21,7 @@ const styles = css({
|
|
|
21
21
|
boxDecorationBreak: 'clone',
|
|
22
22
|
color: "var(--ds-text, #172B4D)",
|
|
23
23
|
font: "var(--ds-font-code, normal 400 0.875em/1 ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
24
25
|
lineHeight: 'inherit',
|
|
25
26
|
overflow: 'auto',
|
|
26
27
|
overflowWrap: 'break-word',
|
|
@@ -7,6 +7,7 @@ const T800 = '#067384';
|
|
|
7
7
|
const Y1100 = '#7A5D1A';
|
|
8
8
|
export const getBaseTheme = () => ({
|
|
9
9
|
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
10
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
10
11
|
fontFamilyItalic: `SFMono-MediumItalic, ${getTokenValue('font.family.code')}`,
|
|
11
12
|
backgroundColor: `var(--ds-background-neutral, ${colors.N20})`,
|
|
12
13
|
textColor: `var(--ds-text, ${colors.N800})`,
|
|
@@ -183,8 +183,9 @@ const syntaxKeywordColors = theme => ({
|
|
|
183
183
|
/**
|
|
184
184
|
* Styles applied at the root element level, common across code/codeblock
|
|
185
185
|
*/
|
|
186
|
-
|
|
186
|
+
const getBaseCodeStyles = theme => ({
|
|
187
187
|
fontSize: CODE_FONT_SIZE,
|
|
188
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
188
189
|
fontFamily: theme.fontFamily,
|
|
189
190
|
fontWeight: "var(--ds-font-weight-regular, 400)",
|
|
190
191
|
backgroundColor: `var(${VAR_CODE_BG_COLOR},${theme.backgroundColor})`,
|
|
@@ -207,6 +208,7 @@ export const getCodeBlockStyles = theme => (highlightedStartText, highlightedEnd
|
|
|
207
208
|
tabSize: 4
|
|
208
209
|
},
|
|
209
210
|
display: 'flex',
|
|
211
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
210
212
|
lineHeight: CODE_LINE_HEIGHT,
|
|
211
213
|
overflowX: 'auto',
|
|
212
214
|
whiteSpace: 'pre',
|
|
@@ -294,6 +296,7 @@ export const getCodeStyles = () => {
|
|
|
294
296
|
display: 'inline',
|
|
295
297
|
padding: '2px 0.5ch',
|
|
296
298
|
boxDecorationBreak: 'clone',
|
|
299
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
297
300
|
fontSize: '0.875em',
|
|
298
301
|
overflow: 'auto',
|
|
299
302
|
overflowWrap: 'break-word',
|
|
@@ -25,8 +25,10 @@ var decoration = css({
|
|
|
25
25
|
background: "var(--ds-background-warning, ".concat(Y75, ")"),
|
|
26
26
|
color: "var(--ds-text-warning, #7F5F01)",
|
|
27
27
|
content: '"<"attr(data-bidi-character-code)">"',
|
|
28
|
-
|
|
28
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
29
|
+
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
29
30
|
fontStyle: 'normal',
|
|
31
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
30
32
|
lineHeight: '18px',
|
|
31
33
|
/**
|
|
32
34
|
* Ensures the decoration receives pointer events when it occurs with
|
package/dist/esm/code.js
CHANGED
|
@@ -24,6 +24,7 @@ var styles = css({
|
|
|
24
24
|
boxDecorationBreak: 'clone',
|
|
25
25
|
color: "var(--ds-text, #172B4D)",
|
|
26
26
|
font: "var(--ds-font-code, normal 400 0.875em/1 ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
27
28
|
lineHeight: 'inherit',
|
|
28
29
|
overflow: 'auto',
|
|
29
30
|
overflowWrap: 'break-word',
|
|
@@ -11,6 +11,7 @@ var Y1100 = '#7A5D1A';
|
|
|
11
11
|
export var getBaseTheme = function getBaseTheme() {
|
|
12
12
|
return {
|
|
13
13
|
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
14
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
14
15
|
fontFamilyItalic: "SFMono-MediumItalic, ".concat(getTokenValue('font.family.code')),
|
|
15
16
|
backgroundColor: "var(--ds-background-neutral, ".concat(colors.N20, ")"),
|
|
16
17
|
textColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
@@ -190,9 +190,10 @@ var syntaxKeywordColors = function syntaxKeywordColors(theme) {
|
|
|
190
190
|
/**
|
|
191
191
|
* Styles applied at the root element level, common across code/codeblock
|
|
192
192
|
*/
|
|
193
|
-
|
|
193
|
+
var getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
194
194
|
return {
|
|
195
195
|
fontSize: CODE_FONT_SIZE,
|
|
196
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
196
197
|
fontFamily: theme.fontFamily,
|
|
197
198
|
fontWeight: "var(--ds-font-weight-regular, 400)",
|
|
198
199
|
backgroundColor: "var(".concat(VAR_CODE_BG_COLOR, ",").concat(theme.backgroundColor, ")"),
|
|
@@ -218,6 +219,7 @@ export var getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
|
218
219
|
tabSize: 4
|
|
219
220
|
},
|
|
220
221
|
display: 'flex',
|
|
222
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
221
223
|
lineHeight: CODE_LINE_HEIGHT,
|
|
222
224
|
overflowX: 'auto',
|
|
223
225
|
whiteSpace: 'pre',
|
|
@@ -304,6 +306,7 @@ export var getCodeStyles = function getCodeStyles() {
|
|
|
304
306
|
display: 'inline',
|
|
305
307
|
padding: '2px 0.5ch',
|
|
306
308
|
boxDecorationBreak: 'clone',
|
|
309
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
307
310
|
fontSize: '0.875em',
|
|
308
311
|
overflow: 'auto',
|
|
309
312
|
overflowWrap: 'break-word',
|
|
@@ -326,5 +326,5 @@ export declare const SUPPORTED_LANGUAGES: readonly [{
|
|
|
326
326
|
export { CODE_BLOCK_SELECTOR } from './internal/theme/constants';
|
|
327
327
|
export type Language = (typeof SUPPORTED_LANGUAGES)[number];
|
|
328
328
|
export type LanguageAlias = (typeof SUPPORTED_LANGUAGES)[number]['alias'][number];
|
|
329
|
-
|
|
329
|
+
type LanguageName = (typeof SUPPORTED_LANGUAGES)[number]['name'];
|
|
330
330
|
export type SupportedLanguages = LanguageName | LanguageAlias;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { CSSObject } from '@emotion/react';
|
|
2
|
-
import type { CodeBlockTheme
|
|
2
|
+
import type { CodeBlockTheme } from './types';
|
|
3
3
|
export declare const getLineNumWidth: (numLines: number) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Styles applied at the root element level, common across code/codeblock
|
|
6
|
-
*/
|
|
7
|
-
export declare const getBaseCodeStyles: (theme: CodeTheme) => {
|
|
8
|
-
fontSize: number;
|
|
9
|
-
fontFamily: string | undefined;
|
|
10
|
-
fontWeight: "var(--ds-font-weight-regular)";
|
|
11
|
-
backgroundColor: string;
|
|
12
|
-
color: string | undefined;
|
|
13
|
-
borderStyle: string;
|
|
14
|
-
borderRadius: "var(--ds-border-radius)";
|
|
15
|
-
};
|
|
16
4
|
/**
|
|
17
5
|
* Takes an implemented CodeBlock theme, and returns styles required for
|
|
18
6
|
* react-syntax-highlighter.
|
|
@@ -652,5 +652,5 @@ export declare const SUPPORTED_LANGUAGES: readonly [
|
|
|
652
652
|
export { CODE_BLOCK_SELECTOR } from './internal/theme/constants';
|
|
653
653
|
export type Language = (typeof SUPPORTED_LANGUAGES)[number];
|
|
654
654
|
export type LanguageAlias = (typeof SUPPORTED_LANGUAGES)[number]['alias'][number];
|
|
655
|
-
|
|
655
|
+
type LanguageName = (typeof SUPPORTED_LANGUAGES)[number]['name'];
|
|
656
656
|
export type SupportedLanguages = LanguageName | LanguageAlias;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { CSSObject } from '@emotion/react';
|
|
2
|
-
import type { CodeBlockTheme
|
|
2
|
+
import type { CodeBlockTheme } from './types';
|
|
3
3
|
export declare const getLineNumWidth: (numLines: number) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Styles applied at the root element level, common across code/codeblock
|
|
6
|
-
*/
|
|
7
|
-
export declare const getBaseCodeStyles: (theme: CodeTheme) => {
|
|
8
|
-
fontSize: number;
|
|
9
|
-
fontFamily: string | undefined;
|
|
10
|
-
fontWeight: "var(--ds-font-weight-regular)";
|
|
11
|
-
backgroundColor: string;
|
|
12
|
-
color: string | undefined;
|
|
13
|
-
borderStyle: string;
|
|
14
|
-
borderRadius: "var(--ds-border-radius)";
|
|
15
|
-
};
|
|
16
4
|
/**
|
|
17
5
|
* Takes an implemented CodeBlock theme, and returns styles required for
|
|
18
6
|
* react-syntax-highlighter.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/code",
|
|
3
|
-
"version": "15.6.
|
|
3
|
+
"version": "15.6.10",
|
|
4
4
|
"description": "Code highlights short strings of code snippets inline with body text.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
32
32
|
"@atlaskit/theme": "^14.0.0",
|
|
33
|
-
"@atlaskit/tokens": "^2.
|
|
33
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
34
34
|
"@atlaskit/tooltip": "^19.0.0",
|
|
35
35
|
"@atlaskit/visually-hidden": "^1.5.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
@@ -45,17 +45,25 @@
|
|
|
45
45
|
"@af/accessibility-testing": "*",
|
|
46
46
|
"@af/integration-testing": "*",
|
|
47
47
|
"@af/visual-regression": "*",
|
|
48
|
+
"@atlaskit/button": "^20.3.10",
|
|
49
|
+
"@atlaskit/docs": "*",
|
|
48
50
|
"@atlaskit/ds-lib": "^3.3.0",
|
|
51
|
+
"@atlaskit/form": "^11.0.2",
|
|
52
|
+
"@atlaskit/link": "*",
|
|
53
|
+
"@atlaskit/primitives": "^13.3.8",
|
|
54
|
+
"@atlaskit/section-message": "*",
|
|
49
55
|
"@atlaskit/ssr": "*",
|
|
50
|
-
"@atlaskit/toggle": "^
|
|
51
|
-
"@
|
|
56
|
+
"@atlaskit/toggle": "^14.0.0",
|
|
57
|
+
"@compiled/react": "^0.18.1",
|
|
52
58
|
"@testing-library/react": "^12.1.5",
|
|
53
59
|
"@types/jscodeshift": "^0.11.0",
|
|
54
60
|
"@types/refractor": "^3.0.2",
|
|
55
61
|
"color-contrast-checker": "^1.5.0",
|
|
62
|
+
"css-loader": "^2.0.0",
|
|
56
63
|
"jscodeshift": "^0.13.0",
|
|
57
64
|
"prismjs": "^1.25.0",
|
|
58
65
|
"react-dom": "^16.8.0",
|
|
66
|
+
"style-loader": "^0.16.1",
|
|
59
67
|
"typescript": "~5.4.2"
|
|
60
68
|
},
|
|
61
69
|
"keywords": [
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { CodeBlock } from '../src';
|
|
4
|
-
|
|
5
|
-
export const text = `/**
|
|
6
|
-
* @jsxRuntime classic
|
|
7
|
-
* @jsx jsx
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import ReactDOM from 'react-dom';
|
|
11
|
-
import styled from '@emotion/styled';
|
|
12
|
-
import { jsx } from '@emotion/react';
|
|
13
|
-
import { N800 } from '@atlaskit/theme/colors';
|
|
14
|
-
|
|
15
|
-
// TODO refactor
|
|
16
|
-
const Content = styled.div\`
|
|
17
|
-
color: \${N800};
|
|
18
|
-
margin-top: 8px !important;
|
|
19
|
-
\`
|
|
20
|
-
|
|
21
|
-
class HelloMessage extends React.Component {
|
|
22
|
-
render() {
|
|
23
|
-
return (
|
|
24
|
-
<Content css={{ background: "green" }}>Hello {this.props.name}</Content>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ReactDOM.render(<HelloMessage name="Taylor" />, document.body);`;
|
|
30
|
-
|
|
31
|
-
export default () => <CodeBlock text={text} language="jsx" />;
|
package/__perf__/inline-code.tsx
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// eslint-disable-file
|
|
2
|
-
export const hundredLineExample = `/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
|
-
/**
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
7
|
-
import React, { CSSProperties, forwardRef } from 'react';
|
|
8
|
-
|
|
9
|
-
import { css, jsx } from '@emotion/react';
|
|
10
|
-
|
|
11
|
-
import { BackgroundColor, Box, Inline, xcss } from '@atlaskit/primitives';
|
|
12
|
-
import { N0, N500, N700, R400, Y300 } from '@atlaskit/theme/colors';
|
|
13
|
-
import { token } from '@atlaskit/tokens';
|
|
14
|
-
|
|
15
|
-
const CSS_VAR_TEXT_COLOR = '--banner-text-color';
|
|
16
|
-
|
|
17
|
-
const textStyles = css({
|
|
18
|
-
color: \`var(\${CSS_VAR_TEXT_COLOR})\`,
|
|
19
|
-
font: token('font.body'),
|
|
20
|
-
fontWeight: token('font.weight.medium', '500'),
|
|
21
|
-
overflow: 'hidden',
|
|
22
|
-
textOverflow: 'ellipsis',
|
|
23
|
-
whiteSpace: 'nowrap',
|
|
24
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
25
|
-
'a, a:visited, a:hover, a:focus, a:active': {
|
|
26
|
-
color: 'currentColor',
|
|
27
|
-
textDecoration: 'underline',
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const backgroundColors: Record<Appearance, BackgroundColor> = {
|
|
32
|
-
warning: 'color.background.warning.bold',
|
|
33
|
-
error: 'color.background.danger.bold',
|
|
34
|
-
announcement: 'color.background.neutral.bold',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const tokenBackgroundColors: Record<Appearance, string> = {
|
|
38
|
-
warning: token('color.background.warning.bold', Y300),
|
|
39
|
-
error: token('color.background.danger.bold', R400),
|
|
40
|
-
announcement: token('color.background.neutral.bold', N500),
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const tokenTextColors: Record<Appearance, string> = {
|
|
44
|
-
warning: token('color.text.warning.inverse', N700),
|
|
45
|
-
error: token('color.text.inverse', N0),
|
|
46
|
-
announcement: token('color.text.inverse', N0),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
type Appearance = 'warning' | 'error' | 'announcement';
|
|
50
|
-
|
|
51
|
-
const containerStyles = xcss({
|
|
52
|
-
overflow: 'hidden',
|
|
53
|
-
maxHeight: 'size.500',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const iconWrapperStyles = xcss({
|
|
57
|
-
display: 'block',
|
|
58
|
-
width: 'size.200',
|
|
59
|
-
height: 'size.200', // This matches Icon's "medium" size, without this the (line-)height is greater than that of the Icon
|
|
60
|
-
flexShrink: '0',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export interface BannerProps {
|
|
64
|
-
appearance?: Appearance;
|
|
65
|
-
children?: React.ReactNode;
|
|
66
|
-
icon?: React.ReactElement;
|
|
67
|
-
testId?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const Banner = forwardRef<HTMLDivElement, BannerProps>(
|
|
71
|
-
({ appearance = 'warning', children, icon, testId }, ref) => {
|
|
72
|
-
const appearanceType =
|
|
73
|
-
appearance in backgroundColors ? appearance : 'warning';
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<Box
|
|
77
|
-
xcss={containerStyles}
|
|
78
|
-
backgroundColor={backgroundColors[appearanceType]}
|
|
79
|
-
padding="space.150"
|
|
80
|
-
testId={testId}
|
|
81
|
-
ref={ref}
|
|
82
|
-
role="alert"
|
|
83
|
-
>
|
|
84
|
-
<Inline space="space.050" alignBlock="center" alignInline="start">
|
|
85
|
-
{icon ? (
|
|
86
|
-
<Box
|
|
87
|
-
as="span"
|
|
88
|
-
xcss={iconWrapperStyles}
|
|
89
|
-
style={{
|
|
90
|
-
fill: tokenBackgroundColors[appearanceType],
|
|
91
|
-
color: tokenTextColors[appearanceType],
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
{icon}
|
|
95
|
-
</Box>
|
|
96
|
-
) : null}
|
|
97
|
-
<span
|
|
98
|
-
style={
|
|
99
|
-
{
|
|
100
|
-
[CSS_VAR_TEXT_COLOR]: tokenTextColors[appearanceType],
|
|
101
|
-
} as CSSProperties
|
|
102
|
-
}
|
|
103
|
-
css={textStyles}
|
|
104
|
-
>
|
|
105
|
-
{children}
|
|
106
|
-
</span>
|
|
107
|
-
</Inline>
|
|
108
|
-
</Box>
|
|
109
|
-
);
|
|
110
|
-
},
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
export default Banner;`;
|