@bitrise/bitkit 10.18.0-alpha-chakra.3 → 10.18.2
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
|
@@ -4,7 +4,6 @@ const ToggleTheme: ComponentStyleConfig = {
|
|
|
4
4
|
baseStyle: {
|
|
5
5
|
formControl: {
|
|
6
6
|
display: 'flex',
|
|
7
|
-
flexWrap: 'wrap',
|
|
8
7
|
gap: '8',
|
|
9
8
|
},
|
|
10
9
|
track: {
|
|
@@ -25,6 +24,9 @@ const ToggleTheme: ComponentStyleConfig = {
|
|
|
25
24
|
backgroundColor: 'turquoise.80',
|
|
26
25
|
},
|
|
27
26
|
},
|
|
27
|
+
_focusVisible: {
|
|
28
|
+
boxShadow: 'outline',
|
|
29
|
+
},
|
|
28
30
|
_before: {
|
|
29
31
|
content: '""',
|
|
30
32
|
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.213 13.915 17.234 7l1.49 1.49L10.212 17 5 11.68l1.49-1.489 3.723 3.724Z' fill='white' /%3E%3C/svg%3E")`,
|
|
@@ -58,18 +60,17 @@ const ToggleTheme: ComponentStyleConfig = {
|
|
|
58
60
|
transform: 'translate(24px)',
|
|
59
61
|
},
|
|
60
62
|
},
|
|
61
|
-
label: {
|
|
62
|
-
flexBasis: 'calc(100% - 56px)',
|
|
63
|
-
},
|
|
64
63
|
spinner: {
|
|
65
64
|
width: '16',
|
|
66
65
|
height: '16',
|
|
66
|
+
marginTop: '4',
|
|
67
|
+
flexShrink: 0,
|
|
67
68
|
color: 'neutral.70',
|
|
68
69
|
},
|
|
69
70
|
helpherText: {
|
|
70
71
|
fontSize: '2',
|
|
71
72
|
lineHeight: '2',
|
|
72
|
-
marginTop: '
|
|
73
|
+
marginTop: '8px',
|
|
73
74
|
color: 'neutral.40',
|
|
74
75
|
},
|
|
75
76
|
},
|
|
@@ -9,9 +9,11 @@ import {
|
|
|
9
9
|
forwardRef,
|
|
10
10
|
useMultiStyleConfig,
|
|
11
11
|
} from '@chakra-ui/react';
|
|
12
|
+
import Box from '../Box/Box';
|
|
12
13
|
import Text from '../Text/Text';
|
|
13
14
|
|
|
14
15
|
export interface ToggleProps extends Omit<FormControlProps, 'label'> {
|
|
16
|
+
dataTestid?: string;
|
|
15
17
|
defaultChecked?: SwitchProps['defaultChecked'];
|
|
16
18
|
id?: SwitchProps['id'];
|
|
17
19
|
isChecked?: SwitchProps['isChecked'];
|
|
@@ -27,8 +29,21 @@ export interface ToggleProps extends Omit<FormControlProps, 'label'> {
|
|
|
27
29
|
* The Toggle component is used as an alternative for the checkbox component.
|
|
28
30
|
*/
|
|
29
31
|
const Toggle = forwardRef<ToggleProps, 'div'>((props, ref) => {
|
|
30
|
-
const {
|
|
32
|
+
const {
|
|
33
|
+
dataTestid,
|
|
34
|
+
defaultChecked,
|
|
35
|
+
helpherText,
|
|
36
|
+
id,
|
|
37
|
+
isChecked,
|
|
38
|
+
isDisabled,
|
|
39
|
+
isLoading,
|
|
40
|
+
label,
|
|
41
|
+
onChange,
|
|
42
|
+
value,
|
|
43
|
+
...rest
|
|
44
|
+
} = props;
|
|
31
45
|
const switchProps = {
|
|
46
|
+
dataTestid,
|
|
32
47
|
defaultChecked,
|
|
33
48
|
id,
|
|
34
49
|
isChecked,
|
|
@@ -38,12 +53,12 @@ const Toggle = forwardRef<ToggleProps, 'div'>((props, ref) => {
|
|
|
38
53
|
};
|
|
39
54
|
const css = useMultiStyleConfig('Switch');
|
|
40
55
|
return (
|
|
41
|
-
<FormControl
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
{label}
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
<FormControl {...rest} ref={ref}>
|
|
57
|
+
<Box sx={css.formControl}>
|
|
58
|
+
<Switch {...switchProps} />
|
|
59
|
+
<FormLabel htmlFor={id}>{label}</FormLabel>
|
|
60
|
+
{isLoading && <Spinner sx={css.spinner} />}
|
|
61
|
+
</Box>
|
|
47
62
|
{helpherText && <Text sx={css.helpherText}>{helpherText}</Text>}
|
|
48
63
|
</FormControl>
|
|
49
64
|
);
|