@bitrise/bitkit 12.26.0 → 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 +4 -2
- package/src/Components/Code/Code.theme.ts +14 -0
- package/src/Components/Icons/16x16/Replace.tsx +1 -1
- package/src/Components/Icons/24x24/Replace.tsx +1 -1
- package/src/Components/Note/Note.theme.ts +60 -0
- package/src/Components/Note/Note.tsx +25 -0
- package/src/Components/Note/NoteMarkdownContent.tsx +48 -0
- package/src/index.ts +3 -0
- package/src/theme.ts +4 -0
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
|
+
});
|
|
@@ -5,7 +5,7 @@ const Replace = forwardRef<IconProps, 'svg'>((props, ref) => (
|
|
|
5
5
|
<path
|
|
6
6
|
fillRule="evenodd"
|
|
7
7
|
clipRule="evenodd"
|
|
8
|
-
d="
|
|
8
|
+
d="M4.00001 2.66659H2.66667V6.66659H2.8347H4.22761H6.66667V5.33325H5.01853C5.75096 4.51492 6.81534 3.99992 8 3.99992C10.2091 3.99992 12 5.79078 12 7.99992H13.3333C13.3333 5.0544 10.9455 2.66659 8 2.66659C6.40708 2.66659 4.97726 3.36493 4.00001 4.47215L4.00001 2.66659ZM11.7724 9.33325H9.33334V10.6666H10.9815C10.2491 11.4849 9.18467 11.9999 8 11.9999C5.79087 11.9999 4.00001 10.2091 4.00001 7.99992H2.66667C2.66667 10.9454 5.05449 13.3333 8 13.3333C9.59293 13.3333 11.0227 12.6349 12 11.5277V13.3333H13.3333V9.33325H13.1653H11.7724Z"
|
|
9
9
|
fill="currentColor"
|
|
10
10
|
/>
|
|
11
11
|
</Icon>
|
|
@@ -5,7 +5,7 @@ const Replace = forwardRef<IconProps, 'svg'>((props, ref) => (
|
|
|
5
5
|
<path
|
|
6
6
|
fillRule="evenodd"
|
|
7
7
|
clipRule="evenodd"
|
|
8
|
-
d="
|
|
8
|
+
d="M6 4H4V10H4.25203H6.34141H10V8H7.52779C8.62643 6.7725 10.223 6 12 6C15.3137 6 18 8.68629 18 12H20C20 7.58172 16.4183 4 12 4C9.61061 4 7.46589 5.04751 6 6.70835V4ZM17.6586 14H14V16H16.4722C15.3736 17.2275 13.777 18 12 18C8.68629 18 6 15.3137 6 12H4C4 16.4183 7.58172 20 12 20C14.3894 20 16.5341 18.9525 18 17.2916V20H20V14H19.748H17.6586Z"
|
|
9
9
|
fill="currentColor"
|
|
10
10
|
/>
|
|
11
11
|
</Icon>
|
|
@@ -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
|
|