@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "12.26.0",
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="M2.00001 0.666586H0.666672L0.666672 4.66659H0.834695H2.22761H4.66667V3.33325H3.01853C3.75096 2.51492 4.81534 1.99992 6 1.99992C8.20914 1.99992 10 3.79078 10 5.99992H11.3333C11.3333 3.0544 8.94552 0.666586 6 0.666586C4.40708 0.666586 2.97726 1.36493 2.00001 2.47215L2.00001 0.666586ZM9.7724 7.33325H7.33334V8.66659H8.98148C8.24905 9.48492 7.18467 9.99992 6 9.99992C3.79087 9.99992 2.00001 8.20906 2.00001 5.99992H0.666672C0.666672 8.94544 3.05449 11.3333 6 11.3333C7.59293 11.3333 9.02275 10.6349 10 9.52768V11.3333H11.3333V7.33325H11.1653H9.7724Z"
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="M2 0H0L0 6H0.252035H2.34141H6V4H3.52779C4.62643 2.7725 6.223 2 8 2C11.3137 2 14 4.68629 14 8H16C16 3.58172 12.4183 0 8 0C5.61061 0 3.46589 1.04751 2 2.70835V0ZM13.6586 10H10V12H12.4722C11.3736 13.2275 9.777 14 8 14C4.68629 14 2 11.3137 2 8H0C0 12.4183 3.58172 16 8 16C10.3894 16 12.5341 14.9525 14 13.2916V16H16V10H15.748H13.6586Z"
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