vpt-sebraeds 0.0.37 → 0.0.38
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.
|
@@ -41,6 +41,8 @@ const Toggle = ({
|
|
|
41
41
|
disabled = false,
|
|
42
42
|
invalid = false,
|
|
43
43
|
variant = 'default', // 'default' ou 'square'
|
|
44
|
+
activeColor = '#193AB8',
|
|
45
|
+
inactiveColor = '#BFC4D3',
|
|
44
46
|
}) => {
|
|
45
47
|
const animatedValue = useRef(new Animated.Value(value ? 1 : 0)).current;
|
|
46
48
|
const componentSize = variant === 'square' ? SQUARE_SIZES[size] : SIZES[size];
|
|
@@ -59,7 +61,7 @@ const Toggle = ({
|
|
|
59
61
|
|
|
60
62
|
const trackColor = animatedValue.interpolate({
|
|
61
63
|
inputRange: [0, 1],
|
|
62
|
-
outputRange: [
|
|
64
|
+
outputRange: [inactiveColor, activeColor],
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
const thumbTranslateX = animatedValue.interpolate({
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export default Toggle;
|
|
2
|
-
declare function Toggle({ value, onValueChange, size, disabled, invalid, variant, }: {
|
|
2
|
+
declare function Toggle({ value, onValueChange, size, disabled, invalid, variant, activeColor, inactiveColor, }: {
|
|
3
3
|
value: any;
|
|
4
4
|
onValueChange: any;
|
|
5
5
|
size?: string | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
invalid?: boolean | undefined;
|
|
8
8
|
variant?: string | undefined;
|
|
9
|
+
activeColor?: string | undefined;
|
|
10
|
+
inactiveColor?: string | undefined;
|
|
9
11
|
}): React.JSX.Element;
|
|
10
12
|
import React from 'react';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Toggle/index.jsx"],"names":[],"mappings":";AAoCA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Toggle/index.jsx"],"names":[],"mappings":";AAoCA;;;;;;;;;sBAgFC;kBApHwC,OAAO"}
|
|
@@ -32,7 +32,7 @@ const SQUARE_SIZES = {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
const Toggle = ({ value, onValueChange, size = 'medium', disabled = false, invalid = false, variant = 'default', // 'default' ou 'square'
|
|
35
|
-
}) => {
|
|
35
|
+
activeColor = '#193AB8', inactiveColor = '#BFC4D3', }) => {
|
|
36
36
|
const animatedValue = useRef(new Animated.Value(value ? 1 : 0)).current;
|
|
37
37
|
const componentSize = variant === 'square' ? SQUARE_SIZES[size] : SIZES[size];
|
|
38
38
|
const isSquare = variant === 'square';
|
|
@@ -47,7 +47,7 @@ const Toggle = ({ value, onValueChange, size = 'medium', disabled = false, inval
|
|
|
47
47
|
}, [value, animatedValue]);
|
|
48
48
|
const trackColor = animatedValue.interpolate({
|
|
49
49
|
inputRange: [0, 1],
|
|
50
|
-
outputRange: [
|
|
50
|
+
outputRange: [inactiveColor, activeColor],
|
|
51
51
|
});
|
|
52
52
|
const thumbTranslateX = animatedValue.interpolate({
|
|
53
53
|
inputRange: [0, 1],
|