@proximus/lavender-checkbox-native 0.1.0-alpha.1 → 0.1.0-alpha.12
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/dist/PxCheckBox.d.ts +2 -25
- package/dist/PxCheckBox.d.ts.map +1 -1
- package/dist/PxCheckBox.js +88 -0
- package/package.json +9 -28
- package/CHANGELOG.md +0 -45
- package/src/PxCheckBox.tsx +0 -225
- package/tsconfig.json +0 -8
- /package/{src/index.ts → dist/index.js} +0 -0
package/dist/PxCheckBox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AccessibilityProps, StyleProp,
|
|
2
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import 'nullthrows';
|
|
4
4
|
export interface ICheckBoxProps {
|
|
5
5
|
/**
|
|
@@ -9,32 +9,9 @@ export interface ICheckBoxProps {
|
|
|
9
9
|
onChange?: (value: boolean) => void;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
testID?: string;
|
|
12
|
-
color?: string;
|
|
13
12
|
label?: string;
|
|
14
13
|
hasError?: boolean;
|
|
15
14
|
wrapperStyle?: StyleProp<ViewStyle>;
|
|
16
|
-
checkboxStyle?: StyleProp<ViewStyle>;
|
|
17
|
-
labelStyle?: StyleProp<TextStyle>;
|
|
18
|
-
labelColor?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Check @react-native-community/checkbox for more info
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Android only
|
|
24
|
-
*/
|
|
25
|
-
focusable?: boolean;
|
|
26
|
-
tintColors?: {
|
|
27
|
-
true?: string;
|
|
28
|
-
false?: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* IOS only
|
|
32
|
-
*/
|
|
33
|
-
checkedColor?: string;
|
|
34
|
-
boxType?: 'circle' | 'square';
|
|
35
|
-
tintColor?: string;
|
|
36
|
-
onTintColor?: string;
|
|
37
|
-
checkedBackgroundColor?: string;
|
|
38
15
|
}
|
|
39
|
-
export declare function PxCheckBox({ checked, onChange, testID, label, disabled,
|
|
16
|
+
export declare function PxCheckBox({ checked, onChange, testID, label, disabled, wrapperStyle, ...accessibilityProps }: ICheckBoxProps & AccessibilityProps): React.JSX.Element;
|
|
40
17
|
//# sourceMappingURL=PxCheckBox.d.ts.map
|
package/dist/PxCheckBox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PxCheckBox.d.ts","sourceRoot":"","sources":["../src/PxCheckBox.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,kBAAkB,
|
|
1
|
+
{"version":3,"file":"PxCheckBox.d.ts","sourceRoot":"","sources":["../src/PxCheckBox.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAgB,EAChB,YAAY,EACZ,GAAG,kBAAkB,EACtB,EAAE,cAAc,GAAG,kBAAkB,qBAmHrC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import CheckBox from '@react-native-community/checkbox';
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { StyleSheet, TouchableOpacity, } from 'react-native';
|
|
4
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
5
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
6
|
+
import { Body } from '@proximus/lavender-texts-native';
|
|
7
|
+
import 'nullthrows';
|
|
8
|
+
export function PxCheckBox({ checked, onChange, testID, label, disabled = false, wrapperStyle, ...accessibilityProps }) {
|
|
9
|
+
const { theme } = useTheme();
|
|
10
|
+
const onChangeCallback = useCallback((value) => {
|
|
11
|
+
setInternalChecked(value);
|
|
12
|
+
if (onChange) {
|
|
13
|
+
onChange(value);
|
|
14
|
+
}
|
|
15
|
+
}, [onChange]);
|
|
16
|
+
const [internalChecked, setInternalChecked] = useState(checked);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setInternalChecked(checked);
|
|
19
|
+
}, [checked]);
|
|
20
|
+
const colors = {
|
|
21
|
+
disabledBackgroundColor: theme.t('ColorBackgroundStateDisabledDefault'),
|
|
22
|
+
disabledLabelColor: theme.t('ColorTextStateDisabledDefault'),
|
|
23
|
+
disabledCheckColor: 'rgba(255, 255, 255, 0.3)',
|
|
24
|
+
disabledBorderColor: theme.t('ColorBorderMainDefault'),
|
|
25
|
+
checkedBackgroundColor: theme.t('ColorBackgroundContainerPrimaryDefault'),
|
|
26
|
+
checkColor: '#FFFFFF',
|
|
27
|
+
tintColor: theme.t('ColorIconBrandDefault'),
|
|
28
|
+
backgroundColor: theme.t('ColorBackgroundContainerLightDefault'),
|
|
29
|
+
borderColor: theme.t('ColorBorderNeutralDefault'),
|
|
30
|
+
defaultLabelColor: theme.t('ColorTextNeutralDefault'),
|
|
31
|
+
};
|
|
32
|
+
return (React.createElement(TouchableOpacity, { style: [
|
|
33
|
+
{
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
},
|
|
37
|
+
wrapperStyle,
|
|
38
|
+
], onPress: () => {
|
|
39
|
+
onChangeCallback(!internalChecked);
|
|
40
|
+
}, ...a11y({
|
|
41
|
+
accessible: false,
|
|
42
|
+
}), ...e2eID(testID + '-checkbox'), disabled: disabled },
|
|
43
|
+
React.createElement(CheckBox, { lineWidth: 2, style: [
|
|
44
|
+
styles.checkbox,
|
|
45
|
+
{
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
width: theme.t('SizeM').number,
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
height: theme.t('SizeM').number,
|
|
50
|
+
}, // Unchecked background color
|
|
51
|
+
], tintColors: {
|
|
52
|
+
// Android only
|
|
53
|
+
true: disabled ? colors.disabledBackgroundColor : colors.tintColor,
|
|
54
|
+
false: disabled ? colors.disabledBackgroundColor : colors.tintColor,
|
|
55
|
+
}, tintColor:
|
|
56
|
+
// iOS only
|
|
57
|
+
disabled ? colors.disabledBackgroundColor : colors.borderColor // enabled
|
|
58
|
+
, onTintColor:
|
|
59
|
+
// iOS only
|
|
60
|
+
disabled
|
|
61
|
+
? colors.disabledBackgroundColor
|
|
62
|
+
: colors.checkedBackgroundColor, onFillColor: disabled
|
|
63
|
+
? colors.disabledBackgroundColor
|
|
64
|
+
: colors.checkedBackgroundColor, onCheckColor: disabled ? colors.disabledCheckColor : colors.checkColor, animationDuration: 0.2, value: internalChecked, disabled: disabled, boxType: 'square', onValueChange: onChangeCallback, focusable: true, ...a11y({
|
|
65
|
+
accessible: accessibilityProps.accessible,
|
|
66
|
+
accessibilityLabel: accessibilityProps.accessibilityLabel || label,
|
|
67
|
+
accessibilityHint: accessibilityProps.accessibilityHint,
|
|
68
|
+
importantForAccessibility: accessibilityProps.importantForAccessibility,
|
|
69
|
+
}), ...e2eID(testID + '-checkbox') }),
|
|
70
|
+
label && label.trim() !== '' && (React.createElement(Body, { accessible: false, importantForAccessibility: 'no', style: [
|
|
71
|
+
styles.label,
|
|
72
|
+
{
|
|
73
|
+
color: disabled
|
|
74
|
+
? colors.disabledLabelColor
|
|
75
|
+
: colors.defaultLabelColor,
|
|
76
|
+
},
|
|
77
|
+
] }, label))));
|
|
78
|
+
}
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
checkbox: {
|
|
81
|
+
borderRadius: 5,
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
marginHorizontal: 12,
|
|
85
|
+
fontStyle: 'normal',
|
|
86
|
+
fontWeight: '400',
|
|
87
|
+
},
|
|
88
|
+
});
|
package/package.json
CHANGED
|
@@ -1,38 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-checkbox-native",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.12",
|
|
4
4
|
"description": "Lavender Checkbox native component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"build": "npx tsc -p tsconfig.json"
|
|
12
|
-
},
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
13
11
|
"peerDependencies": {
|
|
14
|
-
"@proximus/lavender-common-native": "
|
|
15
|
-
"@proximus/lavender-styling-native": "
|
|
16
|
-
"@proximus/lavender-texts-native": "
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@proximus/lavender-common-native": "0.1.0-alpha.1",
|
|
20
|
-
"@proximus/lavender-styling-native": "0.1.0-alpha.1",
|
|
21
|
-
"@proximus/lavender-texts-native": "0.1.0-alpha.1"
|
|
12
|
+
"@proximus/lavender-common-native": "*",
|
|
13
|
+
"@proximus/lavender-styling-native": "*",
|
|
14
|
+
"@proximus/lavender-texts-native": "*"
|
|
22
15
|
},
|
|
23
16
|
"publishConfig": {
|
|
24
17
|
"access": "public"
|
|
25
|
-
}
|
|
26
|
-
"lerna": {
|
|
27
|
-
"command": {
|
|
28
|
-
"publish": {
|
|
29
|
-
"assets": [
|
|
30
|
-
"dist",
|
|
31
|
-
"src",
|
|
32
|
-
"package.json"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"gitHead": "d422a1d369000e1e249afb26de2cef08930c2407"
|
|
18
|
+
}
|
|
38
19
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [0.1.0-alpha.1](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-checkbox-native@0.1.0-alpha.0...@proximus/lavender-checkbox-native@0.1.0-alpha.1) (2025-08-13)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- **BCRI-4210372:** fix types field in modules ([68ac126](https://github.com/Pxs-Corporate/react-native-lavender/commit/68ac12657112473ae9e0e683076b1d9172be9ce6))
|
|
11
|
-
|
|
12
|
-
# 0.1.0-alpha.0 (2025-08-13)
|
|
13
|
-
|
|
14
|
-
### Bug Fixes
|
|
15
|
-
|
|
16
|
-
- **BCRI-3807748:** fix checkbox android native crash ([f358872](https://github.com/Pxs-Corporate/react-native-lavender/commit/f3588725a8a7440722b6fc13a5586da2da758ea0))
|
|
17
|
-
|
|
18
|
-
### Features
|
|
19
|
-
|
|
20
|
-
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
21
|
-
- **BCRI-3651613:** checkbox module ([b791f5f](https://github.com/Pxs-Corporate/react-native-lavender/commit/b791f5f9482f1162302826092d946fa364f37e9d))
|
|
22
|
-
- **BCRI-3651673:** entrypoint module ([9a246af](https://github.com/Pxs-Corporate/react-native-lavender/commit/9a246af671f674f0ff768a9b6a72a77d1f12d065))
|
|
23
|
-
- **BCRI-3660857:** cell components ([af9e45c](https://github.com/Pxs-Corporate/react-native-lavender/commit/af9e45cefc20d08d2338380ff4cd8cd6851abe24))
|
|
24
|
-
- **BCRI-3707400:** entrypoint prefix slot ([5f5c4a9](https://github.com/Pxs-Corporate/react-native-lavender/commit/5f5c4a9a973a5168d359f6d4a9413a3b7bf50d48))
|
|
25
|
-
- **BCRI-3810979:** tile components ([46fc5c7](https://github.com/Pxs-Corporate/react-native-lavender/commit/46fc5c7a0ddff6c2db43fba0de9929626092f265))
|
|
26
|
-
- **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
|
|
27
|
-
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
|
28
|
-
- **BCRI-4210372:** fix bad version numbers ([bc6a8ba](https://github.com/Pxs-Corporate/react-native-lavender/commit/bc6a8ba48c15347442f2ac38dacae7ffba3d95eb))
|
|
29
|
-
|
|
30
|
-
# (2025-08-13)
|
|
31
|
-
|
|
32
|
-
### Bug Fixes
|
|
33
|
-
|
|
34
|
-
- **BCRI-3807748:** fix checkbox android native crash ([f358872](https://github.com/Pxs-Corporate/react-native-lavender/commit/f3588725a8a7440722b6fc13a5586da2da758ea0))
|
|
35
|
-
|
|
36
|
-
### Features
|
|
37
|
-
|
|
38
|
-
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
39
|
-
- **BCRI-3651613:** checkbox module ([b791f5f](https://github.com/Pxs-Corporate/react-native-lavender/commit/b791f5f9482f1162302826092d946fa364f37e9d))
|
|
40
|
-
- **BCRI-3651673:** entrypoint module ([9a246af](https://github.com/Pxs-Corporate/react-native-lavender/commit/9a246af671f674f0ff768a9b6a72a77d1f12d065))
|
|
41
|
-
- **BCRI-3660857:** cell components ([af9e45c](https://github.com/Pxs-Corporate/react-native-lavender/commit/af9e45cefc20d08d2338380ff4cd8cd6851abe24))
|
|
42
|
-
- **BCRI-3707400:** entrypoint prefix slot ([5f5c4a9](https://github.com/Pxs-Corporate/react-native-lavender/commit/5f5c4a9a973a5168d359f6d4a9413a3b7bf50d48))
|
|
43
|
-
- **BCRI-3810979:** tile components ([46fc5c7](https://github.com/Pxs-Corporate/react-native-lavender/commit/46fc5c7a0ddff6c2db43fba0de9929626092f265))
|
|
44
|
-
- **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
|
|
45
|
-
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
package/src/PxCheckBox.tsx
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import CheckBox from '@react-native-community/checkbox';
|
|
2
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
AccessibilityProps,
|
|
5
|
-
Platform,
|
|
6
|
-
StyleProp,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
TextStyle,
|
|
9
|
-
TouchableOpacity,
|
|
10
|
-
ViewStyle,
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
|
|
13
|
-
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
14
|
-
import { Colors, ThemeName, useTheme } from '@proximus/lavender-styling-native';
|
|
15
|
-
import { Body } from '@proximus/lavender-texts-native';
|
|
16
|
-
import 'nullthrows';
|
|
17
|
-
|
|
18
|
-
export interface ICheckBoxProps {
|
|
19
|
-
/**
|
|
20
|
-
* Common Props
|
|
21
|
-
*/
|
|
22
|
-
checked: boolean;
|
|
23
|
-
onChange?: (value: boolean) => void;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
testID?: string;
|
|
26
|
-
color?: string;
|
|
27
|
-
label?: string;
|
|
28
|
-
hasError?: boolean;
|
|
29
|
-
wrapperStyle?: StyleProp<ViewStyle>;
|
|
30
|
-
checkboxStyle?: StyleProp<ViewStyle>;
|
|
31
|
-
labelStyle?: StyleProp<TextStyle>;
|
|
32
|
-
labelColor?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Check @react-native-community/checkbox for more info
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* Android only
|
|
38
|
-
*/
|
|
39
|
-
focusable?: boolean;
|
|
40
|
-
tintColors?: {
|
|
41
|
-
true?: string;
|
|
42
|
-
false?: string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* IOS only
|
|
46
|
-
*/
|
|
47
|
-
checkedColor?: string;
|
|
48
|
-
boxType?: 'circle' | 'square';
|
|
49
|
-
tintColor?: string;
|
|
50
|
-
onTintColor?: string;
|
|
51
|
-
checkedBackgroundColor?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const isAndroid = Platform.OS === 'android';
|
|
55
|
-
|
|
56
|
-
export function PxCheckBox({
|
|
57
|
-
checked,
|
|
58
|
-
onChange,
|
|
59
|
-
testID,
|
|
60
|
-
label,
|
|
61
|
-
disabled = false,
|
|
62
|
-
checkedColor,
|
|
63
|
-
tintColor,
|
|
64
|
-
checkedBackgroundColor,
|
|
65
|
-
onTintColor,
|
|
66
|
-
focusable = false,
|
|
67
|
-
labelColor,
|
|
68
|
-
boxType = 'square',
|
|
69
|
-
wrapperStyle,
|
|
70
|
-
checkboxStyle,
|
|
71
|
-
labelStyle,
|
|
72
|
-
...accessibilityProps
|
|
73
|
-
}: ICheckBoxProps & AccessibilityProps) {
|
|
74
|
-
const { theme } = useTheme();
|
|
75
|
-
|
|
76
|
-
const isScarlet = theme.name === ThemeName.SCARLET;
|
|
77
|
-
|
|
78
|
-
const onChangeCallback = useCallback(
|
|
79
|
-
(value: boolean) => {
|
|
80
|
-
setInternalChecked(value);
|
|
81
|
-
if (onChange) {
|
|
82
|
-
onChange(value);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
[onChange]
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const [internalChecked, setInternalChecked] = useState(checked);
|
|
89
|
-
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
setInternalChecked(checked);
|
|
92
|
-
}, [checked]);
|
|
93
|
-
|
|
94
|
-
const getColors = () =>
|
|
95
|
-
isScarlet
|
|
96
|
-
? {
|
|
97
|
-
disabledBackgroundColor: Colors.v7.shadesOfGrey.whiteOpacity8,
|
|
98
|
-
checkedBackgroundColor: Colors.v8_1.white,
|
|
99
|
-
backgroundColor: Colors.v7.shadesOfGrey.blackOpacity2,
|
|
100
|
-
errorColor: Colors.v7.status.epicError,
|
|
101
|
-
disabledLabelColor: Colors.v7.shadesOfGrey.whiteOpacity16,
|
|
102
|
-
disabledColor: Colors.v7.shadesOfGrey.whiteOpacity8,
|
|
103
|
-
defaultLabel: '#FFF',
|
|
104
|
-
tintColor: Colors.brand.purple,
|
|
105
|
-
focusColor: Colors.white,
|
|
106
|
-
disabledCheckColor: Colors.v8_1.shadesOfGrey.dark160,
|
|
107
|
-
disabledBorderColor: Colors.v8_1.strokeBlack,
|
|
108
|
-
}
|
|
109
|
-
: {
|
|
110
|
-
disabledBackgroundColor: Colors.v8_1.shadesOfGrey.dark160,
|
|
111
|
-
checkedBackgroundColor: Colors.v8_1.shadesOfPurple.purple,
|
|
112
|
-
tintColor: Colors.v8_1.shadesOfPurple.purple,
|
|
113
|
-
backgroundColor: Colors.v8_1.shadesOfGrey.dark4,
|
|
114
|
-
disabledBorderColor: Colors.v8_1.shadesOfGrey.dark160,
|
|
115
|
-
borderColor: Colors.v8_1.strokeBlack,
|
|
116
|
-
errorColor: Colors.v7.status.error,
|
|
117
|
-
disabledLabelColor: Colors.v7.shadesOfGrey.black0Opacity12,
|
|
118
|
-
disabledColor: Colors.v8_1.shadesOfGrey.dark160,
|
|
119
|
-
defaultLabel: '#0A0A0A',
|
|
120
|
-
checkColor: Colors.v8_1.white,
|
|
121
|
-
disabledCheckColor: Colors.v8_1.shadesOfGrey.dark160,
|
|
122
|
-
focusColor: Colors.v8_1.shadesOfPurple.purple,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<TouchableOpacity
|
|
127
|
-
style={[
|
|
128
|
-
{
|
|
129
|
-
flexDirection: 'row',
|
|
130
|
-
alignItems: 'center',
|
|
131
|
-
},
|
|
132
|
-
wrapperStyle,
|
|
133
|
-
]}
|
|
134
|
-
onPress={() => {
|
|
135
|
-
onChangeCallback(!internalChecked);
|
|
136
|
-
}}
|
|
137
|
-
{...a11y({
|
|
138
|
-
accessible: false,
|
|
139
|
-
})}
|
|
140
|
-
{...e2eID(testID + '-checkbox')}
|
|
141
|
-
>
|
|
142
|
-
<CheckBox
|
|
143
|
-
lineWidth={disabled || !internalChecked ? 2 : 3}
|
|
144
|
-
style={[
|
|
145
|
-
styles.checkbox,
|
|
146
|
-
{
|
|
147
|
-
backgroundColor: isAndroid
|
|
148
|
-
? 'transparent'
|
|
149
|
-
: disabled
|
|
150
|
-
? getColors().disabledBackgroundColor
|
|
151
|
-
: getColors().backgroundColor,
|
|
152
|
-
}, // Unchecked background color
|
|
153
|
-
checkboxStyle as any,
|
|
154
|
-
]}
|
|
155
|
-
tintColors={{
|
|
156
|
-
true: getColors().tintColor,
|
|
157
|
-
false: getColors().tintColor,
|
|
158
|
-
}}
|
|
159
|
-
tintColor={
|
|
160
|
-
tintColor || disabled
|
|
161
|
-
? internalChecked
|
|
162
|
-
? getColors().backgroundColor
|
|
163
|
-
: getColors().disabledBackgroundColor
|
|
164
|
-
: getColors().borderColor
|
|
165
|
-
} // checkbox border color when unchecked
|
|
166
|
-
onTintColor={onTintColor || getColors().tintColor} // checkbox border color when checked
|
|
167
|
-
onFillColor={
|
|
168
|
-
checkedBackgroundColor || getColors().checkedBackgroundColor
|
|
169
|
-
}
|
|
170
|
-
onCheckColor={
|
|
171
|
-
checkedColor || disabled
|
|
172
|
-
? getColors().disabledCheckColor
|
|
173
|
-
: getColors().checkColor
|
|
174
|
-
}
|
|
175
|
-
animationDuration={0.5}
|
|
176
|
-
value={internalChecked}
|
|
177
|
-
disabled={disabled}
|
|
178
|
-
boxType={boxType}
|
|
179
|
-
onValueChange={onChangeCallback}
|
|
180
|
-
hideBox={isAndroid || (disabled && internalChecked)}
|
|
181
|
-
focusable={focusable}
|
|
182
|
-
{...a11y({
|
|
183
|
-
accessible: accessibilityProps.accessible,
|
|
184
|
-
accessibilityLabel: accessibilityProps.accessibilityLabel || label,
|
|
185
|
-
accessibilityHint: accessibilityProps.accessibilityHint,
|
|
186
|
-
importantForAccessibility:
|
|
187
|
-
accessibilityProps.importantForAccessibility,
|
|
188
|
-
})}
|
|
189
|
-
{...e2eID(testID + '-checkbox')}
|
|
190
|
-
/>
|
|
191
|
-
{label && label.trim() !== '' && (
|
|
192
|
-
<Body
|
|
193
|
-
accessible={false}
|
|
194
|
-
importantForAccessibility={'no'}
|
|
195
|
-
style={[
|
|
196
|
-
styles.label,
|
|
197
|
-
{
|
|
198
|
-
color: labelColor
|
|
199
|
-
? labelColor
|
|
200
|
-
: disabled
|
|
201
|
-
? getColors().disabledLabelColor
|
|
202
|
-
: getColors().defaultLabel,
|
|
203
|
-
},
|
|
204
|
-
labelStyle,
|
|
205
|
-
]}
|
|
206
|
-
>
|
|
207
|
-
{label}
|
|
208
|
-
</Body>
|
|
209
|
-
)}
|
|
210
|
-
</TouchableOpacity>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const styles = StyleSheet.create({
|
|
215
|
-
checkbox: {
|
|
216
|
-
height: 24,
|
|
217
|
-
width: 24,
|
|
218
|
-
borderRadius: 5,
|
|
219
|
-
},
|
|
220
|
-
label: {
|
|
221
|
-
marginHorizontal: 12,
|
|
222
|
-
fontStyle: 'normal',
|
|
223
|
-
fontWeight: '400',
|
|
224
|
-
},
|
|
225
|
-
});
|
package/tsconfig.json
DELETED
|
File without changes
|