@bitrise/bitkit 13.109.0 → 13.111.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.
|
|
4
|
+
"version": "13.111.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@floating-ui/react-dom-interactions": "^0.8.1",
|
|
39
39
|
"@fontsource/figtree": "^5.0.20",
|
|
40
40
|
"@fontsource/source-code-pro": "^5.0.18",
|
|
41
|
-
"framer-motion": "^11.2.
|
|
41
|
+
"framer-motion": "^11.2.13",
|
|
42
42
|
"luxon": "^3.4.4",
|
|
43
43
|
"react": "^18.3.1",
|
|
44
44
|
"react-dom": "^18.3.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@storybook/react": "^8.1.11",
|
|
68
68
|
"@storybook/react-webpack5": "^8.1.11",
|
|
69
69
|
"@storybook/theming": "^8.1.11",
|
|
70
|
-
"@testing-library/dom": "^10.
|
|
70
|
+
"@testing-library/dom": "^10.3.1",
|
|
71
71
|
"@testing-library/jest-dom": "^6.4.6",
|
|
72
72
|
"@testing-library/react": "^16.0.0",
|
|
73
73
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -75,20 +75,20 @@
|
|
|
75
75
|
"@types/luxon": "^3.4.2",
|
|
76
76
|
"@types/react": "^18.3.3",
|
|
77
77
|
"@types/react-dom": "^18.3.0",
|
|
78
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
79
|
-
"@typescript-eslint/parser": "^7.
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
79
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
80
80
|
"axios": "^1.7.2",
|
|
81
81
|
"eslint": "^8.57.0",
|
|
82
|
-
"glob": "^10.4.
|
|
82
|
+
"glob": "^10.4.3",
|
|
83
83
|
"jest": "^29.7.0",
|
|
84
84
|
"jest-environment-jsdom": "^29.7.0",
|
|
85
85
|
"jsdom": "^24.1.0",
|
|
86
86
|
"prettier": "^3.3.2",
|
|
87
|
-
"react-hook-form": "^7.52.
|
|
88
|
-
"release-it": "^17.4.
|
|
87
|
+
"react-hook-form": "^7.52.1",
|
|
88
|
+
"release-it": "^17.4.1",
|
|
89
89
|
"storybook": "^8.1.11",
|
|
90
90
|
"ts-jest": "^29.1.5",
|
|
91
|
-
"typescript": "^5.5.
|
|
91
|
+
"typescript": "^5.5.3"
|
|
92
92
|
},
|
|
93
93
|
"files": [
|
|
94
94
|
"src",
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import Box, { BoxProps } from '../Box/Box';
|
|
2
|
+
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
3
|
+
import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
|
|
4
|
+
import Text, { TextProps } from '../Text/Text';
|
|
5
|
+
|
|
6
|
+
export interface LabeledDataProps extends BoxProps {
|
|
7
|
+
as?: 'div' | 'dl';
|
|
8
|
+
data: string;
|
|
9
|
+
label: string;
|
|
10
|
+
secondaryLabel?: string;
|
|
11
|
+
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
tooltip?: Omit<TooltipProps, 'children'>;
|
|
13
|
+
trend?: 'positive' | 'negative' | 'neutral';
|
|
14
|
+
trendColorScheme?: 'red' | 'green' | 'grey';
|
|
15
|
+
trendValue?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const LabeledData = ({
|
|
19
|
+
as = 'div',
|
|
20
|
+
data,
|
|
21
|
+
label,
|
|
22
|
+
secondaryLabel,
|
|
23
|
+
size = 'sm',
|
|
24
|
+
tooltip,
|
|
25
|
+
trend,
|
|
26
|
+
trendValue,
|
|
27
|
+
trendColorScheme,
|
|
28
|
+
...rest
|
|
29
|
+
}: LabeledDataProps): JSX.Element => {
|
|
30
|
+
const trendIconSize = size === 'sm' ? '16' : '24';
|
|
31
|
+
const trendSign = trend === 'negative' ? '-' : '+';
|
|
32
|
+
const labelColor = size === 'sm' ? 'text/primary' : 'text/secondary';
|
|
33
|
+
|
|
34
|
+
let trendIconName: TypeIconName | undefined;
|
|
35
|
+
switch (trend) {
|
|
36
|
+
case 'positive':
|
|
37
|
+
trendIconName = 'ArrowUp';
|
|
38
|
+
break;
|
|
39
|
+
case 'negative':
|
|
40
|
+
trendIconName = 'ArrowDown';
|
|
41
|
+
break;
|
|
42
|
+
case 'neutral':
|
|
43
|
+
trendIconName = 'MinusClose';
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let trendIconColor: string | undefined;
|
|
48
|
+
let trendColor: TextProps['color'] | undefined;
|
|
49
|
+
switch (trendColorScheme) {
|
|
50
|
+
case 'red':
|
|
51
|
+
trendColor = 'text/negative';
|
|
52
|
+
trendIconColor = 'icon/negative';
|
|
53
|
+
break;
|
|
54
|
+
case 'green':
|
|
55
|
+
trendIconColor = 'icon/positive';
|
|
56
|
+
trendColor = 'text/positive';
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
trendColor = 'text/secondary';
|
|
60
|
+
trendIconColor = 'icon/tertiary';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Box as={as} display="flex" flexDirection="column" gap="4" {...rest}>
|
|
65
|
+
<Box as="dt" display="flex" alignItems="center" gap="4" color={labelColor} textStyle="comp/input/label">
|
|
66
|
+
{label}
|
|
67
|
+
{tooltip && (
|
|
68
|
+
<Tooltip {...tooltip}>
|
|
69
|
+
<Icon color="icon.tertiary" name="InfoCircle" size="16" />
|
|
70
|
+
</Tooltip>
|
|
71
|
+
)}
|
|
72
|
+
</Box>
|
|
73
|
+
<Box as="dd" display="flex" alignItems="center" gap="4" color="text/body" textStyle={`comp/data/${size}`}>
|
|
74
|
+
{data}
|
|
75
|
+
{trendIconName && trendValue && <Icon color={trendIconColor} name={trendIconName} size={trendIconSize} />}
|
|
76
|
+
</Box>
|
|
77
|
+
{((trendSign && trendValue) || !!secondaryLabel) && (
|
|
78
|
+
<Box as="dd" display="flex" gap="4" color={trendColor} textStyle="body/md/regular">
|
|
79
|
+
{trendSign && trendValue && (
|
|
80
|
+
<>
|
|
81
|
+
{trendSign}
|
|
82
|
+
{trendValue}
|
|
83
|
+
</>
|
|
84
|
+
)}
|
|
85
|
+
{secondaryLabel && (
|
|
86
|
+
<Text as="span" color="text/tertiary">
|
|
87
|
+
{secondaryLabel}
|
|
88
|
+
</Text>
|
|
89
|
+
)}
|
|
90
|
+
</Box>
|
|
91
|
+
)}
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export default LabeledData;
|
package/src/index.ts
CHANGED
|
@@ -166,6 +166,9 @@ export { default as AccordionItem } from './Components/Accordion/AccordionItem';
|
|
|
166
166
|
export type { LightBoxProps } from './Components/LightBox/LightBox';
|
|
167
167
|
export { default as LightBox } from './Components/LightBox/LightBox';
|
|
168
168
|
|
|
169
|
+
export type { LabeledDataProps } from './Components/LabeledData/LabeledData';
|
|
170
|
+
export { default as LabeledData } from './Components/LabeledData/LabeledData';
|
|
171
|
+
|
|
169
172
|
export type { AspectRatioProps } from './Components/AspectRatio/AspectRatio';
|
|
170
173
|
export { default as AspectRatio } from './Components/AspectRatio/AspectRatio';
|
|
171
174
|
|