@bitrise/bitkit 10.29.0-alpha-chakra.1 → 10.29.0-alpha-input.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": "10.29.0-alpha-chakra.1",
4
+ "version": "10.29.0-alpha-input.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -0,0 +1,9 @@
1
+ import { FormLabel as ChakraFormLabel, FormLabelProps, forwardRef } from '@chakra-ui/react';
2
+
3
+ const FormLabel = forwardRef<FormLabelProps, 'label'>((props, ref) => {
4
+ return <ChakraFormLabel {...props} ref={ref} />;
5
+ });
6
+
7
+ export type { FormLabelProps };
8
+
9
+ export default FormLabel;
@@ -14,30 +14,34 @@ import {
14
14
  } from '@chakra-ui/react';
15
15
  import Icon, { TypeIconName } from '../../Icon/Icon';
16
16
 
17
- export interface InputProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
17
+ type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
18
+ type UsedChakraInputProps = Pick<
19
+ ChakraInputProps,
20
+ | 'onBlur'
21
+ | 'onChange'
22
+ | 'role'
23
+ | 'name'
24
+ | 'type'
25
+ | 'value'
26
+ | 'autoComplete'
27
+ | 'autoFocus'
28
+ | 'max'
29
+ | 'maxLength'
30
+ | 'min'
31
+ | 'minLength'
32
+ | 'pattern'
33
+ | 'step'
34
+ >;
35
+ export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
18
36
  'data-testid'?: string;
19
- errorText?: string;
37
+ errorText?: ReactNode;
20
38
  isLoading?: boolean;
21
- helperText?: string;
39
+ helperText?: ReactNode;
22
40
  inputRef?: Ref<HTMLInputElement>;
23
41
  label?: ReactNode;
24
42
  leftIconName?: TypeIconName;
25
- name?: string;
26
- onBlur?: ChakraInputProps['onBlur'];
27
- onChange?: ChakraInputProps['onChange'];
28
43
  rightElement?: ReactNode;
29
44
  rightIconName?: TypeIconName;
30
- role?: ChakraInputProps['role'];
31
- type?: ChakraInputProps['type'];
32
- value?: ChakraInputProps['value'];
33
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes
34
- autoComplete?: ChakraInputProps['autoComplete'];
35
- max?: ChakraInputProps['max'];
36
- maxLength?: ChakraInputProps['maxLength'];
37
- min?: ChakraInputProps['min'];
38
- minLength?: ChakraInputProps['minLength'];
39
- pattern?: ChakraInputProps['pattern'];
40
- step?: ChakraInputProps['step'];
41
45
  }
42
46
 
43
47
  /**
@@ -47,6 +51,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
47
51
  const {
48
52
  'data-testid': dataTestid,
49
53
  autoComplete,
54
+ autoFocus,
50
55
  errorText,
51
56
  helperText,
52
57
  isDisabled,
@@ -79,8 +84,9 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
79
84
  ...rest,
80
85
  ref,
81
86
  };
82
- const InputProps = {
87
+ const inputProps = {
83
88
  autoComplete,
89
+ autoFocus,
84
90
  'data-testid': dataTestid,
85
91
  onBlur,
86
92
  onChange,
@@ -106,11 +112,15 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
106
112
  <Icon name={leftIconName} />
107
113
  </InputLeftElement>
108
114
  )}
109
- <ChakraInput paddingLeft={leftIconName ? '43px' : '11px'} {...InputProps} />
115
+ <ChakraInput
116
+ paddingLeft={leftIconName ? '43px' : '11px'}
117
+ paddingRight={rightIconName ? '43px' : '11px'}
118
+ {...inputProps}
119
+ />
110
120
  {rightElement && <InputRightElement>{rightElement}</InputRightElement>}
111
121
  {!rightElement && rightIconName && (
112
- <InputRightElement>
113
- <Icon name={rightIconName} margin="12px" pointerEvents="none" />
122
+ <InputRightElement margin="12px" pointerEvents="none">
123
+ <Icon name={rightIconName} />
114
124
  </InputRightElement>
115
125
  )}
116
126
  </InputGroup>
package/src/index.ts CHANGED
@@ -204,3 +204,6 @@ export { default as Textarea } from './Components/Form/Textarea/Textarea';
204
204
 
205
205
  export type { InputProps } from './Components/Form/Input/Input';
206
206
  export { default as Input } from './Components/Form/Input/Input';
207
+
208
+ export type { FormLabelProps } from './Components/Form/FormLabel/FormLabel';
209
+ export { default as FormLabel } from './Components/Form/FormLabel/FormLabel';