@bitrise/bitkit 13.118.0 → 13.120.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.118.0",
4
+ "version": "13.120.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -2,11 +2,15 @@ import { forwardRef, Icon, IconProps } from '@chakra-ui/react';
2
2
 
3
3
  const Code = forwardRef<IconProps, 'svg'>((props, ref) => (
4
4
  <Icon ref={ref} viewBox="0 0 16 16" {...props}>
5
+ <path d="M8.79775 3.73663L5.79775 11.7366L7.20224 12.2633L10.2022 4.26332L8.79775 3.73663Z" fill="currentColor" />
5
6
  <path
6
- d="M3.992 13.056c-.205-.219-.308-.57-.308-1.056l.005-1.963c0-.453-.091-.858-.273-1.217a2.055 2.055 0 0 0-.72-.826 2.16 2.16 0 0 0 .752-.808 2.35 2.35 0 0 0 .269-1.13l-.025-2.244c0-.382.073-.67.22-.86.147-.191.374-.287.682-.287H6V1.333H4.84c-.9 0-1.583.218-2.047.654-.463.436-.696 1.079-.696 1.928l.033 2.302c0 .396-.071.662-.213.844-.142.18-.363.272-.661.272H.667v1.334h.601c.28 0 .488.087.623.262.135.175.203.46.203.912l-.018 2.226c0 .676.119 1.208.356 1.595.238.387.583.66 1.036.819.452.158 1.03.238 1.734.238H6v-1.334H5c-.466 0-.802-.11-1.008-.33Zm10.753-5.723c-.297 0-.518-.091-.66-.272-.142-.182-.214-.448-.214-.844l.032-2.302c0-.849-.232-1.492-.696-1.928-.464-.436-1.146-.654-2.046-.654h-1.16v1.332h1.405c.307 0 .535.096.682.287.147.19.22.478.22.86l-.024 2.244c0 .42.089.797.269 1.13.18.333.43.603.752.808a2.04 2.04 0 0 0-.72.825c-.183.36-.274.765-.274 1.218L12.317 12c0 .485-.103.837-.308 1.056-.205.22-.541.33-1.007.33h-1v1.333h.796c.705 0 1.283-.08 1.736-.238a1.916 1.916 0 0 0 1.035-.819c.238-.387.357-.919.357-1.595l-.019-2.226c0-.452.068-.737.204-.912.134-.175.342-.262.622-.262h.602V7.333h-.588Z"
7
+ d="M4.46966 11.0303L1.43933 7.99998L4.46966 4.96965L5.53032 6.03031L3.56065 7.99998L5.53032 9.96965L4.46966 11.0303Z"
8
+ fill="currentColor"
9
+ />
10
+ <path
11
+ d="M11.5303 4.96965L14.5607 7.99998L11.5303 11.0303L10.4697 9.96965L12.4393 7.99998L10.4697 6.03031L11.5303 4.96965Z"
7
12
  fill="currentColor"
8
13
  />
9
- <path d="m5.833 11 3.25-6.667L10.238 5l-3.25 6.667L5.833 11Z" fill="currentColor" />
10
14
  </Icon>
11
15
  ));
12
16
 
@@ -2,11 +2,15 @@ import { forwardRef, Icon, IconProps } from '@chakra-ui/react';
2
2
 
3
3
  const Code = forwardRef<IconProps, 'svg'>((props, ref) => (
4
4
  <Icon ref={ref} viewBox="0 0 24 24" {...props}>
5
+ <path d="M13.0513 5.68378L9.05132 17.6838L10.9487 18.3162L14.9487 6.31623L13.0513 5.68378Z" fill="currentColor" />
5
6
  <path
6
- d="M5.988 19.584c-.308-.328-.462-.856-.462-1.584l.007-2.945c0-.68-.137-1.287-.409-1.825-.274-.54-.634-.953-1.08-1.24A3.241 3.241 0 0 0 5.17 10.78c.27-.5.404-1.065.404-1.695l-.038-3.366c0-.573.11-1.004.331-1.29.22-.287.561-.431 1.022-.431H9V2H7.258c-1.35 0-2.374.327-3.07.98-.695.655-1.044 1.619-1.044 2.892l.05 3.454c0 .594-.108.992-.32 1.265-.214.272-.545.409-.992.409H1v2h.902c.42 0 .732.13.934.394.203.262.304.689.304 1.367l-.027 3.34c0 1.014.18 1.81.535 2.392.357.58.874.99 1.553 1.228.68.238 1.546.357 2.602.357H9v-2H7.5c-.7 0-1.204-.165-1.512-.494ZM22.118 11c-.447 0-.778-.137-.99-.409-.214-.273-.322-.671-.322-1.265l.05-3.454c0-1.273-.349-2.237-1.045-2.891C19.115 2.327 18.092 2 16.742 2H15v1.997h2.11c.46 0 .802.144 1.022.431.22.286.331.717.331 1.29l-.038 3.366c0 .63.134 1.195.404 1.695s.645.905 1.128 1.212c-.447.286-.808.699-1.08 1.238-.274.539-.41 1.147-.41 1.826L18.473 18c0 .728-.154 1.256-.46 1.584-.309.329-.813.494-1.512.494h-1.5v2h1.195c1.057 0 1.924-.119 2.603-.357.678-.238 1.196-.647 1.552-1.228.357-.581.536-1.378.536-2.392l-.028-3.34c0-.678.102-1.105.305-1.367.202-.263.514-.394.933-.394H23v-2h-.882Z"
7
+ d="M17.2071 7.2929L21.9142 12L17.2071 16.7071L15.7929 15.2929L19.0858 12L15.7929 8.70711L17.2071 7.2929Z"
8
+ fill="currentColor"
9
+ />
10
+ <path
11
+ d="M6.79289 16.7071L2.08578 12L6.79289 7.2929L8.20711 8.70711L4.91421 12L8.20711 15.2929L6.79289 16.7071Z"
7
12
  fill="currentColor"
8
13
  />
9
- <path d="m8.75 16.5 4.875-10 1.732 1-4.875 10-1.732-1Z" fill="currentColor" />
10
14
  </Icon>
11
15
  ));
12
16
 
@@ -3,13 +3,17 @@ import Icon, { TypeIconName } from '../Icon/Icon';
3
3
  import { TooltipProps } from '../Tooltip/Tooltip';
4
4
  import Text, { TextProps } from '../Text/Text';
5
5
  import Label from '../Label/Label';
6
+ import Skeleton from '../Skeleton/Skeleton';
7
+ import SkeletonBox from '../Skeleton/SkeletonBox';
6
8
 
7
9
  export interface LabeledDataProps extends BoxProps {
8
10
  as?: 'div' | 'dl';
9
11
  data: string;
12
+ isLoading?: boolean;
10
13
  label: string;
11
14
  secondaryLabel?: string;
12
15
  size?: 'sm' | 'md' | 'lg';
16
+ skeleton?: React.ReactNode;
13
17
  tooltip?: Omit<TooltipProps, 'children'>;
14
18
  trend?: 'positive' | 'negative' | 'neutral';
15
19
  trendColorScheme?: 'red' | 'green' | 'grey';
@@ -19,9 +23,11 @@ export interface LabeledDataProps extends BoxProps {
19
23
  const LabeledData = ({
20
24
  as = 'div',
21
25
  data,
26
+ isLoading = false,
22
27
  label,
23
28
  secondaryLabel,
24
29
  size = 'sm',
30
+ skeleton,
25
31
  tooltip,
26
32
  trend,
27
33
  trendValue,
@@ -32,6 +38,23 @@ const LabeledData = ({
32
38
  const trendSign = trend === 'negative' ? '-' : '+';
33
39
  const labelColor = size === 'sm' ? 'text/primary' : 'text/secondary';
34
40
 
41
+ let dataSkeletonHeight;
42
+ let dataSkeletonPaddingY;
43
+ switch (size) {
44
+ case 'lg':
45
+ dataSkeletonHeight = '30px';
46
+ dataSkeletonPaddingY = '5';
47
+ break;
48
+ case 'md':
49
+ dataSkeletonHeight = '24';
50
+ dataSkeletonPaddingY = '6';
51
+ break;
52
+ case 'sm':
53
+ default:
54
+ dataSkeletonHeight = '16';
55
+ dataSkeletonPaddingY = '4';
56
+ }
57
+
35
58
  let trendIconName: TypeIconName | undefined;
36
59
  switch (trend) {
37
60
  case 'positive':
@@ -61,29 +84,42 @@ const LabeledData = ({
61
84
  trendIconColor = 'icon/tertiary';
62
85
  }
63
86
 
87
+ if (isLoading && skeleton) {
88
+ return <>{skeleton}</>;
89
+ }
90
+
64
91
  return (
65
- <Box as={as} display="flex" flexDirection="column" gap="4" {...rest}>
92
+ <Box as={as} display="flex" flexDirection="column" {...rest}>
66
93
  <Label as="dt" color={labelColor} tooltip={tooltip}>
67
94
  {label}
68
95
  </Label>
69
- <Box as="dd" display="flex" alignItems="center" gap="4" color="text/body" textStyle={`comp/data/${size}`}>
70
- {data}
71
- {trendIconName && trendValue && <Icon color={trendIconColor} name={trendIconName} size={trendIconSize} />}
72
- </Box>
73
- {((trendSign && trendValue) || !!secondaryLabel) && (
74
- <Box as="dd" display="flex" gap="4" color={trendColor} textStyle="body/md/regular">
75
- {trendSign && trendValue && (
76
- <>
77
- {trendSign}
78
- {trendValue}
79
- </>
80
- )}
81
- {secondaryLabel && (
82
- <Text as="span" color="text/tertiary">
83
- {secondaryLabel}
84
- </Text>
96
+ {isLoading ? (
97
+ <Skeleton isActive display="flex" flexDirection="column" gap="4">
98
+ <SkeletonBox height={dataSkeletonHeight} width="120px" marginY={dataSkeletonPaddingY} />
99
+ <SkeletonBox height="14" width="120px" marginY="3" />
100
+ </Skeleton>
101
+ ) : (
102
+ <>
103
+ <Box as="dd" display="flex" alignItems="center" gap="4" color="text/body" textStyle={`comp/data/${size}`}>
104
+ {data}
105
+ {trendIconName && trendValue && <Icon color={trendIconColor} name={trendIconName} size={trendIconSize} />}
106
+ </Box>
107
+ {((trendSign && trendValue) || !!secondaryLabel) && (
108
+ <Box as="dd" display="flex" gap="4" color={trendColor} textStyle="body/md/regular">
109
+ {trendSign && trendValue && (
110
+ <>
111
+ {trendSign}
112
+ {trendValue}
113
+ </>
114
+ )}
115
+ {secondaryLabel && (
116
+ <Text as="span" color="text/tertiary">
117
+ {secondaryLabel}
118
+ </Text>
119
+ )}
120
+ </Box>
85
121
  )}
86
- </Box>
122
+ </>
87
123
  )}
88
124
  </Box>
89
125
  );