@bitrise/bitkit 13.12.0 → 13.14.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 +1 -1
- package/src/Components/CodeBlock/CodeBlock.theme.ts +23 -3
- package/src/Components/CodeBlock/CodeBlock.tsx +6 -1
- package/src/Components/CodeSnippet/CodeSnippet.theme.ts +30 -21
- package/src/Components/CodeSnippet/CodeSnippet.tsx +6 -1
- package/src/Components/Form/Input/Input.tsx +7 -3
- package/src/Components/Note/NoteMarkdownContent.tsx +41 -32
package/package.json
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers([
|
|
4
|
+
'container',
|
|
5
|
+
'codeBox',
|
|
6
|
+
'copyIcon',
|
|
7
|
+
]);
|
|
4
8
|
|
|
5
|
-
const
|
|
9
|
+
const sizes = {
|
|
10
|
+
lg: definePartsStyle({
|
|
11
|
+
codeBox: {
|
|
12
|
+
textStyle: 'code/lg',
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
md: definePartsStyle({
|
|
16
|
+
codeBox: {
|
|
17
|
+
textStyle: 'code/md',
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const CodeBlockTheme = defineMultiStyleConfig({
|
|
6
23
|
baseStyle: {
|
|
7
24
|
codeBox: {
|
|
8
25
|
bg: 'neutral.95',
|
|
9
26
|
border: '1px solid',
|
|
10
27
|
borderColor: 'separator.primary',
|
|
11
28
|
borderRadius: '8',
|
|
12
|
-
fontSize: '2',
|
|
13
29
|
minHeight: '4rem',
|
|
14
30
|
overflowY: 'auto',
|
|
15
31
|
px: '12',
|
|
@@ -26,6 +42,10 @@ const CodeBlockTheme = itemHelpers.defineMultiStyleConfig({
|
|
|
26
42
|
top: '1rem',
|
|
27
43
|
},
|
|
28
44
|
},
|
|
45
|
+
defaultProps: {
|
|
46
|
+
size: 'lg',
|
|
47
|
+
},
|
|
48
|
+
sizes,
|
|
29
49
|
});
|
|
30
50
|
|
|
31
51
|
export default CodeBlockTheme;
|
|
@@ -5,10 +5,11 @@ import IconButton from '../IconButton/IconButton';
|
|
|
5
5
|
interface CodeBlockProps extends BoxProps {
|
|
6
6
|
children: string;
|
|
7
7
|
isCopiable?: boolean;
|
|
8
|
+
size?: 'md' | 'lg';
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
const CodeBlock = ({ children, isCopiable, ...props }: CodeBlockProps) => {
|
|
11
|
-
const style = useMultiStyleConfig('CodeBlock');
|
|
12
|
+
const style = useMultiStyleConfig('CodeBlock', props);
|
|
12
13
|
|
|
13
14
|
const { onCopy } = useClipboard(children);
|
|
14
15
|
|
|
@@ -33,4 +34,8 @@ const CodeBlock = ({ children, isCopiable, ...props }: CodeBlockProps) => {
|
|
|
33
34
|
);
|
|
34
35
|
};
|
|
35
36
|
|
|
37
|
+
CodeBlock.defaultProps = {
|
|
38
|
+
size: 'lg',
|
|
39
|
+
} as CodeBlockProps;
|
|
40
|
+
|
|
36
41
|
export default CodeBlock;
|
|
@@ -1,36 +1,45 @@
|
|
|
1
1
|
import { defineStyle, defineStyleConfig } from '@chakra-ui/styled-system';
|
|
2
2
|
|
|
3
|
+
const sizes = {
|
|
4
|
+
lg: defineStyle({
|
|
5
|
+
textStyle: 'code/lg',
|
|
6
|
+
}),
|
|
7
|
+
md: defineStyle({
|
|
8
|
+
textStyle: 'code/md',
|
|
9
|
+
}),
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const copiableStyle = defineStyle({
|
|
13
|
+
cursor: 'pointer',
|
|
14
|
+
_hover: {
|
|
15
|
+
background: 'neutral.93',
|
|
16
|
+
},
|
|
17
|
+
_active: {
|
|
18
|
+
background: 'neutral.90',
|
|
19
|
+
},
|
|
20
|
+
_focusVisible: {
|
|
21
|
+
boxShadow: 'outline',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
3
25
|
const baseStyle = defineStyle(({ isCopiable }) => {
|
|
4
26
|
const style = {
|
|
5
27
|
bg: 'neutral.95',
|
|
6
28
|
borderRadius: '2',
|
|
7
|
-
fontFamily: 'mono',
|
|
8
|
-
fontSize: '2',
|
|
9
|
-
lineHeight: '20px',
|
|
10
29
|
px: '6px',
|
|
11
30
|
py: '2px',
|
|
12
31
|
width: 'fit-content',
|
|
13
32
|
};
|
|
14
33
|
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
...style,
|
|
18
|
-
_active: {
|
|
19
|
-
background: 'neutral.90',
|
|
20
|
-
},
|
|
21
|
-
_focusVisible: {
|
|
22
|
-
boxShadow: 'outline',
|
|
23
|
-
},
|
|
24
|
-
_hover: {
|
|
25
|
-
background: 'neutral.93',
|
|
26
|
-
},
|
|
27
|
-
cursor: 'pointer',
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return style;
|
|
34
|
+
return { ...style, ...(isCopiable ? copiableStyle : {}) };
|
|
32
35
|
});
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
const CodeSnippetTheme = defineStyleConfig({
|
|
35
38
|
baseStyle,
|
|
39
|
+
defaultProps: {
|
|
40
|
+
size: 'lg',
|
|
41
|
+
},
|
|
42
|
+
sizes,
|
|
36
43
|
});
|
|
44
|
+
|
|
45
|
+
export default CodeSnippetTheme;
|
|
@@ -7,11 +7,12 @@ export interface CodeSnippetProps extends Omit<BoxProps, 'children'> {
|
|
|
7
7
|
children: string;
|
|
8
8
|
isCopiable?: boolean;
|
|
9
9
|
textToCopy?: string;
|
|
10
|
+
size?: 'md' | 'lg';
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const CodeSnippet = (props: CodeSnippetProps) => {
|
|
13
14
|
const { children, isCopiable, textToCopy, ...rest } = props;
|
|
14
|
-
const css = useStyleConfig('CodeSnippet',
|
|
15
|
+
const css = useStyleConfig('CodeSnippet', props);
|
|
15
16
|
const { hasCopied, onCopy } = useClipboard(textToCopy || children);
|
|
16
17
|
|
|
17
18
|
const [isTooltipOpen, setTooltipOpen] = useState(false);
|
|
@@ -33,4 +34,8 @@ const CodeSnippet = (props: CodeSnippetProps) => {
|
|
|
33
34
|
);
|
|
34
35
|
};
|
|
35
36
|
|
|
37
|
+
CodeSnippet.defaultProps = {
|
|
38
|
+
size: 'lg',
|
|
39
|
+
} as CodeSnippetProps;
|
|
40
|
+
|
|
36
41
|
export default CodeSnippet;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent,
|
|
1
|
+
import { ChangeEvent, ReactNode, Ref, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
FormControl,
|
|
4
4
|
FormControlProps,
|
|
@@ -49,6 +49,7 @@ export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
|
|
|
49
49
|
inputHeight?: number;
|
|
50
50
|
inputRef?: Ref<HTMLInputElement>;
|
|
51
51
|
inputStyle?: SystemStyleObject;
|
|
52
|
+
inputWrapperStyle?: SystemStyleObject;
|
|
52
53
|
label?: ReactNode;
|
|
53
54
|
leftIconColor?: TypeColors;
|
|
54
55
|
leftIconName?: TypeIconName;
|
|
@@ -73,6 +74,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
|
|
|
73
74
|
inputHeight,
|
|
74
75
|
inputRef,
|
|
75
76
|
inputStyle,
|
|
77
|
+
inputWrapperStyle,
|
|
76
78
|
isDisabled,
|
|
77
79
|
isInvalid,
|
|
78
80
|
isLoading,
|
|
@@ -125,8 +127,10 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
|
|
|
125
127
|
value,
|
|
126
128
|
};
|
|
127
129
|
|
|
128
|
-
let InputWrapper: any =
|
|
129
|
-
const inputWrapperProps: SystemStyleObject = {
|
|
130
|
+
let InputWrapper: any = Box;
|
|
131
|
+
const inputWrapperProps: SystemStyleObject = {
|
|
132
|
+
...inputWrapperStyle,
|
|
133
|
+
};
|
|
130
134
|
if (leftIconName || rightAddon || rightIconName) {
|
|
131
135
|
InputWrapper = InputGroup;
|
|
132
136
|
inputWrapperProps.zIndex = 0;
|
|
@@ -8,44 +8,53 @@ import Box from '../Box/Box';
|
|
|
8
8
|
import Divider from '../Divider/Divider';
|
|
9
9
|
import Text from '../Text/Text';
|
|
10
10
|
import CodeBlock from '../CodeBlock/CodeBlock';
|
|
11
|
+
import CodeSnippet from '../CodeSnippet/CodeSnippet';
|
|
11
12
|
|
|
12
|
-
const defaultComponents: Components
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
13
|
+
const defaultComponents = (size: 'md' | 'lg'): Components => {
|
|
14
|
+
return {
|
|
15
|
+
a: ({ node, ...props }) => <Link colorScheme="purple" isUnderlined target="_blank" {...props} />,
|
|
16
|
+
blockquote: ({ children }) => (
|
|
17
|
+
<Box
|
|
18
|
+
as="blockquote"
|
|
19
|
+
borderColor="separator.primary"
|
|
20
|
+
borderLeftStyle="solid"
|
|
21
|
+
borderLeftWidth="2px"
|
|
22
|
+
color="text.secondary"
|
|
23
|
+
paddingLeft="16"
|
|
24
|
+
py="8"
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</Box>
|
|
28
|
+
),
|
|
29
|
+
code: ({ node, ...props }) => (
|
|
30
|
+
<CodeSnippet size={size} {...props}>
|
|
31
|
+
{props.children as string}
|
|
32
|
+
</CodeSnippet>
|
|
33
|
+
),
|
|
34
|
+
h1: ({ node, ...props }) => <Text as="h1" textStyle="heading/h1" {...props} />,
|
|
35
|
+
h2: ({ node, ...props }) => <Text as="h2" textStyle="heading/h2" {...props} />,
|
|
36
|
+
h3: ({ node, ...props }) => <Text as="h3" textStyle="heading/h3" {...props} />,
|
|
37
|
+
h4: ({ node, ...props }) => <Text as="h4" textStyle="heading/h4" {...props} />,
|
|
38
|
+
h5: ({ node, ...props }) => <Text as="h5" textStyle="heading/h5" {...props} />,
|
|
39
|
+
h6: ({ node, ...props }) => <Text as="h6" textStyle="heading/h6" {...props} />,
|
|
40
|
+
hr: () => <Divider borderColor="separator.primary" my="16" size="2" />,
|
|
41
|
+
li: ({ node, ...props }) => <ListItem {...props} />,
|
|
42
|
+
ol: ({ node, ...props }) => <List isOrdered {...props} />,
|
|
43
|
+
p: ({ node, ...props }) => <Text {...props} />,
|
|
44
|
+
pre: ({ node, ...props }) => <CodeBlock size={size}>{props.children as string}</CodeBlock>,
|
|
45
|
+
ul: ({ node, ...props }) => <List {...props} />,
|
|
46
|
+
};
|
|
40
47
|
};
|
|
41
|
-
|
|
48
|
+
|
|
49
|
+
type NoteMarkdownContentProps = { md: string; size?: 'md' | 'lg' } & Pick<
|
|
42
50
|
ComponentProps<typeof ReactMarkdown>,
|
|
43
51
|
'components' | 'rehypePlugins'
|
|
44
52
|
>;
|
|
45
|
-
const NoteMarkdownContent = ({ components, md, ...rest }: NoteMarkdownContentProps) => {
|
|
46
|
-
const extendedComponents = { ...defaultComponents, ...components };
|
|
53
|
+
const NoteMarkdownContent = ({ components, md, size = 'lg', ...rest }: NoteMarkdownContentProps) => {
|
|
54
|
+
const extendedComponents = { ...defaultComponents(size), ...components };
|
|
55
|
+
const textStyle = `body/${size}/regular`;
|
|
47
56
|
return (
|
|
48
|
-
<Box display="flex" flexDirection="column" gap="16">
|
|
57
|
+
<Box display="flex" flexDirection="column" gap="16" textStyle={textStyle}>
|
|
49
58
|
<ReactMarkdown components={extendedComponents} {...rest}>
|
|
50
59
|
{md}
|
|
51
60
|
</ReactMarkdown>
|