@atlaskit/code 14.4.5 → 14.4.7
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 +12 -0
- package/__perf__/code-block-100-lines.tsx +7 -0
- package/__perf__/code-block-1000-lines.tsx +7 -0
- package/__perf__/code-block-4458-lines.tsx +7 -0
- package/__perf__/code-block-500-lines.tsx +7 -0
- package/__perf__/{code-block-text.tsx → code-block-no-syntax-highlighting.tsx} +1 -1
- package/__perf__/{code-block-jsx.tsx → code-block-syntax-highlighting.tsx} +0 -0
- package/__perf__/{default.tsx → inline-code.tsx} +0 -0
- package/__perf__/source-code-examples/100-line-example.tsx +101 -0
- package/__perf__/source-code-examples/1000-line-example.tsx +1000 -0
- package/__perf__/source-code-examples/4458-line-example.tsx +4461 -0
- package/__perf__/source-code-examples/500-line-example.tsx +501 -0
- package/dist/cjs/bidi-warning/bidi-warning-decorator.js +6 -19
- package/dist/cjs/bidi-warning/index.js +0 -2
- package/dist/cjs/bidi-warning/ui/index.js +6 -17
- package/dist/cjs/bidi-warning/ui/styled.js +7 -12
- package/dist/cjs/code-block.js +25 -34
- package/dist/cjs/code.js +11 -33
- package/dist/cjs/constants.js +0 -2
- package/dist/cjs/entry-points/block.js +0 -2
- package/dist/cjs/entry-points/constants.js +0 -1
- package/dist/cjs/entry-points/inline.js +0 -4
- package/dist/cjs/extract-react-types/code-block.js +0 -1
- package/dist/cjs/extract-react-types/code.js +0 -1
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/internal/hooks/use-highlight.js +10 -24
- package/dist/cjs/internal/theme/constants.js +2 -3
- package/dist/cjs/internal/theme/get-theme.js +0 -16
- package/dist/cjs/internal/theme/styles.js +4 -23
- package/dist/cjs/internal/utils/get-normalized-language.js +2 -8
- package/dist/cjs/react-syntax-highlighter-bidi-warning-renderer.js +17 -41
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/bidi-warning/bidi-warning-decorator.js +5 -9
- package/dist/es2019/bidi-warning/ui/index.js +0 -1
- package/dist/es2019/bidi-warning/ui/styled.js +5 -6
- package/dist/es2019/code-block.js +5 -3
- package/dist/es2019/code.js +0 -7
- package/dist/es2019/internal/hooks/use-highlight.js +4 -8
- package/dist/es2019/internal/theme/constants.js +2 -1
- package/dist/es2019/internal/theme/get-theme.js +2 -3
- package/dist/es2019/internal/theme/styles.js +8 -9
- package/dist/es2019/internal/utils/get-normalized-language.js +2 -3
- package/dist/es2019/react-syntax-highlighter-bidi-warning-renderer.js +14 -21
- package/dist/es2019/version.json +1 -1
- package/dist/esm/bidi-warning/bidi-warning-decorator.js +6 -16
- package/dist/esm/bidi-warning/ui/index.js +6 -9
- package/dist/esm/bidi-warning/ui/styled.js +7 -8
- package/dist/esm/code-block.js +26 -26
- package/dist/esm/code.js +11 -21
- package/dist/esm/internal/hooks/use-highlight.js +10 -19
- package/dist/esm/internal/theme/constants.js +2 -1
- package/dist/esm/internal/theme/get-theme.js +0 -5
- package/dist/esm/internal/theme/styles.js +4 -10
- package/dist/esm/internal/utils/get-normalized-language.js +2 -3
- package/dist/esm/react-syntax-highlighter-bidi-warning-renderer.js +20 -33
- package/dist/esm/version.json +1 -1
- package/package.json +1 -1
- package/report.api.md +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/code
|
|
2
2
|
|
|
3
|
+
## 14.4.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
8
|
+
|
|
9
|
+
## 14.4.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`b0f6dd0bc35`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b0f6dd0bc35) - Updated to use typography tokens. There is no expected behaviour or visual change.
|
|
14
|
+
|
|
3
15
|
## 14.4.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// eslint-disable-file
|
|
2
|
+
export const hundredLineExample = `/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
7
|
+
|
|
8
|
+
import { UNSAFE_Box as Box, UNSAFE_BoxProps as BoxProps, UNSAFE_Inline as Inline, UNSAFE_Text as Text, UNSAFE_TextProps as TextProps, } from '@atlaskit/ds-explorations';
|
|
9
|
+
import { N0, N500, N700, R400, Y300 } from '@atlaskit/theme/colors';
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
|
|
12
|
+
// Applies styles to nested links within banner messages.
|
|
13
|
+
const nestedLinkStyles = css({
|
|
14
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
15
|
+
'a, a:visited, a:hover, a:focus, a:active': {
|
|
16
|
+
color: 'currentColor',
|
|
17
|
+
textDecoration: 'underline',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const backgroundColors: Record<Appearance, BoxProps['backgroundColor']> = {
|
|
22
|
+
warning: 'warning.bold',
|
|
23
|
+
error: 'danger.bold',
|
|
24
|
+
announcement: 'neutral.bold',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const tokenBackgroundColors: Record<Appearance, string> = {
|
|
28
|
+
warning: token('color.background.warning.bold', Y300),
|
|
29
|
+
error: token('color.background.danger.bold', R400),
|
|
30
|
+
announcement: token('color.background.neutral.bold', N500),
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const textColors: Record<Appearance, TextProps['color']> = {
|
|
34
|
+
warning: 'warning.inverse',
|
|
35
|
+
error: 'inverse',
|
|
36
|
+
announcement: 'inverse',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const tokenTextColors: Record<Appearance, string> = {
|
|
40
|
+
warning: token('color.text.warning.inverse', N700),
|
|
41
|
+
error: token('color.text.inverse', N0),
|
|
42
|
+
announcement: token('color.text.inverse', N0),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type Appearance = 'warning' | 'error' | 'announcement';
|
|
46
|
+
|
|
47
|
+
interface BannerProps {
|
|
48
|
+
appearance?: Appearance;
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
icon?: React.ReactElement;
|
|
51
|
+
testId?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const Banner = forwardRef<HTMLDivElement, BannerProps>(
|
|
55
|
+
({ appearance = 'warning', children, icon, testId }, ref) => {
|
|
56
|
+
const appearanceType =
|
|
57
|
+
appearance in backgroundColors ? appearance : 'warning';
|
|
58
|
+
|
|
59
|
+
const accessibilityProps = useMemo(() => {
|
|
60
|
+
const baseProps = {
|
|
61
|
+
role: 'alert',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (appearance === 'announcement') {
|
|
65
|
+
return {
|
|
66
|
+
...baseProps,
|
|
67
|
+
'aria-label': 'announcement',
|
|
68
|
+
tabIndex: 0,
|
|
69
|
+
role: 'region',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return baseProps;
|
|
74
|
+
}, [appearance]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Box display="block" backgroundColor={backgroundColors[appearanceType]} paddingInline="space.150" overflow="hidden" testId={testId} ref={ref} {...accessibilityProps} UNSAFE_style={{ paddingBlock: '14px', maxHeight: '52px', }} css={nestedLinkStyles} >
|
|
78
|
+
<Inline gap="space.050" alignItems="center" justifyContent="start">
|
|
79
|
+
{icon ? (
|
|
80
|
+
<Box
|
|
81
|
+
as="span"
|
|
82
|
+
display="inline"
|
|
83
|
+
width="size.300"
|
|
84
|
+
height="size.300" // This matches Icon's "medium" size, without this the (line-)height is greater than that of the Icon
|
|
85
|
+
UNSAFE_style={{
|
|
86
|
+
fill: tokenBackgroundColors[appearanceType],
|
|
87
|
+
color: tokenTextColors[appearanceType],
|
|
88
|
+
flexShrink: 0,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{icon}
|
|
92
|
+
</Box>
|
|
93
|
+
) : null}
|
|
94
|
+
<Text fontWeight="medium" lineHeight="lineHeight.300" color={textColors[appearanceType]} shouldTruncate> {children} </Text>
|
|
95
|
+
</Inline>
|
|
96
|
+
</Box>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
export default Banner;`;
|