@bitrise/bitkit 13.67.1-alpha.0 → 13.67.1-alpha.1
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
|
@@ -24,10 +24,10 @@ const contentPadding = (variant: CodeSnippetProps['variant']) => {
|
|
|
24
24
|
const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject => {
|
|
25
25
|
return {
|
|
26
26
|
wrapper: {
|
|
27
|
+
borderRadius: '2',
|
|
27
28
|
display: 'flex',
|
|
28
29
|
position: 'relative',
|
|
29
|
-
width: 'fit-content',
|
|
30
|
-
borderRadius: '2',
|
|
30
|
+
width: variant !== 'inline' ? '100%' : 'fit-content',
|
|
31
31
|
},
|
|
32
32
|
copyContainer: {
|
|
33
33
|
_after:
|
|
@@ -51,7 +51,7 @@ const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject
|
|
|
51
51
|
borderTopRightRadius: variant === 'single' ? '0' : '2',
|
|
52
52
|
borderBottomRightRadius: variant === 'single' ? '0' : '2',
|
|
53
53
|
cursor: 'pointer',
|
|
54
|
-
|
|
54
|
+
div: {
|
|
55
55
|
overflow: 'auto !important',
|
|
56
56
|
},
|
|
57
57
|
minHeight: variant === 'inline' ? '1.5rem' : '2.5rem',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { useClipboard, useMultiStyleConfig } from '@chakra-ui/react';
|
|
2
|
+
import { CollapseProps, useClipboard, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
3
|
import Box, { BoxProps } from '../Box/Box';
|
|
4
4
|
import Tooltip from '../Tooltip/Tooltip';
|
|
5
5
|
import Button from '../Button/Button';
|
|
@@ -9,13 +9,24 @@ import IconButton from '../IconButton/IconButton';
|
|
|
9
9
|
export interface CodeSnippetProps extends Omit<BoxProps, 'children'> {
|
|
10
10
|
children: string;
|
|
11
11
|
size?: 'md' | 'lg';
|
|
12
|
-
startingHeight?:
|
|
12
|
+
startingHeight?: CollapseProps['startingHeight'];
|
|
13
|
+
endingHeight?: CollapseProps['endingHeight'];
|
|
13
14
|
textToCopy?: string;
|
|
14
15
|
variant: 'inline' | 'single' | 'multi';
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const CodeSnippet = (props: CodeSnippetProps) => {
|
|
18
|
-
const {
|
|
19
|
+
const {
|
|
20
|
+
children,
|
|
21
|
+
variant,
|
|
22
|
+
textToCopy,
|
|
23
|
+
size = 'lg',
|
|
24
|
+
startingHeight,
|
|
25
|
+
endingHeight,
|
|
26
|
+
maxHeight,
|
|
27
|
+
height,
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
19
30
|
|
|
20
31
|
const [isExpanded, setExpanded] = useState(false);
|
|
21
32
|
|
|
@@ -61,13 +72,15 @@ const CodeSnippet = (props: CodeSnippetProps) => {
|
|
|
61
72
|
<Collapse
|
|
62
73
|
in={isExpanded}
|
|
63
74
|
startingHeight={startingHeight}
|
|
64
|
-
endingHeight=
|
|
75
|
+
endingHeight={endingHeight}
|
|
65
76
|
transition={{ enter: { duration: 0.5 }, exit: { duration: 0.5 } }}
|
|
66
77
|
>
|
|
67
78
|
{children}
|
|
68
79
|
</Collapse>
|
|
69
80
|
) : (
|
|
70
|
-
|
|
81
|
+
<Box maxHeight={maxHeight} height={height}>
|
|
82
|
+
{children}
|
|
83
|
+
</Box>
|
|
71
84
|
)}
|
|
72
85
|
</Box>
|
|
73
86
|
<IconButton
|