@proximus/lavender-buttonicon-native 2.1.1-alpha.5 → 2.1.1-alpha.51

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.
@@ -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;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;AAyBD,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,qBAkDlB"}
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;AAyBD,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,qBAsDlB"}
@@ -3,29 +3,25 @@ import { a11y, e2eID } from '@proximus/lavender-common-native';
3
3
  import { PxIcon } from '@proximus/lavender-icon-native';
4
4
  import React from 'react';
5
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
- }
6
+ function getBackgroundColor({ variant, inverted, disabled }, theme) {
7
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
8
+ if (variant === 'naked') {
14
9
  return 'transparent';
15
10
  }
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';
11
+ if (disabled) {
12
+ return theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`);
13
+ }
14
+ if (variant === 'primary') {
15
+ return theme.t(`ColorBackgroundContainerPrimary${invertedSuffix}`);
16
+ }
17
+ if (variant === 'secondary') {
18
+ return theme.t(`ColorBackgroundContainerSecondary${invertedSuffix}`);
24
19
  }
20
+ return 'transparent';
25
21
  }
26
22
  export function PxButtonIcon({ variant = 'primary', iconName, wrapperStyle, onPress, disabled, testID, accessibilityLabel, accessibilityHint, inverted, size = 'default', }) {
27
23
  const { theme } = useTheme();
28
- const backgroundColor = getBackgroundColor({ variant, inverted }, theme);
24
+ const backgroundColor = getBackgroundColor({ variant, inverted, disabled }, theme);
29
25
  return (React.createElement(TouchableOpacity, { ...e2eID(testID), onPress: onPress, focusable: true, disabled: disabled, ...a11y({
30
26
  accessibilityRole: 'button',
31
27
  accessible: true,
@@ -52,7 +48,7 @@ export function PxButtonIcon({ variant = 'primary', iconName, wrapperStyle, onPr
52
48
  alignItems: 'center',
53
49
  justifyContent: 'center',
54
50
  } },
55
- React.createElement(PxIcon, { inverted: variant === 'primary' ? !inverted : inverted, name: iconName, size: size === 'small' ? 'Xs' : 'S', color: 'Brand' }))));
51
+ React.createElement(PxIcon, { inverted: variant === 'primary' ? !inverted : inverted, name: iconName, size: size === 'small' ? 'Xs' : 'S', color: 'Brand', disabled: disabled }))));
56
52
  }
57
53
  const styles = StyleSheet.create({
58
54
  container: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-buttonicon-native",
3
- "version": "2.1.1-alpha.5",
3
+ "version": "2.1.1-alpha.51",
4
4
  "description": "Button icon component",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",