@bitrise/bitkit 12.6.0 → 12.6.1

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": "12.6.0",
4
+ "version": "12.6.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -9,8 +9,15 @@ import {
9
9
  TextareaProps as ChakraTextareaProps,
10
10
  forwardRef,
11
11
  } from '@chakra-ui/react';
12
+ import Text from '../../Text/Text';
12
13
 
13
- export interface TextareaProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
14
+ type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
15
+ type UsedChakraTextProps = Pick<
16
+ ChakraTextareaProps,
17
+ 'onBlur' | 'onChange' | 'role' | 'name' | 'value' | 'autoComplete' | 'autoFocus' | 'maxLength' | 'minLength'
18
+ >;
19
+
20
+ export interface TextareaProps extends UsedFormControlProps, UsedChakraTextProps {
14
21
  'data-testid'?: string;
15
22
  errorText?: string;
16
23
  isLoading?: boolean;
@@ -27,6 +34,8 @@ export interface TextareaProps extends Omit<FormControlProps, 'label' | 'onBlur'
27
34
  */
28
35
  const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
29
36
  const {
37
+ autoComplete,
38
+ autoFocus,
30
39
  'data-testid': dataTestid,
31
40
  errorText,
32
41
  helperText,
@@ -34,10 +43,14 @@ const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
34
43
  isInvalid,
35
44
  isLoading,
36
45
  label,
46
+ maxLength,
47
+ minLength,
37
48
  placeholder,
38
49
  onBlur,
39
50
  onChange,
51
+ resize,
40
52
  name,
53
+ role,
41
54
  value,
42
55
  ...rest
43
56
  } = props;
@@ -48,16 +61,34 @@ const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
48
61
  ref,
49
62
  };
50
63
  const textareaProps = {
64
+ autoComplete,
65
+ autoFocus,
51
66
  'data-testid': dataTestid,
52
67
  onBlur,
53
68
  onChange,
69
+ maxLength,
70
+ minLength,
54
71
  name,
55
72
  placeholder,
73
+ resize,
74
+ role,
56
75
  value,
57
76
  };
58
77
  return (
59
78
  <FormControl {...formControlProps}>
60
- {label && <FormLabel>{label}</FormLabel>}
79
+ {label && (
80
+ <FormLabel
81
+ requiredIndicator={null as any}
82
+ optionalIndicator={
83
+ <Text as="span" fontSize="2" color="neutral.40" fontWeight="normal" marginLeft="4px">
84
+ (Optional)
85
+ </Text>
86
+ }
87
+ >
88
+ {label}
89
+ </FormLabel>
90
+ )}
91
+
61
92
  <ChakraTextarea {...textareaProps} />
62
93
  {errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
63
94
  {helperText && <FormHelperText as="p">{helperText}</FormHelperText>}