@proximus/lavender-button-native 0.1.0-alpha.5 → 0.1.0-alpha.7
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/PxButton.js +142 -0
- package/dist/far/away/package.json +34 -0
- package/dist/index.js +1 -0
- package/package.json +15 -8
- package/tsconfig.json +2 -2
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.7](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.6...@proximus/lavender-button-native@0.1.0-alpha.7) (2025-09-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @proximus/lavender-button-native
|
|
9
|
+
|
|
10
|
+
# [0.1.0-alpha.6](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.5...@proximus/lavender-button-native@0.1.0-alpha.6) (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.5](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.4...@proximus/lavender-button-native@0.1.0-alpha.5) (2025-09-19)
|
|
7
17
|
|
|
8
18
|
### Features
|
package/dist/PxButton.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
import { Header } from '@proximus/lavender-texts-native';
|
|
6
|
+
function getButtonColors(props, theme) {
|
|
7
|
+
const { type, inverted = false } = props;
|
|
8
|
+
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
9
|
+
switch (type) {
|
|
10
|
+
case 'secondary': {
|
|
11
|
+
return {
|
|
12
|
+
backgroundColor: theme.t(`ColorBackgroundContainerSecondary${invertedSuffix}`),
|
|
13
|
+
textColor: theme.t(`ColorTextBrand${invertedSuffix}`),
|
|
14
|
+
disabledBackgroundColor: theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`),
|
|
15
|
+
disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
case 'tertiary': {
|
|
19
|
+
return {
|
|
20
|
+
backgroundColor: 'transparent',
|
|
21
|
+
disabledBackgroundColor: 'transparent',
|
|
22
|
+
textColor: theme.t(`ColorTextBrand${invertedSuffix}`),
|
|
23
|
+
disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
default: {
|
|
27
|
+
return {
|
|
28
|
+
backgroundColor: theme.t(`ColorBackgroundContainerPrimary${invertedSuffix}`),
|
|
29
|
+
textColor: inverted
|
|
30
|
+
? theme.t('ColorTextBrandDefault')
|
|
31
|
+
: theme.t('ColorTextBrandInverted'),
|
|
32
|
+
disabledBackgroundColor: theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`),
|
|
33
|
+
disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
|
|
34
|
+
borderColor: theme.t('ColorBorderNone'),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getIconColor(props, theme) {
|
|
40
|
+
const { type, disabled, inverted } = props;
|
|
41
|
+
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
42
|
+
switch (type) {
|
|
43
|
+
case 'primary':
|
|
44
|
+
return disabled
|
|
45
|
+
? theme.t(`ColorIconStateDisabled${invertedSuffix}`)
|
|
46
|
+
: inverted
|
|
47
|
+
? theme.t('ColorIconBrandDefault')
|
|
48
|
+
: theme.t('ColorIconBrandInverted');
|
|
49
|
+
default:
|
|
50
|
+
return disabled
|
|
51
|
+
? theme.t(`ColorIconStateDisabled${invertedSuffix}`)
|
|
52
|
+
: theme.t(`ColorIconBrand${invertedSuffix}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function getIconBackgroundColor(props, theme) {
|
|
56
|
+
const { type, disabled, inverted } = props;
|
|
57
|
+
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
58
|
+
switch (type) {
|
|
59
|
+
case 'tertiary':
|
|
60
|
+
return disabled
|
|
61
|
+
? theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`)
|
|
62
|
+
: theme.t(`ColorBackgroundContainerSecondary${invertedSuffix}`);
|
|
63
|
+
default:
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function PxButton({ title, wrapperStyle, titleStyle, isRoundedBottomCorner = true, testID, disabled = false, prefix, suffix, onPress, type = 'primary', accessibilityLabel, accessibilityHint, inverted, }) {
|
|
68
|
+
const { theme } = useTheme();
|
|
69
|
+
const buttonColors = getButtonColors({ type, inverted }, theme);
|
|
70
|
+
const iconStyles = {
|
|
71
|
+
size: theme.t('SizeIconXs').number,
|
|
72
|
+
color: getIconColor({ type, disabled, inverted }, theme),
|
|
73
|
+
padding: theme.t('Padding2xsMobile').number,
|
|
74
|
+
};
|
|
75
|
+
const iconBackgroundStyles = {
|
|
76
|
+
backgroundColor: getIconBackgroundColor({ type, disabled, inverted }, theme),
|
|
77
|
+
borderRadius: theme.t('RadiusPill').number,
|
|
78
|
+
marginHorizontal: theme.t('SpacingXsMobile').number,
|
|
79
|
+
};
|
|
80
|
+
let adaptedPrefix = prefix && React.cloneElement(prefix, iconStyles);
|
|
81
|
+
adaptedPrefix =
|
|
82
|
+
prefix && type === 'tertiary' ? (React.createElement(View, { style: iconBackgroundStyles }, adaptedPrefix)) : (adaptedPrefix);
|
|
83
|
+
let adaptedSuffix = suffix && React.cloneElement(suffix, iconStyles);
|
|
84
|
+
adaptedSuffix =
|
|
85
|
+
suffix && type === 'tertiary' ? (React.createElement(View, { style: iconBackgroundStyles }, adaptedSuffix)) : (adaptedSuffix);
|
|
86
|
+
return (React.createElement(TouchableOpacity, { ...e2eID(testID), onPress: onPress, focusable: true, disabled: disabled, ...a11y({
|
|
87
|
+
accessibilityRole: 'button',
|
|
88
|
+
accessible: true,
|
|
89
|
+
accessibilityState: {
|
|
90
|
+
disabled,
|
|
91
|
+
},
|
|
92
|
+
accessibilityLabel: accessibilityLabel || title,
|
|
93
|
+
accessibilityHint,
|
|
94
|
+
}), style: wrapperStyle },
|
|
95
|
+
React.createElement(View, { style: [
|
|
96
|
+
styles.button,
|
|
97
|
+
{
|
|
98
|
+
backgroundColor: buttonColors.backgroundColor,
|
|
99
|
+
borderColor: buttonColors.borderColor,
|
|
100
|
+
borderRadius: theme.t('RadiusButtonSmall').number,
|
|
101
|
+
...(isRoundedBottomCorner && {
|
|
102
|
+
borderBottomEndRadius: theme.t('RadiusButtonBig').number,
|
|
103
|
+
}),
|
|
104
|
+
paddingHorizontal: type === 'tertiary' ? 0 : theme.t('PaddingMMobile').number,
|
|
105
|
+
paddingVertical: type === 'tertiary'
|
|
106
|
+
? theme.t('Padding2xsMobile').number
|
|
107
|
+
: theme.t('PaddingXsMobile').number,
|
|
108
|
+
gap: theme.t('Spacing2xsMobile').number,
|
|
109
|
+
...(type !== 'tertiary' && {
|
|
110
|
+
minHeight: theme.t('SpacingLMobile').number,
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
disabled && {
|
|
114
|
+
backgroundColor: buttonColors.disabledBackgroundColor,
|
|
115
|
+
},
|
|
116
|
+
type === 'tertiary' && {
|
|
117
|
+
paddingVertical: 4,
|
|
118
|
+
paddingHorizontal: 0,
|
|
119
|
+
},
|
|
120
|
+
] },
|
|
121
|
+
adaptedPrefix,
|
|
122
|
+
React.createElement(Header, { style: [
|
|
123
|
+
{
|
|
124
|
+
color: buttonColors.textColor,
|
|
125
|
+
},
|
|
126
|
+
disabled && {
|
|
127
|
+
color: buttonColors.disabledText,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
lineHeight: 21,
|
|
131
|
+
},
|
|
132
|
+
titleStyle,
|
|
133
|
+
] }, title),
|
|
134
|
+
adaptedSuffix)));
|
|
135
|
+
}
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
button: {
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
flexDirection: 'row',
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
},
|
|
142
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-button-native",
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
|
+
"description": "Button component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@proximus/lavender-common-native": "*",
|
|
9
|
+
"@proximus/lavender-icon-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 './PxButton';
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-button-native",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Button component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"clean": "rm -rf dist",
|
|
9
|
-
"
|
|
9
|
+
"transform-package-json": "node ../../../scripts/tranformPackageJson.js package.json dist/far/away",
|
|
10
|
+
"prepublish": "yarn clean && yarn transform-package-json && yarn build",
|
|
10
11
|
"build": "npx tsc -p tsconfig.json"
|
|
11
12
|
},
|
|
12
13
|
"peerDependencies": {
|
|
@@ -16,10 +17,10 @@
|
|
|
16
17
|
"@proximus/lavender-texts-native": "workspace:*"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@proximus/lavender-common-native": "0.1.0-alpha.
|
|
20
|
-
"@proximus/lavender-icon-native": "0.1.0-alpha.
|
|
21
|
-
"@proximus/lavender-styling-native": "0.1.0-alpha.
|
|
22
|
-
"@proximus/lavender-texts-native": "0.1.0-alpha.
|
|
20
|
+
"@proximus/lavender-common-native": "0.1.0-alpha.6",
|
|
21
|
+
"@proximus/lavender-icon-native": "0.1.0-alpha.6",
|
|
22
|
+
"@proximus/lavender-styling-native": "0.1.0-alpha.5",
|
|
23
|
+
"@proximus/lavender-texts-native": "0.1.0-alpha.6"
|
|
23
24
|
},
|
|
24
25
|
"publishConfig": {
|
|
25
26
|
"access": "public"
|
|
@@ -28,12 +29,18 @@
|
|
|
28
29
|
"command": {
|
|
29
30
|
"publish": {
|
|
30
31
|
"assets": [
|
|
31
|
-
|
|
32
|
+
{
|
|
33
|
+
"from": "dist/far/away/package.json",
|
|
34
|
+
"to": "."
|
|
35
|
+
},
|
|
36
|
+
"dist/*.js",
|
|
37
|
+
"dist/*.d.ts",
|
|
38
|
+
"dist/*.d.ts.map",
|
|
32
39
|
"src",
|
|
33
40
|
"package.json"
|
|
34
41
|
]
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
},
|
|
38
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
|
|
39
46
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../../tsconfig.npm.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "dist"
|
|
4
|
+
"outDir": "dist"
|
|
5
5
|
},
|
|
6
6
|
"include": ["src","../../../lib.d.ts"],
|
|
7
|
-
"exclude": ["dist", "node_modules", "src/**/*.
|
|
7
|
+
"exclude": ["dist", "node_modules", "src/**/*.spec.tsx", "src/**/*.spec.ts"]
|
|
8
8
|
}
|