@bitrise/bitkit 13.67.1-alpha.0 → 13.68.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.67.1-alpha.0",
4
+ "version": "13.68.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -1,22 +1,23 @@
1
1
  import { defineStyle, defineStyleConfig, SystemStyleObject } from '@chakra-ui/styled-system';
2
+ import { rem } from '../../utils/utils';
2
3
  import { CodeSnippetProps } from './CodeSnippet';
3
4
 
4
5
  const contentPadding = (variant: CodeSnippetProps['variant']) => {
5
6
  switch (variant) {
6
7
  case 'single':
7
8
  return {
8
- padding: '.75rem',
9
- paddingLeft: '1rem',
9
+ padding: '12',
10
+ paddingLeft: '16',
10
11
  paddingRight: '0',
11
12
  };
12
13
  case 'multi':
13
14
  return {
14
- padding: '1rem',
15
+ padding: '16',
15
16
  };
16
17
  default:
17
18
  return {
18
- paddingX: '.375rem',
19
- paddingY: '.125rem',
19
+ paddingX: rem(6),
20
+ paddingY: rem(2),
20
21
  };
21
22
  }
22
23
  };
@@ -24,10 +25,10 @@ const contentPadding = (variant: CodeSnippetProps['variant']) => {
24
25
  const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject => {
25
26
  return {
26
27
  wrapper: {
28
+ borderRadius: '2',
27
29
  display: 'flex',
28
30
  position: 'relative',
29
- width: 'fit-content',
30
- borderRadius: '2',
31
+ width: variant !== 'inline' ? '100%' : 'fit-content',
31
32
  },
32
33
  copyContainer: {
33
34
  _after:
@@ -51,10 +52,10 @@ const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject
51
52
  borderTopRightRadius: variant === 'single' ? '0' : '2',
52
53
  borderBottomRightRadius: variant === 'single' ? '0' : '2',
53
54
  cursor: 'pointer',
54
- '.chakra-collapse': {
55
+ div: {
55
56
  overflow: 'auto !important',
56
57
  },
57
- minHeight: variant === 'inline' ? '1.5rem' : '2.5rem',
58
+ minHeight: variant === 'inline' ? '24' : '40',
58
59
  overflow: 'auto',
59
60
  scrollbarHeight: variant === 'single' ? 'none' : undefined,
60
61
  '::-webkit-scrollbar': {
@@ -63,7 +64,7 @@ const baseStyle = defineStyle(({ variant, size, isExpanded }): SystemStyleObject
63
64
  position: variant === 'single' ? 'relative' : 'static',
64
65
  textColor: 'text/body',
65
66
  textStyle: size === 'md' ? 'code/md' : 'code/lg',
66
- lineHeight: '1rem',
67
+ lineHeight: rem(16),
67
68
  width: '100%',
68
69
  whiteSpace: variant === 'single' ? 'nowrap' : 'pre',
69
70
  ...contentPadding(variant),
@@ -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?: number;
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 { children, variant, textToCopy, size = 'lg', startingHeight, ...rest } = props;
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="100vh"
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
- children
81
+ <Box maxHeight={maxHeight} height={height}>
82
+ {children}
83
+ </Box>
71
84
  )}
72
85
  </Box>
73
86
  <IconButton
@@ -30,7 +30,7 @@ const defaultComponents = (size: 'sm' | 'md' | 'lg', gap: GapType = '16'): Compo
30
30
  </Box>
31
31
  ),
32
32
  code: ({ node, ...props }) => (
33
- <CodeSnippet variant="multi" {...props}>
33
+ <CodeSnippet variant="multi" {...props} size={codeSize}>
34
34
  {props.children as string}
35
35
  </CodeSnippet>
36
36
  ),