@bitrise/bitkit 12.63.2 → 12.65.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.63.2",
4
+ "version": "12.65.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -7,6 +7,9 @@ const baseStyle = defineStyle({
7
7
  border: '1px solid',
8
8
  borderColor: 'separator.primary',
9
9
  borderRadius: '8',
10
+ textWrap: 'wrap',
11
+ wordBreak: 'break-all',
12
+ overflowY: 'auto',
10
13
  });
11
14
 
12
15
  export default defineStyleConfig({
@@ -1,11 +1,15 @@
1
1
  import { ReactNode } from 'react';
2
- import { useStyleConfig } from '@chakra-ui/react';
2
+ import { BoxProps, useStyleConfig } from '@chakra-ui/react';
3
3
  import Box from '../Box/Box';
4
4
 
5
- const CodeBlock = ({ children }: { children: ReactNode }) => {
5
+ interface CodeBlockProps extends BoxProps {
6
+ children: ReactNode;
7
+ }
8
+
9
+ const CodeBlock = ({ children, ...props }: CodeBlockProps) => {
6
10
  const css = useStyleConfig('CodeBlock');
7
11
  return (
8
- <Box __css={css} as="pre">
12
+ <Box __css={css} as="pre" {...props}>
9
13
  {children}
10
14
  </Box>
11
15
  );
@@ -0,0 +1,62 @@
1
+ import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
2
+
3
+ const itemHelpers = createMultiStyleConfigHelpers(['container', 'stage', 'iconWithLine', 'line', 'label']);
4
+
5
+ const ProgressIndicatorTheme = itemHelpers.defineMultiStyleConfig({
6
+ baseStyle: {
7
+ container: {
8
+ display: 'flex',
9
+ },
10
+ stage: {
11
+ display: 'flex',
12
+ gap: '1rem',
13
+ },
14
+ iconWithLine: {
15
+ display: 'flex',
16
+ },
17
+ line: {
18
+ flexGrow: '1',
19
+ },
20
+ label: {
21
+ size: '2',
22
+ whiteSpace: 'nowrap',
23
+ textOverflow: 'ellipsis',
24
+ overflow: 'hidden',
25
+ maxWidth: 'calc(100% - 1rem)',
26
+ lineHeight: '1.5rem',
27
+ },
28
+ },
29
+ variants: {
30
+ vertical: {
31
+ container: {
32
+ flexDir: 'column',
33
+ },
34
+ stage: {
35
+ flexDir: 'row',
36
+ },
37
+ iconWithLine: {
38
+ flexDir: 'column',
39
+ },
40
+ line: {
41
+ marginX: 'calc(.75rem - 1px)',
42
+ height: '1.5rem',
43
+ },
44
+ },
45
+ horizontal: {
46
+ container: {
47
+ flexDir: 'row',
48
+ },
49
+ stage: {
50
+ flexDir: 'column',
51
+ },
52
+ iconWithLine: {
53
+ flexDir: 'row',
54
+ },
55
+ line: {
56
+ marginY: 'calc(.75rem - 1px)',
57
+ },
58
+ },
59
+ },
60
+ });
61
+
62
+ export default ProgressIndicatorTheme;
@@ -0,0 +1,103 @@
1
+ import { createStylesContext, useMultiStyleConfig } from '@chakra-ui/react';
2
+ import Box from '../Box/Box';
3
+ import Icon, { IconProps } from '../Icon/Icon';
4
+ import Text from '../Text/Text';
5
+ import Divider, { DividerProps } from '../Divider/Divider';
6
+ import Link, { LinkProps } from '../Link/Link';
7
+
8
+ const [ProgressIndicatorContext] = createStylesContext('ProgressIndicator');
9
+
10
+ type ProgressIndicatorProps = {
11
+ stages: {
12
+ label: string;
13
+ isInvalid?: boolean;
14
+ isDisabled?: boolean;
15
+ action?: {
16
+ label: string;
17
+ onClick?: () => void;
18
+ href?: LinkProps['href'];
19
+ isExternal?: LinkProps['isExternal'];
20
+ };
21
+ }[];
22
+ activeStageIndex: number;
23
+ variant: 'horizontal' | 'vertical';
24
+ };
25
+
26
+ const ProgressIndicator = ({ stages, activeStageIndex, variant }: ProgressIndicatorProps): JSX.Element => {
27
+ const style = useMultiStyleConfig('ProgressIndicator', { variant });
28
+
29
+ return (
30
+ <ProgressIndicatorContext value={style}>
31
+ <Box sx={style.container}>
32
+ {stages.map(({ label, isInvalid, isDisabled, action }, index, array) => {
33
+ let iconName: IconProps['name'];
34
+ let iconColor: IconProps['color'] = 'purple.50';
35
+
36
+ let dividerProps: {
37
+ color: DividerProps['color'];
38
+ variant?: DividerProps['variant'];
39
+ } = { color: 'neutral.93' };
40
+
41
+ if (index < activeStageIndex) {
42
+ iconName = 'BuildstatusSuccessful';
43
+ dividerProps = { ...dividerProps, color: 'purple.50' };
44
+ } else if (index === activeStageIndex) {
45
+ iconName = 'StageCurrent';
46
+ dividerProps = {
47
+ ...dividerProps,
48
+ color: 'purple.50',
49
+ variant: 'dashed',
50
+ };
51
+ } else {
52
+ iconName = 'StageIncomplete';
53
+ iconColor = 'neutral.60';
54
+ }
55
+ if (isInvalid) {
56
+ iconName = 'StepstatusWarning';
57
+ iconColor = 'red.50';
58
+ }
59
+ if (isDisabled) {
60
+ iconColor = 'neutral.80';
61
+ }
62
+
63
+ return (
64
+ <Box
65
+ width={variant === 'horizontal' ? `${100 / array.length}%` : 'auto'}
66
+ sx={style.stage}
67
+ // eslint-disable-next-line react/no-array-index-key
68
+ key={index}
69
+ >
70
+ <Box sx={style.iconWithLine}>
71
+ <Icon name={iconName} color={iconColor} />
72
+ <Divider
73
+ sx={style.line}
74
+ size="2"
75
+ orientation={variant === 'horizontal' ? 'horizontal' : 'vertical'}
76
+ {...dividerProps}
77
+ />
78
+ </Box>
79
+ {action && !isDisabled ? (
80
+ <Link
81
+ colorScheme="purple"
82
+ as={action.href ? 'a' : 'button'}
83
+ href={action.href}
84
+ onClick={action.onClick}
85
+ isExternal={action.isExternal}
86
+ sx={style.label}
87
+ >
88
+ {label}
89
+ </Link>
90
+ ) : (
91
+ <Text color={isDisabled ? 'neutral.80' : 'neutral.10'} sx={style.label}>
92
+ {label}
93
+ </Text>
94
+ )}
95
+ </Box>
96
+ );
97
+ })}
98
+ </Box>
99
+ </ProgressIndicatorContext>
100
+ );
101
+ };
102
+
103
+ export default ProgressIndicator;
package/src/theme.ts CHANGED
@@ -31,6 +31,7 @@ import DatePickerDay from './Components/DatePicker/DatePickerDay.theme';
31
31
  import NumberInput from './Components/NumberInput/NumberInput.theme';
32
32
  import Skeleton from './Components/Skeleton/Skeleton.theme';
33
33
  import ProgressBar from './Components/ProgressBar/ProgressBar.theme';
34
+ import ProgressIndicator from './Components/ProgressIndicator/ProgressIndicator.theme';
34
35
  import Slider from './Components/Slider/Slider.theme';
35
36
  import Sidebar from './Components/Sidebar/Sidebar.theme';
36
37
  import SidebarItem from './Components/Sidebar/SidebarItem.theme';
@@ -125,6 +126,7 @@ const theme = {
125
126
  Sidebar,
126
127
  SidebarItem,
127
128
  Progress: ProgressBar,
129
+ ProgressIndicator,
128
130
  Slider,
129
131
  SegmentedControl,
130
132
  Tag,