@proximus/lavender-button-native 0.1.0-alpha.5 → 0.1.0-beta.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.
@@ -8,8 +8,12 @@ export interface IProps extends AccessibilityProps {
8
8
  titleStyle?: StyleProp<TextStyle>;
9
9
  wrapperStyle?: StyleProp<ViewStyle>;
10
10
  onPress?: () => void;
11
+ /** @deprecated Use `variant` instead. */
11
12
  type?: Variant;
13
+ variant?: Variant;
14
+ /** @deprecated Use `shape` instead. */
12
15
  isRoundedBottomCorner?: boolean;
16
+ shape?: 'default' | 'alternative';
13
17
  theme?: ITheme;
14
18
  disabled?: boolean;
15
19
  testID?: string;
@@ -17,5 +21,5 @@ export interface IProps extends AccessibilityProps {
17
21
  suffix?: ReactNode;
18
22
  inverted?: boolean;
19
23
  }
20
- export declare function PxButton({ title, wrapperStyle, titleStyle, isRoundedBottomCorner, testID, disabled, prefix, suffix, onPress, type, accessibilityLabel, accessibilityHint, inverted, }: IProps): React.JSX.Element;
24
+ export declare function PxButton(props: IProps): React.JSX.Element;
21
25
  //# sourceMappingURL=PxButton.d.ts.map
@@ -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,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkFD,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,YAAY,EACZ,UAAU,EACV,qBAA4B,EAC5B,MAAM,EACN,QAAgB,EAChB,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,GACT,EAAE,MAAM,qBA2GR"}
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,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA8GD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBA0HrC"}
@@ -0,0 +1,173 @@
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
+ /**
7
+ * Keeps backward compatibility for `type` prop.
8
+ */
9
+ function useVariant(props) {
10
+ const { variant, type } = props;
11
+ if (type && !variant) {
12
+ return type;
13
+ }
14
+ else if (!variant) {
15
+ return 'primary';
16
+ }
17
+ return variant;
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
+ }
34
+ function getButtonColors(props, theme) {
35
+ const { variant, inverted = false } = props;
36
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
37
+ switch (variant) {
38
+ case 'secondary': {
39
+ return {
40
+ backgroundColor: theme.t(`ColorBackgroundContainerSecondary${invertedSuffix}`),
41
+ textColor: theme.t(`ColorTextBrand${invertedSuffix}`),
42
+ disabledBackgroundColor: theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`),
43
+ disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
44
+ };
45
+ }
46
+ case 'tertiary': {
47
+ return {
48
+ backgroundColor: 'transparent',
49
+ disabledBackgroundColor: 'transparent',
50
+ textColor: theme.t(`ColorTextBrand${invertedSuffix}`),
51
+ disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
52
+ };
53
+ }
54
+ default: {
55
+ return {
56
+ backgroundColor: theme.t(`ColorBackgroundContainerPrimary${invertedSuffix}`),
57
+ textColor: inverted
58
+ ? theme.t('ColorTextBrandDefault')
59
+ : theme.t('ColorTextBrandInverted'),
60
+ disabledBackgroundColor: theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`),
61
+ disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
62
+ borderColor: theme.t('ColorBorderNoneDefault'),
63
+ };
64
+ }
65
+ }
66
+ }
67
+ function getIconColor(props, theme) {
68
+ const { variant, disabled, inverted } = props;
69
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
70
+ switch (variant) {
71
+ case 'primary':
72
+ return disabled
73
+ ? theme.t(`ColorIconStateDisabled${invertedSuffix}`)
74
+ : inverted
75
+ ? theme.t('ColorIconBrandDefault')
76
+ : theme.t('ColorIconBrandInverted');
77
+ default:
78
+ return disabled
79
+ ? theme.t(`ColorIconStateDisabled${invertedSuffix}`)
80
+ : theme.t(`ColorIconBrand${invertedSuffix}`);
81
+ }
82
+ }
83
+ function getIconBackgroundColor(props, theme) {
84
+ const { variant, disabled, inverted } = props;
85
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
86
+ switch (variant) {
87
+ case 'tertiary':
88
+ return disabled
89
+ ? theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`)
90
+ : theme.t(`ColorBackgroundContainerSecondary${invertedSuffix}`);
91
+ default:
92
+ return undefined;
93
+ }
94
+ }
95
+ export function PxButton(props) {
96
+ const { title, wrapperStyle, titleStyle, testID, disabled = false, prefix, suffix, onPress, accessibilityLabel, accessibilityHint, inverted, } = props;
97
+ const { theme } = useTheme();
98
+ const variant = useVariant(props);
99
+ const shape = useShape(props);
100
+ const buttonColors = getButtonColors({ variant, inverted }, theme);
101
+ const iconStyles = {
102
+ size: 'Xs',
103
+ deprecatedColor: getIconColor({ variant, disabled, inverted }, theme),
104
+ padding: theme.t('Padding2xsMobile').number,
105
+ };
106
+ const iconBackgroundStyles = {
107
+ backgroundColor: getIconBackgroundColor({ variant, disabled, inverted }, theme),
108
+ borderRadius: theme.t('RadiusPill').number,
109
+ marginHorizontal: theme.t('SpacingXsMobile').number,
110
+ };
111
+ let adaptedPrefix = prefix && React.cloneElement(prefix, iconStyles);
112
+ adaptedPrefix =
113
+ prefix && variant === 'tertiary' ? (React.createElement(View, { style: iconBackgroundStyles }, adaptedPrefix)) : (adaptedPrefix);
114
+ let adaptedSuffix = suffix && React.cloneElement(suffix, iconStyles);
115
+ adaptedSuffix =
116
+ suffix && variant === 'tertiary' ? (React.createElement(View, { style: iconBackgroundStyles }, adaptedSuffix)) : (adaptedSuffix);
117
+ return (React.createElement(TouchableOpacity, { ...e2eID(testID), onPress: onPress, focusable: true, disabled: disabled, ...a11y({
118
+ accessibilityRole: 'button',
119
+ accessible: true,
120
+ accessibilityState: {
121
+ disabled,
122
+ },
123
+ accessibilityLabel: accessibilityLabel || title,
124
+ accessibilityHint,
125
+ }), style: wrapperStyle },
126
+ React.createElement(View, { style: [
127
+ styles.button,
128
+ {
129
+ backgroundColor: buttonColors.backgroundColor,
130
+ borderColor: buttonColors.borderColor,
131
+ borderRadius: theme.t('RadiusButtonSmall').number,
132
+ ...(shape === 'default' && {
133
+ borderBottomEndRadius: theme.t('RadiusButtonBig').number,
134
+ }),
135
+ paddingHorizontal: variant === 'tertiary' ? 0 : theme.t('PaddingMMobile').number,
136
+ paddingVertical: variant === 'tertiary'
137
+ ? theme.t('Padding2xsMobile').number
138
+ : theme.t('PaddingXsMobile').number,
139
+ gap: theme.t('Spacing2xsMobile').number,
140
+ ...(variant !== 'tertiary' && {
141
+ minHeight: theme.t('SpacingLMobile').number,
142
+ }),
143
+ },
144
+ disabled && {
145
+ backgroundColor: buttonColors.disabledBackgroundColor,
146
+ },
147
+ variant === 'tertiary' && {
148
+ paddingVertical: 4,
149
+ paddingHorizontal: 0,
150
+ },
151
+ ] },
152
+ adaptedPrefix,
153
+ React.createElement(Header, { style: [
154
+ {
155
+ color: buttonColors.textColor,
156
+ },
157
+ disabled && {
158
+ color: buttonColors.disabledText,
159
+ },
160
+ {
161
+ lineHeight: 21,
162
+ },
163
+ titleStyle,
164
+ ] }, title),
165
+ adaptedSuffix)));
166
+ }
167
+ const styles = StyleSheet.create({
168
+ button: {
169
+ alignItems: 'center',
170
+ flexDirection: 'row',
171
+ justifyContent: 'center',
172
+ },
173
+ });
package/package.json CHANGED
@@ -1,39 +1,19 @@
1
1
  {
2
2
  "name": "@proximus/lavender-button-native",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-beta.0",
4
4
  "description": "Button component",
5
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
- },
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist"
9
+ ],
12
10
  "peerDependencies": {
13
- "@proximus/lavender-common-native": "workspace:*",
14
- "@proximus/lavender-icon-native": "workspace:*",
15
- "@proximus/lavender-styling-native": "workspace:*",
16
- "@proximus/lavender-texts-native": "workspace:*"
17
- },
18
- "devDependencies": {
19
- "@proximus/lavender-common-native": "0.1.0-alpha.4",
20
- "@proximus/lavender-icon-native": "0.1.0-alpha.4",
21
- "@proximus/lavender-styling-native": "0.1.0-alpha.3",
22
- "@proximus/lavender-texts-native": "0.1.0-alpha.4"
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": "6e9252a716a08ededdfbfd6f5b1db70ab21e026e"
18
+ }
39
19
  }
package/CHANGELOG.md DELETED
@@ -1,47 +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.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
-
8
- ### Features
9
-
10
- - **BCRI-4249550:** message card + tag components ([#22](https://github.com/Pxs-Corporate/react-native-lavender/issues/22)) ([39fb91c](https://github.com/Pxs-Corporate/react-native-lavender/commit/39fb91cc294a37d07e63fca2b4e993d90b867082))
11
-
12
- # [0.1.0-alpha.4](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.3...@proximus/lavender-button-native@0.1.0-alpha.4) (2025-09-12)
13
-
14
- **Note:** Version bump only for package @proximus/lavender-button-native
15
-
16
- # [0.1.0-alpha.3](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.2...@proximus/lavender-button-native@0.1.0-alpha.3) (2025-09-05)
17
-
18
- ### Features
19
-
20
- - **BCRI-4279213:** update token architecture and component styles ([#18](https://github.com/Pxs-Corporate/react-native-lavender/issues/18)) ([2fabf41](https://github.com/Pxs-Corporate/react-native-lavender/commit/2fabf416ce069e9756daa868c3012181db87e7f5))
21
-
22
- # [0.1.0-alpha.2](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.1...@proximus/lavender-button-native@0.1.0-alpha.2) (2025-08-13)
23
-
24
- ### Bug Fixes
25
-
26
- - **BCRI-4210372:** fix types field in modules ([68ac126](https://github.com/Pxs-Corporate/react-native-lavender/commit/68ac12657112473ae9e0e683076b1d9172be9ce6))
27
-
28
- # [0.1.0-alpha.1](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-button-native@0.1.0-alpha.0...@proximus/lavender-button-native@0.1.0-alpha.1) (2025-08-13)
29
-
30
- ### Features
31
-
32
- - **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
33
-
34
- # 0.1.0-alpha.0 (2025-08-12)
35
-
36
- ### Features
37
-
38
- - **BCRI-000000:** lerna setup ([1d24b00](https://github.com/Pxs-Corporate/react-native-lavender/commit/1d24b00a9ca917d873e9c497bfebf6a0cc570d13))
39
- - **BCRI-000000:** lerna setup ([f7fa837](https://github.com/Pxs-Corporate/react-native-lavender/commit/f7fa837fb15e0fd1ee838f99f421ff23a52c0403))
40
- - **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
41
- - **BCRI-3619796:** top navigation bar ([0b2bcae](https://github.com/Pxs-Corporate/react-native-lavender/commit/0b2bcaee7243b9f00f88e2b2fb97d86cf0cf5b77))
42
- - **BCRI-3651606:** mono repo creation ([d19f852](https://github.com/Pxs-Corporate/react-native-lavender/commit/d19f852a710963ff85b1a9d31d18188217aa23ab))
43
- - **BCRI-3689585:** icon module ([f13230d](https://github.com/Pxs-Corporate/react-native-lavender/commit/f13230d9c7643680089a0db2c69b96cd73ff246e))
44
- - **BCRI-3702949:** tertiary button ([4999cea](https://github.com/Pxs-Corporate/react-native-lavender/commit/4999cea4d7866084d0f8c1cba37070c6cdaa7601))
45
- - **BCRI-3702949:** tertiary button ([db24455](https://github.com/Pxs-Corporate/react-native-lavender/commit/db24455bd9687d80920be3e42c9e1fc14703a571))
46
- - **BCRI-3749589:** button icon component ([62cfd94](https://github.com/Pxs-Corporate/react-native-lavender/commit/62cfd945420c26cf6da6dfb802cc998c613e9687))
47
- - **BCRI-3810979:** tile components ([46fc5c7](https://github.com/Pxs-Corporate/react-native-lavender/commit/46fc5c7a0ddff6c2db43fba0de9929626092f265))
package/src/PxButton.tsx DELETED
@@ -1,241 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import type {
4
- AccessibilityProps,
5
- StyleProp,
6
- TextStyle,
7
- ViewStyle,
8
- } from 'react-native';
9
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
10
- import { a11y, e2eID } from '@proximus/lavender-common-native';
11
- import type { ITheme } from '@proximus/lavender-styling-native';
12
- import { useTheme } from '@proximus/lavender-styling-native';
13
- import { Header } from '@proximus/lavender-texts-native';
14
-
15
- export type Variant = 'primary' | 'secondary' | 'tertiary';
16
-
17
- export interface IProps extends AccessibilityProps {
18
- title: string;
19
- titleStyle?: StyleProp<TextStyle>;
20
- wrapperStyle?: StyleProp<ViewStyle>;
21
- onPress?: () => void;
22
- type?: Variant;
23
- isRoundedBottomCorner?: boolean;
24
- theme?: ITheme;
25
- disabled?: boolean;
26
- testID?: string;
27
- prefix?: ReactNode;
28
- suffix?: ReactNode;
29
- inverted?: boolean;
30
- }
31
-
32
- function getButtonColors(props: Partial<IProps>, theme: ITheme) {
33
- const { type, inverted = false } = props;
34
-
35
- const invertedSuffix = inverted ? 'Inverted' : 'Default';
36
-
37
- switch (type) {
38
- case 'secondary': {
39
- return {
40
- backgroundColor: theme.t(
41
- `ColorBackgroundContainerSecondary${invertedSuffix}`
42
- ),
43
- textColor: theme.t(`ColorTextBrand${invertedSuffix}`),
44
- disabledBackgroundColor: theme.t(
45
- `ColorBackgroundStateDisabled${invertedSuffix}`
46
- ),
47
- disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
48
- };
49
- }
50
-
51
- case 'tertiary': {
52
- return {
53
- backgroundColor: 'transparent',
54
- disabledBackgroundColor: 'transparent',
55
- textColor: theme.t(`ColorTextBrand${invertedSuffix}`),
56
- disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
57
- };
58
- }
59
-
60
- default: {
61
- return {
62
- backgroundColor: theme.t(
63
- `ColorBackgroundContainerPrimary${invertedSuffix}`
64
- ),
65
- textColor: inverted
66
- ? theme.t('ColorTextBrandDefault')
67
- : theme.t('ColorTextBrandInverted'),
68
- disabledBackgroundColor: theme.t(
69
- `ColorBackgroundStateDisabled${invertedSuffix}`
70
- ),
71
- disabledText: theme.t(`ColorTextStateDisabled${invertedSuffix}`),
72
- borderColor: theme.t('ColorBorderNone'),
73
- };
74
- }
75
- }
76
- }
77
-
78
- function getIconColor(props: Partial<IProps>, theme: ITheme) {
79
- const { type, disabled, inverted } = props;
80
-
81
- const invertedSuffix = inverted ? 'Inverted' : 'Default';
82
-
83
- switch (type) {
84
- case 'primary':
85
- return disabled
86
- ? theme.t(`ColorIconStateDisabled${invertedSuffix}`)
87
- : inverted
88
- ? theme.t('ColorIconBrandDefault')
89
- : theme.t('ColorIconBrandInverted');
90
- default:
91
- return disabled
92
- ? theme.t(`ColorIconStateDisabled${invertedSuffix}`)
93
- : theme.t(`ColorIconBrand${invertedSuffix}`);
94
- }
95
- }
96
-
97
- function getIconBackgroundColor(props: Partial<IProps>, theme: ITheme) {
98
- const { type, disabled, inverted } = props;
99
-
100
- const invertedSuffix = inverted ? 'Inverted' : 'Default';
101
-
102
- switch (type) {
103
- case 'tertiary':
104
- return disabled
105
- ? theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`)
106
- : theme.t(`ColorBackgroundContainerSecondary${invertedSuffix}`);
107
- default:
108
- return undefined;
109
- }
110
- }
111
-
112
- export function PxButton({
113
- title,
114
- wrapperStyle,
115
- titleStyle,
116
- isRoundedBottomCorner = true,
117
- testID,
118
- disabled = false,
119
- prefix,
120
- suffix,
121
- onPress,
122
- type = 'primary',
123
- accessibilityLabel,
124
- accessibilityHint,
125
- inverted,
126
- }: IProps) {
127
- const { theme } = useTheme();
128
- const buttonColors = getButtonColors({ type, inverted }, theme);
129
-
130
- const iconStyles = {
131
- size: theme.t('SizeIconXs').number,
132
- color: getIconColor({ type, disabled, inverted }, theme),
133
- padding: theme.t('Padding2xsMobile').number,
134
- };
135
-
136
- const iconBackgroundStyles = {
137
- backgroundColor: getIconBackgroundColor(
138
- { type, disabled, inverted },
139
- theme
140
- ),
141
- borderRadius: theme.t('RadiusPill').number,
142
- marginHorizontal: theme.t('SpacingXsMobile').number,
143
- };
144
-
145
- let adaptedPrefix =
146
- prefix && React.cloneElement(prefix as ReactElement, iconStyles);
147
-
148
- adaptedPrefix =
149
- prefix && type === 'tertiary' ? (
150
- <View style={iconBackgroundStyles}>{adaptedPrefix}</View>
151
- ) : (
152
- adaptedPrefix
153
- );
154
-
155
- let adaptedSuffix =
156
- suffix && React.cloneElement(suffix as ReactElement, iconStyles);
157
-
158
- adaptedSuffix =
159
- suffix && type === 'tertiary' ? (
160
- <View style={iconBackgroundStyles}>{adaptedSuffix}</View>
161
- ) : (
162
- adaptedSuffix
163
- );
164
-
165
- return (
166
- <TouchableOpacity
167
- {...e2eID(testID)}
168
- onPress={onPress}
169
- focusable={true}
170
- disabled={disabled}
171
- {...a11y({
172
- accessibilityRole: 'button',
173
- accessible: true,
174
- accessibilityState: {
175
- disabled,
176
- },
177
- accessibilityLabel: accessibilityLabel || title,
178
- accessibilityHint,
179
- })}
180
- style={wrapperStyle}
181
- >
182
- <View
183
- style={[
184
- styles.button,
185
- {
186
- backgroundColor: buttonColors.backgroundColor,
187
- borderColor: buttonColors.borderColor,
188
- borderRadius: theme.t('RadiusButtonSmall').number,
189
- ...(isRoundedBottomCorner && {
190
- borderBottomEndRadius: theme.t('RadiusButtonBig').number,
191
- }),
192
- paddingHorizontal:
193
- type === 'tertiary' ? 0 : theme.t('PaddingMMobile').number,
194
- paddingVertical:
195
- type === 'tertiary'
196
- ? theme.t('Padding2xsMobile').number
197
- : theme.t('PaddingXsMobile').number,
198
- gap: theme.t('Spacing2xsMobile').number,
199
- ...(type !== 'tertiary' && {
200
- minHeight: theme.t('SpacingLMobile').number,
201
- }),
202
- },
203
- disabled && {
204
- backgroundColor: buttonColors.disabledBackgroundColor,
205
- },
206
- type === 'tertiary' && {
207
- paddingVertical: 4,
208
- paddingHorizontal: 0,
209
- },
210
- ]}
211
- >
212
- {adaptedPrefix}
213
- <Header
214
- style={[
215
- {
216
- color: buttonColors.textColor,
217
- },
218
- disabled && {
219
- color: buttonColors.disabledText,
220
- },
221
- {
222
- lineHeight: 21,
223
- },
224
- titleStyle,
225
- ]}
226
- >
227
- {title}
228
- </Header>
229
- {adaptedSuffix}
230
- </View>
231
- </TouchableOpacity>
232
- );
233
- }
234
-
235
- const styles = StyleSheet.create({
236
- button: {
237
- alignItems: 'center',
238
- flexDirection: 'row',
239
- justifyContent: 'center',
240
- },
241
- });
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.npm.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- },
6
- "include": ["src","../../../lib.d.ts"],
7
- "exclude": ["dist", "node_modules", "src/**/*.test.ts", "src/**/*.spec.ts"]
8
- }
File without changes