@proximus/lavender-buttonicon-native 0.1.0-alpha.1 → 0.1.0-alpha.11
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/PxButtonIcon.d.ts +2 -1
- package/dist/PxButtonIcon.d.ts.map +1 -1
- package/dist/PxButtonIcon.js +78 -0
- package/package.json +10 -30
- package/CHANGELOG.md +0 -20
- package/src/PxButtonIcon.tsx +0 -116
- package/tsconfig.json +0 -8
- /package/{src/index.ts → dist/index.js} +0 -0
package/dist/PxButtonIcon.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export interface IButtonIconProps extends AccessibilityProps {
|
|
|
8
8
|
onPress?: () => void;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
inverted?: boolean;
|
|
11
|
+
size?: 'small' | 'default';
|
|
11
12
|
testID?: string;
|
|
12
13
|
}
|
|
13
|
-
export declare function PxButtonIcon({ variant, iconName, wrapperStyle, onPress, disabled, testID, accessibilityLabel, accessibilityHint, inverted, }: IButtonIconProps): React.JSX.Element;
|
|
14
|
+
export declare function PxButtonIcon({ variant, iconName, wrapperStyle, onPress, disabled, testID, accessibilityLabel, accessibilityHint, inverted, size, }: IButtonIconProps): React.JSX.Element;
|
|
14
15
|
//# sourceMappingURL=PxButtonIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PxButtonIcon.d.ts","sourceRoot":"","sources":["../src/PxButtonIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,SAAS,EAIT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PxButtonIcon.d.ts","sourceRoot":"","sources":["../src/PxButtonIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,SAAS,EAIT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAG1E,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAC3C,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA0CD,wBAAgB,YAAY,CAAC,EAC3B,OAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,MAAM,EACN,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,IAAgB,GACjB,EAAE,gBAAgB,qBAmDlB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { StyleSheet, TouchableOpacity, View, } from 'react-native';
|
|
2
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
3
|
+
import { PxIcon } from '@proximus/lavender-icon-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
6
|
+
function getBackgroundColor({ variant, inverted }, theme) {
|
|
7
|
+
if (!inverted) {
|
|
8
|
+
if (variant === 'primary') {
|
|
9
|
+
return theme.t('ColorBackgroundContainerPrimaryDefault');
|
|
10
|
+
}
|
|
11
|
+
if (variant === 'secondary') {
|
|
12
|
+
return theme.t('ColorBackgroundContainerSecondaryDefault');
|
|
13
|
+
}
|
|
14
|
+
return 'transparent';
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (variant === 'primary') {
|
|
18
|
+
return theme.t('ColorBackgroundContainerPrimaryInverted');
|
|
19
|
+
}
|
|
20
|
+
if (variant === 'secondary') {
|
|
21
|
+
return theme.t('ColorBackgroundContainerSecondaryInverted');
|
|
22
|
+
}
|
|
23
|
+
return 'transparent';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function getColor({ variant, inverted }, theme) {
|
|
27
|
+
if (!inverted) {
|
|
28
|
+
if (variant === 'primary') {
|
|
29
|
+
return theme.t('ColorTextBrandInverted');
|
|
30
|
+
}
|
|
31
|
+
return theme.t('ColorTextBrandDefault');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (variant === 'primary') {
|
|
35
|
+
return theme.t('ColorTextBrandDefault');
|
|
36
|
+
}
|
|
37
|
+
return theme.t('ColorTextBrandInverted');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function PxButtonIcon({ variant = 'primary', iconName, wrapperStyle, onPress, disabled, testID, accessibilityLabel, accessibilityHint, inverted, size = 'default', }) {
|
|
41
|
+
const { theme } = useTheme();
|
|
42
|
+
const backgroundColor = getBackgroundColor({ variant, inverted }, theme);
|
|
43
|
+
const color = getColor({ variant, inverted }, theme);
|
|
44
|
+
return (React.createElement(TouchableOpacity, { ...e2eID(testID), onPress: onPress, focusable: true, disabled: disabled, ...a11y({
|
|
45
|
+
accessibilityRole: 'button',
|
|
46
|
+
accessible: true,
|
|
47
|
+
accessibilityState: {
|
|
48
|
+
disabled,
|
|
49
|
+
},
|
|
50
|
+
accessibilityLabel,
|
|
51
|
+
accessibilityHint,
|
|
52
|
+
}), style: [
|
|
53
|
+
styles.container,
|
|
54
|
+
{ backgroundColor, borderRadius: theme?.t('RadiusPill')?.number },
|
|
55
|
+
wrapperStyle,
|
|
56
|
+
] },
|
|
57
|
+
React.createElement(View, { style: {
|
|
58
|
+
height: size === 'small'
|
|
59
|
+
? // @ts-ignore
|
|
60
|
+
theme?.t(`SizeM`)?.number
|
|
61
|
+
: // @ts-ignore
|
|
62
|
+
theme?.t(`SizeL`)?.number,
|
|
63
|
+
aspectRatio: 1,
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center',
|
|
66
|
+
} },
|
|
67
|
+
React.createElement(PxIcon, { name: iconName, size: size === 'small'
|
|
68
|
+
? theme?.t('SizeIconXs')?.number
|
|
69
|
+
: theme?.t('SizeIconS')?.number, color: color }))));
|
|
70
|
+
}
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
container: {
|
|
73
|
+
flexDirection: 'column',
|
|
74
|
+
flex: 0,
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
},
|
|
78
|
+
});
|
package/package.json
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-buttonicon-native",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
4
|
"description": "Button icon component",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"main": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"build": "npx tsc -p tsconfig.json"
|
|
11
|
-
},
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
12
10
|
"peerDependencies": {
|
|
13
|
-
"@proximus/lavender-common-native": "
|
|
14
|
-
"@proximus/lavender-icon-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-icon-native": "0.1.0-alpha.1",
|
|
21
|
-
"@proximus/lavender-styling-native": "0.1.0-alpha.1",
|
|
22
|
-
"@proximus/lavender-texts-native": "0.1.0-alpha.1"
|
|
11
|
+
"@proximus/lavender-common-native": "*",
|
|
12
|
+
"@proximus/lavender-icon-native": "*",
|
|
13
|
+
"@proximus/lavender-styling-native": "*",
|
|
14
|
+
"@proximus/lavender-texts-native": "*"
|
|
23
15
|
},
|
|
24
16
|
"publishConfig": {
|
|
25
17
|
"access": "public"
|
|
26
|
-
}
|
|
27
|
-
"lerna": {
|
|
28
|
-
"command": {
|
|
29
|
-
"publish": {
|
|
30
|
-
"assets": [
|
|
31
|
-
"dist",
|
|
32
|
-
"src",
|
|
33
|
-
"package.json"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"gitHead": "d422a1d369000e1e249afb26de2cef08930c2407"
|
|
18
|
+
}
|
|
39
19
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,20 +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-buttonicon-native@0.1.0-alpha.0...@proximus/lavender-buttonicon-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
|
-
### Features
|
|
15
|
-
|
|
16
|
-
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
17
|
-
- **BCRI-3619796:** top navigation bar ([0b2bcae](https://github.com/Pxs-Corporate/react-native-lavender/commit/0b2bcaee7243b9f00f88e2b2fb97d86cf0cf5b77))
|
|
18
|
-
- **BCRI-3749589:** button icon component ([62cfd94](https://github.com/Pxs-Corporate/react-native-lavender/commit/62cfd945420c26cf6da6dfb802cc998c613e9687))
|
|
19
|
-
- **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
|
|
20
|
-
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
package/src/PxButtonIcon.tsx
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AccessibilityProps,
|
|
3
|
-
StyleProp,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
View,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
10
|
-
import { PxIcon } from '@proximus/lavender-icon-native';
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { Colors } from '@proximus/lavender-styling-native';
|
|
13
|
-
import type { IconName } from '@proximus/lavender-icon/dist/iconNames.js';
|
|
14
|
-
|
|
15
|
-
export interface IButtonIconProps extends AccessibilityProps {
|
|
16
|
-
iconName: IconName;
|
|
17
|
-
variant: 'primary' | 'secondary' | 'naked';
|
|
18
|
-
wrapperStyle?: StyleProp<ViewStyle>;
|
|
19
|
-
onPress?: () => void;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
inverted?: boolean;
|
|
22
|
-
testID?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getBackgroundColor({ variant, inverted }: Partial<IButtonIconProps>) {
|
|
26
|
-
if (!inverted) {
|
|
27
|
-
if (variant === 'primary') {
|
|
28
|
-
return Colors.v8_1.shadesOfPurple.purple;
|
|
29
|
-
}
|
|
30
|
-
if (variant === 'secondary') {
|
|
31
|
-
return Colors.v8_1.shadesOfPurple.purpleLight;
|
|
32
|
-
}
|
|
33
|
-
return 'transparent';
|
|
34
|
-
} else {
|
|
35
|
-
if (variant === 'primary') {
|
|
36
|
-
return Colors.v8_1.white;
|
|
37
|
-
}
|
|
38
|
-
if (variant === 'secondary') {
|
|
39
|
-
return Colors.v8_1.shadesOfGrey.dark320;
|
|
40
|
-
}
|
|
41
|
-
return 'transparent';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getColor({ variant, inverted }: Partial<IButtonIconProps>) {
|
|
46
|
-
if (!inverted) {
|
|
47
|
-
if (variant === 'primary') {
|
|
48
|
-
return Colors.v8_1.white;
|
|
49
|
-
}
|
|
50
|
-
if (variant === 'secondary') {
|
|
51
|
-
return Colors.v8_1.shadesOfPurple.purple;
|
|
52
|
-
}
|
|
53
|
-
return Colors.v8_1.shadesOfPurple.purple;
|
|
54
|
-
} else {
|
|
55
|
-
if (variant === 'primary') {
|
|
56
|
-
return Colors.v8_1.shadesOfPurple.purple;
|
|
57
|
-
}
|
|
58
|
-
return Colors.v8_1.white;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function PxButtonIcon({
|
|
63
|
-
variant = 'primary',
|
|
64
|
-
iconName,
|
|
65
|
-
wrapperStyle,
|
|
66
|
-
onPress,
|
|
67
|
-
disabled,
|
|
68
|
-
testID,
|
|
69
|
-
accessibilityLabel,
|
|
70
|
-
accessibilityHint,
|
|
71
|
-
inverted,
|
|
72
|
-
}: IButtonIconProps) {
|
|
73
|
-
const backgroundColor = getBackgroundColor({ variant, inverted });
|
|
74
|
-
const color = getColor({ variant, inverted });
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<TouchableOpacity
|
|
78
|
-
{...e2eID(testID)}
|
|
79
|
-
onPress={onPress}
|
|
80
|
-
focusable={true}
|
|
81
|
-
disabled={disabled}
|
|
82
|
-
{...a11y({
|
|
83
|
-
accessibilityRole: 'button',
|
|
84
|
-
accessible: true,
|
|
85
|
-
accessibilityState: {
|
|
86
|
-
disabled,
|
|
87
|
-
},
|
|
88
|
-
accessibilityLabel,
|
|
89
|
-
accessibilityHint,
|
|
90
|
-
})}
|
|
91
|
-
style={[styles.container, { backgroundColor }, wrapperStyle]}
|
|
92
|
-
>
|
|
93
|
-
<View
|
|
94
|
-
style={{
|
|
95
|
-
height: 24,
|
|
96
|
-
width: 24,
|
|
97
|
-
alignItems: 'center',
|
|
98
|
-
justifyContent: 'center',
|
|
99
|
-
}}
|
|
100
|
-
>
|
|
101
|
-
<PxIcon name={iconName} size={22} color={color} />
|
|
102
|
-
</View>
|
|
103
|
-
</TouchableOpacity>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const styles = StyleSheet.create({
|
|
108
|
-
container: {
|
|
109
|
-
flexDirection: 'column',
|
|
110
|
-
padding: 8,
|
|
111
|
-
flex: 0,
|
|
112
|
-
borderRadius: 20,
|
|
113
|
-
alignItems: 'center',
|
|
114
|
-
justifyContent: 'center',
|
|
115
|
-
},
|
|
116
|
-
});
|
package/tsconfig.json
DELETED
|
File without changes
|