@proximus/lavender-radio-native 0.1.0-alpha.0
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 +27 -0
- package/dist/PxRadioButton.d.ts +17 -0
- package/dist/PxRadioButton.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +39 -0
- package/src/PxRadioButton.tsx +163 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +8 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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.0 (2025-08-13)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
11
|
+
- **BCRI-3651767:** radio module ([f0a0f6a](https://github.com/Pxs-Corporate/react-native-lavender/commit/f0a0f6ac805651ecb46c13c2b2119b0d9492b58a))
|
|
12
|
+
- **BCRI-3651770:** spinner module ([7671419](https://github.com/Pxs-Corporate/react-native-lavender/commit/76714190c7f7908a4199e2e3194844dbdbe2fb0f))
|
|
13
|
+
- **BCRI-3660857:** cell components ([af9e45c](https://github.com/Pxs-Corporate/react-native-lavender/commit/af9e45cefc20d08d2338380ff4cd8cd6851abe24))
|
|
14
|
+
- **BCRI-3810979:** tile components ([46fc5c7](https://github.com/Pxs-Corporate/react-native-lavender/commit/46fc5c7a0ddff6c2db43fba0de9929626092f265))
|
|
15
|
+
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
|
16
|
+
- **BCRI-4210372:** fix bad version numbers ([bc6a8ba](https://github.com/Pxs-Corporate/react-native-lavender/commit/bc6a8ba48c15347442f2ac38dacae7ffba3d95eb))
|
|
17
|
+
|
|
18
|
+
# (2025-08-13)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
23
|
+
- **BCRI-3651767:** radio module ([f0a0f6a](https://github.com/Pxs-Corporate/react-native-lavender/commit/f0a0f6ac805651ecb46c13c2b2119b0d9492b58a))
|
|
24
|
+
- **BCRI-3651770:** spinner module ([7671419](https://github.com/Pxs-Corporate/react-native-lavender/commit/76714190c7f7908a4199e2e3194844dbdbe2fb0f))
|
|
25
|
+
- **BCRI-3660857:** cell components ([af9e45c](https://github.com/Pxs-Corporate/react-native-lavender/commit/af9e45cefc20d08d2338380ff4cd8cd6851abe24))
|
|
26
|
+
- **BCRI-3810979:** tile components ([46fc5c7](https://github.com/Pxs-Corporate/react-native-lavender/commit/46fc5c7a0ddff6c2db43fba0de9929626092f265))
|
|
27
|
+
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccessibilityProps, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
export interface IRadioButton extends AccessibilityProps {
|
|
4
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
color?: string;
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
label?: string;
|
|
10
|
+
testID?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
size?: number;
|
|
14
|
+
labelA11y?: AccessibilityProps;
|
|
15
|
+
}
|
|
16
|
+
export declare function PxRadioButton({ color, checked, label, onPress, testID, disabled, hasError, labelA11y, containerStyle, labelStyle, size, ...accessibilityProps }: IRadioButton & AccessibilityProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=PxRadioButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxRadioButton.d.ts","sourceRoot":"","sources":["../src/PxRadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAElB,SAAS,EAET,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAMtB,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACtD,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAChC;AACD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAgB,EAChB,QAAgB,EAChB,SAAS,EACT,cAAc,EACd,UAAU,EACV,IAAS,EACT,GAAG,kBAAkB,EACtB,EAAE,YAAY,GAAG,kBAAkB,qBAyGnC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-radio-native",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Lavender radio component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"prepublish": "yarn clean && yarn build",
|
|
12
|
+
"build": "npx tsc -p tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@proximus/lavender-common-native": "workspace:*",
|
|
16
|
+
"@proximus/lavender-styling-native": "workspace:*",
|
|
17
|
+
"@proximus/lavender-texts-native": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@proximus/lavender-common-native": "0.1.0-alpha.0",
|
|
21
|
+
"@proximus/lavender-styling-native": "0.1.0-alpha.0",
|
|
22
|
+
"@proximus/lavender-texts-native": "0.1.0-alpha.0"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"lerna": {
|
|
28
|
+
"command": {
|
|
29
|
+
"publish": {
|
|
30
|
+
"assets": [
|
|
31
|
+
"dist",
|
|
32
|
+
"src",
|
|
33
|
+
"package.json"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "27525289a448a6e4f3c2d36a88b9dc54d0f15fbf"
|
|
39
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AccessibilityProps,
|
|
4
|
+
Platform,
|
|
5
|
+
StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TextStyle,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
10
|
+
ViewStyle,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
|
|
13
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
14
|
+
import { Colors, useIsThemeScarlet } from '@proximus/lavender-styling-native';
|
|
15
|
+
import { Body } from '@proximus/lavender-texts-native';
|
|
16
|
+
|
|
17
|
+
export interface IRadioButton extends AccessibilityProps {
|
|
18
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
19
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
20
|
+
checked: boolean;
|
|
21
|
+
color?: string;
|
|
22
|
+
onPress?: () => void;
|
|
23
|
+
label?: string;
|
|
24
|
+
testID?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
hasError?: boolean;
|
|
27
|
+
size?: number;
|
|
28
|
+
labelA11y?: AccessibilityProps;
|
|
29
|
+
}
|
|
30
|
+
export function PxRadioButton({
|
|
31
|
+
color,
|
|
32
|
+
checked,
|
|
33
|
+
label,
|
|
34
|
+
onPress,
|
|
35
|
+
testID,
|
|
36
|
+
disabled = false,
|
|
37
|
+
hasError = false,
|
|
38
|
+
labelA11y,
|
|
39
|
+
containerStyle,
|
|
40
|
+
labelStyle,
|
|
41
|
+
size = 24,
|
|
42
|
+
...accessibilityProps
|
|
43
|
+
}: IRadioButton & AccessibilityProps) {
|
|
44
|
+
const isScarlet = useIsThemeScarlet();
|
|
45
|
+
|
|
46
|
+
const getColors = () =>
|
|
47
|
+
isScarlet
|
|
48
|
+
? {
|
|
49
|
+
backgroundColor: Colors.v7.shadesOfGrey.blackOpacity2,
|
|
50
|
+
checkedBgColor: Colors.brand.purple,
|
|
51
|
+
errorColor: '#F22613',
|
|
52
|
+
disabledLabelColor: Colors.v7.shadesOfGrey.whiteOpacity64,
|
|
53
|
+
disabledBgColor: Colors.v7.shadesOfGrey.whiteOpacity52,
|
|
54
|
+
disabledBorderColor: Colors.v7.shadesOfGrey.whiteOpacity12,
|
|
55
|
+
disabledCheckedBgColor: Colors.v7.shadesOfGrey.whiteOpacity12,
|
|
56
|
+
defaultLabel: '#FFF',
|
|
57
|
+
borderColor: Colors.shadesOfGrey.white,
|
|
58
|
+
focusColor: Colors.white,
|
|
59
|
+
defaultBorderColor: Colors.v7.shadesOfGrey.whiteOpacity52,
|
|
60
|
+
checkedBorderColor: color || Colors.shadesOfGrey.white,
|
|
61
|
+
}
|
|
62
|
+
: {
|
|
63
|
+
defaultBorderColor: Colors.v8_1.strokeBlack,
|
|
64
|
+
checkedBorderColor: color || Colors.v8_1.shadesOfPurple.purple,
|
|
65
|
+
backgroundColor: Colors.v8_1.shadesOfGrey.dark4,
|
|
66
|
+
errorColor: '#B30000',
|
|
67
|
+
checkedBgColor: Colors.v8_1.white,
|
|
68
|
+
disabledLabelColor: Colors.v7.shadesOfGrey.black0Opacity56,
|
|
69
|
+
disabledBgColor: Colors.v8_1.shadesOfGrey.dark160,
|
|
70
|
+
disabledCheckedBgColor: Colors.v8_1.shadesOfGrey.dark320,
|
|
71
|
+
disabledBorderColor: '#cccccc',
|
|
72
|
+
defaultLabel: '#0A0A0A',
|
|
73
|
+
borderColor: Colors.v8_1.shadesOfPurple.purple,
|
|
74
|
+
focusColor: Colors.v8_1.shadesOfPurple.purple,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View focusable style={containerStyle} {...e2eID(testID + '-radioButton')}>
|
|
79
|
+
<TouchableOpacity
|
|
80
|
+
focusable={true}
|
|
81
|
+
onPress={onPress}
|
|
82
|
+
style={[styles.container, { height: size }]}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
{...a11y({
|
|
85
|
+
accessible: true,
|
|
86
|
+
accessibilityRole: 'button',
|
|
87
|
+
accessibilityLabel: labelA11y?.accessibilityLabel || label,
|
|
88
|
+
accessibilityState: {
|
|
89
|
+
checked,
|
|
90
|
+
disabled,
|
|
91
|
+
},
|
|
92
|
+
...accessibilityProps,
|
|
93
|
+
})}
|
|
94
|
+
>
|
|
95
|
+
<View
|
|
96
|
+
style={[
|
|
97
|
+
styles.radio,
|
|
98
|
+
{
|
|
99
|
+
borderColor: getColors().defaultBorderColor,
|
|
100
|
+
backgroundColor: getColors().backgroundColor,
|
|
101
|
+
},
|
|
102
|
+
checked && {
|
|
103
|
+
borderWidth: 7,
|
|
104
|
+
borderColor: getColors().checkedBorderColor,
|
|
105
|
+
backgroundColor: getColors().checkedBgColor,
|
|
106
|
+
},
|
|
107
|
+
disabled && {
|
|
108
|
+
backgroundColor: getColors().disabledBgColor,
|
|
109
|
+
borderColor: getColors().disabledBgColor,
|
|
110
|
+
},
|
|
111
|
+
disabled &&
|
|
112
|
+
checked && {
|
|
113
|
+
borderColor: getColors().disabledBorderColor,
|
|
114
|
+
backgroundColor: getColors().disabledCheckedBgColor,
|
|
115
|
+
borderWidth: 7,
|
|
116
|
+
},
|
|
117
|
+
hasError && {
|
|
118
|
+
borderColor: getColors().errorColor,
|
|
119
|
+
},
|
|
120
|
+
hasError &&
|
|
121
|
+
checked && {
|
|
122
|
+
borderColor: getColors().errorColor,
|
|
123
|
+
backgroundColor: isScarlet ? '#0A0A0A' : Colors.v8_1.white,
|
|
124
|
+
borderWidth: 7,
|
|
125
|
+
},
|
|
126
|
+
{ height: size, width: size },
|
|
127
|
+
]}
|
|
128
|
+
/>
|
|
129
|
+
{label && (
|
|
130
|
+
<Body
|
|
131
|
+
style={[
|
|
132
|
+
styles.label,
|
|
133
|
+
{
|
|
134
|
+
color: disabled
|
|
135
|
+
? getColors().disabledLabelColor
|
|
136
|
+
: getColors().defaultLabel,
|
|
137
|
+
},
|
|
138
|
+
labelStyle,
|
|
139
|
+
]}
|
|
140
|
+
{...(labelA11y && a11y(labelA11y))}
|
|
141
|
+
>
|
|
142
|
+
{label}
|
|
143
|
+
</Body>
|
|
144
|
+
)}
|
|
145
|
+
</TouchableOpacity>
|
|
146
|
+
</View>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const styles = StyleSheet.create({
|
|
151
|
+
container: {
|
|
152
|
+
flexDirection: 'row',
|
|
153
|
+
},
|
|
154
|
+
radio: {
|
|
155
|
+
borderRadius: 12,
|
|
156
|
+
borderWidth: 2,
|
|
157
|
+
},
|
|
158
|
+
label: {
|
|
159
|
+
marginHorizontal: 12,
|
|
160
|
+
lineHeight: 21,
|
|
161
|
+
fontSize: Platform.OS === 'android' ? 12 : 14,
|
|
162
|
+
},
|
|
163
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PxRadioButton';
|