@bitrise/bitkit 13.293.0 → 13.295.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.293.0",
4
+ "version": "13.295.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -16,6 +16,7 @@ const ScrollButton = (props: BoxProps) => {
16
16
  boxShadow="large"
17
17
  h={32}
18
18
  w={32}
19
+ type="button"
19
20
  >
20
21
  <Icon color="icon/tertiary" name="ArrowDown" size="16" />
21
22
  </Box>
@@ -72,11 +73,13 @@ const ScrollableDialogBody = (props: DialogBodyProps) => {
72
73
  alignSelf="center"
73
74
  bottom={8}
74
75
  flexShrink={0}
75
- onClick={() => {
76
+ onClick={(e) => {
76
77
  if (!contentRef.current) {
77
78
  return;
78
79
  }
79
80
 
81
+ (e.currentTarget as HTMLElement).blur();
82
+
80
83
  contentRef.current.scrollTo({
81
84
  top: contentRef.current.scrollHeight,
82
85
  behavior: 'smooth',
@@ -12,6 +12,7 @@ export type LabeledDataProps = BoxProps & {
12
12
  skeletonVariant?: 'single' | 'double';
13
13
  as?: 'div' | 'dl';
14
14
  isLoading?: boolean;
15
+ isDisabled?: boolean;
15
16
  label: string;
16
17
  secondaryLabel?: ReactNode;
17
18
  size?: 'sm' | 'md' | 'lg';
@@ -29,6 +30,7 @@ const LabeledData = ({
29
30
  data,
30
31
  placeholder,
31
32
  isLoading = false,
33
+ isDisabled,
32
34
  label,
33
35
  secondaryLabel,
34
36
  size = 'sm',
@@ -41,7 +43,13 @@ const LabeledData = ({
41
43
  ...rest
42
44
  }: LabeledDataProps) => {
43
45
  const trendIconSize = size === 'sm' ? '16' : '24';
44
- const labelColor = size === 'sm' ? 'text/primary' : 'text/secondary';
46
+ let labelColor = 'text/secondary';
47
+ if (isDisabled) {
48
+ labelColor = 'text/disabled';
49
+ } else if (size === 'sm') {
50
+ labelColor = 'text/primary';
51
+ }
52
+
45
53
  let trendSign;
46
54
  if (shouldShowTrendSign) {
47
55
  trendSign = trend === 'negative' ? '-' : '+';
@@ -110,7 +118,14 @@ const LabeledData = ({
110
118
  ) : (
111
119
  <>
112
120
  {data && (
113
- <Box as="dd" display="flex" alignItems="center" gap="4" color="text/body" textStyle={`comp/data/${size}`}>
121
+ <Box
122
+ as="dd"
123
+ display="flex"
124
+ alignItems="center"
125
+ gap="4"
126
+ color={isDisabled ? 'text/disabled' : 'text/body'}
127
+ textStyle={`comp/data/${size}`}
128
+ >
114
129
  {data}
115
130
  {trendIconName && trendValue && <Icon color={trendIconColor} name={trendIconName} size={trendIconSize} />}
116
131
  </Box>
@@ -129,7 +144,7 @@ const LabeledData = ({
129
144
  </>
130
145
  )}
131
146
  {secondaryLabel && (
132
- <Text as="span" color="text/tertiary">
147
+ <Text as="span" color={isDisabled ? 'text/disabled' : 'text/tertiary'}>
133
148
  {secondaryLabel}
134
149
  </Text>
135
150
  )}
@@ -7,7 +7,7 @@ const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpe
7
7
  'footer',
8
8
  ]);
9
9
 
10
- const baseStyle = definePartsStyle({
10
+ const baseStyle = definePartsStyle((props) => ({
11
11
  container: {
12
12
  paddingTop: '16',
13
13
  display: 'grid',
@@ -17,6 +17,7 @@ const baseStyle = definePartsStyle({
17
17
  },
18
18
  data: {
19
19
  gridArea: 'data',
20
+ color: props.isDisabled ? 'text/disabled' : undefined,
20
21
  },
21
22
  actions: {
22
23
  gridArea: 'actions',
@@ -34,7 +35,7 @@ const baseStyle = definePartsStyle({
34
35
  paddingBottom: '8',
35
36
  paddingTop: '6',
36
37
  },
37
- });
38
+ }));
38
39
 
39
40
  const SettingsCardTheme = defineMultiStyleConfig({
40
41
  baseStyle,
@@ -12,12 +12,15 @@ import ToggleComponent, { ToggleComponentProps } from '../../Components/Toggle/T
12
12
 
13
13
  const [SettingsCardStyleProvider, useSettingsCardStyle] = createStylesContext('SettingsCard');
14
14
  export const SettingsCardData = ({ helperText, ...rest }: LabeledDataProps & { helperText?: string }) => {
15
- const { data } = useSettingsCardStyle();
16
- const labeledData = <LabeledData {...rest} __css={data} />;
15
+ const {
16
+ data: { color, ...dataRest },
17
+ } = useSettingsCardStyle();
18
+ const isDisabled = color === 'text/disabled';
19
+ const labeledData = <LabeledData isDisabled={isDisabled} {...rest} __css={dataRest} />;
17
20
 
18
21
  return helperText ? (
19
- <Box __css={data}>
20
- <LabeledData {...rest} secondaryLabel={helperText} />
22
+ <Box __css={dataRest}>
23
+ <LabeledData {...rest} secondaryLabel={helperText} isDisabled={isDisabled} />
21
24
  </Box>
22
25
  ) : (
23
26
  labeledData
@@ -28,10 +31,13 @@ export const SettingsCardActions = ({ children }: { children: ReactNode }) => {
28
31
  return <Box __css={actions}>{children}</Box>;
29
32
  };
30
33
  export const SettingsCardOnOffValue = (props: Pick<ToggleProps, 'isChecked' | 'valueText' | 'label'>) => {
31
- const { data } = useSettingsCardStyle();
34
+ const {
35
+ data: { color, ...rest },
36
+ } = useSettingsCardStyle();
37
+ const isDisabled = color === 'text/disabled';
32
38
  return (
33
- <Box __css={data}>
34
- <Toggle {...props} isReadOnly />
39
+ <Box __css={rest}>
40
+ <Toggle isDisabled={isDisabled} isReadOnly {...props} />
35
41
  </Box>
36
42
  );
37
43
  };
@@ -42,10 +48,14 @@ interface SettingsCardToggleProps extends Omit<ToggleProps, 'variant' | 'isReadO
42
48
  }
43
49
 
44
50
  export const SettingsCardToggle = (props: SettingsCardToggleProps) => {
45
- const { data } = useSettingsCardStyle();
51
+ const {
52
+ data: { color, ...rest },
53
+ } = useSettingsCardStyle();
54
+ const isDisabled = color === 'text/disabled';
55
+
46
56
  return (
47
- <Box __css={data}>
48
- <Toggle {...props} variant="fixed" />
57
+ <Box __css={rest}>
58
+ <Toggle isDisabled={isDisabled} variant="fixed" {...props} />
49
59
  </Box>
50
60
  );
51
61
  };
@@ -157,8 +167,8 @@ export const SettingsCardFooterStatus = ({
157
167
  </SettingsCardFooter>
158
168
  );
159
169
  };
160
- const SettingsCard = ({ children, ...props }: Omit<CardProps, 'variant'>) => {
161
- const style = useMultiStyleConfig('SettingsCard');
170
+ const SettingsCard = ({ children, isDisabled, ...props }: Omit<CardProps, 'variant'> & { isDisabled?: boolean }) => {
171
+ const style = useMultiStyleConfig('SettingsCard', { isDisabled });
162
172
  return (
163
173
  <SettingsCardStyleProvider value={style}>
164
174
  <Card variant="outline" sx={style.container} {...props}>