@bitrise/bitkit 10.29.0-alpha-input.1 → 10.29.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 +1 -2
- package/src/Components/Dropdown/Dropdown.tsx +25 -14
- package/src/Components/Fade/Fade.stories.tsx +5 -0
- package/src/Components/Fade/Fade.tsx +4 -0
- package/src/Components/Form/Textarea/Textarea.theme.ts +30 -5
- package/src/Components/Input/Input.theme.ts +20 -0
- package/src/index.ts +2 -5
- package/src/old.ts +3 -6
- package/src/theme.ts +1 -1
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/Components/Form/FormLabel/FormLabel.tsx +0 -9
- package/src/Components/Form/Input/Input.stories.tsx +0 -52
- package/src/Components/Form/Input/Input.theme.ts +0 -38
- package/src/Components/Form/Input/Input.tsx +0 -133
- package/src/Old/Visibility/Visibility.css +0 -13
- package/src/Old/Visibility/Visibility.tsx +0 -29
- package/src/Old/Visibility/VisibilityContainer.tsx +0 -27
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ComponentMeta } from '@storybook/react';
|
|
2
|
-
import IconButton from '@/Components/IconButton/IconButton';
|
|
3
|
-
import Input from './Input';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: Input,
|
|
7
|
-
argTypes: {
|
|
8
|
-
type: {
|
|
9
|
-
control: 'inline-radio',
|
|
10
|
-
options: ['number', 'password', 'text'],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
args: {
|
|
14
|
-
isDisabled: false,
|
|
15
|
-
isInvalid: false,
|
|
16
|
-
isLoading: false,
|
|
17
|
-
isReadOnly: false,
|
|
18
|
-
label: 'Input',
|
|
19
|
-
placeholder: 'Placeholder text',
|
|
20
|
-
type: 'text',
|
|
21
|
-
width: '400px',
|
|
22
|
-
},
|
|
23
|
-
} as ComponentMeta<typeof Input>;
|
|
24
|
-
|
|
25
|
-
export const WithProps = {
|
|
26
|
-
args: {
|
|
27
|
-
errorText: '',
|
|
28
|
-
helperText:
|
|
29
|
-
'Inline help. Maecenas a turpis tortor. Nunc vitae libero tempor, ullamcorper purus quis, mattis tellus.',
|
|
30
|
-
label: 'Input',
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const WithElement = {
|
|
35
|
-
args: {
|
|
36
|
-
isDisabled: true,
|
|
37
|
-
label: 'With additional element (Like IconButton)',
|
|
38
|
-
rightElement: (
|
|
39
|
-
<IconButton aria-label="Copy to clipboard" borderLeftRadius="0" iconName="Duplicate" variant="secondary">
|
|
40
|
-
eee
|
|
41
|
-
</IconButton>
|
|
42
|
-
),
|
|
43
|
-
value: '1234567890ABCDE',
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const WithIcon = {
|
|
48
|
-
args: {
|
|
49
|
-
label: 'With Icon on the left and/or right side',
|
|
50
|
-
leftIconName: 'Magnifier',
|
|
51
|
-
},
|
|
52
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { defineStyle } from '@chakra-ui/styled-system';
|
|
2
|
-
|
|
3
|
-
const InputTheme = defineStyle({
|
|
4
|
-
baseStyle: {
|
|
5
|
-
field: {
|
|
6
|
-
width: '100%',
|
|
7
|
-
padding: '0.6875rem',
|
|
8
|
-
background: 'neutral.100',
|
|
9
|
-
border: '1px solid',
|
|
10
|
-
borderColor: 'neutral.90',
|
|
11
|
-
borderRadius: '4',
|
|
12
|
-
boxShadow: 'inner',
|
|
13
|
-
outline: 0,
|
|
14
|
-
appearance: 'none',
|
|
15
|
-
transition: '200ms',
|
|
16
|
-
_placeholder: {
|
|
17
|
-
fontStyle: 'italic',
|
|
18
|
-
},
|
|
19
|
-
_disabled: {
|
|
20
|
-
background: 'neutral.93',
|
|
21
|
-
cursor: 'not-allowed',
|
|
22
|
-
},
|
|
23
|
-
_focusVisible: {
|
|
24
|
-
boxShadow: 'formFocus',
|
|
25
|
-
borderColor: 'purple.50',
|
|
26
|
-
},
|
|
27
|
-
_invalid: {
|
|
28
|
-
color: 'red.50',
|
|
29
|
-
borderColor: 'red.50',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
leftElement: {
|
|
33
|
-
background: 'red',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export default InputTheme;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { ReactNode, Ref } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
FormControl,
|
|
4
|
-
FormControlProps,
|
|
5
|
-
FormErrorMessage,
|
|
6
|
-
FormHelperText,
|
|
7
|
-
FormLabel,
|
|
8
|
-
Input as ChakraInput,
|
|
9
|
-
InputProps as ChakraInputProps,
|
|
10
|
-
forwardRef,
|
|
11
|
-
InputGroup,
|
|
12
|
-
InputLeftElement,
|
|
13
|
-
InputRightElement,
|
|
14
|
-
} from '@chakra-ui/react';
|
|
15
|
-
import Icon, { TypeIconName } from '../../Icon/Icon';
|
|
16
|
-
|
|
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 {
|
|
36
|
-
'data-testid'?: string;
|
|
37
|
-
errorText?: ReactNode;
|
|
38
|
-
isLoading?: boolean;
|
|
39
|
-
helperText?: ReactNode;
|
|
40
|
-
inputRef?: Ref<HTMLInputElement>;
|
|
41
|
-
label?: ReactNode;
|
|
42
|
-
leftIconName?: TypeIconName;
|
|
43
|
-
rightElement?: ReactNode;
|
|
44
|
-
rightIconName?: TypeIconName;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Input component is a component that is used to get user input in a text field.
|
|
49
|
-
*/
|
|
50
|
-
const Input = forwardRef<InputProps, 'div'>((props, ref) => {
|
|
51
|
-
const {
|
|
52
|
-
'data-testid': dataTestid,
|
|
53
|
-
autoComplete,
|
|
54
|
-
autoFocus,
|
|
55
|
-
errorText,
|
|
56
|
-
helperText,
|
|
57
|
-
isDisabled,
|
|
58
|
-
inputRef,
|
|
59
|
-
isInvalid,
|
|
60
|
-
isLoading,
|
|
61
|
-
label,
|
|
62
|
-
leftIconName,
|
|
63
|
-
max,
|
|
64
|
-
maxLength,
|
|
65
|
-
min,
|
|
66
|
-
minLength,
|
|
67
|
-
pattern,
|
|
68
|
-
placeholder,
|
|
69
|
-
step,
|
|
70
|
-
onBlur,
|
|
71
|
-
onChange,
|
|
72
|
-
rightElement,
|
|
73
|
-
rightIconName,
|
|
74
|
-
name,
|
|
75
|
-
role,
|
|
76
|
-
type,
|
|
77
|
-
value,
|
|
78
|
-
...rest
|
|
79
|
-
} = props;
|
|
80
|
-
|
|
81
|
-
const formControlProps = {
|
|
82
|
-
isDisabled: isDisabled || isLoading,
|
|
83
|
-
isInvalid: isInvalid || !!errorText,
|
|
84
|
-
...rest,
|
|
85
|
-
ref,
|
|
86
|
-
};
|
|
87
|
-
const inputProps = {
|
|
88
|
-
autoComplete,
|
|
89
|
-
autoFocus,
|
|
90
|
-
'data-testid': dataTestid,
|
|
91
|
-
onBlur,
|
|
92
|
-
onChange,
|
|
93
|
-
name,
|
|
94
|
-
max,
|
|
95
|
-
maxLength,
|
|
96
|
-
min,
|
|
97
|
-
minLength,
|
|
98
|
-
pattern,
|
|
99
|
-
placeholder,
|
|
100
|
-
ref: inputRef,
|
|
101
|
-
role,
|
|
102
|
-
step,
|
|
103
|
-
type,
|
|
104
|
-
value,
|
|
105
|
-
};
|
|
106
|
-
return (
|
|
107
|
-
<FormControl {...formControlProps}>
|
|
108
|
-
{label && <FormLabel>{label}</FormLabel>}
|
|
109
|
-
<InputGroup>
|
|
110
|
-
{leftIconName && (
|
|
111
|
-
<InputLeftElement margin="12px" pointerEvents="none">
|
|
112
|
-
<Icon name={leftIconName} />
|
|
113
|
-
</InputLeftElement>
|
|
114
|
-
)}
|
|
115
|
-
<ChakraInput
|
|
116
|
-
paddingLeft={leftIconName ? '43px' : '11px'}
|
|
117
|
-
paddingRight={rightIconName ? '43px' : '11px'}
|
|
118
|
-
{...inputProps}
|
|
119
|
-
/>
|
|
120
|
-
{rightElement && <InputRightElement>{rightElement}</InputRightElement>}
|
|
121
|
-
{!rightElement && rightIconName && (
|
|
122
|
-
<InputRightElement margin="12px" pointerEvents="none">
|
|
123
|
-
<Icon name={rightIconName} />
|
|
124
|
-
</InputRightElement>
|
|
125
|
-
)}
|
|
126
|
-
</InputGroup>
|
|
127
|
-
{errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
|
|
128
|
-
{helperText && <FormHelperText as="p">{helperText}</FormHelperText>}
|
|
129
|
-
</FormControl>
|
|
130
|
-
);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
export default Input;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.Visibility {
|
|
2
|
-
opacity: 0;
|
|
3
|
-
transition-property: opacity;
|
|
4
|
-
transition-duration: var(--transition-duration--base);
|
|
5
|
-
transition-timing-function: var(--transition-timing-function);
|
|
6
|
-
pointer-events: none;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.Visibility__container--enabled:hover .Visibility--uncontrolled,
|
|
10
|
-
.Visibility--visible {
|
|
11
|
-
opacity: 1;
|
|
12
|
-
pointer-events: all;
|
|
13
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import Flex, { Props as FlexProps } from '../Flex/Flex';
|
|
4
|
-
import './Visibility.css';
|
|
5
|
-
|
|
6
|
-
export interface Props extends FlexProps {
|
|
7
|
-
/**
|
|
8
|
-
* Flag that makes the component work independently from
|
|
9
|
-
* the container, and controls the visibility.
|
|
10
|
-
*/
|
|
11
|
-
visible?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A component to fade content in when the child component
|
|
16
|
-
* is hovered on, or can be used standalone as a controlled component with the
|
|
17
|
-
* visibility prop.
|
|
18
|
-
*/
|
|
19
|
-
const Visibility: React.FunctionComponent<Props> = (props: Props) => {
|
|
20
|
-
const { visible, ...rest } = props;
|
|
21
|
-
const classes = classnames('Visibility', {
|
|
22
|
-
'Visibility--uncontrolled': visible === undefined,
|
|
23
|
-
'Visibility--visible': visible,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return <Flex className={classes} {...rest} />;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default Visibility;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import Flex, { Props as FlexProps } from '../Flex/Flex';
|
|
4
|
-
|
|
5
|
-
export interface Props extends FlexProps {
|
|
6
|
-
/**
|
|
7
|
-
* Flag that controls if the enabled
|
|
8
|
-
* state for controlling the child Visibility state.
|
|
9
|
-
*/
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Container that controls the visibility state on hover. */
|
|
14
|
-
const VisibilityContainer: React.FunctionComponent<Props> = (props: Props) => {
|
|
15
|
-
const { className, enabled, ...rest } = props;
|
|
16
|
-
const classes = classnames(className, 'Visibility__container', {
|
|
17
|
-
'Visibility__container--enabled': enabled,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return <Flex className={classes} {...rest} />;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
VisibilityContainer.defaultProps = {
|
|
24
|
-
enabled: true,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default VisibilityContainer;
|