@bitrise/bitkit 12.26.1 → 12.27.0
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.27.0",
|
|
5
5
|
"repository": "git@github.com:bitrise-io/bitkit.git",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
"luxon": "^3.1.0",
|
|
35
35
|
"react": "^18.2.0",
|
|
36
36
|
"react-dom": "^18.2.0",
|
|
37
|
-
"react-focus-lock": "^2.9.1"
|
|
37
|
+
"react-focus-lock": "^2.9.1",
|
|
38
|
+
"react-markdown": "^8.0.7",
|
|
39
|
+
"rehype-sanitize": "^5.0.1"
|
|
38
40
|
},
|
|
39
41
|
"peerDependencies": {
|
|
40
42
|
"react": "^18.2.0",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineStyle, defineStyleConfig } from '@chakra-ui/styled-system';
|
|
2
|
+
|
|
3
|
+
const baseStyle = defineStyle({
|
|
4
|
+
py: '8',
|
|
5
|
+
px: '12',
|
|
6
|
+
bg: 'neutral.95',
|
|
7
|
+
border: '1px solid',
|
|
8
|
+
borderColor: 'separator.primary',
|
|
9
|
+
borderRadius: '8',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default defineStyleConfig({
|
|
13
|
+
baseStyle,
|
|
14
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Status } from './Note';
|
|
2
|
+
|
|
3
|
+
const borderColor = {
|
|
4
|
+
info: 'separator.primary',
|
|
5
|
+
error: 'red.80',
|
|
6
|
+
warning: 'yellow.80',
|
|
7
|
+
success: 'green.80',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const decorationBackground = {
|
|
11
|
+
info: 'neutral.95',
|
|
12
|
+
error: 'red.95',
|
|
13
|
+
warning: 'yellow.95',
|
|
14
|
+
success: 'green.95',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const decorationColor = {
|
|
18
|
+
info: 'neutral.40',
|
|
19
|
+
error: 'red.50',
|
|
20
|
+
warning: 'yellow.50',
|
|
21
|
+
success: 'green.50',
|
|
22
|
+
};
|
|
23
|
+
const NoteTheme = {
|
|
24
|
+
parts: ['container', 'icon', 'body'],
|
|
25
|
+
baseStyle({ status }: { status: Status }) {
|
|
26
|
+
return {
|
|
27
|
+
wrapper: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
boxShadow: 'medium',
|
|
30
|
+
},
|
|
31
|
+
decoration: {
|
|
32
|
+
color: decorationColor[status],
|
|
33
|
+
display: 'flex',
|
|
34
|
+
width: '40',
|
|
35
|
+
borderTopLeftRadius: '8',
|
|
36
|
+
borderBottomLeftRadius: '8',
|
|
37
|
+
borderWidth: '1px',
|
|
38
|
+
borderRight: 'none',
|
|
39
|
+
px: '8',
|
|
40
|
+
py: '12',
|
|
41
|
+
borderColor: borderColor[status],
|
|
42
|
+
bg: decorationBackground[status],
|
|
43
|
+
},
|
|
44
|
+
container: {
|
|
45
|
+
flexGrow: 1,
|
|
46
|
+
paddingTop: '24',
|
|
47
|
+
paddingRight: '24',
|
|
48
|
+
paddingBottom: '32',
|
|
49
|
+
paddingLeft: '16',
|
|
50
|
+
borderTopRightRadius: '8',
|
|
51
|
+
borderBottomRightRadius: '8',
|
|
52
|
+
borderWidth: '1px',
|
|
53
|
+
borderLeft: 'none',
|
|
54
|
+
borderColor: borderColor[status],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default NoteTheme;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
|
+
import Box from '../Box/Box';
|
|
4
|
+
import Icon from '../Icon/Icon';
|
|
5
|
+
|
|
6
|
+
export type Status = 'info' | 'success' | 'error' | 'warning';
|
|
7
|
+
const iconNames = {
|
|
8
|
+
info: 'Info',
|
|
9
|
+
success: 'Tick',
|
|
10
|
+
error: 'ErrorGeneral',
|
|
11
|
+
warning: 'Warning',
|
|
12
|
+
} as const;
|
|
13
|
+
const Note = ({ children, status }: { children: ReactNode; status: Status }) => {
|
|
14
|
+
const { container, decoration, wrapper } = useMultiStyleConfig('Note', { status });
|
|
15
|
+
return (
|
|
16
|
+
<Box __css={wrapper}>
|
|
17
|
+
<Box __css={decoration}>
|
|
18
|
+
<Icon size="24" name={iconNames[status]} />
|
|
19
|
+
</Box>
|
|
20
|
+
<Box __css={container}>{children}</Box>
|
|
21
|
+
</Box>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default Note;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import ReactMarkdown, { Components } from 'react-markdown';
|
|
2
|
+
import rehypeSanitize from 'rehype-sanitize';
|
|
3
|
+
import { Code } from '@chakra-ui/react';
|
|
4
|
+
|
|
5
|
+
import List from '../List/List';
|
|
6
|
+
import ListItem from '../List/ListItem';
|
|
7
|
+
import Box from '../Box/Box';
|
|
8
|
+
import Divider from '../Divider/Divider';
|
|
9
|
+
import Text from '../Text/Text';
|
|
10
|
+
|
|
11
|
+
const components: Components = {
|
|
12
|
+
h1: ({ node, ...props }) => <Text size="6" {...props} />,
|
|
13
|
+
h2: ({ node, ...props }) => <Text paddingTop="12" size="5" {...props} />,
|
|
14
|
+
h3: ({ node, ...props }) => <Text paddingTop="12" size="4" fontWeight="bold" {...props} />,
|
|
15
|
+
h4: ({ node, ...props }) => <Text paddingTop="12" size="3" fontWeight="bold" {...props} />,
|
|
16
|
+
h5: ({ node, ...props }) => <Text paddingTop="12" size="2" fontWeight="bold" {...props} />,
|
|
17
|
+
h6: ({ node, ...props }) => <Text paddingTop="12" size="1" fontWeight="bold" {...props} />,
|
|
18
|
+
p: ({ node, ...props }) => <Text {...props} />,
|
|
19
|
+
hr: () => <Divider my="16" borderColor="separator.primary" size="2" />,
|
|
20
|
+
pre: ({ node, ...props }) => <Code {...props} />,
|
|
21
|
+
ul: ({ node, ordered, ...props }) => <List paddingBottom="8" {...props} />,
|
|
22
|
+
ol: ({ node, ordered, ...props }) => <List paddingBottom="8" isOrdered {...props} />,
|
|
23
|
+
li: ({ node, ordered, ...props }) => <ListItem {...props} />,
|
|
24
|
+
blockquote: ({ children }) => (
|
|
25
|
+
<Box
|
|
26
|
+
py="8"
|
|
27
|
+
as="blockquote"
|
|
28
|
+
paddingLeft="16"
|
|
29
|
+
borderLeftStyle="solid"
|
|
30
|
+
borderLeftWidth="2px"
|
|
31
|
+
borderColor="separator.primary"
|
|
32
|
+
color="text.secondary"
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</Box>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
const NoteMarkdownContent = ({ md }: { md: string }) => {
|
|
39
|
+
return (
|
|
40
|
+
<Box display="flex" flexDirection="column" gap="16">
|
|
41
|
+
<ReactMarkdown rehypePlugins={[rehypeSanitize]} components={components}>
|
|
42
|
+
{md}
|
|
43
|
+
</ReactMarkdown>
|
|
44
|
+
</Box>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default NoteMarkdownContent;
|
package/src/index.ts
CHANGED
|
@@ -285,3 +285,6 @@ export { default as SelectableRow } from './Components/Table/SelectableRow';
|
|
|
285
285
|
|
|
286
286
|
export type { TagProps } from './Components/Tag/Tag';
|
|
287
287
|
export { default as Tag } from './Components/Tag/Tag';
|
|
288
|
+
|
|
289
|
+
export { default as Note } from './Components/Note/Note';
|
|
290
|
+
export { default as MarkdownContent } from './Components/Note/NoteMarkdownContent';
|
package/src/theme.ts
CHANGED
|
@@ -36,6 +36,8 @@ import Sidebar from './Components/Sidebar/Sidebar.theme';
|
|
|
36
36
|
import SidebarItem from './Components/Sidebar/SidebarItem.theme';
|
|
37
37
|
import SegmentedControl from './Components/SegmentedControl/SegmentedControl.theme';
|
|
38
38
|
import Tag from './Components/Tag/Tag.theme';
|
|
39
|
+
import Note from './Components/Note/Note.theme';
|
|
40
|
+
import Code from './Components/Code/Code.theme';
|
|
39
41
|
|
|
40
42
|
import breakpoints from './Foundations/Breakpoints/Breakpoints';
|
|
41
43
|
import colors from './Foundations/Colors/Colors';
|
|
@@ -119,6 +121,8 @@ const theme = {
|
|
|
119
121
|
Slider,
|
|
120
122
|
SegmentedControl,
|
|
121
123
|
Tag,
|
|
124
|
+
Note,
|
|
125
|
+
Code,
|
|
122
126
|
},
|
|
123
127
|
};
|
|
124
128
|
|