@proximus/lavender-tiles-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/PxTile.d.ts +17 -0
- package/dist/PxTile.d.ts.map +1 -0
- package/dist/PxTileButton.d.ts +6 -0
- package/dist/PxTileButton.d.ts.map +1 -0
- package/dist/PxTileCheckbox.d.ts +7 -0
- package/dist/PxTileCheckbox.d.ts.map +1 -0
- package/dist/PxTileRadio.d.ts +7 -0
- package/dist/PxTileRadio.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +45 -0
- package/src/PxTile.tsx +156 -0
- package/src/PxTileButton.tsx +21 -0
- package/src/PxTileCheckbox.tsx +79 -0
- package/src/PxTileRadio.tsx +47 -0
- package/src/index.ts +4 -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
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **BCRI-4013861:** tile text colors ([67c5bfc](https://github.com/Pxs-Corporate/react-native-lavender/commit/67c5bfc95c4359bd31b4aef9ea09b6b663beeaef))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
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
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- **BCRI-4013861:** tile text colors ([67c5bfc](https://github.com/Pxs-Corporate/react-native-lavender/commit/67c5bfc95c4359bd31b4aef9ea09b6b663beeaef))
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
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))
|
package/dist/PxTile.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export interface IPxTile extends AccessibilityProps {
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
prefix?: ReactNode;
|
|
8
|
+
suffix?: ReactElement;
|
|
9
|
+
centerContent?: boolean;
|
|
10
|
+
centerPrefix?: boolean;
|
|
11
|
+
backgroundColor?: 'neutral' | 'neutral-bare';
|
|
12
|
+
testID?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
labelsAccessibilityProps?: AccessibilityProps;
|
|
15
|
+
}
|
|
16
|
+
export declare function PxTile({ label, description, containerStyle, prefix, suffix, testID, backgroundColor, accessible, accessibilityRole, accessibilityLabel, accessibilityHint, disabled, centerContent, centerPrefix, labelsAccessibilityProps, }: IPxTile): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=PxTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxTile.d.ts","sourceRoot":"","sources":["../src/PxTile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,WAAW,OAAQ,SAAQ,kBAAkB;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB,CAAC,EAAE,kBAAkB,CAAC;CAC/C;AAED,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,WAAW,EACX,cAAc,EACd,MAAM,EACN,MAAM,EACN,MAAM,EACN,eAA2B,EAC3B,UAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,wBAAwB,GACzB,EAAE,OAAO,qBA6FT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxTileButton.d.ts","sourceRoot":"","sources":["../src/PxTileButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,qBAepE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxTileCheckbox.d.ts","sourceRoot":"","sources":["../src/PxTileCheckbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,OAAO,EAAU,MAAM,UAAU,CAAC;AAM3C,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,GAAG;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,qBAmEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxTileRadio.d.ts","sourceRoot":"","sources":["../src/PxTileRadio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,qBAsC5D"}
|
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,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-tiles-native",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Lavender cell list component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rm -rf dist",
|
|
9
|
+
"prepublish": "yarn clean && yarn build",
|
|
10
|
+
"build": "npx tsc -p tsconfig.json"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@proximus/lavender-checkbox-native": "workspace:*",
|
|
14
|
+
"@proximus/lavender-common-native": "workspace:*",
|
|
15
|
+
"@proximus/lavender-icon-native": "workspace:*",
|
|
16
|
+
"@proximus/lavender-radio-native": "workspace:*",
|
|
17
|
+
"@proximus/lavender-separator-native": "workspace:*",
|
|
18
|
+
"@proximus/lavender-styling-native": "workspace:*",
|
|
19
|
+
"@proximus/lavender-texts-native": "workspace:*"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@proximus/lavender-checkbox-native": "0.1.0-alpha.0",
|
|
23
|
+
"@proximus/lavender-common-native": "0.1.0-alpha.0",
|
|
24
|
+
"@proximus/lavender-icon-native": "0.1.0-alpha.0",
|
|
25
|
+
"@proximus/lavender-radio-native": "0.1.0-alpha.0",
|
|
26
|
+
"@proximus/lavender-separator-native": "0.1.0-alpha.0",
|
|
27
|
+
"@proximus/lavender-styling-native": "0.1.0-alpha.0",
|
|
28
|
+
"@proximus/lavender-texts-native": "0.1.0-alpha.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"lerna": {
|
|
34
|
+
"command": {
|
|
35
|
+
"publish": {
|
|
36
|
+
"assets": [
|
|
37
|
+
"dist",
|
|
38
|
+
"src",
|
|
39
|
+
"package.json"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "27525289a448a6e4f3c2d36a88b9dc54d0f15fbf"
|
|
45
|
+
}
|
package/src/PxTile.tsx
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccessibilityProps,
|
|
3
|
+
Platform,
|
|
4
|
+
StyleProp,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
View,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
10
|
+
import { Body, Header } from '@proximus/lavender-texts-native';
|
|
11
|
+
import { Colors, useTheme } from '@proximus/lavender-styling-native';
|
|
12
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
13
|
+
|
|
14
|
+
export interface IPxTile extends AccessibilityProps {
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
18
|
+
prefix?: ReactNode;
|
|
19
|
+
suffix?: ReactElement;
|
|
20
|
+
centerContent?: boolean;
|
|
21
|
+
centerPrefix?: boolean;
|
|
22
|
+
backgroundColor?: 'neutral' | 'neutral-bare';
|
|
23
|
+
testID?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
labelsAccessibilityProps?: AccessibilityProps;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function PxTile({
|
|
29
|
+
label,
|
|
30
|
+
description,
|
|
31
|
+
containerStyle,
|
|
32
|
+
prefix,
|
|
33
|
+
suffix,
|
|
34
|
+
testID,
|
|
35
|
+
backgroundColor = 'neutral',
|
|
36
|
+
accessible = true,
|
|
37
|
+
accessibilityRole,
|
|
38
|
+
accessibilityLabel,
|
|
39
|
+
accessibilityHint,
|
|
40
|
+
disabled,
|
|
41
|
+
centerContent,
|
|
42
|
+
centerPrefix,
|
|
43
|
+
labelsAccessibilityProps,
|
|
44
|
+
}: IPxTile) {
|
|
45
|
+
const { theme } = useTheme();
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View
|
|
49
|
+
style={[
|
|
50
|
+
styles.container,
|
|
51
|
+
containerStyle,
|
|
52
|
+
{
|
|
53
|
+
backgroundColor:
|
|
54
|
+
backgroundColor === 'neutral'
|
|
55
|
+
? theme.t('BackgroundColorActionNeutralDefault')
|
|
56
|
+
: theme.t('BackgroundColorActionNeutralBareDefault'),
|
|
57
|
+
gap: prefix && theme.t('SpacingInsideSectionLMobile').number,
|
|
58
|
+
borderRadius: theme.t('RadiusMain').number,
|
|
59
|
+
padding: theme.t('PaddingSMobile').number,
|
|
60
|
+
},
|
|
61
|
+
disabled && {
|
|
62
|
+
backgroundColor: Colors.v8_1.shadesOfGrey.dark4,
|
|
63
|
+
},
|
|
64
|
+
]}
|
|
65
|
+
{...a11y({
|
|
66
|
+
accessibilityRole,
|
|
67
|
+
accessible,
|
|
68
|
+
importantForAccessibility: accessible ? 'yes' : 'no-hide-descendants',
|
|
69
|
+
accessibilityLabel: Platform.select({
|
|
70
|
+
android:
|
|
71
|
+
(accessibilityLabel &&
|
|
72
|
+
accessibilityLabel + (accessibilityHint || '')) ||
|
|
73
|
+
label + (description || ''),
|
|
74
|
+
default: accessibilityLabel || label,
|
|
75
|
+
}),
|
|
76
|
+
accessibilityHint: accessibilityHint || description,
|
|
77
|
+
})}
|
|
78
|
+
>
|
|
79
|
+
<View
|
|
80
|
+
style={[
|
|
81
|
+
styles.prefixSuffixContainer,
|
|
82
|
+
{
|
|
83
|
+
...(centerPrefix && {
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
88
|
+
]}
|
|
89
|
+
>
|
|
90
|
+
{prefix}
|
|
91
|
+
{suffix}
|
|
92
|
+
</View>
|
|
93
|
+
<View>
|
|
94
|
+
<Header
|
|
95
|
+
{...a11y({
|
|
96
|
+
...labelsAccessibilityProps,
|
|
97
|
+
accessible,
|
|
98
|
+
importantForAccessibility: accessible ? 'yes' : 'no',
|
|
99
|
+
})}
|
|
100
|
+
style={[
|
|
101
|
+
styles.labelText,
|
|
102
|
+
centerContent && {
|
|
103
|
+
textAlign: 'center',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
fontSize: theme.t('TextSizeLabelLMobile').number,
|
|
107
|
+
color: theme.t('TextColorActionNeutralDefault'),
|
|
108
|
+
},
|
|
109
|
+
]}
|
|
110
|
+
disabled={disabled}
|
|
111
|
+
>
|
|
112
|
+
{label}
|
|
113
|
+
</Header>
|
|
114
|
+
{description && (
|
|
115
|
+
<Body
|
|
116
|
+
{...a11y({
|
|
117
|
+
...labelsAccessibilityProps,
|
|
118
|
+
accessible,
|
|
119
|
+
importantForAccessibility: accessible ? 'yes' : 'no',
|
|
120
|
+
})}
|
|
121
|
+
style={{
|
|
122
|
+
...(centerContent && {
|
|
123
|
+
textAlign: 'center',
|
|
124
|
+
}),
|
|
125
|
+
color: theme.t('TextColorActionNeutralDefault'),
|
|
126
|
+
fontSize: theme.t('TextSizeLabelLMobile').number,
|
|
127
|
+
}}
|
|
128
|
+
{...e2eID(`${testID}_subTitle`)}
|
|
129
|
+
disabled={disabled}
|
|
130
|
+
>
|
|
131
|
+
{description}
|
|
132
|
+
</Body>
|
|
133
|
+
)}
|
|
134
|
+
</View>
|
|
135
|
+
</View>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const styles = StyleSheet.create({
|
|
140
|
+
container: {
|
|
141
|
+
flexDirection: 'column',
|
|
142
|
+
gap: 16,
|
|
143
|
+
width: 215,
|
|
144
|
+
},
|
|
145
|
+
prefixSuffixContainer: {
|
|
146
|
+
flexDirection: 'row',
|
|
147
|
+
justifyContent: 'space-between',
|
|
148
|
+
},
|
|
149
|
+
suffixLabelDescription: {
|
|
150
|
+
alignSelf: 'flex-end',
|
|
151
|
+
},
|
|
152
|
+
labelText: {
|
|
153
|
+
fontSize: 14,
|
|
154
|
+
color: Colors.v8_1.black,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IPxTile, PxTile } from './PxTile';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
4
|
+
import { TouchableOpacity } from 'react-native';
|
|
5
|
+
|
|
6
|
+
export function PxTileButton(props: IPxTile & { onPress: () => void }) {
|
|
7
|
+
return (
|
|
8
|
+
<TouchableOpacity
|
|
9
|
+
{...a11y({
|
|
10
|
+
accessible: true,
|
|
11
|
+
accessibilityRole: 'button',
|
|
12
|
+
accessibilityLabel: props.accessibilityLabel || props.label,
|
|
13
|
+
accessibilityHint: props.accessibilityHint || props.description,
|
|
14
|
+
})}
|
|
15
|
+
disabled={props.disabled}
|
|
16
|
+
{...e2eID(props.testID)}
|
|
17
|
+
>
|
|
18
|
+
<PxTile {...props} accessible={false} />
|
|
19
|
+
</TouchableOpacity>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { IPxTile, PxTile } from './PxTile';
|
|
3
|
+
import { PxCheckBox } from '@proximus/lavender-checkbox-native';
|
|
4
|
+
import { Platform, TouchableOpacity } from 'react-native';
|
|
5
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
6
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
7
|
+
|
|
8
|
+
export function PxTileCheckbox(
|
|
9
|
+
props: IPxTile & {
|
|
10
|
+
checked: boolean;
|
|
11
|
+
onChange?: (checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
) {
|
|
14
|
+
const { theme } = useTheme();
|
|
15
|
+
const [internalChecked, setInternalChecked] = useState(props.checked);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setInternalChecked(props.checked);
|
|
19
|
+
}, [props.checked]);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<TouchableOpacity
|
|
23
|
+
{...a11y({
|
|
24
|
+
accessible: true,
|
|
25
|
+
accessibilityRole: 'checkbox',
|
|
26
|
+
accessibilityState: {
|
|
27
|
+
checked: internalChecked,
|
|
28
|
+
disabled: props.disabled,
|
|
29
|
+
},
|
|
30
|
+
accessibilityLabel: props.accessibilityLabel || props.label,
|
|
31
|
+
accessibilityHint: props.accessibilityHint || props.description,
|
|
32
|
+
})}
|
|
33
|
+
disabled={props.disabled}
|
|
34
|
+
onPress={() => {
|
|
35
|
+
props.onChange?.(!internalChecked);
|
|
36
|
+
setInternalChecked(!internalChecked);
|
|
37
|
+
}}
|
|
38
|
+
{...e2eID(props.testID)}
|
|
39
|
+
>
|
|
40
|
+
<PxTile
|
|
41
|
+
{...props}
|
|
42
|
+
containerStyle={{
|
|
43
|
+
borderWidth: theme.t('BorderSizeM').number,
|
|
44
|
+
borderColor: internalChecked
|
|
45
|
+
? theme.t('BorderColorActionActiveDefault')
|
|
46
|
+
: theme.t('BorderColorActionNeutralDefault'),
|
|
47
|
+
}}
|
|
48
|
+
accessible={false}
|
|
49
|
+
suffix={
|
|
50
|
+
<PxCheckBox
|
|
51
|
+
disabled={props.disabled}
|
|
52
|
+
accessibilityLabel={props.label}
|
|
53
|
+
accessibilityHint={props.description}
|
|
54
|
+
boxType={'square'}
|
|
55
|
+
wrapperStyle={{
|
|
56
|
+
height: 32,
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
}}
|
|
59
|
+
checkboxStyle={{
|
|
60
|
+
// Not applied on Android because of a weird visual bug
|
|
61
|
+
...(Platform.OS === 'ios' && {
|
|
62
|
+
width: 16,
|
|
63
|
+
height: 16,
|
|
64
|
+
}),
|
|
65
|
+
backgroundColor: 'transparent',
|
|
66
|
+
}}
|
|
67
|
+
checked={internalChecked}
|
|
68
|
+
onChange={(value) => {
|
|
69
|
+
props.onChange?.(value);
|
|
70
|
+
setInternalChecked(value);
|
|
71
|
+
}}
|
|
72
|
+
accessible={false}
|
|
73
|
+
importantForAccessibility={'no-hide-descendants'}
|
|
74
|
+
/>
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
</TouchableOpacity>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PxRadioButton } from '@proximus/lavender-radio-native';
|
|
2
|
+
import { IPxTile, PxTile } from './PxTile';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
5
|
+
import { TouchableOpacity } from 'react-native';
|
|
6
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
7
|
+
|
|
8
|
+
export function PxTileRadio(
|
|
9
|
+
props: IPxTile & { checked?: boolean; onPress: () => void }
|
|
10
|
+
) {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
return (
|
|
13
|
+
<TouchableOpacity
|
|
14
|
+
{...a11y({
|
|
15
|
+
accessible: true,
|
|
16
|
+
accessibilityRole: 'radio',
|
|
17
|
+
accessibilityState: {
|
|
18
|
+
checked: props.checked,
|
|
19
|
+
disabled: props.disabled,
|
|
20
|
+
},
|
|
21
|
+
accessibilityLabel: props.accessibilityLabel || props.label,
|
|
22
|
+
accessibilityHint: props.accessibilityHint || props.description,
|
|
23
|
+
})}
|
|
24
|
+
disabled={props.disabled}
|
|
25
|
+
{...e2eID(props.testID)}
|
|
26
|
+
>
|
|
27
|
+
<PxTile
|
|
28
|
+
{...props}
|
|
29
|
+
containerStyle={{
|
|
30
|
+
borderWidth: theme.t('BorderSizeM').number,
|
|
31
|
+
borderColor: props.checked
|
|
32
|
+
? theme.t('BorderColorActionActiveDefault')
|
|
33
|
+
: theme.t('BorderColorActionNeutralDefault'),
|
|
34
|
+
}}
|
|
35
|
+
accessible={false}
|
|
36
|
+
suffix={
|
|
37
|
+
<PxRadioButton
|
|
38
|
+
disabled={props.disabled}
|
|
39
|
+
size={20}
|
|
40
|
+
checked={!!props.checked}
|
|
41
|
+
onPress={props.onPress}
|
|
42
|
+
/>
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
</TouchableOpacity>
|
|
46
|
+
);
|
|
47
|
+
}
|
package/src/index.ts
ADDED