@proximus/lavender-buttonicon-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 +14 -0
- package/dist/PxButtonIcon.d.ts +14 -0
- package/dist/PxButtonIcon.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +40 -0
- package/src/PxButtonIcon.tsx +116 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +8 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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-3619796:** top navigation bar ([0b2bcae](https://github.com/Pxs-Corporate/react-native-lavender/commit/0b2bcaee7243b9f00f88e2b2fb97d86cf0cf5b77))
|
|
12
|
+
- **BCRI-3749589:** button icon component ([62cfd94](https://github.com/Pxs-Corporate/react-native-lavender/commit/62cfd945420c26cf6da6dfb802cc998c613e9687))
|
|
13
|
+
- **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
|
|
14
|
+
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { IconName } from '@proximus/lavender-icon/dist/iconNames.js';
|
|
4
|
+
export interface IButtonIconProps extends AccessibilityProps {
|
|
5
|
+
iconName: IconName;
|
|
6
|
+
variant: 'primary' | 'secondary' | 'naked';
|
|
7
|
+
wrapperStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
inverted?: boolean;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function PxButtonIcon({ variant, iconName, wrapperStyle, onPress, disabled, testID, accessibilityLabel, accessibilityHint, inverted, }: IButtonIconProps): React.JSX.Element;
|
|
14
|
+
//# sourceMappingURL=PxButtonIcon.d.ts.map
|
|
@@ -0,0 +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;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAE1E,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,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuCD,wBAAgB,YAAY,CAAC,EAC3B,OAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,MAAM,EACN,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,GACT,EAAE,gBAAgB,qBAiClB"}
|
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,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-buttonicon-native",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Button icon component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"clean": "rm -rf dist",
|
|
10
|
+
"prepublish": "yarn clean && yarn build",
|
|
11
|
+
"build": "npx tsc -p tsconfig.json"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@proximus/lavender-common-native": "workspace:*",
|
|
15
|
+
"@proximus/lavender-icon-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-icon-native": "0.1.0-alpha.0",
|
|
22
|
+
"@proximus/lavender-styling-native": "0.1.0-alpha.0",
|
|
23
|
+
"@proximus/lavender-texts-native": "0.1.0-alpha.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"lerna": {
|
|
29
|
+
"command": {
|
|
30
|
+
"publish": {
|
|
31
|
+
"assets": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src",
|
|
34
|
+
"package.json"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "59b3436b786cc1c73b4a20a98b2a85139e75b72e"
|
|
40
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
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/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PxButtonIcon';
|