@bitrise/bitkit 10.18.2 → 10.19.0-alpha-chakra.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 +1 -1
- package/src/Components/Form/Form.theme.ts +32 -0
- package/src/Components/Form/Textarea/Textarea.stories.tsx +20 -0
- package/src/Components/Form/Textarea/Textarea.theme.ts +31 -0
- package/src/Components/Form/Textarea/Textarea.tsx +34 -0
- package/src/Components/Toggle/Toggle.theme.ts +4 -6
- package/src/Components/Toggle/Toggle.tsx +7 -3
- package/src/index.ts +3 -0
- package/src/old.ts +0 -3
- package/src/theme.ts +4 -0
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/Old/Textarea/Textarea.css +0 -34
- package/src/Old/Textarea/Textarea.tsx +0 -23
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComponentStyleConfig } from '@chakra-ui/theme';
|
|
2
|
+
|
|
3
|
+
const FormTheme = {
|
|
4
|
+
Form: {
|
|
5
|
+
baseStyle: {
|
|
6
|
+
helperText: {
|
|
7
|
+
fontSize: '2',
|
|
8
|
+
lineHeight: '2',
|
|
9
|
+
marginTop: '4',
|
|
10
|
+
color: 'neutral.40',
|
|
11
|
+
},
|
|
12
|
+
} as ComponentStyleConfig,
|
|
13
|
+
},
|
|
14
|
+
FormError: {
|
|
15
|
+
baseStyle: {
|
|
16
|
+
text: {
|
|
17
|
+
fontSize: '2',
|
|
18
|
+
lineHeight: '2',
|
|
19
|
+
marginTop: '4',
|
|
20
|
+
color: 'red.50',
|
|
21
|
+
},
|
|
22
|
+
} as ComponentStyleConfig,
|
|
23
|
+
},
|
|
24
|
+
FormLabel: {
|
|
25
|
+
baseStyle: {
|
|
26
|
+
marginBottom: '4',
|
|
27
|
+
fontWeight: 'bold',
|
|
28
|
+
} as ComponentStyleConfig,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default FormTheme;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentMeta } from '@storybook/react';
|
|
2
|
+
import Textarea from './Textarea';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
component: Textarea,
|
|
6
|
+
} as ComponentMeta<typeof Textarea>;
|
|
7
|
+
|
|
8
|
+
export const WithProps = {
|
|
9
|
+
args: {
|
|
10
|
+
errorText: '',
|
|
11
|
+
helpherText:
|
|
12
|
+
'Inline help. Maecenas a turpis tortor. Nunc vitae libero tempor, ullamcorper purus quis, mattis tellus.',
|
|
13
|
+
isDisabled: false,
|
|
14
|
+
isInvalid: false,
|
|
15
|
+
isLoading: false,
|
|
16
|
+
isReadOnly: false,
|
|
17
|
+
label: 'Textarea',
|
|
18
|
+
placeholder: 'Placeholder text',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentStyleConfig } from '@chakra-ui/theme';
|
|
2
|
+
|
|
3
|
+
const TextareaTheme: ComponentStyleConfig = {
|
|
4
|
+
baseStyle: {
|
|
5
|
+
width: '100%',
|
|
6
|
+
minHeight: '96',
|
|
7
|
+
padding: '16',
|
|
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
|
+
lineHeight: 'short',
|
|
16
|
+
verticalAlign: 'top',
|
|
17
|
+
_disabled: {
|
|
18
|
+
background: 'neutral.93',
|
|
19
|
+
cursor: 'not-allowed',
|
|
20
|
+
},
|
|
21
|
+
_focusVisible: {
|
|
22
|
+
boxShadow: 'outline',
|
|
23
|
+
},
|
|
24
|
+
_invalid: {
|
|
25
|
+
color: 'red.50',
|
|
26
|
+
borderColor: 'red.50',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default TextareaTheme;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
FormControlProps,
|
|
5
|
+
FormErrorMessage,
|
|
6
|
+
FormHelperText,
|
|
7
|
+
FormLabel,
|
|
8
|
+
Textarea as ChakraTextarea,
|
|
9
|
+
forwardRef,
|
|
10
|
+
} from '@chakra-ui/react';
|
|
11
|
+
|
|
12
|
+
export interface TextareaProps extends Omit<FormControlProps, 'label'> {
|
|
13
|
+
errorText?: string;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
helpherText?: string;
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The Textarea component allows you to easily create multi-line text inputs.
|
|
21
|
+
*/
|
|
22
|
+
const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
|
|
23
|
+
const { errorText, helpherText, isDisabled, isInvalid, isLoading, label, placeholder, ...rest } = props;
|
|
24
|
+
return (
|
|
25
|
+
<FormControl isDisabled={isDisabled || isLoading} isInvalid={isInvalid || !!errorText} {...rest} ref={ref}>
|
|
26
|
+
{label && <FormLabel>{label}</FormLabel>}
|
|
27
|
+
<ChakraTextarea placeholder={placeholder} />
|
|
28
|
+
{errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
|
|
29
|
+
{helpherText && <FormHelperText as="p">{helpherText}</FormHelperText>}
|
|
30
|
+
</FormControl>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default Textarea;
|
|
@@ -60,6 +60,10 @@ const ToggleTheme: ComponentStyleConfig = {
|
|
|
60
60
|
transform: 'translate(24px)',
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
|
+
label: {
|
|
64
|
+
fontWeight: 'normal',
|
|
65
|
+
marginBottom: 0,
|
|
66
|
+
},
|
|
63
67
|
spinner: {
|
|
64
68
|
width: '16',
|
|
65
69
|
height: '16',
|
|
@@ -67,12 +71,6 @@ const ToggleTheme: ComponentStyleConfig = {
|
|
|
67
71
|
flexShrink: 0,
|
|
68
72
|
color: 'neutral.70',
|
|
69
73
|
},
|
|
70
|
-
helpherText: {
|
|
71
|
-
fontSize: '2',
|
|
72
|
-
lineHeight: '2',
|
|
73
|
-
marginTop: '8px',
|
|
74
|
-
color: 'neutral.40',
|
|
75
|
-
},
|
|
76
74
|
},
|
|
77
75
|
};
|
|
78
76
|
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
FormControl,
|
|
4
4
|
FormControlProps,
|
|
5
|
+
FormHelperText,
|
|
5
6
|
FormLabel,
|
|
6
7
|
Spinner,
|
|
7
8
|
Switch,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
useMultiStyleConfig,
|
|
11
12
|
} from '@chakra-ui/react';
|
|
12
13
|
import Box from '../Box/Box';
|
|
13
|
-
import Text from '../Text/Text';
|
|
14
14
|
|
|
15
15
|
export interface ToggleProps extends Omit<FormControlProps, 'label'> {
|
|
16
16
|
dataTestid?: string;
|
|
@@ -56,10 +56,14 @@ const Toggle = forwardRef<ToggleProps, 'div'>((props, ref) => {
|
|
|
56
56
|
<FormControl {...rest} ref={ref}>
|
|
57
57
|
<Box sx={css.formControl}>
|
|
58
58
|
<Switch {...switchProps} />
|
|
59
|
-
|
|
59
|
+
{label && (
|
|
60
|
+
<FormLabel htmlFor={id} sx={css.label}>
|
|
61
|
+
{label}
|
|
62
|
+
</FormLabel>
|
|
63
|
+
)}
|
|
60
64
|
{isLoading && <Spinner sx={css.spinner} />}
|
|
61
65
|
</Box>
|
|
62
|
-
{helpherText && <
|
|
66
|
+
{helpherText && <FormHelperText as="p">{helpherText}</FormHelperText>}
|
|
63
67
|
</FormControl>
|
|
64
68
|
);
|
|
65
69
|
});
|
package/src/index.ts
CHANGED
|
@@ -195,3 +195,6 @@ export { default as Tr } from './Components/Table/Tr';
|
|
|
195
195
|
|
|
196
196
|
export type { ToggleProps } from './Components/Toggle/Toggle';
|
|
197
197
|
export { default as Toggle } from './Components/Toggle/Toggle';
|
|
198
|
+
|
|
199
|
+
export type { TextareaProps } from './Components/Form/Textarea/Textarea';
|
|
200
|
+
export { default as Textarea } from './Components/Form/Textarea/Textarea';
|
package/src/old.ts
CHANGED
|
@@ -91,9 +91,6 @@ export { default as OldTableHeaderRow } from './Old/Table/TableHeaderRow';
|
|
|
91
91
|
export type { Props as OldTableRowProps } from './Old/Table/TableRow';
|
|
92
92
|
export { default as OldTableRow } from './Old/Table/TableRow';
|
|
93
93
|
|
|
94
|
-
export type { Props as TextareaProps } from './Old/Textarea/Textarea';
|
|
95
|
-
export { default as Textarea } from './Old/Textarea/Textarea';
|
|
96
|
-
|
|
97
94
|
export type { Props as VisibilityProps } from './Old/Visibility/Visibility';
|
|
98
95
|
export { default as Visibility } from './Old/Visibility/Visibility';
|
|
99
96
|
|
package/src/theme.ts
CHANGED
|
@@ -24,6 +24,8 @@ import Tooltip from './Components/Tooltip/Tooltip.theme';
|
|
|
24
24
|
import CloseButton from './Components/CloseButton/CloseButton.theme';
|
|
25
25
|
import Popover from './Components/Popover/Popover.theme';
|
|
26
26
|
import Toggle from './Components/Toggle/Toggle.theme';
|
|
27
|
+
import Textarea from './Components/Form/Textarea/Textarea.theme';
|
|
28
|
+
import Form from './Components/Form/Form.theme';
|
|
27
29
|
|
|
28
30
|
import breakpoints from './Foundations/Breakpoints/Breakpoints';
|
|
29
31
|
import colors from './Foundations/Colors/Colors';
|
|
@@ -80,6 +82,7 @@ const theme = {
|
|
|
80
82
|
Divider,
|
|
81
83
|
Dropdown,
|
|
82
84
|
EmptyState,
|
|
85
|
+
...Form,
|
|
83
86
|
Link,
|
|
84
87
|
List,
|
|
85
88
|
Menu,
|
|
@@ -95,6 +98,7 @@ const theme = {
|
|
|
95
98
|
Input,
|
|
96
99
|
Popover,
|
|
97
100
|
Switch: Toggle,
|
|
101
|
+
Textarea,
|
|
98
102
|
},
|
|
99
103
|
};
|
|
100
104
|
|