@bitrise/bitkit 13.328.0 → 13.330.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.328.0",
4
+ "version": "13.330.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -21,7 +21,7 @@ export interface CheckboxProps extends Omit<
21
21
  > {
22
22
  inputProps?: CheckboxInputProps;
23
23
  helperText?: ReactNode;
24
- errorText?: string;
24
+ errorText?: ReactNode;
25
25
  value?: ChakraCheckboxProps['value'];
26
26
  inputRef?: Ref<HTMLInputElement>;
27
27
  isIndeterminate?: ChakraCheckboxProps['isIndeterminate'];
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, DragEvent, useId, useRef, useState } from 'react';
1
+ import { ChangeEvent, DragEvent, ReactNode, useId, useRef, useState } from 'react';
2
2
  import {
3
3
  FormControl,
4
4
  FormControlProps,
@@ -15,8 +15,8 @@ import Text from '../../Text/Text';
15
15
  export interface FileInputProps extends Omit<FormControlProps, 'onChange'> {
16
16
  accept?: HTMLInputElement['accept'];
17
17
  disabledLabel?: string;
18
- errorText?: string;
19
- helperText?: string;
18
+ errorText?: ReactNode;
19
+ helperText?: ReactNode;
20
20
  name?: string;
21
21
  onChange: (files: FileList | null) => void;
22
22
  }
@@ -19,7 +19,7 @@ export interface RadioProps extends Omit<
19
19
  > {
20
20
  inputProps?: RadioInputProps;
21
21
  helperText?: ReactNode;
22
- errorText?: string;
22
+ errorText?: ReactNode;
23
23
  value?: ChakraRadioProps['value'];
24
24
  inputRef?: Ref<HTMLInputElement>;
25
25
  isChecked?: ChakraRadioProps['isChecked'];
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, useState } from 'react';
1
+ import { ChangeEvent, ReactNode, useState } from 'react';
2
2
  import {
3
3
  FormControl,
4
4
  FormControlProps,
@@ -29,11 +29,11 @@ type UsedChakraTextProps = Pick<
29
29
 
30
30
  export type TextareaProps = {
31
31
  badge?: FormLabelProps['badge'];
32
- errorText?: string;
32
+ errorText?: ReactNode;
33
33
  infoTooltipLabel?: string;
34
34
  infoTooltipProps?: TooltipProps;
35
35
  isLoading?: boolean;
36
- helperText?: string;
36
+ helperText?: ReactNode;
37
37
  label?: FormLabelProps['children'];
38
38
  maxLength?: number;
39
39
  recommendedLength?: number;
@@ -18,7 +18,7 @@ import { getDataAttributes } from '../../utils/utils';
18
18
 
19
19
  export interface SelectProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
20
20
  badge?: FormLabelProps['badge'];
21
- errorText?: string;
21
+ errorText?: ReactNode;
22
22
  helperText?: ReactNode;
23
23
  infoTooltipLabel?: string;
24
24
  infoTooltipProps?: TooltipProps;
@@ -15,14 +15,14 @@ const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpe
15
15
  'leafBadge',
16
16
  ]);
17
17
 
18
- const baseStyle = definePartsStyle({
18
+ const baseStyle = definePartsStyle(({ variant, isEmpty }) => ({
19
19
  listItem: {
20
20
  overflow: 'hidden',
21
21
  },
22
22
  icon: {
23
23
  marginTop: '10px',
24
24
  marginBottom: '2px',
25
- color: 'icon/primary',
25
+ color: isEmpty ? 'icon/disabled' : 'icon/primary',
26
26
  },
27
27
  leafBadge: {
28
28
  marginTop: '10px',
@@ -92,7 +92,7 @@ const baseStyle = definePartsStyle({
92
92
  display: 'flex',
93
93
  alignItems: 'flex-start',
94
94
  textAlign: 'start',
95
- borderBottom: '1px solid',
95
+ borderBottom: variant === 'files' ? 'none' : '1px solid',
96
96
  borderColor: 'border/minimal',
97
97
  },
98
98
  textBlock: {
@@ -102,6 +102,13 @@ const baseStyle = definePartsStyle({
102
102
  py: '8',
103
103
  gap: '4',
104
104
  flex: '1',
105
+ color: isEmpty ? 'text/tertiary' : 'text/body',
106
+ '& > .description-text': {
107
+ wordBreak: 'break-word',
108
+ overflowWrap: 'break-word',
109
+ textStyle: 'body/sm/regular',
110
+ color: 'text/secondary',
111
+ },
105
112
  },
106
113
  suffixBlock: {
107
114
  display: 'flex',
@@ -144,7 +151,7 @@ const baseStyle = definePartsStyle({
144
151
  display: 'none',
145
152
  alignItems: 'center',
146
153
  },
147
- });
154
+ }));
148
155
 
149
156
  const TreeViewTheme = defineMultiStyleConfig({
150
157
  baseStyle,
@@ -49,13 +49,18 @@ const TreeViewNodeContent = memo(
49
49
  onClick,
50
50
  children,
51
51
  }: TreeViewNodeContentProps) => {
52
- const styles = useMultiStyleConfig('TreeView', {});
53
52
  const { variant } = useTreeViewContext();
54
53
 
55
54
  const isFilesVariant = variant === 'files';
56
55
  const hasChildren = Boolean(children);
57
- const isSelectable = !(isBranch && !hasChildren);
58
56
  const isEmptyBranch = isBranch && !hasChildren;
57
+ const isSelectable = !isEmptyBranch;
58
+
59
+ const styles = useMultiStyleConfig('TreeView', {
60
+ variant,
61
+ isEmpty: isEmptyBranch,
62
+ });
63
+
59
64
  const chevronIcon = isExpanded ? 'ChevronDown' : 'ChevronRight';
60
65
  const primaryIconName = isFilesVariant ? 'FolderEmpty' : chevronIcon;
61
66
 
@@ -137,16 +142,7 @@ const TreeViewNodeContent = memo(
137
142
  <Text fontWeight={isExpanded ? 'semibold' : 'normal'} overflowWrap="break-word" wordBreak="break-word">
138
143
  {title}
139
144
  </Text>
140
- {description && (
141
- <Text
142
- color="text/secondary"
143
- wordBreak="break-word"
144
- overflowWrap="break-word"
145
- textStyle="body/sm/regular"
146
- >
147
- {description}
148
- </Text>
149
- )}
145
+ {description && <Text className="description-text">{description}</Text>}
150
146
  </Box>
151
147
 
152
148
  {(hasLabelContent || hasHoverActions) && (
@@ -71,7 +71,7 @@ export const SettingsCardFooterToggle = ({
71
71
  label,
72
72
  errorText,
73
73
  ...props
74
- }: { label: string; errorText?: string } & ToggleComponentProps) => {
74
+ }: { label: string; errorText?: ReactNode } & ToggleComponentProps) => {
75
75
  return (
76
76
  <SettingsCardFooter>
77
77
  <Box display="flex" alignItems="center" gap="8">