@bitrise/bitkit 13.116.0 → 13.117.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.116.0",
4
+ "version": "13.117.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -0,0 +1,33 @@
1
+ import { forwardRef } from '@chakra-ui/react';
2
+ import Text, { TextProps } from '../Text/Text';
3
+ import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
4
+ import Icon from '../Icon/Icon';
5
+
6
+ export interface LabelProps extends TextProps {
7
+ tooltip?: Omit<TooltipProps, 'children'>;
8
+ }
9
+
10
+ const Label = forwardRef<LabelProps, 'label'>((props, ref) => {
11
+ const { children, tooltip, ...rest } = props;
12
+ return (
13
+ <Text
14
+ as="label"
15
+ textStyle="comp/input/label"
16
+ display="flex"
17
+ alignItems="center"
18
+ gap="4"
19
+ marginBlockEnd="4"
20
+ {...rest}
21
+ ref={ref}
22
+ >
23
+ {children}
24
+ {tooltip && (
25
+ <Tooltip {...tooltip}>
26
+ <Icon color="icon.tertiary" name="InfoCircle" size="16" />
27
+ </Tooltip>
28
+ )}
29
+ </Text>
30
+ );
31
+ });
32
+
33
+ export default Label;
@@ -1,7 +1,8 @@
1
1
  import Box, { BoxProps } from '../Box/Box';
2
2
  import Icon, { TypeIconName } from '../Icon/Icon';
3
- import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
3
+ import { TooltipProps } from '../Tooltip/Tooltip';
4
4
  import Text, { TextProps } from '../Text/Text';
5
+ import Label from '../Label/Label';
5
6
 
6
7
  export interface LabeledDataProps extends BoxProps {
7
8
  as?: 'div' | 'dl';
@@ -62,14 +63,9 @@ const LabeledData = ({
62
63
 
63
64
  return (
64
65
  <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 as="dt" color={labelColor} tooltip={tooltip}>
66
67
  {label}
67
- {tooltip && (
68
- <Tooltip {...tooltip}>
69
- <Icon color="icon.tertiary" name="InfoCircle" size="16" />
70
- </Tooltip>
71
- )}
72
- </Box>
68
+ </Label>
73
69
  <Box as="dd" display="flex" alignItems="center" gap="4" color="text/body" textStyle={`comp/data/${size}`}>
74
70
  {data}
75
71
  {trendIconName && trendValue && <Icon color={trendIconColor} name={trendIconName} size={trendIconSize} />}
package/src/index.ts CHANGED
@@ -345,3 +345,6 @@ export { default as DataWidget } from './Components/DataWidget/DataWidget';
345
345
 
346
346
  export type { DataWidgetItemProps } from './Components/DataWidget/DataWidgetItem';
347
347
  export { default as DataWidgetItem } from './Components/DataWidget/DataWidgetItem';
348
+
349
+ export type { LabelProps } from './Components/Label/Label';
350
+ export { default as Label } from './Components/Label/Label';