@bitrise/bitkit 13.159.0 → 13.160.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": "13.159.0",
4
+ "version": "13.160.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -11,6 +11,7 @@ const contentPadding = (variant: CodeSnippetProps['variant']) => {
11
11
  paddingRight: '0',
12
12
  };
13
13
  case 'multi':
14
+ case 'multi-breakwords':
14
15
  return {
15
16
  padding: '16',
16
17
  };
@@ -23,6 +24,16 @@ const contentPadding = (variant: CodeSnippetProps['variant']) => {
23
24
  };
24
25
 
25
26
  const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject => {
27
+ let copyContainerWrapping = 'pre';
28
+ if (variant === 'single') {
29
+ copyContainerWrapping = 'nowrap';
30
+ }
31
+ if (variant === 'multi-breakwords') {
32
+ copyContainerWrapping = 'break-spaces';
33
+ }
34
+
35
+ const isMultiline = variant === 'multi' || variant === 'multi-breakwords';
36
+
26
37
  return {
27
38
  wrapper: {
28
39
  borderRadius: '2',
@@ -66,23 +77,23 @@ const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject
66
77
  textStyle: size === 'md' ? 'code/md' : 'code/lg',
67
78
  lineHeight: rem(16),
68
79
  width: '100%',
69
- whiteSpace: variant === 'single' ? 'nowrap' : 'pre',
80
+ whiteSpace: copyContainerWrapping,
70
81
  ...contentPadding(variant),
71
82
  },
72
83
  copyIcon: {
73
84
  bg: 'background/secondary',
74
85
  border: 'none',
75
- borderRadius: variant === 'multi' ? '2' : 'unset',
86
+ borderRadius: isMultiline ? '2' : 'unset',
76
87
  borderTopRightRadius: '2',
77
88
  borderBottomRightRadius: '2',
78
- position: variant === 'multi' ? 'absolute' : 'relative',
79
- px: variant === 'multi' ? '4' : '12',
80
- py: variant === 'multi' ? '4' : '8',
81
- right: variant === 'multi' ? '4' : '0',
89
+ position: isMultiline ? 'absolute' : 'relative',
90
+ px: isMultiline ? '4' : '12',
91
+ py: isMultiline ? '4' : '8',
92
+ right: isMultiline ? '4' : '0',
82
93
  svg: {
83
94
  color: 'icon/secondary',
84
95
  },
85
- top: variant === 'multi' ? '4' : '0',
96
+ top: isMultiline ? '4' : '0',
86
97
  _hover: {
87
98
  bg: 'background/hover',
88
99
  svg: {
@@ -12,7 +12,7 @@ export interface CodeSnippetProps extends Omit<BoxProps, 'children'> {
12
12
  startingHeight?: CollapseProps['startingHeight'];
13
13
  endingHeight?: CollapseProps['endingHeight'];
14
14
  textToCopy?: string;
15
- variant: 'inline' | 'single' | 'multi';
15
+ variant: 'inline' | 'single' | 'multi' | 'multi-breakwords';
16
16
  }
17
17
 
18
18
  const CodeSnippet = (props: CodeSnippetProps) => {
@@ -65,6 +65,7 @@ const CodeSnippet = (props: CodeSnippetProps) => {
65
65
  </Box>
66
66
  );
67
67
  case 'multi':
68
+ case 'multi-breakwords':
68
69
  return (
69
70
  <Box __css={styles.wrapper} {...rest}>
70
71
  <Box as="code" sx={styles.copyContainer}>