@proximus/lavender-button-native 0.1.0-alpha.16 → 0.1.0-alpha.17
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/PxButton.d.ts +2 -0
- package/dist/PxButton.d.ts.map +1 -1
- package/dist/PxButton.js +18 -3
- package/package.json +1 -1
package/dist/PxButton.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export interface IProps extends AccessibilityProps {
|
|
|
11
11
|
/** @deprecated Use `variant` instead. */
|
|
12
12
|
type?: Variant;
|
|
13
13
|
variant?: Variant;
|
|
14
|
+
/** @deprecated Use `shape` instead. */
|
|
14
15
|
isRoundedBottomCorner?: boolean;
|
|
16
|
+
shape?: 'default' | 'alternative';
|
|
15
17
|
theme?: ITheme;
|
|
16
18
|
disabled?: boolean;
|
|
17
19
|
testID?: string;
|
package/dist/PxButton.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PxButton.d.ts","sourceRoot":"","sources":["../src/PxButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAIhE,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,MAAO,SAAQ,kBAAkB;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yCAAyC;IACzC,IAAI,CAAC,EAAE,OA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,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA8GD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBA0HrC"}
|
package/dist/PxButton.js
CHANGED
|
@@ -5,7 +5,6 @@ import { useTheme } from '@proximus/lavender-styling-native';
|
|
|
5
5
|
import { Header } from '@proximus/lavender-texts-native';
|
|
6
6
|
/**
|
|
7
7
|
* Keeps backward compatibility for `type` prop.
|
|
8
|
-
* @param props
|
|
9
8
|
*/
|
|
10
9
|
function useVariant(props) {
|
|
11
10
|
const { variant, type } = props;
|
|
@@ -17,6 +16,21 @@ function useVariant(props) {
|
|
|
17
16
|
}
|
|
18
17
|
return variant;
|
|
19
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Keeps backward compatibility for `isRoundedBottomCorner` prop.
|
|
21
|
+
*/
|
|
22
|
+
function useShape(props) {
|
|
23
|
+
const { shape, isRoundedBottomCorner } = props;
|
|
24
|
+
if (shape) {
|
|
25
|
+
return shape;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if (isRoundedBottomCorner === undefined || isRoundedBottomCorner) {
|
|
29
|
+
return 'default';
|
|
30
|
+
}
|
|
31
|
+
return 'alternative';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
20
34
|
function getButtonColors(props, theme) {
|
|
21
35
|
const { variant, inverted = false } = props;
|
|
22
36
|
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
@@ -79,9 +93,10 @@ function getIconBackgroundColor(props, theme) {
|
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
export function PxButton(props) {
|
|
82
|
-
const { title, wrapperStyle, titleStyle,
|
|
96
|
+
const { title, wrapperStyle, titleStyle, testID, disabled = false, prefix, suffix, onPress, accessibilityLabel, accessibilityHint, inverted, } = props;
|
|
83
97
|
const { theme } = useTheme();
|
|
84
98
|
const variant = useVariant(props);
|
|
99
|
+
const shape = useShape(props);
|
|
85
100
|
const buttonColors = getButtonColors({ variant, inverted }, theme);
|
|
86
101
|
const iconStyles = {
|
|
87
102
|
size: 'Xs',
|
|
@@ -114,7 +129,7 @@ export function PxButton(props) {
|
|
|
114
129
|
backgroundColor: buttonColors.backgroundColor,
|
|
115
130
|
borderColor: buttonColors.borderColor,
|
|
116
131
|
borderRadius: theme.t('RadiusButtonSmall').number,
|
|
117
|
-
...(
|
|
132
|
+
...(shape === 'default' && {
|
|
118
133
|
borderBottomEndRadius: theme.t('RadiusButtonBig').number,
|
|
119
134
|
}),
|
|
120
135
|
paddingHorizontal: variant === 'tertiary' ? 0 : theme.t('PaddingMMobile').number,
|