@bitrise/bitkit 13.117.0 → 13.119.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.117.0",
4
+ "version": "13.119.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -77,6 +77,7 @@ const DatePickerDayView = ({
77
77
  onMouseEnter={onMouseEnter}
78
78
  role="option"
79
79
  sx={day}
80
+ type="button"
80
81
  >
81
82
  <Text sx={text}>{children}</Text>
82
83
  </Box>
@@ -24,6 +24,7 @@ export const DatePickerHeaderPrevious = ({ label }: { label: string }) => {
24
24
  isTooltipDisabled
25
25
  onClick={onPrevious}
26
26
  size="sm"
27
+ type="button"
27
28
  variant="tertiary"
28
29
  visibility={controls === 'right' ? 'hidden' : undefined}
29
30
  />
@@ -46,6 +46,7 @@ const DatePickerMonthItem = ({
46
46
  onClick={() => onClick(n)}
47
47
  role="option"
48
48
  sx={day}
49
+ type="button"
49
50
  width="48"
50
51
  >
51
52
  <Text sx={{ ...text, width: '48' }}>{children}</Text>
@@ -20,7 +20,7 @@ const DraggableCard = forwardRef<HTMLDivElement, DraggableCardProps>((props, ref
20
20
  return (
21
21
  <Card ref={ref} {...rest} sx={style.card}>
22
22
  <Box visibility={isDragging ? 'hidden' : 'visible'} sx={style.wrapper}>
23
- <Box as="button" ref={activatorRef} {...activatorListeners} sx={style.handler}>
23
+ <Box as="button" ref={activatorRef} {...activatorListeners} sx={style.handler} type="button">
24
24
  <svg width="8" height="12" viewBox="0 0 8 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
25
25
  <circle cx="2" cy="2" r="1" />
26
26
  <circle cx="6" cy="2" r="1" />
@@ -64,7 +64,7 @@ const FilterDate = (props: FilterDateProps) => {
64
64
  mode="range"
65
65
  >
66
66
  <Box position={isOpen ? 'relative' : undefined} sx={filterStyle.item} zIndex={isOpen ? 'dialog' : undefined}>
67
- <Text as="button" disabled={isLoading} onClick={onToggle} size="2" sx={filterStyle.tagEdit}>
67
+ <Text as="button" disabled={isLoading} onClick={onToggle} size="2" sx={filterStyle.tagEdit} type="button">
68
68
  <Icon color="neutral.60" name="Calendar" size="16" /> {label}
69
69
  <Icon name="ChevronDown" size="16" />
70
70
  </Text>
@@ -75,6 +75,7 @@ const FilterItem = (props: FilterItemProps) => {
75
75
  onClick={onToggle}
76
76
  size="2"
77
77
  sx={filterStyle.tagEdit}
78
+ type="button"
78
79
  >
79
80
  {getText()}
80
81
  {type === 'select' && <Icon name="ChevronDown" size="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
  );
@@ -71,7 +71,7 @@ const Sidebar = forwardRef<SidebarProps, 'nav'>(({ children, title, ...boxProps
71
71
 
72
72
  const SidebarButton = ({ onClick, title }: Pick<BoxProps, 'onClick'> & { title: string }) => {
73
73
  return (
74
- <Box alignItems="center" as="button" display="flex" gap="4" h="56" onClick={onClick} paddingLeft="16">
74
+ <Box alignItems="center" as="button" type="button" display="flex" gap="4" h="56" onClick={onClick} paddingLeft="16">
75
75
  <Icon name="ChevronLeft" size="24" />
76
76
  <Text as="span" lineHeight="var(--space-24)">
77
77
  {title}
@@ -63,6 +63,7 @@ const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
63
63
  flexDirection: isNumeric ? 'row-reverse' : 'row',
64
64
  }}
65
65
  as="button"
66
+ type="button"
66
67
  onClick={onClick}
67
68
  >
68
69
  {properties.children}
@@ -47,7 +47,7 @@ const Toggletip = (props: ToggletipProps) => {
47
47
  return (
48
48
  <Popover placement="top" variant="dark" withArrow {...rest}>
49
49
  <PopoverTrigger>
50
- <Box as="button" {...(popoverTrigger || {})}>
50
+ <Box as="button" type="button" {...(popoverTrigger || {})}>
51
51
  {children}
52
52
  </Box>
53
53
  </PopoverTrigger>