@proximus/lavender-checkbox-native 0.1.0-alpha.4 → 0.1.0-alpha.6
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/CHANGELOG.md +10 -0
- package/dist/PxCheckBox.js +88 -0
- package/dist/far/away/package.json +34 -0
- package/dist/index.js +1 -0
- package/package.json +14 -7
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.1.0-alpha.6](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-checkbox-native@0.1.0-alpha.5...@proximus/lavender-checkbox-native@0.1.0-alpha.6) (2025-09-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @proximus/lavender-checkbox-native
|
|
9
|
+
|
|
10
|
+
# [0.1.0-alpha.5](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-checkbox-native@0.1.0-alpha.4...@proximus/lavender-checkbox-native@0.1.0-alpha.5) (2025-09-25)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **BCRI-000000:** no free space on gh runner during build ([#27](https://github.com/Pxs-Corporate/react-native-lavender/issues/27)) ([a7c8604](https://github.com/Pxs-Corporate/react-native-lavender/commit/a7c86043b5cefcb10fd768d449c5718fbabe87ec))
|
|
15
|
+
|
|
6
16
|
# [0.1.0-alpha.4](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-checkbox-native@0.1.0-alpha.3...@proximus/lavender-checkbox-native@0.1.0-alpha.4) (2025-09-19)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @proximus/lavender-checkbox-native
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-checkbox-native",
|
|
3
|
+
"version": "0.1.0-alpha.6",
|
|
4
|
+
"description": "Lavender Checkbox native component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@proximus/lavender-common-native": "*",
|
|
10
|
+
"@proximus/lavender-styling-native": "*",
|
|
11
|
+
"@proximus/lavender-texts-native": "*"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"lerna": {
|
|
17
|
+
"command": {
|
|
18
|
+
"publish": {
|
|
19
|
+
"assets": [
|
|
20
|
+
{
|
|
21
|
+
"from": "dist/far/away/package.json",
|
|
22
|
+
"to": "."
|
|
23
|
+
},
|
|
24
|
+
"dist/*.js",
|
|
25
|
+
"dist/*.d.ts",
|
|
26
|
+
"dist/*.d.ts.map",
|
|
27
|
+
"src",
|
|
28
|
+
"package.json"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
|
|
34
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PxCheckBox';
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-checkbox-native",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.6",
|
|
4
4
|
"description": "Lavender Checkbox native component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"clean": "rm -rf dist",
|
|
10
|
-
"
|
|
10
|
+
"transform-package-json": "node ../../../scripts/tranformPackageJson.js package.json dist/far/away",
|
|
11
|
+
"prepublish": "yarn clean && yarn transform-package-json && yarn build",
|
|
11
12
|
"build": "npx tsc -p tsconfig.json"
|
|
12
13
|
},
|
|
13
14
|
"peerDependencies": {
|
|
@@ -16,9 +17,9 @@
|
|
|
16
17
|
"@proximus/lavender-texts-native": "workspace:*"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@proximus/lavender-common-native": "0.1.0-alpha.
|
|
20
|
-
"@proximus/lavender-styling-native": "0.1.0-alpha.
|
|
21
|
-
"@proximus/lavender-texts-native": "0.1.0-alpha.
|
|
20
|
+
"@proximus/lavender-common-native": "0.1.0-alpha.6",
|
|
21
|
+
"@proximus/lavender-styling-native": "0.1.0-alpha.5",
|
|
22
|
+
"@proximus/lavender-texts-native": "0.1.0-alpha.6"
|
|
22
23
|
},
|
|
23
24
|
"publishConfig": {
|
|
24
25
|
"access": "public"
|
|
@@ -27,12 +28,18 @@
|
|
|
27
28
|
"command": {
|
|
28
29
|
"publish": {
|
|
29
30
|
"assets": [
|
|
30
|
-
|
|
31
|
+
{
|
|
32
|
+
"from": "dist/far/away/package.json",
|
|
33
|
+
"to": "."
|
|
34
|
+
},
|
|
35
|
+
"dist/*.js",
|
|
36
|
+
"dist/*.d.ts",
|
|
37
|
+
"dist/*.d.ts.map",
|
|
31
38
|
"src",
|
|
32
39
|
"package.json"
|
|
33
40
|
]
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
},
|
|
37
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
|
|
38
45
|
}
|
package/tsconfig.json
CHANGED